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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java

Issue 48623010: Issue 12694. Fix for parsing 'buildIn() {}' top-level functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/SimpleParserTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
index cb9bcd83ff880befad2e5b6e421d448c51f80e03..6727585bde328e4ec2e2cd49e6c1e2274879b496 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/parser/Parser.java
@@ -601,7 +601,9 @@ public class Parser {
while (!matches(TokenType.EOF)) {
CommentAndMetadata commentAndMetadata = parseCommentAndMetadata();
if ((matches(Keyword.IMPORT) || matches(Keyword.EXPORT) || matches(Keyword.LIBRARY) || matches(Keyword.PART))
- && !matches(peek(), TokenType.PERIOD) && !matches(peek(), TokenType.LT)) {
+ && !matches(peek(), TokenType.PERIOD)
+ && !matches(peek(), TokenType.LT)
+ && !matches(peek(), TokenType.OPEN_PAREN)) {
Directive directive = parseDirective(commentAndMetadata);
if (declarations.size() > 0 && !directiveFoundAfterDeclaration) {
reportError(ParserErrorCode.DIRECTIVE_AFTER_DECLARATION);
@@ -2907,7 +2909,7 @@ public class Parser {
if (matches(Keyword.CLASS)) {
return parseClassDeclaration(commentAndMetadata, validateModifiersForClass(modifiers));
} else if (matches(Keyword.TYPEDEF) && !matches(peek(), TokenType.PERIOD)
- && !matches(peek(), TokenType.LT)) {
+ && !matches(peek(), TokenType.LT) && !matches(peek(), TokenType.OPEN_PAREN)) {
validateModifiersForTypedef(modifiers);
return parseTypeAlias(commentAndMetadata);
}
@@ -4285,8 +4287,11 @@ public class Parser {
Modifiers modifiers = new Modifiers();
boolean progress = true;
while (progress) {
- if (matches(Keyword.ABSTRACT) && !matches(peek(), TokenType.PERIOD)
- && !matches(peek(), TokenType.LT)) {
+ if (matches(peek(), TokenType.PERIOD) || matches(peek(), TokenType.LT)
+ || matches(peek(), TokenType.OPEN_PAREN)) {
+ return modifiers;
+ }
+ if (matches(Keyword.ABSTRACT)) {
if (modifiers.getAbstractKeyword() != null) {
reportError(ParserErrorCode.DUPLICATED_MODIFIER, currentToken.getLexeme());
advance();
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/parser/SimpleParserTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698