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

Unified Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/ResolverTestCase.java

Issue 592923002: Put union types behind a flag. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make union-type options available in [AnalysisEngine]. Created 6 years, 3 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
Index: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/ResolverTestCase.java
diff --git a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/ResolverTestCase.java b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/ResolverTestCase.java
index ccf12a40dbf75cbd8329a91948abb34533777116..b510208f1310aef3108b3b95258bfad3e2e7aef3 100644
--- a/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/ResolverTestCase.java
+++ b/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/resolver/ResolverTestCase.java
@@ -13,6 +13,7 @@
*/
package com.google.dart.engine.resolver;
+import com.google.dart.engine.AnalysisEngine;
import com.google.dart.engine.EngineTestCase;
import com.google.dart.engine.ast.CompilationUnit;
import com.google.dart.engine.ast.CompilationUnitMember;
@@ -166,6 +167,16 @@ public class ResolverTestCase extends EngineTestCase {
return library;
}
+ /**
+ * Enable optionally strict union types for the current test.
+ *
+ * @param strictUnionTypes {@code true} if union types should be strict.
+ */
+ protected void enableUnionTypes(boolean strictUnionTypes) {
+ AnalysisEngine.getInstance().setEnableUnionTypes(true);
+ AnalysisEngine.getInstance().setStrictUnionTypes(strictUnionTypes);
+ }
+
protected Expression findTopLevelConstantExpression(CompilationUnit compilationUnit, String name) {
return findTopLevelDeclaration(compilationUnit, name).getInitializer();
}
@@ -203,6 +214,10 @@ public class ResolverTestCase extends EngineTestCase {
*/
protected void reset() {
analysisContext = AnalysisContextFactory.contextWithCore();
+ // These defaults are duplicated for the editor in
+ // editor/tools/plugins/com.google.dart.tools.core/.options .
+ AnalysisEngine.getInstance().setEnableUnionTypes(false);
+ AnalysisEngine.getInstance().setStrictUnionTypes(false);
}
/**

Powered by Google App Engine
This is Rietveld 408576698