fix(ExpressionParser): undefined is undefined (was null)
This commit is contained in:
parent
0ca05eee45
commit
b4613ab2d2
|
@ -511,10 +511,15 @@ export class _ParseAST {
|
||||||
this.rparensExpected--;
|
this.rparensExpected--;
|
||||||
this.expectCharacter(chars.$RPAREN);
|
this.expectCharacter(chars.$RPAREN);
|
||||||
return result;
|
return result;
|
||||||
} else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) {
|
|
||||||
|
} else if (this.next.isKeywordNull()) {
|
||||||
this.advance();
|
this.advance();
|
||||||
return new LiteralPrimitive(this.span(start), null);
|
return new LiteralPrimitive(this.span(start), null);
|
||||||
|
|
||||||
|
} else if (this.next.isKeywordUndefined()) {
|
||||||
|
this.advance();
|
||||||
|
return new LiteralPrimitive(this.span(start), void 0);
|
||||||
|
|
||||||
} else if (this.next.isKeywordTrue()) {
|
} else if (this.next.isKeywordTrue()) {
|
||||||
this.advance();
|
this.advance();
|
||||||
return new LiteralPrimitive(this.span(start), true);
|
return new LiteralPrimitive(this.span(start), true);
|
||||||
|
|
|
@ -92,6 +92,8 @@ export function main() {
|
||||||
|
|
||||||
it('should parse null', () => { checkAction('null'); });
|
it('should parse null', () => { checkAction('null'); });
|
||||||
|
|
||||||
|
it('should parse undefined', () => { checkAction('undefined'); });
|
||||||
|
|
||||||
it('should parse unary - expressions', () => {
|
it('should parse unary - expressions', () => {
|
||||||
checkAction('-1', '0 - 1');
|
checkAction('-1', '0 - 1');
|
||||||
checkAction('+1', '1');
|
checkAction('+1', '1');
|
||||||
|
|
Loading…
Reference in New Issue