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

Unified Diff: compiler/java/com/google/dart/compiler/DartCompiler.java

Issue 10545131: Issue 3531. Don't allow using built-in identifier as import prefix (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweaks for review comments 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/parser/DartParser.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/DartCompiler.java
diff --git a/compiler/java/com/google/dart/compiler/DartCompiler.java b/compiler/java/com/google/dart/compiler/DartCompiler.java
index dd85e0b109ce94f4687c1b3210255d64f2e9e1f0..0639e82754e44d1d9b8c7aab1822e5e9684ce8cd 100644
--- a/compiler/java/com/google/dart/compiler/DartCompiler.java
+++ b/compiler/java/com/google/dart/compiler/DartCompiler.java
@@ -620,6 +620,15 @@ public class DartCompiler {
continue;
}
+ // Validate import prefixes.
+ for (LibraryNode importNode : lib.getImportPaths()) {
+ String prefix = importNode.getPrefix();
+ if (DartParser.PSEUDO_KEYWORDS_SET.contains(prefix)) {
+ context.onError(new DartCompilationError(importNode.getSourceInfo(),
+ ResolverErrorCode.BUILT_IN_IDENTIFIER_AS_IMPORT_PREFIX, prefix));
+ }
+ }
+
// check that each imported library has a library directive
for (LibraryUnit importedLib : lib.getImports()) {
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/parser/DartParser.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698