Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: compiler/java/com/google/dart/compiler/parser/DartParser.java

Issue 10069022: Got rid of peculiar null literal in parsing an incomplete new expression. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiler/java/com/google/dart/compiler/parser/DartParser.java
diff --git a/compiler/java/com/google/dart/compiler/parser/DartParser.java b/compiler/java/com/google/dart/compiler/parser/DartParser.java
index 5547edac69f3c4f074543925ab9d51a53e86f3c2..8453c78d73b4445b053b4911bafc8d8dacfa6647 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -1787,7 +1787,7 @@ public class DartParser extends CompletionHooksParserBase {
if (looksLikeTopLevelKeyword() || peek(0).equals(Token.RBRACE)) {
// Allow recovery back to the top level.
reportErrorWithoutAdvancing(ParserErrorCode.UNEXPECTED_TOKEN);
- return done(DartNullLiteral.get());
+ return done(null);
}
DartExpression result = parseConditionalExpression();
Token token = peek(0);
@@ -1958,7 +1958,9 @@ public class DartParser extends CompletionHooksParserBase {
reportError(expression, ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT);
}
}
- arguments.add(done(expression));
+ if (expression != null) {
+ arguments.add(done(expression));
+ }
switch(peek(0)) {
// Must keep in sync with @Terminals above
case COMMA:
@@ -2246,7 +2248,7 @@ public class DartParser extends CompletionHooksParserBase {
if (expect(Token.COLON)) {
value = parseExpression();
} else {
- value = doneWithoutConsuming(DartNullLiteral.get());
+ value = doneWithoutConsuming(new DartSyntheticErrorExpression());
}
return done(new DartMapLiteralEntry(keyExpr, value));
}
@@ -3090,6 +3092,9 @@ public class DartParser extends CompletionHooksParserBase {
beginFunctionStatementBody();
if (optional(Token.ARROW)) {
DartExpression expr = parseExpression();
+ if (expr == null) {
+ expr = new DartSyntheticErrorExpression();
+ }
if (requireSemicolonForArrow) {
expect(Token.SEMICOLON);
}
@@ -3438,6 +3443,7 @@ public class DartParser extends CompletionHooksParserBase {
}
DartExpression expression = parseExpression();
expectStatmentTerminator();
+
return done(new DartExprStmt(expression));
}

Powered by Google App Engine
This is Rietveld 408576698