[ClavaLaraApi] Adds debug messages to ClavaCode
@@ -39,6 +39,7 @@ ClavaCode.isExecutedOnce = function ($statement) {
// If finds a scope that is part of a loop or if/else, return false immediately
if($scopeOwner.instanceOf('loop') || $scopeOwner.instanceOf('if')) {
+ debug("ClavaCode.isExecutedOnce: failed because scope is part of loop or if");
return false;
}
@@ -54,6 +55,7 @@ ClavaCode.isExecutedOnce = function ($statement) {
// Verify if function is called only once
var calls = $function.calls;
if(calls.length !== 1) {
+ debug("ClavaCode.isExecutedOnce: failed because function '"+$function.name+"' is called " + calls.length + " times");
return false;
}
@@ -67,6 +69,7 @@ ClavaCode.isExecutedOnce = function ($statement) {
}
// Could not find the scope of the statement. Is it outside of a function?
+ debug("ClavaCode.isExecutedOnce: failed because scope could not be found");
return false;
}
