Index: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
index 20a0872ef41d5b2e371a63b3fd735f5a2bab8c0d..e21497a92f74f4c2826526b727848f4742d07a48 100644 |
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
@@ -17,6 +17,9 @@ import com.google.dart.compiler.DartCompilationError; |
import com.google.dart.compiler.DartCompilationPhase; |
import com.google.dart.compiler.DartCompilerContext; |
import com.google.dart.compiler.ErrorCode; |
+import com.google.dart.compiler.ErrorSeverity; |
+import com.google.dart.compiler.Source; |
+import com.google.dart.compiler.SystemLibraryManager; |
import com.google.dart.compiler.ast.ASTVisitor; |
import com.google.dart.compiler.ast.DartArrayAccess; |
import com.google.dart.compiler.ast.DartArrayLiteral; |
@@ -180,7 +183,8 @@ public class TypeAnalyzer implements DartCompilationPhase { |
private final InterfaceType functionType; |
private final InterfaceType dynamicIteratorType; |
private final boolean developerModeChecks; |
- |
+ private final boolean suppressSdkWarnings; |
+ |
/** |
* Keeps track of the number of nested catches, used to detect re-throws |
* outside of any catch block. |
@@ -202,6 +206,8 @@ public class TypeAnalyzer implements DartCompilationPhase { |
this.nullType = typeProvider.getNullType(); |
this.functionType = typeProvider.getFunctionType(); |
this.dynamicIteratorType = typeProvider.getIteratorType(dynamicType); |
+ this.suppressSdkWarnings = context.getCompilerConfiguration().getCompilerOptions() |
+ .suppressSdkWarnings(); |
} |
@VisibleForTesting |
@@ -218,8 +224,14 @@ public class TypeAnalyzer implements DartCompilationPhase { |
return dynamicType; |
} |
- private void onError(HasSourceInfo node, ErrorCode code, Object... arguments) { |
- context.onError(new DartCompilationError(node, code, arguments)); |
+ private void onError(HasSourceInfo node, ErrorCode errorCode, Object... arguments) { |
+ Source source = node.getSourceInfo().getSource(); |
+ if (suppressSdkWarnings && errorCode.getErrorSeverity() == ErrorSeverity.WARNING) { |
+ if (source != null && SystemLibraryManager.isDartUri(source.getUri())) { |
+ return; |
+ } |
+ } |
+ context.onError(new DartCompilationError(node, errorCode, arguments)); |
} |
AssertionError internalError(HasSourceInfo node, String message, Object... arguments) { |