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

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

Issue 10544068: Issue 3307. Report error when built-in identifier used as type annotation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Status file changes after new co19 Created 8 years, 6 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
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7286c466a27a71a71816e77dcdfe2bd347fe58a1..d9ca7cb4a9b8c6be3935f85d7816b7856fa26c94 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -5,6 +5,7 @@
package com.google.dart.compiler.parser;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableSet;
import com.google.common.io.CharStreams;
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.DartCompilerListener;
@@ -164,6 +165,7 @@ public class DartParser extends CompletionHooksParserBase {
STATIC_KEYWORD,
TYPEDEF_KEYWORD
};
+ public static final Set<String> PSEUDO_KEYWORDS_SET = ImmutableSet.copyOf(PSEUDO_KEYWORDS);
public DartParser(Source source,
String sourceCode,
@@ -1112,6 +1114,10 @@ public class DartParser extends CompletionHooksParserBase {
if (peek(0).equals(Token.LPAREN)) {
return true;
}
+ // operator call (
+ if (peekPseudoKeyword(0, CALL_KEYWORD) && peek(1).equals(Token.LPAREN)) {
+ return true;
+ }
// operator equals (
if (peekPseudoKeyword(0, EQUALS_KEYWORD) && peek(1).equals(Token.LPAREN)) {
return true;
@@ -1248,7 +1254,11 @@ public class DartParser extends CompletionHooksParserBase {
arity = 0;
}
} else if (operation == Token.IDENTIFIER
- && ctx.getTokenString().equals(EQUALS_KEYWORD)) {
+ && ctx.getTokenString().equals(CALL_KEYWORD)) {
+ name = done(new DartIdentifier(CALL_KEYWORD));
+ arity = -1;
+ } else if (operation == Token.IDENTIFIER
+ && ctx.getTokenString().equals(EQUALS_KEYWORD)) {
name = done(new DartIdentifier(EQUALS_KEYWORD));
arity = 1;
} else if (operation == Token.IDENTIFIER
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolutionContext.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698