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

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

Issue 9148026: Recompile unit with potential conflict/dependency on some top-level symbol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix for compiling corelib, so NPE in TreeShaker Created 8 years, 11 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 fdbd834733645a98fcd3cbca59a33f1772538f2b..daab50a82fc18aab2fab20f504d45469f4c0a40f 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -166,8 +166,8 @@ public class DartParser extends CompletionHooksParserBase {
this(ctx, false);
}
- public DartParser(ParserContext ctx, Set<String> prefixes) {
- this(ctx, false, prefixes);
+ public DartParser(ParserContext ctx, Set<String> prefixes, boolean isDietParse) {
+ this(ctx, isDietParse, prefixes);
}
public DartParser(ParserContext ctx, boolean isDietParse) {
@@ -2716,20 +2716,29 @@ public class DartParser extends CompletionHooksParserBase {
*/
private DartBlock parseFunctionStatementBody(boolean requireSemicolonForArrow) {
if (isDietParse) {
- expect(Token.LBRACE);
DartBlock emptyBlock = new DartBlock(new ArrayList<DartStatement>());
- int nesting = 1;
- while (nesting > 0) {
- Token token = next();
- switch (token) {
- case LBRACE:
- ++nesting;
- break;
- case RBRACE:
- --nesting;
+ if (optional(Token.ARROW)) {
+ while (true) {
+ Token token = next();
+ if (token == Token.SEMICOLON) {
break;
- case EOS:
- return emptyBlock;
+ }
+ }
+ } else {
+ expect(Token.LBRACE);
+ int nesting = 1;
+ while (nesting > 0) {
+ Token token = next();
+ switch (token) {
+ case LBRACE:
+ ++nesting;
+ break;
+ case RBRACE:
+ --nesting;
+ break;
+ case EOS:
+ return emptyBlock;
+ }
}
}
// Return an empty block so we don't generate unparseable code.

Powered by Google App Engine
This is Rietveld 408576698