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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/AnalysisEngine.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
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/AnalysisEngine.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/AnalysisEngine.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/AnalysisEngine.java
index 157f8fd6a7eb802d3dcaba33868b03fafb6d92fc..996922953c08e6a794e603a75e2ab3e4e2d17ff9 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/AnalysisEngine.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/AnalysisEngine.java
@@ -95,6 +95,17 @@ public final class AnalysisEngine {
private PartitionManager partitionManager = new PartitionManager();
/**
+ * A flag indicating whether union types should be used.
+ */
+ private boolean enableUnionTypes = false;
+
+ /**
+ * A flag indicating whether union types should have strict semantics. This option has no effect
+ * when {@code enabledUnionTypes} is {@code false}.
+ */
+ private boolean strictUnionTypes = false;
+
+ /**
* Prevent the creation of instances of this class.
*/
private AnalysisEngine() {
@@ -125,6 +136,15 @@ public final class AnalysisEngine {
}
/**
+ * Return {@code true} if union types are enabled.
+ *
+ * @return {@code true} if union types are enabled.
+ */
+ public boolean getEnableUnionTypes() {
+ return enableUnionTypes;
+ }
+
+ /**
* Return the logger that should receive information about errors within the analysis engine.
*
* @return the logger that should receive information about errors within the analysis engine
@@ -143,6 +163,24 @@ public final class AnalysisEngine {
}
/**
+ * Return {@code true} if union types have strict semantics.
+ *
+ * @return {@code true} if union types have strict semantics.
+ */
+ public boolean getStrictUnionTypes() {
+ return strictUnionTypes;
+ }
+
+ /**
+ * Set whether union types should be enabled.
+ *
+ * @param enableUnionTypes {@code true} if union types should be enabled.
+ */
+ public void setEnableUnionTypes(boolean enableUnionTypes) {
+ this.enableUnionTypes = enableUnionTypes;
+ }
+
+ /**
* Set the logger that should receive information about errors within the analysis engine to the
* given logger.
*
@@ -152,4 +190,16 @@ public final class AnalysisEngine {
public void setLogger(Logger logger) {
this.logger = logger == null ? Logger.NULL : logger;
}
+
+ /**
+ * Set whether union types should be "strict". For example, for strict union types the subtyping
+ * relation is {A1,...,An} <: A iff Ai <: i for all i, and the assignment compatibility relation
+ * is {A1,...,An} <=> A iff Ai <=> A for all i. For non-strict (permissive) union types, in
+ * contrast, the "for all"s are replaced by "there exists".
+ *
+ * @param strictUnionTypes
+ */
+ public void setStrictUnionTypes(boolean strictUnionTypes) {
+ this.strictUnionTypes = strictUnionTypes;
+ }
}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ResolverVisitor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698