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

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

Issue 11280135: Issue 6836. Using undeclared identifier in static context is now warning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
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 a79148c2fa09144518d66679bebd9128e61ff3b8..cb52309bd66fd727043491ff837782a8366501b8 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -532,6 +532,7 @@ public class DartParser extends CompletionHooksParserBase {
private void parseDirectives(DartUnit unit) {
List<DartAnnotation> metadata = parseMetadata();
+ boolean hasLibraryDirective = false;
if (peekPseudoKeyword(0, LIBRARY_KEYWORD)) {
DartLibraryDirective libraryDirective = parseLibraryDirective();
for (DartDirective directive : unit.getDirectives()) {
@@ -542,6 +543,7 @@ public class DartParser extends CompletionHooksParserBase {
}
setMetadata(libraryDirective, metadata);
unit.getDirectives().add(libraryDirective);
+ hasLibraryDirective = true;
}
while (peekPseudoKeyword(0, IMPORT_KEYWORD) || peekPseudoKeyword(0, EXPORT_KEYWORD)) {
if (peekPseudoKeyword(0, IMPORT_KEYWORD)) {
@@ -552,6 +554,9 @@ public class DartParser extends CompletionHooksParserBase {
DartExportDirective exportDirective = parseExportDirective();
setMetadata(exportDirective, metadata);
unit.getDirectives().add(exportDirective);
+ if (!hasLibraryDirective) {
+ reportError(exportDirective, ParserErrorCode.EXPORT_WITHOUT_LIBRARY_DIRECTIVE);
+ }
}
}
while (peekPseudoKeyword(0, PART_KEYWORD)) {

Powered by Google App Engine
This is Rietveld 408576698