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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 11416004: Reject deprecated language features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
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: dart/sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
index 9ad691915fc523da02190f61526daf5feb89bc69..dc843ebfeeefddd40e1af5f110b6abd2c655ecbf 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -104,6 +104,8 @@ abstract class Compiler implements DiagnosticListener {
final bool enableUserAssertions;
final bool enableConcreteTypeInference;
final bool analyzeAll;
+ final bool rejectDeprecatedFeatures;
+ final bool omgThisIsALongOptionName;
bool disableInlining = false;
@@ -215,6 +217,8 @@ abstract class Compiler implements DiagnosticListener {
bool generateSourceMap: true,
bool disallowUnsafeEval: false,
this.analyzeAll: false,
+ this.rejectDeprecatedFeatures: false,
+ this.omgThisIsALongOptionName: false,
List<String> strips: const []})
: libraries = new Map<String, LibraryElement>(),
progress = new Stopwatch() {
@@ -331,12 +335,10 @@ abstract class Compiler implements DiagnosticListener {
try {
runCompiler(uri);
} on CompilerCancelledException catch (exception) {
- log(exception.toString());
- log('compilation failed');
+ log('Error: $exception');
return false;
}
tracer.close();
- log('compilation succeeded');
return true;
}
@@ -757,6 +759,19 @@ abstract class Compiler implements DiagnosticListener {
reportDiagnostic(span, "$message", kind);
}
+ void onDeprecatedFeature(Spannable span, String feature) {
+ if (!omgThisIsALongOptionName &&
+ currentElement.getLibrary().isPlatformLibrary) {
+ return;
+ }
+ var kind = rejectDeprecatedFeatures
+ ? api.Diagnostic.ERROR : api.Diagnostic.WARNING;
+ var message = rejectDeprecatedFeatures
+ ? MessageKind.DEPRECATED_FEATURE_ERROR.error([feature])
+ : MessageKind.DEPRECATED_FEATURE_WARNING.error([feature]);
+ reportMessage(spanFromSpannable(span), message, kind);
+ }
+
void reportDiagnostic(SourceSpan span, String message, api.Diagnostic kind);
SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) {

Powered by Google App Engine
This is Rietveld 408576698