Last active
October 4, 2021 20:29
-
-
Save serhii-ilin/def6ab7c68f894df7399be8ca0f1d68c to your computer and use it in GitHub Desktop.
CQL execution hack for debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
if (cqm.models.CQL.Expression.bonnieInstrumented) { | |
return; | |
} | |
let _expression = cqm.models.CQL.Expression; | |
let _execute = cqm.models.CQL.Expression.prototype.execute; | |
cqm.models.CQL.Expression.prototype.execute = function(ctx) { | |
let execValue = _execute.apply(this, [ctx]); | |
if (this.localId != null) { | |
let _printVal = execValue; | |
if (typeof _printVal === 'object' && _printVal != null) { | |
_printVal = JSON.stringify(_printVal); | |
} | |
_arg = this.arg || this.args; | |
if (typeof _arg === 'object' && _arg != null) { | |
_arg = JSON.stringify(_arg); | |
} | |
let _name = (this.name || this.source || this.path); | |
if (typeof _name === 'object' && _name != null) { | |
_name = JSON.stringify(_name); | |
} | |
console.log("type=" + this.constructor.name + "|localId=" + this. | |
localId + "|name=" + _name + "|library=" + this.library + "|execValue=" + _printVal + "|args=" + _arg + " JSON=" + JSON.stringify(this.json)); | |
} | |
return execValue; | |
}; | |
cqm.models.CQL.Expression = function() { | |
_expression.apply(this, arguments); | |
this.json = arguments[0]; | |
console.log("Created expression JSON", this.json); | |
}; | |
cqm.models.CQL.Expression.prototype = Object.create(_expression.prototype); | |
cqm.models.CQL.Expression.bonnieInstrumented = true; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment