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

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

Issue 11366078: Report error for deprecated #library #import #source (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 41d3d9b107bd3bc743bc970c0d5c18237ffc855d..055b5b0f89536b7635356fa61d5195e1bf0f1eb5 100644
--- a/compiler/java/com/google/dart/compiler/parser/DartParser.java
+++ b/compiler/java/com/google/dart/compiler/parser/DartParser.java
@@ -619,6 +619,7 @@ public class DartParser extends CompletionHooksParserBase {
private DartLibraryDirective parseObsoleteLibraryDirective() {
expect(Token.LIBRARY);
+ reportDeprecatedError(position(), ParserErrorCode.DEPRECATED_LIBRARY_DIRECTIVE);
expect(Token.LPAREN);
beginLiteral();
expect(Token.STRING);
@@ -715,6 +716,7 @@ public class DartParser extends CompletionHooksParserBase {
protected DartImportDirective parseObsoleteImportDirective() {
expect(Token.IMPORT);
+ reportDeprecatedError(position(), ParserErrorCode.DEPRECATED_IMPORT_DIRECTIVE);
expect(Token.LPAREN);
beginLiteral();
@@ -761,6 +763,7 @@ public class DartParser extends CompletionHooksParserBase {
private DartSourceDirective parseSourceDirective() {
expect(Token.SOURCE);
+ reportDeprecatedError(position(), ParserErrorCode.DEPRECATED_SOURCE_DIRECTIVE);
expect(Token.LPAREN);
beginLiteral();
expect(Token.STRING);
@@ -5391,6 +5394,23 @@ public class DartParser extends CompletionHooksParserBase {
return errorCount < MAX_DEFAULT_ERRORS;
}
+ private void reportDeprecatedError(int position, ErrorCode errorCode) {
+ // TODO(scheglov) remove after http://code.google.com/p/dart/issues/detail?id=6508
+ if (!Elements.isCoreLibrarySource(source) &&
+ !Elements.isLibrarySource(source, "/isolate/isolate.dart")
+ && !Elements.isLibrarySource(source, "/json/json.dart")
+ && !Elements.isLibrarySource(source, "/math/math.dart")
+ && !Elements.isLibrarySource(source, "/html/dartium/nativewrappers.dart")
+ && !Elements.isLibrarySource(source, "/io/io.dart")
+ && !Elements.isLibrarySource(source, "/crypto/crypto.dart")
+ && !Elements.isLibrarySource(source, "/uri/uri.dart")
+ && !Elements.isLibrarySource(source, "/utf/utf.dart")
+ && !Elements.isLibrarySource(source, "/scalarlist/scalarlist.dart")
+ ) {
+ super.reportError(position, errorCode);
+ }
+ }
+
@Override
protected void reportError(int position, ErrorCode errorCode, Object... arguments) {
// TODO(devoncarew): we're not correctly identifying dart:html as a core library

Powered by Google App Engine
This is Rietveld 408576698