aboutsummaryrefslogtreecommitdiff
path: root/main_background.js
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@fsf.org>2018-10-31 14:03:43 -0400
committerRuben Rodriguez <ruben@fsf.org>2018-10-31 14:03:43 -0400
commit8c1bd035a207836c337b3169fe7b7316668c68fd (patch)
tree69ad98563a991b55f7941a6844eb4637d295b4e0 /main_background.js
parentd6d9e376c9be9da7826b131e1ae0ce35b233281d (diff)
Defining or calling functions does not qualify as nontrivial
Diffstat (limited to 'main_background.js')
-rw-r--r--main_background.js19
1 files changed, 7 insertions, 12 deletions
diff --git a/main_background.js b/main_background.js
index 14d2668..8848956 100644
--- a/main_background.js
+++ b/main_background.js
@@ -493,6 +493,7 @@ function full_evaluate(script){
return script.charAt(end+i) == "[";
}
var error_count = 0;
+ var defines_functions = false;
while(toke !== undefined && toke.type != acorn.tokTypes.eof){
if(toke.type.keyword !== undefined){
//dbg_print("Keyword:");
@@ -501,10 +502,8 @@ function full_evaluate(script){
// This type of loop detection ignores functional loop alternatives and ternary operators
if(toke.type.keyword == "function"){
- dbg_print("%c NONTRIVIAL: Function declaration.","color:red");
- if(DEBUG == false){
- return [false,"NONTRIVIAL: Function declaration."];
- }
+ dbg_print("%c NOTICE: Function declaration.","color:green");
+ defines_functions = true;
}
if(loopkeys[toke.type.keyword] !== undefined){
@@ -535,13 +534,6 @@ function full_evaluate(script){
}
}
}else if(status === undefined){// is the identifier user defined?
- // Are arguments being passed to a user defined variable?
- if(being_called(toke.end)){
- dbg_print("%c NONTRIVIAL: User defined variable '"+toke.value+"' called as function","color:red");
- if(DEBUG == false){
- return [false,"NONTRIVIAL: User defined variable '"+toke.value+"' called as function"];
- }
- }
// Is there bracket suffix notation?
if(is_bsn(toke.end)){
dbg_print("%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'","color:red");
@@ -563,7 +555,10 @@ function full_evaluate(script){
}
dbg_print("%cAppears to be trivial.","color:green;");
- return [true,"Script appears to be trivial."];
+ if (defines_functions === true)
+ return [true,"Script appears to be trivial but defines functions."];
+ else
+ return [true,"Script appears to be trivial."];
}