feat(parser): change Parser to return null when one of the operands is null

This commit is contained in:
vsavkin
2014-11-04 09:06:46 -08:00
parent a7fe25d93f
commit c41f59c794
2 changed files with 22 additions and 14 deletions

View File

@ -86,19 +86,7 @@ export class Binary extends AST {
var right = this.right.eval(context, formatters);
// Null check for the operations.
if (left == null || right == null) {
switch (this.operation) {
case '+':
if (left != null) return left;
if (right != null) return right;
return 0;
case '-':
if (left != null) return left;
if (right != null) return 0 - right;
return 0;
}
return null;
}
if (left == null || right == null) return null;
switch (this.operation) {
case '+' : return autoConvertAdd(left, right);