@@ -113,8 +113,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
113113 if (ArgumentValidation .anyBooleans (args )) {
114114 boolean equals = true ;
115115 for (int i = 1 ; i < args .length ; i ++) {
116- boolean arg1 = ArgumentValidation .getBoolean (args [i - 1 ], t );
117- boolean arg2 = ArgumentValidation .getBoolean (args [i ], t );
116+ boolean arg1 = ArgumentValidation .getBoolean (args [i - 1 ], t , env );
117+ boolean arg2 = ArgumentValidation .getBoolean (args [i ], t , env );
118118 if (arg1 != arg2 ) {
119119 equals = false ;
120120 break ;
@@ -144,8 +144,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
144144 if (!ArgumentValidation .isNumber (args [i ])) {
145145 return CBoolean .FALSE ;
146146 }
147- double arg1 = ArgumentValidation .getNumber (args [i - 1 ], t );
148- double arg2 = ArgumentValidation .getNumber (args [i ], t );
147+ double arg1 = ArgumentValidation .getNumber (args [i - 1 ], t , env );
148+ double arg2 = ArgumentValidation .getNumber (args [i ], t , env );
149149 if (arg1 != arg2 ) {
150150 return CBoolean .FALSE ;
151151 }
@@ -488,8 +488,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
488488 if (ArgumentValidation .anyBooleans (args )) {
489489 boolean equals = true ;
490490 for (int i = 1 ; i < args .length ; i ++) {
491- boolean arg1 = ArgumentValidation .getBoolean (args [i - 1 ], t );
492- boolean arg2 = ArgumentValidation .getBoolean (args [i ], t );
491+ boolean arg1 = ArgumentValidation .getBoolean (args [i - 1 ], t , env );
492+ boolean arg2 = ArgumentValidation .getBoolean (args [i ], t , env );
493493 if (arg1 != arg2 ) {
494494 equals = false ;
495495 break ;
@@ -520,8 +520,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
520520 if (!ArgumentValidation .isNumber (args [i ])) {
521521 return CBoolean .FALSE ;
522522 }
523- double arg1 = ArgumentValidation .getNumber (args [i - 1 ], t );
524- double arg2 = ArgumentValidation .getNumber (args [i ], t );
523+ double arg1 = ArgumentValidation .getNumber (args [i - 1 ], t , env );
524+ double arg2 = ArgumentValidation .getNumber (args [i ], t , env );
525525 if (arg1 != arg2 ) {
526526 return CBoolean .FALSE ;
527527 }
@@ -797,8 +797,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
797797 if (args .length != 2 ) {
798798 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
799799 }
800- double arg1 = ArgumentValidation .getNumber (args [0 ], t );
801- double arg2 = ArgumentValidation .getNumber (args [1 ], t );
800+ double arg1 = ArgumentValidation .getNumber (args [0 ], t , env );
801+ double arg2 = ArgumentValidation .getNumber (args [1 ], t , env );
802802 return CBoolean .get (arg1 < arg2 );
803803 }
804804
@@ -871,8 +871,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
871871 if (args .length != 2 ) {
872872 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
873873 }
874- double arg1 = ArgumentValidation .getNumber (args [0 ], t );
875- double arg2 = ArgumentValidation .getNumber (args [1 ], t );
874+ double arg1 = ArgumentValidation .getNumber (args [0 ], t , env );
875+ double arg2 = ArgumentValidation .getNumber (args [1 ], t , env );
876876 return CBoolean .get (arg1 > arg2 );
877877 }
878878
@@ -945,8 +945,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
945945 if (args .length != 2 ) {
946946 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
947947 }
948- double arg1 = ArgumentValidation .getNumber (args [0 ], t );
949- double arg2 = ArgumentValidation .getNumber (args [1 ], t );
948+ double arg1 = ArgumentValidation .getNumber (args [0 ], t , env );
949+ double arg2 = ArgumentValidation .getNumber (args [1 ], t , env );
950950 return CBoolean .get (arg1 <= arg2 );
951951 }
952952
@@ -1020,8 +1020,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
10201020 if (args .length != 2 ) {
10211021 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
10221022 }
1023- double arg1 = ArgumentValidation .getNumber (args [0 ], t );
1024- double arg2 = ArgumentValidation .getNumber (args [1 ], t );
1023+ double arg1 = ArgumentValidation .getNumber (args [0 ], t , env );
1024+ double arg2 = ArgumentValidation .getNumber (args [1 ], t , env );
10251025 return CBoolean .get (arg1 >= arg2 );
10261026 }
10271027
@@ -1096,7 +1096,7 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
10961096 //This will only happen if they hardcode true/false in, but we still
10971097 //need to handle it appropriately.
10981098 for (Mixed c : args ) {
1099- if (!ArgumentValidation .getBoolean (c , t )) {
1099+ if (!ArgumentValidation .getBoolean (c , t , env )) {
11001100 return CBoolean .FALSE ;
11011101 }
11021102 }
@@ -1107,7 +1107,7 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
11071107 public CBoolean execs (Target t , Environment env , Script parent , ParseTree ... nodes ) {
11081108 for (ParseTree tree : nodes ) {
11091109 Mixed c = env .getEnv (GlobalEnv .class ).GetScript ().seval (tree , env );
1110- boolean b = ArgumentValidation .getBoolean (c , t );
1110+ boolean b = ArgumentValidation .getBoolean (c , t , env );
11111111 if (b == false ) {
11121112 return CBoolean .FALSE ;
11131113 }
@@ -1180,7 +1180,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
11801180 continue ;
11811181 }
11821182 if (child .isConst ()) {
1183- if (ArgumentValidation .getBoolean (child .getData (), t ) == true ) {
1183+ if (ArgumentValidation .getBoolean (child .getData (), t , env ) == true ) {
11841184 it .remove ();
11851185 } else {
11861186 foundFalse = true ;
@@ -1204,7 +1204,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
12041204// }
12051205 // At this point, it could be that there are some conditions with side effects, followed by a final false. However,
12061206 // if false is the only remaining condition (which could be) then we can simply return false here.
1207- if (children .size () == 1 && children .get (0 ).isConst () && ArgumentValidation .getBoolean (children .get (0 ).getData (), t ) == false ) {
1207+ if (children .size () == 1 && children .get (0 ).isConst () && ArgumentValidation .getBoolean (children .get (0 ).getData (), t , env ) == false ) {
12081208 return new ParseTree (CBoolean .FALSE , fileOptions );
12091209 }
12101210 if (children .isEmpty ()) {
@@ -1262,7 +1262,7 @@ public Mixed execs(Target t, Environment env, Script parent, ParseTree... nodes)
12621262 Mixed lastValue = CBoolean .TRUE ;
12631263 for (ParseTree tree : nodes ) {
12641264 lastValue = env .getEnv (GlobalEnv .class ).GetScript ().seval (tree , env );
1265- if (!ArgumentValidation .getBooleanish (lastValue , t )) {
1265+ if (!ArgumentValidation .getBooleanish (lastValue , t , env )) {
12661266 return lastValue ;
12671267 }
12681268 }
@@ -1305,7 +1305,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
13051305 continue ;
13061306 }
13071307 if (child .isConst ()) {
1308- if (ArgumentValidation .getBoolean (child .getData (), t ) == true ) {
1308+ if (ArgumentValidation .getBoolean (child .getData (), t , env ) == true ) {
13091309 it .remove ();
13101310 } else {
13111311 foundFalse = true ;
@@ -1329,7 +1329,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
13291329// }
13301330 // At this point, it could be that there are some conditions with side effects, followed by a final false. However,
13311331 // if false is the only remaining condition (which could be) then we can simply return false here.
1332- if (children .size () == 1 && children .get (0 ).isConst () && ArgumentValidation .getBoolean (children .get (0 ).getData (), t ) == false ) {
1332+ if (children .size () == 1 && children .get (0 ).isConst () && ArgumentValidation .getBoolean (children .get (0 ).getData (), t , env ) == false ) {
13331333 return new ParseTree (children .get (0 ).getData (), fileOptions );
13341334 }
13351335 if (children .isEmpty ()) {
@@ -1389,7 +1389,7 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
13891389 //This will only happen if they hardcode true/false in, but we still
13901390 //need to handle it appropriately.
13911391 for (Mixed c : args ) {
1392- if (ArgumentValidation .getBoolean (c , t )) {
1392+ if (ArgumentValidation .getBoolean (c , t , env )) {
13931393 return CBoolean .TRUE ;
13941394 }
13951395 }
@@ -1400,7 +1400,7 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
14001400 public CBoolean execs (Target t , Environment env , Script parent , ParseTree ... nodes ) {
14011401 for (ParseTree tree : nodes ) {
14021402 Mixed c = env .getEnv (GlobalEnv .class ).GetScript ().seval (tree , env );
1403- if (ArgumentValidation .getBoolean (c , t )) {
1403+ if (ArgumentValidation .getBoolean (c , t , env )) {
14041404 return CBoolean .TRUE ;
14051405 }
14061406 }
@@ -1476,7 +1476,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
14761476 if (child .getData () instanceof CSymbol ) {
14771477 throw new ConfigCompileException ("Unexpected symbol: \" " + child .getData ().val () + "\" " , t );
14781478 }
1479- if (ArgumentValidation .getBoolean (child .getData (), t ) == false ) {
1479+ if (ArgumentValidation .getBoolean (child .getData (), t , env ) == false ) {
14801480 it .remove ();
14811481 } else {
14821482 foundTrue = true ;
@@ -1500,7 +1500,7 @@ public ParseTree optimizeDynamic(Target t, Environment env,
15001500// }
15011501 // At this point, it could be that there are some conditions with side effects, followed by a final true. However,
15021502 // if true is the only remaining condition (which could be) then we can simply return true here.
1503- if (children .size () == 1 && children .get (0 ).isConst () && ArgumentValidation .getBoolean (children .get (0 ).getData (), t ) == true ) {
1503+ if (children .size () == 1 && children .get (0 ).isConst () && ArgumentValidation .getBoolean (children .get (0 ).getData (), t , env ) == true ) {
15041504 return new ParseTree (CBoolean .TRUE , fileOptions );
15051505 }
15061506 if (children .isEmpty ()) {
@@ -1557,7 +1557,7 @@ public Mixed exec(Target t, Environment env, GenericParameters generics, Mixed..
15571557 public Mixed execs (Target t , Environment env , Script parent , ParseTree ... nodes ) {
15581558 for (ParseTree tree : nodes ) {
15591559 Mixed c = env .getEnv (GlobalEnv .class ).GetScript ().seval (tree , env );
1560- if (ArgumentValidation .getBooleanish (c , t )) {
1560+ if (ArgumentValidation .getBooleanish (c , t , env )) {
15611561 return c ;
15621562 }
15631563 }
@@ -1649,7 +1649,7 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
16491649 if (args .length != 1 ) {
16501650 throw new CREFormatException (this .getName () + " expects 1 argument." , t );
16511651 }
1652- return CBoolean .get (!ArgumentValidation .getBoolean (args [0 ], t ));
1652+ return CBoolean .get (!ArgumentValidation .getBoolean (args [0 ], t , env ));
16531653 }
16541654
16551655 @ Override
@@ -1753,8 +1753,8 @@ public CBoolean exec(Target t, Environment env, GenericParameters generics, Mixe
17531753 if (args .length != 2 ) {
17541754 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
17551755 }
1756- boolean val1 = ArgumentValidation .getBoolean (args [0 ], t );
1757- boolean val2 = ArgumentValidation .getBoolean (args [1 ], t );
1756+ boolean val1 = ArgumentValidation .getBoolean (args [0 ], t , env );
1757+ boolean val2 = ArgumentValidation .getBoolean (args [1 ], t , env );
17581758 return CBoolean .get (val1 ^ val2 );
17591759 }
17601760
@@ -2049,9 +2049,9 @@ public CInt exec(Target t, Environment env, GenericParameters generics, Mixed...
20492049 if (args .length < 2 ) {
20502050 throw new CREFormatException (this .getName () + " expects at least 2 arguments." , t );
20512051 }
2052- long val = ArgumentValidation .getInt (args [0 ], t );
2052+ long val = ArgumentValidation .getInt (args [0 ], t , env );
20532053 for (int i = 1 ; i < args .length ; i ++) {
2054- val = val & ArgumentValidation .getInt (args [i ], t );
2054+ val = val & ArgumentValidation .getInt (args [i ], t , env );
20552055 }
20562056 return new CInt (val , t );
20572057 }
@@ -2136,9 +2136,9 @@ public CInt exec(Target t, Environment env, GenericParameters generics, Mixed...
21362136 if (args .length < 2 ) {
21372137 throw new CREFormatException (this .getName () + " expects at least 2 arguments." , t );
21382138 }
2139- long val = ArgumentValidation .getInt (args [0 ], t );
2139+ long val = ArgumentValidation .getInt (args [0 ], t , env );
21402140 for (int i = 1 ; i < args .length ; i ++) {
2141- val = val | ArgumentValidation .getInt (args [i ], t );
2141+ val = val | ArgumentValidation .getInt (args [i ], t , env );
21422142 }
21432143 return new CInt (val , t );
21442144 }
@@ -2225,9 +2225,9 @@ public CInt exec(Target t, Environment env, GenericParameters generics, Mixed...
22252225 if (args .length < 2 ) {
22262226 throw new CREFormatException (this .getName () + " expects at least 2 arguments." , t );
22272227 }
2228- long val = ArgumentValidation .getInt (args [0 ], t );
2228+ long val = ArgumentValidation .getInt (args [0 ], t , env );
22292229 for (int i = 1 ; i < args .length ; i ++) {
2230- val = val ^ ArgumentValidation .getInt (args [i ], t );
2230+ val = val ^ ArgumentValidation .getInt (args [i ], t , env );
22312231 }
22322232 return new CInt (val , t );
22332233 }
@@ -2310,7 +2310,7 @@ public CInt exec(Target t, Environment env, GenericParameters generics, Mixed...
23102310 if (args .length != 1 ) {
23112311 throw new CREFormatException (this .getName () + " expects 1 argument." , t );
23122312 }
2313- return new CInt (~ArgumentValidation .getInt (args [0 ], t ), t );
2313+ return new CInt (~ArgumentValidation .getInt (args [0 ], t , env ), t );
23142314 }
23152315
23162316 @ Override
@@ -2376,8 +2376,8 @@ public CInt exec(Target t, Environment env, GenericParameters generics, Mixed...
23762376 if (args .length != 2 ) {
23772377 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
23782378 }
2379- long value = ArgumentValidation .getInt (args [0 ], t );
2380- long toShift = ArgumentValidation .getInt (args [1 ], t );
2379+ long value = ArgumentValidation .getInt (args [0 ], t , env );
2380+ long toShift = ArgumentValidation .getInt (args [1 ], t , env );
23812381 return new CInt (value << toShift , t );
23822382 }
23832383
@@ -2446,8 +2446,8 @@ public CInt exec(Target t, Environment env, GenericParameters generics, Mixed...
24462446 if (args .length != 2 ) {
24472447 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
24482448 }
2449- long value = ArgumentValidation .getInt (args [0 ], t );
2450- long toShift = ArgumentValidation .getInt (args [1 ], t );
2449+ long value = ArgumentValidation .getInt (args [0 ], t , env );
2450+ long toShift = ArgumentValidation .getInt (args [1 ], t , env );
24512451 return new CInt (value >> toShift , t );
24522452 }
24532453
@@ -2518,8 +2518,8 @@ public CInt exec(Target t, Environment env, GenericParameters generics, Mixed...
25182518 if (args .length != 2 ) {
25192519 throw new CREFormatException (this .getName () + " expects 2 arguments." , t );
25202520 }
2521- long value = ArgumentValidation .getInt (args [0 ], t );
2522- long toShift = ArgumentValidation .getInt (args [1 ], t );
2521+ long value = ArgumentValidation .getInt (args [0 ], t , env );
2522+ long toShift = ArgumentValidation .getInt (args [1 ], t , env );
25232523 return new CInt (value >>> toShift , t );
25242524 }
25252525
@@ -2707,9 +2707,9 @@ public Boolean runAsync() {
27072707
27082708 @ Override
27092709 public Mixed exec (Target t , Environment env , GenericParameters generics , Mixed ... args ) throws ConfigRuntimeException {
2710- double d1 = ArgumentValidation .getNumber (args [0 ], t );
2711- double d2 = ArgumentValidation .getNumber (args [1 ], t );
2712- double epsilon = ArgumentValidation .getDouble (args [2 ], t );
2710+ double d1 = ArgumentValidation .getNumber (args [0 ], t , env );
2711+ double d2 = ArgumentValidation .getNumber (args [1 ], t , env );
2712+ double epsilon = ArgumentValidation .getDouble (args [2 ], t , env );
27132713 return CBoolean .get (java .lang .Math .abs (d1 - d2 ) < epsilon );
27142714 }
27152715
0 commit comments