Version 2.0.0-dev.31.0
Merge commit '73eb8a37e00bc1f0be7885ce7c347df557ca32f2' into dev
diff --git a/BUILD.gn b/BUILD.gn
index 3f93c69..b2dc62f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -49,6 +49,10 @@
}
group("runtime_kernel") {
+ import("runtime/runtime_args.gni")
+
+ target_supports_aot = dart_target_arch == "arm" || dart_target_arch == "arm64" || dart_target_arch == "x64"
+
if (targetting_fuchsia) {
# Fuchsia has run_vm_tests marked testonly.
testonly = true
@@ -61,6 +65,10 @@
"utils/kernel-service:copy_kernel_service_snapshot",
"utils/kernel-service:kernel-service",
]
+
+ if (target_supports_aot) {
+ deps += ["runtime/bin:precompiler_entry_points_json"]
+ }
}
group("runtime_precompiled") {
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d07d323..ba4829f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -90,7 +90,8 @@
`whereType`.
* `Iterable.singleWhere` added `orElse` parameter.
* `List` added `+` operator, `first` and `last` setters, and `indexWhere`
- and `lastIndexWhere` methods.
+ and `lastIndexWhere` methods, and static `copyRange` and `writeIterable`
+ methods.
* `Map` added `fromEntries` constructor.
* `Map` added `addEntries`, `cast`, `entries`, `map`, `removeWhere`,
`retype`, `update` and `updateAll` members.
diff --git a/docs/language/informal/mixin-inference.md b/docs/language/informal/mixin-inference.md
new file mode 100644
index 0000000..5972c27
--- /dev/null
+++ b/docs/language/informal/mixin-inference.md
@@ -0,0 +1,330 @@
+# Dart 2.X super mixin inference proposal
+
+leafp@google.com
+
+Status: Draft
+
+This is intended to define a prototype approach to supporting inference of type
+arguments in super-mixin applications. This is not an official part of Dart
+2, but is an experimental feature hidden under flags. When super-mixins are
+specified and landed, this feature or some variant of it may be included.
+
+## Syntactic conventions
+
+The meta-variables `X`, `Y`, and `Z` range over type variables.
+
+The meta-variables `T`, and `U` range over types.
+
+The meta-variables `M`, `I`, and `S` range over interface types (that is,
+classes instantiated with zero or more type arguments).
+
+The meta-variable `C` ranges over classes.
+
+The meta-variable `B` ranges over types used as bounds for type variables.
+
+Throughout this document, I assume that bound type variables have been suitably
+renamed to avoid accidental capture.
+
+## Mixin inference
+
+In Dart 2 syntax, a class definition may also have an interpretation as mixin
+under certain restrictions defined elsewhere.
+
+### Mixins and superclass constraints
+
+Given a class of the form:
+
+```
+class C<X0, ..., Xn> extends S with M0, ..., Mj implements I0, ..., Ik { ...}
+```
+
+we say that the superclass of `C<X0, ..., Xn>` is `S with M0, ..., Mj`.
+
+When interpreted as a mixin, we say that the super class constraints for `C<X0,
+..., Xn>` are `S`, `M0`, ..., `Mj`.
+
+Given a mixin application class of the form:
+
+```
+class C<X0, ..., Xn> = S with M0, ..., Mj implements I0, ..., Ik;
+```
+
+for we say that the superclass of `C<X0, ..., Xn>` is `S with M0, ..., Mj-1`.
+
+When interpreted as a mixin, we say that the super class constraints for `C<X0,
+..., Xn>` are `S`, `M0`, ..., `Mj-1`.
+
+#### Discussion
+
+A class, interpreted as a mixin, is interpreted as a function from its
+superclass to its own type. That is, the actual class onto which the mixin is
+applied must be a subtype of the superclass constraint. When the superclass is
+itself a mixin, we interpret each component of the mixin as a separate
+constraint, each of which the actual class onto which the mixin is applied must
+be a subtype of.
+
+### Mixin type inference
+
+Given a class of the form:
+
+```
+class C<T0, ..., Tn> extends S with M0, ..., Mj implements I0, ..., Ik { ...}
+```
+
+or of the form
+
+```
+class C<T0, ..., Tn> = S with M0, ..., Mj implements I0, ..., Ik;
+```
+
+we say that the superclass of `M0` is `S`, the superclass of `M1` is `S with
+M0`, etc.
+
+For a class with one or more mixins of either of the forms above we allow any
+or all of the `M0`, ..., `Mj` to have their type arguments inferred. That is,
+if any of the `M0`, ..., `Mj` are references to generic classes with no type
+arguments provided, the missing type arguments will be attempted to be
+reconstructed in accordance with this specification.
+
+Type inference for a class is done from the innermost mixin application out.
+That is, the type arguments for `M0` (if any) are inferred before type arguments
+for `M1`, and so on. Each successive inference is done with respect to the
+inferred version of its superclass: so if type arguments `T0, ..., Tn` are
+inferred for `M0`, `M1` is inferred with respect to `M0<T0, ..., Tn`>, etc.
+
+Type inference for the class hierarchy is done from top down. That is, in the
+example classes above, all mixin inference for the definitions of `S`, the `Mi`,
+and the `Ii` is done before mixin inference for `C` is done.
+
+Let be `M` be a mixin applied to a superclass `S` where `M` is a reference to a
+generic class with no type arguments provided, and `S` is some class (possibly
+generic); and where `M` is defined with type parameters `X0, ..., Xj`. Let `S0,
+..., Sn` be the superclass constraints for `M` as defined above. Note that the
+`Xi` may appear free in the `Si`. Let `C0, ..., Cn` be the corresponding
+classes for the `Si`: that is, each `Si` is of the form `Ci<T0, ..., Tk>` for
+some `k >= 0`. Note that by assumption, the `Xi` are disjoint from any type
+parameters in the enclosing scope, since we have assumed that type variables are
+suitably renamed to avoid capture.
+
+For each `Si`, find the unique `Ui` in the super-interface graph of `S` such
+that the class of `Ui` is `Ci`. Note that if there is not such a `Ui`, then
+there is no instantiation of `M` that will allow its superclass constraint to be
+satisfied, and if there is such a `Ui` but it is not unique, then the superclass
+hierarchy is ill-formed. In either case it is an error.
+
+Let *SLN* be the smallest set of pairs of type variables and types `(Z0, T0),
+..., (Zl, Tl)` with type variables drawn from `X0, ..., Xj` such that `{T0/Z0,
+..., Tl/Zl}Si == Ui`. That is, replacing each free type variable in the `Si`
+with its corresponding type in *SLN* makes `Si` and `Ui` the same. If no such
+set exists, then it is an error. Note that for well-formed programs, the only
+free type variables in the `Ti` must by definition be drawn from the type
+parameters to the enclosing class of the mixin application. Hence it follows
+both that the `Ti` are well-formed types in the scope of the mixin application,
+and that the the `Xi` do not occur free in the `Ti` since we have assumed that
+classes are suitably renamed to avoid capture.
+
+Let `[X0 extends B0, ..., Xj extends Bj]` be a set of type variable bounds such
+that if `(Xi, Ti)` is in *SLN* then `Bi` is `Ti` and otherwise `Bi` is the
+declared bound for `Xi` in the definition of `M`.
+
+Let `[X0 -> T0', ..., Xj -> Tj']` be the default bounds for this set of type
+variable bounds as defined in the "instantiate to bounds" specification.
+
+The inferred type arguments for `M` are then `<T0', ..., Ti'>`.
+
+It is an error if the inferred type arguments are not a valid instantiation of
+`M` (that is, if they do not satisfy the bounds of `M`).
+
+#### Discussion
+
+For each superclass constraint, there must be a matching interface in the
+super-interface hierarchy of the actual superclass. So for each superclass
+constraint of the form `I0<U0, ..., Uk>` there must be some `I0<U0', ..., Uk'>`
+in the super-interface hierarchy of the actual superclass `S` (if not, there is
+an error in the super class hierarchy, or in the mixin application). Note that
+the `Ui` may have free occurrences of the type variables for which we are
+solving, but the `Ui'` may not. A simple equality traversal comparing `Ui` and
+`Ui'` will find all of the type variables which must be equated in order to make
+the two interfaces equal. Once a type variable is solved via such a traversal,
+subsequent occurrences must be constrained to an equal type, otherwise there is
+no solution. Type variables which do not appear in any of the superclass
+constraints are not constrained by the mixin application. Some or all of the
+type variables may be unconstrained in this manner. We choose a solution for
+these type variables using the instantiate to bounds algorithm. We construct a
+synthetic set of bounds using the chosen constraints for the constrained
+variables, and use instantiate to bounds to produce the remaining results.
+Since instantiate to bounds may produce a super-bounded type, we must check that
+the result satisfies the bounds (or else define a version of instantiate to
+bounds which issues an error rather than approximates).
+
+Note that we do not take into account information from later mixins when solving
+the constraints: nor from implemented interfaces. The approach specified here
+may therefore fail to find valid instantiations. We may consider relaxing this
+in the future. Note however that fully using information from other positions
+will result in equality constraint queries in which type variables being solved
+for appear on both sides of the query, hence leading to a full unification
+problem.
+
+The approach specified here is a simplification of the subtype matching
+algorithm used in expression level type inference. In the case that there is no
+solution to the declarative specification above, subtype matching may still find
+a solution which does not satisfy the property that no generic interface may
+occur twice in the class hierarchy with different type arguments. A valid
+implementation of the approach specified here should be to run the subtype
+matching algorithm, and then to subsequently check that no generic interface has
+been introduced at incompatible type.
+
+## Tests and illustrative examples.
+
+Some examples illustrating key points.
+
+### Inference proceeds outward
+
+```
+class I<X> {}
+
+class M0<T> extends I<T> {}
+
+class M1<T> extends I<T> {}
+
+// M1 is inferred as M1<int>
+class A extends M0<int> with M1 {}
+```
+
+```
+class I<X> {}
+
+class M0<T> extends I<T> {}
+
+class M1<T> extends I<T> {}
+
+class M2<T> extends I<T> {}
+
+// M1 is inferred as M1<int>
+// M2 is inferred as M1<int>
+class A extends M0<int> with M1, M2 {}
+```
+
+```
+class I<X> {}
+
+class M0<T> extends Object implements I<T> {}
+
+class M1<T> extends I<T> {}
+
+// M0 is inferred as M0<dynamic>
+// Error since class hierarchy is inconsistent
+class A extends Object with M0, M1<int> {}
+```
+
+```
+class I<X> {}
+
+class M0<T> extends Object implements I<T> {}
+
+class M1<T> extends I<T> {}
+
+// M0 is inferred as M0<dynamic> (unconstrained)
+// M1 is inferred as M1<dynamic> (constrained by inferred argument to M0)
+// Error since class hierarchy is inconsistent
+class A extends Object with M0, M1 implements I<int> {}
+```
+
+### Multiple superclass constraints
+```
+class I<X> {}
+
+class J<X> {}
+
+class M0<X, Y> extends I<X> with J<Y> {}
+
+class M1 implements I<int> {}
+class M2 extends M1 implements J<double> {}
+
+// M0 is inferred as M0<int, double>
+class A extends M2 with M0 {}
+```
+
+### Instantiate to bounds
+```
+class I<X> {}
+
+class M0<X, Y extends String> extends I<X> {}
+
+class M1 implements I<int> {}
+
+// M0 is inferred as M0<int, String>
+class A extends M1 with M0 {}
+```
+
+```
+class I<X> {}
+
+class M0<X, Y extends X> extends I<X> {}
+
+class M1 implements I<int> {}
+
+// M0 is inferred as M0<int, int>
+class A extends M1 with M0 {}
+```
+
+```
+class I<X> {}
+
+class M0<X, Y extends Comparable<Y>> extends I<X> {}
+
+class M1 implements I<int> {}
+
+// M0 is inferred as M0<int, Comparable<dynamic>>
+// Error since super-bounded type not allowed
+class A extends M1 with M0 {}
+```
+
+### Non-trivial constraints
+
+```
+class I<X> {}
+
+class M0<T> extends I<List<T>> {}
+
+class M1<T> extends I<List<T>> {}
+
+class M2<T> extends M1<Map<T, T>> {}
+
+// M0 is inferred as M0<Map<int, int>>
+class A extends M2<int> with M0 {}
+```
+
+### Unification
+These examples are not inferred given the strategy in this proposal, and suggest
+some tricky cases to consider if we consider a broader approach.
+
+
+```
+class I<X, Y> {}
+
+class M0<T> implements I<T, int> {}
+
+class M1<T> implements I<String, T> {}
+
+// M0 inferred as M0<String>
+// M1 inferred as M1<int>
+class A extends Object with M0, M1 {}
+```
+
+
+```
+class I<X, Y> {}
+
+class M0<T> implements I<T, List<T>> {}
+
+class M1<T> implements I<List<T>, T> {}
+
+// No solution, even with unification, since solution
+// requires that I<List<U0>, U0> == I<U1, List<U1>>
+// for some U0, U1, and hence that:
+// U0 = List<U1>
+// U1 = List<U0>
+// which has no finite solution
+class A extends Object with M0, M1 {}
+```
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index cf6afc5..06a8bf7 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -109,7 +109,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
- 1.18.6
+ 1.18.7
</h1>
<p>
This document contains a specification of the API provided by the
@@ -3116,12 +3116,33 @@
<p>
The one-based index of the column containing the declaration name.
</p>
+ </dd><dt class="field"><b>codeOffset: int</b></dt><dd>
+
+ <p>
+ The offset of the first character of the declaration code in the file.
+ </p>
+ </dd><dt class="field"><b>codeLength: int</b></dt><dd>
+
+ <p>
+ The length of the declaration code in the file.
+ </p>
</dd><dt class="field"><b>className: String<span style="color:#999999"> (optional)</span></b></dt><dd>
<p>
The name of the class enclosing this declaration. If the declaration
is not a class member, this field will be absent.
</p>
+ </dd><dt class="field"><b>parameters: String<span style="color:#999999"> (optional)</span></b></dt><dd>
+
+ <p>
+ The parameter list for the element. If the element is not a method or
+ function this field will not be defined. If the element doesn't have
+ parameters (e.g. getter), this field will not be defined. If the
+ element has zero parameters, this field will have a value of "()".
+
+ The value should not be treated as exact presentation of parameters,
+ it is just approximation of parameters to give the user general idea.
+ </p>
</dd></dl></dd><dt class="typeDefinition"><a name="type_ElementKind">ElementKind: String</a></dt><dd>
<p>
An enumeration of the kinds of elements.
diff --git a/pkg/analysis_server/lib/protocol/protocol_constants.dart b/pkg/analysis_server/lib/protocol/protocol_constants.dart
index e061b39b..d9cad4b 100644
--- a/pkg/analysis_server/lib/protocol/protocol_constants.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_constants.dart
@@ -236,6 +236,8 @@
const String SEARCH_REQUEST_FIND_TOP_LEVEL_DECLARATIONS_PATTERN = 'pattern';
const String SEARCH_REQUEST_GET_ELEMENT_DECLARATIONS =
'search.getElementDeclarations';
+const String SEARCH_REQUEST_GET_ELEMENT_DECLARATIONS_MAX_RESULTS = 'maxResults';
+const String SEARCH_REQUEST_GET_ELEMENT_DECLARATIONS_PATTERN = 'pattern';
const String SEARCH_REQUEST_GET_TYPE_HIERARCHY = 'search.getTypeHierarchy';
const String SEARCH_REQUEST_GET_TYPE_HIERARCHY_FILE = 'file';
const String SEARCH_REQUEST_GET_TYPE_HIERARCHY_OFFSET = 'offset';
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index 3c54e20..3616da5 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -8733,7 +8733,10 @@
* "offset": int
* "line": int
* "column": int
+ * "codeOffset": int
+ * "codeLength": int
* "className": optional String
+ * "parameters": optional String
* }
*
* Clients may not extend, implement or mix-in this class.
@@ -8751,8 +8754,14 @@
int _column;
+ int _codeOffset;
+
+ int _codeLength;
+
String _className;
+ String _parameters;
+
/**
* The name of the declaration.
*/
@@ -8832,6 +8841,32 @@
}
/**
+ * The offset of the first character of the declaration code in the file.
+ */
+ int get codeOffset => _codeOffset;
+
+ /**
+ * The offset of the first character of the declaration code in the file.
+ */
+ void set codeOffset(int value) {
+ assert(value != null);
+ this._codeOffset = value;
+ }
+
+ /**
+ * The length of the declaration code in the file.
+ */
+ int get codeLength => _codeLength;
+
+ /**
+ * The length of the declaration code in the file.
+ */
+ void set codeLength(int value) {
+ assert(value != null);
+ this._codeLength = value;
+ }
+
+ /**
* The name of the class enclosing this declaration. If the declaration is
* not a class member, this field will be absent.
*/
@@ -8845,16 +8880,41 @@
this._className = value;
}
+ /**
+ * The parameter list for the element. If the element is not a method or
+ * function this field will not be defined. If the element doesn't have
+ * parameters (e.g. getter), this field will not be defined. If the element
+ * has zero parameters, this field will have a value of "()". The value
+ * should not be treated as exact presentation of parameters, it is just
+ * approximation of parameters to give the user general idea.
+ */
+ String get parameters => _parameters;
+
+ /**
+ * The parameter list for the element. If the element is not a method or
+ * function this field will not be defined. If the element doesn't have
+ * parameters (e.g. getter), this field will not be defined. If the element
+ * has zero parameters, this field will have a value of "()". The value
+ * should not be treated as exact presentation of parameters, it is just
+ * approximation of parameters to give the user general idea.
+ */
+ void set parameters(String value) {
+ this._parameters = value;
+ }
+
ElementDeclaration(String name, ElementKind kind, int fileIndex, int offset,
- int line, int column,
- {String className}) {
+ int line, int column, int codeOffset, int codeLength,
+ {String className, String parameters}) {
this.name = name;
this.kind = kind;
this.fileIndex = fileIndex;
this.offset = offset;
this.line = line;
this.column = column;
+ this.codeOffset = codeOffset;
+ this.codeLength = codeLength;
this.className = className;
+ this.parameters = parameters;
}
factory ElementDeclaration.fromJson(
@@ -8901,13 +8961,33 @@
} else {
throw jsonDecoder.mismatch(jsonPath, "column");
}
+ int codeOffset;
+ if (json.containsKey("codeOffset")) {
+ codeOffset =
+ jsonDecoder.decodeInt(jsonPath + ".codeOffset", json["codeOffset"]);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, "codeOffset");
+ }
+ int codeLength;
+ if (json.containsKey("codeLength")) {
+ codeLength =
+ jsonDecoder.decodeInt(jsonPath + ".codeLength", json["codeLength"]);
+ } else {
+ throw jsonDecoder.mismatch(jsonPath, "codeLength");
+ }
String className;
if (json.containsKey("className")) {
className = jsonDecoder.decodeString(
jsonPath + ".className", json["className"]);
}
- return new ElementDeclaration(name, kind, fileIndex, offset, line, column,
- className: className);
+ String parameters;
+ if (json.containsKey("parameters")) {
+ parameters = jsonDecoder.decodeString(
+ jsonPath + ".parameters", json["parameters"]);
+ }
+ return new ElementDeclaration(
+ name, kind, fileIndex, offset, line, column, codeOffset, codeLength,
+ className: className, parameters: parameters);
} else {
throw jsonDecoder.mismatch(jsonPath, "ElementDeclaration", json);
}
@@ -8922,9 +9002,14 @@
result["offset"] = offset;
result["line"] = line;
result["column"] = column;
+ result["codeOffset"] = codeOffset;
+ result["codeLength"] = codeLength;
if (className != null) {
result["className"] = className;
}
+ if (parameters != null) {
+ result["parameters"] = parameters;
+ }
return result;
}
@@ -8940,7 +9025,10 @@
offset == other.offset &&
line == other.line &&
column == other.column &&
- className == other.className;
+ codeOffset == other.codeOffset &&
+ codeLength == other.codeLength &&
+ className == other.className &&
+ parameters == other.parameters;
}
return false;
}
@@ -8954,7 +9042,10 @@
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, line.hashCode);
hash = JenkinsSmiHash.combine(hash, column.hashCode);
+ hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
+ hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
hash = JenkinsSmiHash.combine(hash, className.hashCode);
+ hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
return JenkinsSmiHash.finish(hash);
}
}
@@ -15301,28 +15392,114 @@
/**
* search.getElementDeclarations params
*
+ * {
+ * "pattern": optional String
+ * "maxResults": optional int
+ * }
+ *
* Clients may not extend, implement or mix-in this class.
*/
class SearchGetElementDeclarationsParams implements RequestParams {
+ String _pattern;
+
+ int _maxResults;
+
+ /**
+ * The regular expression used to match the names of declarations. If this
+ * field is missing, return all declarations.
+ */
+ String get pattern => _pattern;
+
+ /**
+ * The regular expression used to match the names of declarations. If this
+ * field is missing, return all declarations.
+ */
+ void set pattern(String value) {
+ this._pattern = value;
+ }
+
+ /**
+ * The maximum number of declarations to return. If this field is missing,
+ * return all matching declarations.
+ */
+ int get maxResults => _maxResults;
+
+ /**
+ * The maximum number of declarations to return. If this field is missing,
+ * return all matching declarations.
+ */
+ void set maxResults(int value) {
+ this._maxResults = value;
+ }
+
+ SearchGetElementDeclarationsParams({String pattern, int maxResults}) {
+ this.pattern = pattern;
+ this.maxResults = maxResults;
+ }
+
+ factory SearchGetElementDeclarationsParams.fromJson(
+ JsonDecoder jsonDecoder, String jsonPath, Object json) {
+ if (json == null) {
+ json = {};
+ }
+ if (json is Map) {
+ String pattern;
+ if (json.containsKey("pattern")) {
+ pattern =
+ jsonDecoder.decodeString(jsonPath + ".pattern", json["pattern"]);
+ }
+ int maxResults;
+ if (json.containsKey("maxResults")) {
+ maxResults =
+ jsonDecoder.decodeInt(jsonPath + ".maxResults", json["maxResults"]);
+ }
+ return new SearchGetElementDeclarationsParams(
+ pattern: pattern, maxResults: maxResults);
+ } else {
+ throw jsonDecoder.mismatch(
+ jsonPath, "search.getElementDeclarations params", json);
+ }
+ }
+
+ factory SearchGetElementDeclarationsParams.fromRequest(Request request) {
+ return new SearchGetElementDeclarationsParams.fromJson(
+ new RequestDecoder(request), "params", request.params);
+ }
+
@override
- Map<String, dynamic> toJson() => <String, dynamic>{};
+ Map<String, dynamic> toJson() {
+ Map<String, dynamic> result = {};
+ if (pattern != null) {
+ result["pattern"] = pattern;
+ }
+ if (maxResults != null) {
+ result["maxResults"] = maxResults;
+ }
+ return result;
+ }
@override
Request toRequest(String id) {
- return new Request(id, "search.getElementDeclarations", null);
+ return new Request(id, "search.getElementDeclarations", toJson());
}
@override
+ String toString() => JSON.encode(toJson());
+
+ @override
bool operator ==(other) {
if (other is SearchGetElementDeclarationsParams) {
- return true;
+ return pattern == other.pattern && maxResults == other.maxResults;
}
return false;
}
@override
int get hashCode {
- return 653510116;
+ int hash = 0;
+ hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
+ hash = JenkinsSmiHash.combine(hash, maxResults.hashCode);
+ return JenkinsSmiHash.finish(hash);
}
}
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 8174780..0ca111b 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -108,7 +108,7 @@
* The version of the analysis server. The value should be replaced
* automatically during the build.
*/
- static final String VERSION = '1.18.6';
+ static final String VERSION = '1.18.7';
/**
* The options of this server instance.
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
index 272498f..55c8231 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
@@ -683,6 +683,10 @@
if (runPub) {
String vmPath = Platform.executable;
String pubPath = path.join(path.dirname(vmPath), 'pub');
+ if (Platform.isWindows) {
+ // Process.run requires the `.bat` suffix on Windows
+ pubPath = '$pubPath.bat';
+ }
ProcessResult result = Process.runSync(pubPath, <String>['get'],
stderrEncoding: UTF8,
stdoutEncoding: UTF8,
diff --git a/pkg/analysis_server/lib/src/search/search_domain.dart b/pkg/analysis_server/lib/src/search/search_domain.dart
index 6ed9709..ecdce2a 100644
--- a/pkg/analysis_server/lib/src/search/search_domain.dart
+++ b/pkg/analysis_server/lib/src/search/search_domain.dart
@@ -127,42 +127,23 @@
}
/**
- * Implement the `search.getTypeHierarchy` request.
- */
- Future getTypeHierarchy(protocol.Request request) async {
- var params = new protocol.SearchGetTypeHierarchyParams.fromRequest(request);
- String file = params.file;
- // prepare element
- Element element = await server.getElementAtOffset(file, params.offset);
- if (element == null) {
- _sendTypeHierarchyNull(request);
- return;
- }
- // maybe supertype hierarchy only
- if (params.superOnly == true) {
- TypeHierarchyComputer computer =
- new TypeHierarchyComputer(searchEngine, element);
- List<protocol.TypeHierarchyItem> items = computer.computeSuper();
- protocol.Response response =
- new protocol.SearchGetTypeHierarchyResult(hierarchyItems: items)
- .toResponse(request.id);
- server.sendResponse(response);
- return;
- }
- // prepare type hierarchy
- TypeHierarchyComputer computer =
- new TypeHierarchyComputer(searchEngine, element);
- List<protocol.TypeHierarchyItem> items = await computer.compute();
- protocol.Response response =
- new protocol.SearchGetTypeHierarchyResult(hierarchyItems: items)
- .toResponse(request.id);
- server.sendResponse(response);
- }
-
- /**
* Implement the `search.getDeclarations` request.
*/
Future getDeclarations(protocol.Request request) async {
+ var params =
+ new protocol.SearchGetElementDeclarationsParams.fromRequest(request);
+
+ RegExp regExp;
+ if (params.pattern != null) {
+ try {
+ regExp = new RegExp(params.pattern);
+ } on FormatException catch (exception) {
+ server.sendResponse(new protocol.Response.invalidParameter(
+ request, 'pattern', exception.message));
+ return;
+ }
+ }
+
var files = <String>[];
var declarations = <search.Declaration>[];
@@ -197,9 +178,18 @@
}
}
+ int remainingMaxResults = params.maxResults;
for (var driver in server.driverMap.values.toList()) {
- var driverDeclarations = await driver.search.declarations(files);
+ var driverDeclarations =
+ await driver.search.declarations(regExp, remainingMaxResults, files);
declarations.addAll(driverDeclarations);
+
+ if (remainingMaxResults != null) {
+ remainingMaxResults -= driverDeclarations.length;
+ if (remainingMaxResults <= 0) {
+ break;
+ }
+ }
}
List<protocol.ElementDeclaration> elementDeclarations =
@@ -210,7 +200,11 @@
declaration.fileIndex,
declaration.offset,
declaration.line,
- declaration.column);
+ declaration.column,
+ declaration.codeOffset,
+ declaration.codeLength,
+ className: declaration.className,
+ parameters: declaration.parameters);
}).toList();
server.sendResponse(new protocol.SearchGetElementDeclarationsResult(
@@ -218,6 +212,39 @@
.toResponse(request.id));
}
+ /**
+ * Implement the `search.getTypeHierarchy` request.
+ */
+ Future getTypeHierarchy(protocol.Request request) async {
+ var params = new protocol.SearchGetTypeHierarchyParams.fromRequest(request);
+ String file = params.file;
+ // prepare element
+ Element element = await server.getElementAtOffset(file, params.offset);
+ if (element == null) {
+ _sendTypeHierarchyNull(request);
+ return;
+ }
+ // maybe supertype hierarchy only
+ if (params.superOnly == true) {
+ TypeHierarchyComputer computer =
+ new TypeHierarchyComputer(searchEngine, element);
+ List<protocol.TypeHierarchyItem> items = computer.computeSuper();
+ protocol.Response response =
+ new protocol.SearchGetTypeHierarchyResult(hierarchyItems: items)
+ .toResponse(request.id);
+ server.sendResponse(response);
+ return;
+ }
+ // prepare type hierarchy
+ TypeHierarchyComputer computer =
+ new TypeHierarchyComputer(searchEngine, element);
+ List<protocol.TypeHierarchyItem> items = await computer.compute();
+ protocol.Response response =
+ new protocol.SearchGetTypeHierarchyResult(hierarchyItems: items)
+ .toResponse(request.id);
+ server.sendResponse(response);
+ }
+
@override
protocol.Response handleRequest(protocol.Request request) {
try {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
index ddf51d0..7966324 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_library_contributor.dart
@@ -61,6 +61,21 @@
_addConstructorSuggestions(element, relevance);
}
}
+ if (optype.includeReturnValueSuggestions) {
+ if (element.isEnum) {
+ String enumName = element.displayName;
+ int relevance = optype.returnValueSuggestionsFilter(
+ element.type, DART_RELEVANCE_DEFAULT);
+ for (var field in element.fields) {
+ if (field.isEnumConstant) {
+ addSuggestion(field,
+ prefix: prefix,
+ relevance: relevance,
+ elementCompletion: '$enumName.${field.name}');
+ }
+ }
+ }
+ }
}
@override
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
index ab4dad7..d0bc0b2 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/override_contributor.dart
@@ -89,14 +89,19 @@
StringBuffer displayTextBuffer = new StringBuffer();
DartChangeBuilder builder = await _buildReplacementText(
request.result, targetId, element, displayTextBuffer);
- String completion =
- builder.sourceChange.edits[0].edits[0].replacement.trim();
- if (completion == null || completion.length == 0) {
+ String replacement = builder.sourceChange.edits[0].edits[0].replacement;
+ String completion = replacement.trim();
+ String overrideAnnotation = '@override';
+ if (_hasOverride(request.target.containingNode) &&
+ completion.startsWith(overrideAnnotation)) {
+ completion = completion.substring(overrideAnnotation.length).trim();
+ }
+ if (completion.length == 0) {
return null;
}
SourceRange selectionRange = builder.selectionRange;
- int offsetDelta = range.node(targetId).offset;
+ int offsetDelta = targetId.offset + replacement.indexOf(completion);
String displayText =
displayTextBuffer.isNotEmpty ? displayTextBuffer.toString() : null;
CompletionSuggestion suggestion = new CompletionSuggestion(
@@ -129,26 +134,6 @@
}
/**
- * Compute a selection range for the given completion.
- */
- SourceRange _computeSelectionRange(String completion) {
- // TODO(pq): consider moving this into ChangeBuilder.
- // { return null; } or => null;
- int offset = completion.indexOf('null;');
- if (offset != -1) {
- return new SourceRange(offset, 4);
- }
- // { }
- offset = completion.indexOf('{');
- if (offset != -1) {
- return new SourceRange(offset + 2, 0);
- }
-
- // Default.
- return new SourceRange(0, 0);
- }
-
- /**
* If the target looks like a partial identifier inside a class declaration
* then return that identifier, otherwise return `null`.
*/
@@ -165,6 +150,17 @@
}
}
}
+ } else if (node is FieldDeclaration) {
+ Object entity = target.entity;
+ if (entity is VariableDeclarationList) {
+ NodeList<VariableDeclaration> variables = entity.variables;
+ if (variables.length == 1) {
+ SimpleIdentifier targetId = variables[0].name;
+ if (targetId.name.isEmpty) {
+ return targetId;
+ }
+ }
+ }
}
return null;
}
@@ -179,4 +175,20 @@
classElement.getMethod(memberName) != null ||
classElement.getSetter(memberName) != null;
}
+
+ /**
+ * Return `true` if the given [node] has an `override` annotation.
+ */
+ bool _hasOverride(AstNode node) {
+ if (node is AnnotatedNode) {
+ NodeList<Annotation> metadata = node.metadata;
+ for (Annotation annotation in metadata) {
+ if (annotation.name.name == 'override' &&
+ annotation.arguments == null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart
index 8239f37..593de24 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/static_member_contributor.dart
@@ -68,6 +68,13 @@
}
@override
+ visitConstructorElement(ConstructorElement element) {
+ if (element.context.analysisOptions.previewDart2) {
+ _addSuggestion(element);
+ }
+ }
+
+ @override
visitFieldElement(FieldElement element) {
if (element.isStatic) {
_addSuggestion(element);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index 83347c9..9ebcf46 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -147,13 +147,15 @@
* Add a suggestion based upon the given element.
*/
void addSuggestion(Element element,
- {String prefix, int relevance: DART_RELEVANCE_DEFAULT}) {
+ {String prefix,
+ int relevance: DART_RELEVANCE_DEFAULT,
+ String elementCompletion}) {
if (element.isPrivate) {
if (element.library != containingLibrary) {
return;
}
}
- String completion = element.displayName;
+ String completion = elementCompletion ?? element.displayName;
if (prefix != null && prefix.length > 0) {
if (completion == null || completion.length <= 0) {
completion = prefix;
diff --git a/pkg/analysis_server/lib/src/services/correction/assist.dart b/pkg/analysis_server/lib/src/services/correction/assist.dart
index 665d092..8902596 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist.dart
@@ -67,6 +67,10 @@
'dart.assist.convert.isNotEmpty', 30, "Convert to 'isNotEmpty'");
static const CONVERT_PART_OF_TO_URI = const AssistKind(
'dart.assist.convert.partOfToPartUri', 30, "Convert to use a URI");
+ static const CONVERT_TO_DOUBLE_QUOTED_STRING = const AssistKind(
+ 'dart.assist.convert.toDoubleQuotedString',
+ 30,
+ "Convert to double quoted string");
static const CONVERT_TO_FIELD_PARAMETER = const AssistKind(
'dart.assist.convert.toConstructorFieldParameter',
30,
@@ -75,6 +79,10 @@
'dart.assist.convert.toConstructorNormalParameter',
30,
"Convert to normal parameter");
+ static const CONVERT_TO_SINGLE_QUOTED_STRING = const AssistKind(
+ 'dart.assist.convert.toSingleQuotedString',
+ 30,
+ "Convert to single quoted string");
static const ENCAPSULATE_FIELD =
const AssistKind('dart.assist.encapsulateField', 30, "Encapsulate field");
static const EXCHANGE_OPERANDS =
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index 915c706..ce3e78b 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -129,6 +129,7 @@
await _addProposal_convertDocumentationIntoLine();
await _addProposal_convertToAsyncFunctionBody();
await _addProposal_convertToBlockFunctionBody();
+ await _addProposal_convertToDoubleQuotedString();
await _addProposal_convertToExpressionFunctionBody();
await _addProposal_convertPartOfToUri();
await _addProposal_convertToForIndexLoop();
@@ -138,6 +139,7 @@
await _addProposal_convertToIsNotEmpty();
await _addProposal_convertToFieldParameter();
await _addProposal_convertToNormalParameter();
+ await _addProposal_convertToSingleQuotedString();
await _addProposal_encapsulateField();
await _addProposal_exchangeOperands();
await _addProposal_flutterConvertToChildren();
@@ -635,10 +637,11 @@
String libraryPath = unitLibraryElement.source.fullName;
String partPath = unit.element.source.fullName;
String relativePath = relative(libraryPath, from: dirname(partPath));
+ String uri = new Uri.file(relativePath).toString();
SourceRange replacementRange = range.node(directive.libraryName);
DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addSimpleReplacement(replacementRange, "'$relativePath'");
+ builder.addSimpleReplacement(replacementRange, "'$uri'");
});
_addAssistFromBuilder(changeBuilder, DartAssistKind.CONVERT_PART_OF_TO_URI);
}
@@ -717,6 +720,10 @@
changeBuilder, DartAssistKind.CONVERT_INTO_BLOCK_BODY);
}
+ Future<Null> _addProposal_convertToDoubleQuotedString() async {
+ await _convertQuotes(false, DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING);
+ }
+
Future<Null> _addProposal_convertToExpressionFunctionBody() async {
// prepare current body
FunctionBody body = getEnclosingFunctionBody();
@@ -1158,6 +1165,10 @@
}
}
+ Future<Null> _addProposal_convertToSingleQuotedString() async {
+ await _convertQuotes(true, DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING);
+ }
+
Future<Null> _addProposal_encapsulateField() async {
// find FieldDeclaration
FieldDeclaration fieldDeclaration =
@@ -1435,6 +1446,10 @@
builder.addSimpleReplacement(nextRange, widgetText);
builder.addSimpleReplacement(widgetRange, nextText);
+
+ int lengthDelta = nextRange.length - widgetRange.length;
+ int newWidgetOffset = nextRange.offset + lengthDelta;
+ changeBuilder.setSelection(new Position(file, newWidgetOffset));
});
_addAssistFromBuilder(changeBuilder, DartAssistKind.FLUTTER_MOVE_DOWN);
}
@@ -1463,6 +1478,9 @@
builder.addSimpleReplacement(previousRange, widgetText);
builder.addSimpleReplacement(widgetRange, previousText);
+
+ int newWidgetOffset = previousRange.offset;
+ changeBuilder.setSelection(new Position(file, newWidgetOffset));
});
_addAssistFromBuilder(changeBuilder, DartAssistKind.FLUTTER_MOVE_UP);
}
@@ -2896,6 +2914,60 @@
changeBuilder, DartAssistKind.CONVERT_INTO_GENERIC_FUNCTION_SYNTAX);
}
+ Future<Null> _convertQuotes(bool fromDouble, AssistKind kind) async {
+ if (node is SimpleStringLiteral) {
+ SimpleStringLiteral literal = node;
+ if (fromDouble ? !literal.isSingleQuoted : literal.isSingleQuoted) {
+ String newQuote = literal.isMultiline
+ ? (fromDouble ? "'''" : '"""')
+ : (fromDouble ? "'" : '"');
+ int quoteLength = literal.isMultiline ? 3 : 1;
+ String lexeme = literal.literal.lexeme;
+ if (lexeme.indexOf(newQuote) < 0) {
+ DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
+ builder.addSimpleReplacement(
+ new SourceRange(
+ literal.offset + (literal.isRaw ? 1 : 0), quoteLength),
+ newQuote);
+ builder.addSimpleReplacement(
+ new SourceRange(literal.end - quoteLength, quoteLength),
+ newQuote);
+ });
+ _addAssistFromBuilder(changeBuilder, kind);
+ }
+ }
+ } else if (node is InterpolationString) {
+ StringInterpolation parent = node.parent;
+ if (fromDouble ? !parent.isSingleQuoted : parent.isSingleQuoted) {
+ String newQuote = parent.isMultiline
+ ? (fromDouble ? "'''" : '"""')
+ : (fromDouble ? "'" : '"');
+ int quoteLength = parent.isMultiline ? 3 : 1;
+ NodeList<InterpolationElement> elements = parent.elements;
+ for (int i = 0; i < elements.length; i++) {
+ InterpolationElement element = elements[i];
+ if (element is InterpolationString) {
+ String lexeme = element.contents.lexeme;
+ if (lexeme.indexOf(newQuote) >= 0) {
+ return;
+ }
+ }
+ }
+ DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
+ builder.addSimpleReplacement(
+ new SourceRange(
+ parent.offset + (parent.isRaw ? 1 : 0), quoteLength),
+ newQuote);
+ builder.addSimpleReplacement(
+ new SourceRange(parent.end - quoteLength, quoteLength), newQuote);
+ });
+ _addAssistFromBuilder(changeBuilder, kind);
+ }
+ }
+ }
+
/// Return the [ClassElement] with the given [className] that is exported
/// from the library with the given [libraryUri], or `null` if the libary
/// does not export a class with such name.
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 101583e..93e8299 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -24,6 +24,7 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/error/error.dart';
+import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
@@ -1513,13 +1514,17 @@
String file = source.fullName;
if (isAbsolute(file) && AnalysisEngine.isDartFileName(file)) {
String libName = _computeLibraryName(file);
- DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
- await changeBuilder.addFileEdit(source.fullName,
- (DartFileEditBuilder builder) {
- builder.addSimpleInsertion(0, 'library $libName;$eol$eol');
- });
- _addFixFromBuilder(changeBuilder, DartFixKind.CREATE_FILE,
- args: [source.shortName]);
+ try {
+ DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(source.fullName,
+ (DartFileEditBuilder builder) {
+ builder.addSimpleInsertion(0, 'library $libName;$eol$eol');
+ });
+ _addFixFromBuilder(changeBuilder, DartFixKind.CREATE_FILE,
+ args: [source.shortName]);
+ } on AnalysisException {
+ // Ignore the exception and just don't create a fix.
+ }
}
}
}
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index bd0864c..f050efa 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -89,6 +89,12 @@
return source;
}
+ void configurePreviewDart2() {
+ driver.configure(
+ analysisOptions: new AnalysisOptionsImpl.from(driver.analysisOptions)
+ ..previewDart2 = true);
+ }
+
void processRequiredPlugins() {
AnalysisEngine.instance.processRequiredPlugins();
}
diff --git a/pkg/analysis_server/test/analysis/get_errors_test.dart b/pkg/analysis_server/test/analysis/get_errors_test.dart
index 67eddd3..8649fcc 100644
--- a/pkg/analysis_server/test/analysis/get_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/get_errors_test.dart
@@ -69,14 +69,14 @@
@failingTest
test_fileDoesNotExist() {
// Broken under the new driver.
- String file = '$projectPath/doesNotExist.dart';
+ String file = convertPath('$projectPath/doesNotExist.dart');
return _checkInvalid(file);
}
@failingTest
test_fileWithoutContext() {
// Broken under the new driver.
- String file = '/outside.dart';
+ String file = convertPath('/outside.dart');
newFile(file, content: '''
main() {
print(42);
diff --git a/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart b/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart
index c3f7d6bb..b6a705b 100644
--- a/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart
@@ -119,9 +119,9 @@
expect(analyzedFilesReceived, isTrue);
analyzedFilesReceived = false;
- modifyTestFile('import "/foo.dart";');
+ modifyTestFile('import "${convertPathForImport('/foo.dart')}";');
await prepareAnalyzedFiles();
- assertHasFile('/foo.dart');
+ assertHasFile(convertPath('/foo.dart'));
}
void unsubscribeAnalyzedFiles() {
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index af77043..96fca2a 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -781,21 +781,17 @@
<String>["1+fooConst", "1-fooNotConst", "1-bar"],
failingTests: '1');
- buildTests(
- 'testCompletion_annotation_type',
- '''
+ buildTests('testCompletion_annotation_type', '''
class AAA {
const AAA({int a, int b});
const AAA.nnn(int c, int d);
}
@AAA!1
main() {
-}''',
- <String>[
- "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/,
- "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/
- ],
- failingTests: '1');
+}''', <String>[
+ "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/,
+ "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/
+ ]);
buildTests('testCompletion_annotation_type_inClass_withoutMember', '''
class AAA {
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 08eeb1ba..94c8884 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -503,7 +503,7 @@
foo(bar) => 0;''');
addTestFile('''
library libA;
- part "/testA.dart";
+ part "${convertPathForImport('/testA.dart')}";
import "dart:math";
/// The [^]
main(aaa, bbb) {}
@@ -529,7 +529,7 @@
test_inherited() {
newFile('/libA.dart', content: 'class A {m() {}}');
addTestFile('''
-import '/libA.dart';
+import ${convertPathForImport('/libA.dart')};
class B extends A {
x() {^}
}
diff --git a/pkg/analysis_server/test/domain_diagnostic_test.dart b/pkg/analysis_server/test/domain_diagnostic_test.dart
index c3ff619..7601a5e 100644
--- a/pkg/analysis_server/test/domain_diagnostic_test.dart
+++ b/pkg/analysis_server/test/domain_diagnostic_test.dart
@@ -29,7 +29,7 @@
newFile('/project/pubspec.yaml', content: 'name: project');
newFile('/project/bin/test.dart', content: 'main() {}');
- server.setAnalysisRoots('0', ['/project/'], [], {});
+ server.setAnalysisRoots('0', [convertPath('/project/')], [], {});
await server.onAnalysisComplete;
@@ -40,7 +40,7 @@
expect(result.contexts, hasLength(1));
ContextData context = result.contexts[0];
- expect(context.name, '/project');
+ expect(context.name, convertPath('/project'));
expect(context.explicitFileCount, 1); /* test.dart */
expect(context.implicitFileCount, 4);
diff --git a/pkg/analysis_server/test/domain_execution_test.dart b/pkg/analysis_server/test/domain_execution_test.dart
index 8ccdb16..02b95c1 100644
--- a/pkg/analysis_server/test/domain_execution_test.dart
+++ b/pkg/analysis_server/test/domain_execution_test.dart
@@ -182,7 +182,7 @@
// map the file
ExecutionMapUriResult result = _mapUri(file: path);
expect(result.file, isNull);
- expect(result.uri, 'file:///a/b.dart');
+ expect(result.uri, new Uri.file(path).toString());
}
void test_mapUri_file_dartUriKind() {
@@ -196,11 +196,10 @@
}
void test_mapUri_uri() {
- String path = '/a/b.dart';
- newFile(path);
+ String path = newFile('/a/b.dart').path;
// map the uri
- ExecutionMapUriResult result = _mapUri(uri: 'file://$path');
- expect(result.file, '/a/b.dart');
+ ExecutionMapUriResult result = _mapUri(uri: new Uri.file(path).toString());
+ expect(result.file, convertPath('/a/b.dart'));
expect(result.uri, isNull);
}
diff --git a/pkg/analysis_server/test/edit/fixes_test.dart b/pkg/analysis_server/test/edit/fixes_test.dart
index 92c67e2..1be66ae 100644
--- a/pkg/analysis_server/test/edit/fixes_test.dart
+++ b/pkg/analysis_server/test/edit/fixes_test.dart
@@ -110,10 +110,12 @@
}
test_suggestImportFromDifferentAnalysisRoot() async {
+ String asFileUri(String input) =>
+ new Uri.file(convertPath(input)).toString();
newFolder('/aaa');
newFile('/aaa/.packages', content: '''
-aaa:${resourceProvider.convertPath('/aaa/lib')}
-bbb:${resourceProvider.convertPath('/bbb/lib')}
+aaa:${asFileUri('/aaa/lib')}
+bbb:${asFileUri('/bbb/lib')}
''');
// Ensure that the target is analyzed as an implicit source.
newFile('/aaa/lib/foo.dart', content: 'import "package:bbb/target.dart";');
@@ -122,7 +124,8 @@
newFile('/bbb/lib/target.dart', content: 'class Foo() {}');
handleSuccessfulRequest(
- new AnalysisSetAnalysisRootsParams(['/aaa', '/bbb'], []).toRequest('0'),
+ new AnalysisSetAnalysisRootsParams(
+ [convertPath('/aaa'), convertPath('/bbb')], []).toRequest('0'),
handler: analysisHandler);
// Configure the test file.
diff --git a/pkg/analysis_server/test/edit/organize_directives_test.dart b/pkg/analysis_server/test/edit/organize_directives_test.dart
index ed87cba..9ca4c06 100644
--- a/pkg/analysis_server/test/edit/organize_directives_test.dart
+++ b/pkg/analysis_server/test/edit/organize_directives_test.dart
@@ -35,7 +35,8 @@
Future test_BAD_doesNotExist() async {
// The analysis driver fails to return an error
Request request =
- new EditOrganizeDirectivesParams('/no/such/file.dart').toRequest('0');
+ new EditOrganizeDirectivesParams(convertPath('/no/such/file.dart'))
+ .toRequest('0');
Response response = await waitResponse(request);
expect(
response, isResponseFailure('0', RequestErrorCode.FILE_NOT_ANALYZED));
diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
index 35eca2f..ab48dde 100644
--- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
@@ -1199,6 +1199,18 @@
/**
* Return top-level and class member declarations.
*
+ * Parameters
+ *
+ * pattern: String (optional)
+ *
+ * The regular expression used to match the names of declarations. If this
+ * field is missing, return all declarations.
+ *
+ * maxResults: int (optional)
+ *
+ * The maximum number of declarations to return. If this field is missing,
+ * return all matching declarations.
+ *
* Returns
*
* declarations: List<ElementDeclaration>
@@ -1209,9 +1221,12 @@
*
* The list of the paths of files with declarations.
*/
- Future<SearchGetElementDeclarationsResult>
- sendSearchGetElementDeclarations() async {
- var result = await server.send("search.getElementDeclarations", null);
+ Future<SearchGetElementDeclarationsResult> sendSearchGetElementDeclarations(
+ {String pattern, int maxResults}) async {
+ var params = new SearchGetElementDeclarationsParams(
+ pattern: pattern, maxResults: maxResults)
+ .toJson();
+ var result = await server.send("search.getElementDeclarations", params);
ResponseDecoder decoder = new ResponseDecoder(null);
return new SearchGetElementDeclarationsResult.fromJson(
decoder, 'result', result);
diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
index 3801787..93cc065 100644
--- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart
+++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart
@@ -332,7 +332,10 @@
* "offset": int
* "line": int
* "column": int
+ * "codeOffset": int
+ * "codeLength": int
* "className": optional String
+ * "parameters": optional String
* }
*/
final Matcher isElementDeclaration =
@@ -342,9 +345,12 @@
"fileIndex": isInt,
"offset": isInt,
"line": isInt,
- "column": isInt
+ "column": isInt,
+ "codeOffset": isInt,
+ "codeLength": isInt
}, optionalFields: {
- "className": isString
+ "className": isString,
+ "parameters": isString
}));
/**
@@ -2665,8 +2671,15 @@
/**
* search.getElementDeclarations params
+ *
+ * {
+ * "pattern": optional String
+ * "maxResults": optional int
+ * }
*/
-final Matcher isSearchGetElementDeclarationsParams = isNull;
+final Matcher isSearchGetElementDeclarationsParams = new LazyMatcher(() =>
+ new MatchesJsonObject("search.getElementDeclarations params", null,
+ optionalFields: {"pattern": isString, "maxResults": isInt}));
/**
* search.getElementDeclarations result
diff --git a/pkg/analysis_server/test/search/declarations_test.dart b/pkg/analysis_server/test/search/declarations_test.dart
index 253b657..4feda64 100644
--- a/pkg/analysis_server/test/search/declarations_test.dart
+++ b/pkg/analysis_server/test/search/declarations_test.dart
@@ -22,11 +22,21 @@
class DeclarationsTest extends AbstractSearchDomainTest {
SearchGetElementDeclarationsResult declarationsResult;
- void assertHas(String name, ElementKind kind) {
- declarationsResult.declarations.singleWhere((d) =>
+ ElementDeclaration assertHas(String name, ElementKind kind,
+ {String className}) {
+ return declarationsResult.declarations.singleWhere((ElementDeclaration d) =>
declarationsResult.files[d.fileIndex] == testFile &&
d.name == name &&
- d.kind == kind);
+ d.kind == kind &&
+ d.className == className);
+ }
+
+ void assertNo(String name) {
+ expect(
+ declarationsResult.declarations,
+ isNot(contains(predicate((ElementDeclaration d) =>
+ declarationsResult.files[d.fileIndex] == testFile &&
+ d.name == name))));
}
test_class() async {
@@ -43,11 +53,11 @@
await _getDeclarations();
assertHas('C', ElementKind.CLASS);
- assertHas('f', ElementKind.FIELD);
- assertHas('named', ElementKind.CONSTRUCTOR);
- assertHas('g', ElementKind.GETTER);
- assertHas('s', ElementKind.SETTER);
- assertHas('m', ElementKind.METHOD);
+ assertHas('f', ElementKind.FIELD, className: 'C');
+ assertHas('named', ElementKind.CONSTRUCTOR, className: 'C');
+ assertHas('g', ElementKind.GETTER, className: 'C');
+ assertHas('s', ElementKind.SETTER, className: 'C');
+ assertHas('m', ElementKind.METHOD, className: 'C');
}
test_enum() async {
@@ -64,24 +74,44 @@
assertHas('c', ElementKind.ENUM_CONSTANT);
}
+ test_maxResults() async {
+ newFile(join(testFolder, 'a.dart'), content: r'''
+class A {}
+class B {}
+''').path;
+ newFile(join(testFolder, 'b.dart'), content: r'''
+class C {}
+class D {}
+''').path;
+
+ // Limit to exactly one file.
+ await _getDeclarations(pattern: r'[A-D]', maxResults: 2);
+ expect(declarationsResult.declarations, hasLength(2));
+
+ // Limit in the middle of the second file.
+ await _getDeclarations(pattern: r'[A-D]', maxResults: 3);
+ expect(declarationsResult.declarations, hasLength(3));
+
+ // No limit.
+ await _getDeclarations(pattern: r'[A-D]');
+ expect(declarationsResult.declarations, hasLength(4));
+ }
+
test_multipleFiles() async {
var a = newFile(join(testFolder, 'a.dart'), content: 'class A {}').path;
var b = newFile(join(testFolder, 'b.dart'), content: 'class B {}').path;
- Request request = new SearchGetElementDeclarationsParams().toRequest('0');
- Response response = await waitResponse(request);
+ await _getDeclarations();
- var result = new SearchGetElementDeclarationsResult.fromResponse(response);
-
- expect(result.files, contains(a));
- expect(result.files, contains(b));
+ expect(declarationsResult.files, contains(a));
+ expect(declarationsResult.files, contains(b));
{
ElementDeclaration declaration =
- result.declarations.singleWhere((d) => d.name == 'A');
+ declarationsResult.declarations.singleWhere((d) => d.name == 'A');
expect(declaration.name, 'A');
expect(declaration.kind, ElementKind.CLASS);
- expect(result.files[declaration.fileIndex], a);
+ expect(declarationsResult.files[declaration.fileIndex], a);
expect(declaration.offset, 6);
expect(declaration.line, 1);
expect(declaration.column, 7);
@@ -89,13 +119,38 @@
{
ElementDeclaration declaration =
- result.declarations.singleWhere((d) => d.name == 'B');
+ declarationsResult.declarations.singleWhere((d) => d.name == 'B');
expect(declaration.name, 'B');
expect(declaration.kind, ElementKind.CLASS);
- expect(result.files[declaration.fileIndex], b);
+ expect(declarationsResult.files[declaration.fileIndex], b);
}
}
+ test_parameters() async {
+ addTestFile(r'''
+void f(bool a, String b) {}
+''');
+ await _getDeclarations();
+
+ ElementDeclaration declaration = assertHas('f', ElementKind.FUNCTION);
+ expect(declaration.parameters, '(bool a, String b)');
+ }
+
+ test_regExp() async {
+ addTestFile(r'''
+class A {}
+class B {}
+class C {}
+class D {}
+''');
+ await _getDeclarations(pattern: r'[A-C]');
+
+ assertHas('A', ElementKind.CLASS);
+ assertHas('B', ElementKind.CLASS);
+ assertHas('C', ElementKind.CLASS);
+ assertNo('D');
+ }
+
test_top() async {
addTestFile(r'''
int get g => 0;
@@ -115,8 +170,10 @@
assertHas('tf2', ElementKind.FUNCTION_TYPE_ALIAS);
}
- Future<Null> _getDeclarations() async {
- Request request = new SearchGetElementDeclarationsParams().toRequest('0');
+ Future<Null> _getDeclarations({String pattern, int maxResults}) async {
+ Request request = new SearchGetElementDeclarationsParams(
+ pattern: pattern, maxResults: maxResults)
+ .toRequest('0');
Response response = await waitResponse(request);
declarationsResult =
diff --git a/pkg/analysis_server/test/search/type_hierarchy_test.dart b/pkg/analysis_server/test/search/type_hierarchy_test.dart
index c3132ab..d53bf67 100644
--- a/pkg/analysis_server/test/search/type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/search/type_hierarchy_test.dart
@@ -180,9 +180,8 @@
''');
await waitForTasksFinished();
// configure roots
- Request request =
- new AnalysisSetAnalysisRootsParams([projectPath, '/packages/pkgA'], [])
- .toRequest('0');
+ Request request = new AnalysisSetAnalysisRootsParams(
+ [projectPath, convertPath('/packages/pkgA')], []).toRequest('0');
handleSuccessfulRequest(request);
// test A type hierarchy
List<TypeHierarchyItem> items = await _getTypeHierarchy('A {}');
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index 05c1b3d..0335310 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -144,7 +144,8 @@
test_Annotation_imported_constructor_named_param() async {
addSource('/libA.dart', '''
library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
- addTestSource('import "/libA.dart"; @A(^) main() { }');
+ addTestSource(
+ 'import "${convertPathForImport("/libA.dart")}"; @A(^) main() { }');
await computeSuggestions();
assertSuggestArgumentsAndTypes(
namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
@@ -444,7 +445,8 @@
test_ArgumentList_imported_constructor_named_param() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart', 'library libA; class A{A({int one}); }');
- addTestSource('import "/libA.dart"; main() { new A(^);}');
+ addTestSource(
+ 'import "${convertPathForImport("/libA.dart")}"; main() { new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
@@ -452,7 +454,8 @@
test_ArgumentList_imported_constructor_named_param2() async {
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart', 'library libA; class A{A.foo({int one}); }');
- addTestSource('import "/libA.dart"; main() { new A.foo(^);}');
+ addTestSource(
+ 'import "${convertPathForImport("/libA.dart")}"; main() { new A.foo(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
@@ -461,7 +464,8 @@
// ArgumentList InstanceCreationExpression VariableDeclaration
addSource(
'/libA.dart', 'library libA; class A { A({int i, String s, d}) {} }}');
- addTestSource('import "/libA.dart"; main() { var a = new A(^);}');
+ addTestSource(
+ 'import "${convertPathForImport("/libA.dart")}"; main() { var a = new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(
namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'});
@@ -471,7 +475,8 @@
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource(
'/libA.dart', 'library libA; class A{factory A({int one}) => null;}');
- addTestSource('import "/libA.dart"; main() { new A(^);}');
+ addTestSource(
+ 'import "${convertPathForImport("/libA.dart")}"; main() { new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
@@ -480,7 +485,8 @@
// ArgumentList InstanceCreationExpression ExpressionStatement
addSource('/libA.dart',
'library libA; abstract class A{factory A.foo({int one});}');
- addTestSource('import "/libA.dart"; main() { new A.foo(^);}');
+ addTestSource(
+ 'import "${convertPathForImport("/libA.dart")}"; main() { new A.foo(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(namedArgumentsWithTypes: {'one': 'int'});
}
@@ -489,7 +495,8 @@
// ArgumentList InstanceCreationExpression VariableDeclaration
addSource('/libA.dart',
'library libA; class A {factory A({int i, String s, d}) {} }}');
- addTestSource('import "/libA.dart"; main() { var a = new A(^);}');
+ addTestSource(
+ 'import "${convertPathForImport("/libA.dart")}"; main() { var a = new A(^);}');
await computeSuggestions();
assertSuggestArgumentsAndTypes(
namedArgumentsWithTypes: {'i': 'int', 's': 'String', 'd': 'dynamic'});
@@ -503,7 +510,7 @@
expect() { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect(a^)}''');
@@ -519,7 +526,7 @@
expect(String arg) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect(^)}''');
@@ -535,7 +542,7 @@
expect(String arg1, int arg2) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect(^)}''');
@@ -551,7 +558,7 @@
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect(^)}''');
@@ -567,7 +574,7 @@
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect('hello', ^)}''');
@@ -583,7 +590,7 @@
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect('hello', ^x)}''');
@@ -599,7 +606,7 @@
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect('hello', x^)}''');
@@ -615,7 +622,7 @@
expect(String arg1, int arg2, {bool arg3}) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B { }
String bar() => true;
void main() {expect('hello', x ^)}''');
@@ -884,7 +891,7 @@
test_ArgumentList_local_function_1() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
expect(arg) { }
class B { }
String bar() => true;
@@ -896,7 +903,7 @@
test_ArgumentList_local_function_2() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
expect(arg1, int arg2) { }
class B { }
String bar() => true;
@@ -908,7 +915,7 @@
test_ArgumentList_local_function_3() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
expect(arg1, int arg2) { }
class B { }
String bar() => true;
@@ -920,7 +927,7 @@
test_ArgumentList_local_function_3a() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
expect(arg1, int arg2, {bool arg3}) { }
class B { }
String bar() => true;
@@ -932,7 +939,7 @@
test_ArgumentList_local_function_3b() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
expect(arg1, int arg2, {bool arg3}) { }
class B { }
String bar() => true;
@@ -944,7 +951,7 @@
test_ArgumentList_local_function_3c() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
expect(arg1, int arg2, {bool arg3}) { }
class B { }
String bar() => true;
@@ -956,7 +963,7 @@
test_ArgumentList_local_function_3d() async {
// ArgumentList MethodInvocation ExpressionStatement Block
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
expect(arg1, int arg2, {bool arg3}) { }
class B { }
String bar() => true;
@@ -1011,7 +1018,7 @@
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B {
expect() { }
void foo() {expect(^)}}
@@ -1027,7 +1034,7 @@
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
- import '/libA.dart'
+ import '${convertPathForImport('/libA.dart')}'
class B {
expect(arg, int blat) { }
void foo() {expect(^)}}
diff --git a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
index 0bc60b7..2aa2825 100644
--- a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
@@ -38,7 +38,7 @@
// SimpleIdentifier HideCombinator ImportDirective
addSource('/testAB.dart', '''
library libAB;
- part '/partAB.dart';
+ part "${convertPathForImport('/partAB.dart')}";
class A { }
class B { }''');
addSource('/partAB.dart', '''
@@ -50,8 +50,8 @@
class C { }
class D { }''');
addTestSource('''
- import "/testAB.dart" hide ^;
- import "/testCD.dart";
+ import "${convertPathForImport("/testAB.dart")}" hide ^;
+ import "${convertPathForImport("/testCD.dart")}";
class X {}''');
await computeSuggestions();
@@ -78,7 +78,7 @@
// SimpleIdentifier HideCombinator ImportDirective
addSource('/testAB.dart', '''
library libAB;
- part '/partAB.dart';
+ part "${convertPathForImport('/partAB.dart')}";
class A { }
class B { }
class _AB''');
@@ -93,8 +93,8 @@
class C { }
class D { }''');
addTestSource('''
- import "/testAB.dart" show ^;
- import "/testCD.dart";
+ import "${convertPathForImport("/testAB.dart")}" show ^;
+ import "${convertPathForImport("/testCD.dart")}";
class X {}''');
await computeSuggestions();
@@ -140,7 +140,7 @@
class B {}
''');
addTestSource('''
-import "/testB.dart" show ^;
+import "${convertPathForImport("/testB.dart")}" show ^;
''');
await computeSuggestions();
assertSuggestClass('A',
diff --git a/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart b/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
index 7f455ec..0809c6e 100644
--- a/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
@@ -61,9 +61,9 @@
expect(replacementLength, equals(0));
assertHasResult(CompletionSuggestionKind.INVOCATION, 'E');
assertHasResult(CompletionSuggestionKind.INVOCATION, 'E.e1',
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertHasResult(CompletionSuggestionKind.INVOCATION, 'E.e2',
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
}
test_PrefixedIdentifier_field() async {
@@ -85,7 +85,8 @@
test_PrefixedIdentifier_field_inPart() async {
// SimpleIdentifier PrefixedIdentifier ExpressionStatement
newFile('/project/bin/myLib.dart',
- content: 'library L; part "$testFile"; class A {static int s2;}');
+ content:
+ 'library L; part "${convertPathForImport(testFile)}"; class A {static int s2;}');
addTestFile('part of L; foo() {A.^}');
await getSuggestionsWith({
'L.A': ['s2']
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 3f38e82..f0c3285 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -198,6 +198,7 @@
CompletionSuggestion assertSuggestConstructor(String name,
{int relevance: DART_RELEVANCE_DEFAULT,
String importUri,
+ String elementName,
int elemOffset,
String defaultArgListString: _UNCHECKED,
List<int> defaultArgumentListTextRanges}) {
@@ -211,7 +212,8 @@
expect(element, isNotNull);
expect(element.kind, equals(ElementKind.CONSTRUCTOR));
int index = name.indexOf('.');
- expect(element.name, index >= 0 ? name.substring(index + 1) : '');
+ elementName ??= index >= 0 ? name.substring(index + 1) : '';
+ expect(element.name, elementName);
return cs;
}
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
index ef82b02..d0717e8 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
@@ -41,7 +41,7 @@
addSource('/libB.dart', '''
library libB;
import "/libA.dart" as foo;
-part '$testFile';
+part '${convertPathForImport(testFile)}';
''');
addTestSource('part of libB; main() {^}');
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index 66268e1..9c62da3 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -1849,6 +1849,33 @@
assertNotSuggested('two');
}
+ test_enum_filter() async {
+ addSource('/a.dart', '''
+enum E { one, two }
+enum F { three, four }
+''');
+ addTestSource('''
+import 'a.dart';
+
+void foo({E e}) {}
+
+main() {
+ foo(e: ^);
+}
+''');
+ await computeSuggestions();
+
+ assertSuggestEnum('E');
+ assertSuggestEnumConst('E.one',
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
+ assertSuggestEnumConst('E.two',
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
+
+ assertSuggestEnum('F');
+ assertSuggestEnumConst('F.three');
+ assertSuggestEnumConst('F.four');
+ }
+
test_ExpressionStatement_identifier() async {
// SimpleIdentifier ExpressionStatement Block
resolveSource('/testA.dart', '''
@@ -2381,6 +2408,36 @@
assertNotSuggested('int');
}
+ test_implicitCreation() async {
+ configurePreviewDart2();
+ addSource('/a.dart', '''
+class A {
+ A.a1();
+ A.a2();
+}
+class B {
+ B.b1();
+ B.b2();
+}
+''');
+ addTestSource('''
+import 'a.dart';
+
+main() {
+ ^;
+}
+''');
+ await computeSuggestions();
+
+ assertSuggestClass('A');
+ assertSuggestConstructor('A.a1');
+ assertSuggestConstructor('A.a2');
+
+ assertSuggestClass('B');
+ assertSuggestConstructor('B.b1');
+ assertSuggestConstructor('B.b2');
+ }
+
test_ImportDirective_dart() async {
// SimpleStringLiteral ImportDirective
addTestSource('''
@@ -2524,6 +2581,35 @@
assertNotSuggested('A');
}
+ test_InstanceCreationExpression_filter() async {
+ configurePreviewDart2();
+ addSource('/a.dart', '''
+class A {}
+class B extends A {}
+class C implements A {}
+class D {}
+''');
+ addTestSource('''
+import 'a.dart';
+
+main() {
+ A a = new ^
+}
+''');
+ await computeSuggestions();
+
+ assertSuggestConstructor('A',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
+ assertSuggestConstructor('B',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
+ assertSuggestConstructor('C',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
+ assertNotSuggested('D');
+ }
+
test_InstanceCreationExpression_imported() async {
// SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
addSource('/testA.dart', '''
diff --git a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
index 2c49eca..9679580 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
@@ -91,7 +91,7 @@
addSource(libFile, '''
library testA;
import "dart:async" deferred as bar;
- part "$testFile";''');
+ part "${convertPathForImport(testFile)}";''');
addTestSource('part of testA; foo() {bar.^}');
// Assume that libraries containing has been computed for part files
await computeLibrariesContaining();
@@ -105,10 +105,11 @@
addSource('/libA.dart', 'library libA; class A { }');
addSource('/libB.dart', '''
library libB;
- export "/libA.dart";
+ export "${convertPathForImport("/libA.dart")}";
class B { }
@deprecated class B1 { }''');
- addTestSource('import "/libB.dart" as foo; main() {foo.^} class C { }');
+ addTestSource(
+ 'import "${convertPathForImport("/libB.dart")}" as foo; main() {foo.^} class C { }');
await computeSuggestions();
assertSuggestClass('B');
assertSuggestClass('B1', relevance: DART_RELEVANCE_LOW, isDeprecated: true);
@@ -124,7 +125,7 @@
class X { }
class Y { }''');
addTestSource('''
- import "/testB.dart" as b;
+ import "${convertPathForImport("/testB.dart")}" as b;
var T2;
class A { }
main() {b.^}''');
@@ -151,8 +152,8 @@
class Y { }''');
addSource(libFile, '''
library testA;
- import "/testB.dart" as b;
- part "$testFile";
+ import "${convertPathForImport("/testB.dart")}" as b;
+ part "${convertPathForImport(testFile)}";
var T2;
class A { }''');
addTestSource('''
@@ -181,7 +182,7 @@
class X { }
class Y { }''');
addTestSource('''
- import "/testB.dart" as b;
+ import "${convertPathForImport("/testB.dart")}" as b;
var T2;
class A { }
foo(b.^ f) {}''');
@@ -206,7 +207,7 @@
class X { }
class Y { }''');
addTestSource('''
- import "/testB.dart" as b;
+ import "${convertPathForImport("/testB.dart")}" as b;
var T2;
class A { }
foo(b.^) {}''');
@@ -231,7 +232,7 @@
class X extends _W {}
class M{}''');
addTestSource('''
- import "/testB.dart";
+ import "${convertPathForImport("/testB.dart")}";
foo(X x) {x.^}''');
await computeSuggestions();
assertNoSuggestions();
@@ -243,7 +244,7 @@
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
- import "/testA.dart";
+ import "${convertPathForImport("/testA.dart")}";
class X {foo(){A^.bar}}''');
await computeSuggestions();
assertNoSuggestions();
diff --git a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
index 3343e5e..ff859fe 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
@@ -297,9 +297,9 @@
class C {C.bar({boo: 'hoo', int z: 0}) { } }''');
addSource('/testB.dart', '''
library testB;
-import "/testA.dart" as t;
+import "${convertPathForImport("/testA.dart")}" as t;
import "dart:math" as math;
-part "$testFile"
+part "${convertPathForImport(testFile)}"
main() {new ^ String x = "hello";}''');
addTestSource('''
part of testB;
diff --git a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
index 17d3cef..8f42b69 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
@@ -2330,11 +2330,13 @@
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertSuggestConstructor('B',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestConstructor('C',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertNotSuggested('D');
}
@@ -2349,11 +2351,13 @@
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertSuggestConstructor('B',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestConstructor('C',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertNotSuggested('D');
}
@@ -2399,8 +2403,10 @@
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
- assertSuggestConstructor('B', elemOffset: -1);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
+ assertSuggestConstructor('B',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertNotSuggested('C');
}
@@ -2415,8 +2421,10 @@
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
- assertSuggestConstructor('B', elemOffset: -1);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
+ assertSuggestConstructor('B',
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertNotSuggested('C');
}
@@ -2442,11 +2450,13 @@
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertSuggestConstructor('B',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestConstructor('C',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertNotSuggested('D');
}
@@ -2460,11 +2470,13 @@
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertSuggestConstructor('B',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestConstructor('C',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertNotSuggested('D');
}
diff --git a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
index 9d776dc..abe72fc 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
@@ -31,8 +31,8 @@
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
library libA;
- import "/testB.dart";
- part "$testFile";
+ import "${convertPathForImport("/testB.dart")}";
+ part "${convertPathForImport(testFile)}";
class A { }
var m;''');
addTestSource('''
@@ -69,8 +69,8 @@
class B { }''');
addTestSource('''
library libA;
- import "/testB.dart";
- part "/testA.dart";
+ import "${convertPathForImport("/testB.dart")}";
+ part "${convertPathForImport("/testA.dart")}";
class A { A({String boo: 'hoo'}) { } }
main() {new ^}
var m;''');
@@ -105,8 +105,8 @@
''');
addTestSource('''
library libA;
- import "/testB.dart";
- part "/testA.dart";
+ import "${convertPathForImport("/testB.dart")}";
+ part "${convertPathForImport("/testA.dart")}";
class Local { }
main() {
A a;
@@ -121,11 +121,13 @@
// A is suggested with a higher relevance
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertSuggestConstructor('B',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestConstructor('C',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
// D is sorted out
assertNotSuggested('D');
@@ -156,8 +158,8 @@
''');
addTestSource('''
library libA;
- import "/testB.dart";
- part "/testA.dart";
+ import "${convertPathForImport("/testB.dart")}";
+ part "${convertPathForImport("/testA.dart")}";
class Local { }
main() {
A a = new ^
@@ -170,11 +172,13 @@
// A is suggested with a higher relevance
assertSuggestConstructor('A',
elemOffset: -1,
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertSuggestConstructor('B',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestConstructor('C',
- elemOffset: -1, relevance: DART_RELEVANCE_DEFAULT);
+ elemOffset: -1,
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_SUBTYPE);
// D is sorted out
assertNotSuggested('D');
@@ -200,8 +204,8 @@
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
library libA;
- import "/testB.dart";
- part "$testFile";
+ import "${convertPathForImport("/testB.dart")}";
+ part "${convertPathForImport(testFile)}";
class A { var a1; a2(){}}
var m;
typedef t1(int blue);
@@ -249,8 +253,8 @@
var n;''');
addTestSource('''
library libA;
- import "/testB.dart";
- part "/testA.dart";
+ import "${convertPathForImport("/testB.dart")}";
+ part "${convertPathForImport("/testA.dart")}";
class A { A({String boo: 'hoo'}) { } }
main() {^}
var m;''');
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 64f561f..8650537 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -135,7 +135,7 @@
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class B { }
String bar() => true;
void main() {expect(^)}''');
@@ -163,7 +163,7 @@
expect(arg) { }
void baz() { }''');
addTestSource('''
-import '/libA.dart'
+import "${convertPathForImport('/libA.dart')}"
class B { }
String bar() => true;
void main() {expect(^)}''');
@@ -192,7 +192,7 @@
void baz() { }''');
addTestSource('''
import 'dart:async';
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class B { }
String bar() => true;
void main() {new A(^)}''');
@@ -224,7 +224,7 @@
void baz() { }''');
addTestSource('''
import 'dart:async';
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class B { }
String bar() => true;
void main() {new A(^)}''');
@@ -253,7 +253,7 @@
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
-import '/libA.dart'
+import "${convertPathForImport('/libA.dart')}"
expect(arg) { }
class B { }
String bar() => true;
@@ -281,7 +281,7 @@
bool hasLength(int expected) { }
void baz() { }''');
addTestSource('''
-import '/libA.dart'
+import "${convertPathForImport('/libA.dart')}"
class B {
expect(arg) { }
void foo() {expect(^)}}
@@ -311,7 +311,7 @@
void baz() { }''');
addTestSource('''
import 'dart:async';
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class B { }
String bar(f()) => true;
void main() {boo(){} bar(^);}''');
@@ -345,7 +345,7 @@
void baz() { }''');
addTestSource('''
import 'dart:async';
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class B { }
String bar({inc()}) => true;
void main() {boo(){} bar(inc: ^);}''');
@@ -356,10 +356,12 @@
assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
assertSuggestFunction('bar', 'String',
kind: CompletionSuggestionKind.IDENTIFIER,
- relevance: DART_RELEVANCE_LOCAL_FUNCTION + DART_RELEVANCE_INCREMENT);
+ relevance:
+ DART_RELEVANCE_LOCAL_FUNCTION + DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestFunction('boo', 'dynamic',
kind: CompletionSuggestionKind.IDENTIFIER,
- relevance: DART_RELEVANCE_LOCAL_FUNCTION + DART_RELEVANCE_INCREMENT);
+ relevance:
+ DART_RELEVANCE_LOCAL_FUNCTION + DART_RELEVANCE_BOOST_SUBTYPE);
assertNotSuggested('hasLength');
assertNotSuggested('identical');
assertSuggestClass('B', kind: CompletionSuggestionKind.IDENTIFIER);
@@ -379,7 +381,7 @@
void baz() { }''');
addTestSource('''
import 'dart:async';
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class B { String bar(f()) => true; }
void main() {new B().bar(^);}''');
await computeSuggestions();
@@ -407,7 +409,7 @@
}
''');
addTestSource('''
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class PageState {
void _incrementCounter() { }
@@ -433,7 +435,7 @@
library A;
bool hasLength(int expected) { }''');
addTestSource('''
-import '/libA.dart'
+import "${convertPathForImport('/libA.dart')}"
String bar() => true;
void main() {expect(foo: ^)}''');
await computeSuggestions();
@@ -469,14 +471,14 @@
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
assertSuggestTopLevelVar('a', 'A',
- relevance:
- DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE +
+ DART_RELEVANCE_BOOST_TYPE);
assertSuggestTopLevelVar('b', 'B',
- relevance:
- DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE +
+ DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestTopLevelVar('c', 'C',
- relevance:
- DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE +
+ DART_RELEVANCE_BOOST_SUBTYPE);
assertSuggestTopLevelVar('d', 'D',
relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
assertSuggestTopLevelVar('e', 'E',
@@ -492,7 +494,7 @@
}
''');
addTestSource('''
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class PageState {
void _incrementCounter() { }
@@ -520,7 +522,7 @@
}
''');
addTestSource('''
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class PageState {
void _incrementCounter() { }
@@ -548,7 +550,7 @@
}
''');
addTestSource('''
-import '/libA.dart';
+import "${convertPathForImport('/libA.dart')}";
class PageState {
void _incrementCounter() { }
@@ -801,7 +803,8 @@
expect(replacementOffset, completionOffset);
expect(replacementLength, 0);
- assertSuggestLocalVariable('a', 'int');
+ assertSuggestLocalVariable('a', 'int',
+ relevance: DART_RELEVANCE_LOCAL_VARIABLE + DART_RELEVANCE_BOOST_TYPE);
assertNotSuggested('Object');
assertNotSuggested('b');
assertNotSuggested('==');
@@ -828,10 +831,10 @@
int T3;
var _T4;'''); // not imported
addTestSource('''
-import "/testAB.dart";
-import "/testCD.dart" hide D;
-import "/testEEF.dart" show EE;
-import "/testG.dart" as g;
+import "${convertPathForImport("/testAB.dart")}";
+import "${convertPathForImport("/testCD.dart")}" hide D;
+import "${convertPathForImport("/testEEF.dart")}" show EE;
+import "${convertPathForImport("/testG.dart")}" as g;
int T5;
var _T6;
String get T7 => 'hello';
@@ -926,10 +929,10 @@
int T3;
var _T4;'''); // not imported
addTestSource('''
-import "/testAB.dart";
-import "/testCD.dart" hide D;
-import "/testEEF.dart" show EE;
-import "/testG.dart" as g;
+import "${convertPathForImport("/testAB.dart")}";
+import "${convertPathForImport("/testCD.dart")}" hide D;
+import "${convertPathForImport("/testEEF.dart")}" show EE;
+import "${convertPathForImport("/testG.dart")}" as g;
int T5;
var _T6;
String get T7 => 'hello';
@@ -1039,10 +1042,10 @@
int T3;
var _T4;'''); // not imported
addTestSource('''
-import "/testAB.dart";
-import "/testCD.dart" hide D;
-import "/testEEF.dart" show EE;
-import "/testG.dart" as g;
+import "${convertPathForImport("/testAB.dart")}";
+import "${convertPathForImport("/testCD.dart")}" hide D;
+import "${convertPathForImport("/testEEF.dart")}" show EE;
+import "${convertPathForImport("/testG.dart")}" as g;
int T5;
var _T6;
String get T7 => 'hello';
@@ -1138,10 +1141,10 @@
int T3;
var _T4;'''); // not imported
addTestSource('''
-import "/testAB.dart";
-import "/testCD.dart" hide D;
-import "/testEEF.dart" show EE;
-import "/testG.dart" as g;
+import "${convertPathForImport("/testAB.dart")}";
+import "${convertPathForImport("/testCD.dart")}" hide D;
+import "${convertPathForImport("/testEEF.dart")}" show EE;
+import "${convertPathForImport("/testG.dart")}" as g;
int T5;
var _T6;
String get T7 => 'hello';
@@ -1237,10 +1240,10 @@
int T3;
var _T4;'''); // not imported
addTestSource('''
-import "/testAB.dart";
-import "/testCD.dart" hide D;
-import "/testEEF.dart" show EE;
-import "/testG.dart" as g;
+import "${convertPathForImport("/testAB.dart")}";
+import "${convertPathForImport("/testCD.dart")}" hide D;
+import "${convertPathForImport("/testEEF.dart")}" show EE;
+import "${convertPathForImport("/testG.dart")}" as g;
int T5;
var _T6;
Z D2() {int x;}
@@ -1304,7 +1307,7 @@
class I { int i1; i2() { } }
class M { var m1; int m2() { } }''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class A extends E implements I with M {a() {^}}''');
await computeSuggestions();
@@ -1370,10 +1373,10 @@
int T3;
var _T4;'''); // not imported
addTestSource('''
-import "/testAB.dart";
-import "/testCD.dart" hide D;
-import "/testEEF.dart" show EE;
-import "/testG.dart" as g;
+import "${convertPathForImport("/testAB.dart")}";
+import "${convertPathForImport("/testCD.dart")}" hide D;
+import "${convertPathForImport("/testEEF.dart")}" show EE;
+import "${convertPathForImport("/testG.dart")}" as g;
int T5;
var _T6;
String get T7 => 'hello';
@@ -1422,7 +1425,7 @@
addSource('/testB.dart', '''
class B { }''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class A {var b; X _c;}
class X{}
// looks like a cascade to the parser
@@ -1447,7 +1450,7 @@
addSource('/testB.dart', '''
class B { }''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class A {var b; X _c;}
class X{}
main() {A a; a..^z}''');
@@ -1470,7 +1473,7 @@
addSource('/testB.dart', '''
class B { }''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class A {var b; X _c;}
class X{}
main() {A a; a..^ return}''');
@@ -1711,8 +1714,8 @@
class C { }
class D { }''');
addTestSource('''
-import "/testAB.dart" hide ^;
-import "/testCD.dart";
+import "${convertPathForImport("/testAB.dart")}" hide ^;
+import "${convertPathForImport("/testCD.dart")}";
class X {}''');
await computeSuggestions();
@@ -1737,8 +1740,8 @@
class C { }
class D { }''');
addTestSource('''
-import "/testAB.dart" show ^;
-import "/testCD.dart";
+import "${convertPathForImport("/testAB.dart")}" show ^;
+import "${convertPathForImport("/testCD.dart")}";
class X {}''');
await computeSuggestions();
@@ -1752,7 +1755,7 @@
F1() { }
class A {int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
class B {int x;}
@@ -1773,7 +1776,7 @@
F1() { }
class A {int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
class B {int x;}
@@ -1801,7 +1804,7 @@
F1() { }
class A {int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
class B {int x;}
@@ -1822,7 +1825,7 @@
F1() { }
class A {int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
class B {int x;}
@@ -1850,7 +1853,7 @@
F1() { }
class A {int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
class B {int x;}
@@ -1908,7 +1911,7 @@
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
var m;
main() {new X.^}''');
await computeSuggestions();
@@ -1933,7 +1936,7 @@
F1() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
var m;
main() {new X.^}''');
await computeSuggestions();
@@ -2152,29 +2155,27 @@
}
test_enum_filter() async {
- // SimpleIdentifier NamedExpression ArgumentList
- // InstanceCreationExpression
addTestSource('''
- enum E { one, two }
- enum F { three, four }
- class A {}
- class B {
- B({E someE});
- }
- A a = new A();
- B b = new B(someE: ^);
- ''');
+enum E { one, two }
+enum F { three, four }
+
+void foo({E e}) {}
+
+main() {
+ foo(e: ^);
+}
+''');
await computeSuggestions();
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
+ assertSuggestEnum('E');
assertSuggestEnumConst('E.one',
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
assertSuggestEnumConst('E.two',
- relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
- assertNotSuggested('a');
- assertNotSuggested('F.three');
- assertNotSuggested('F.four');
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_BOOST_TYPE);
+
+ assertSuggestEnum('F');
+ assertSuggestEnumConst('F.three');
+ assertSuggestEnumConst('F.four');
}
test_ExpressionStatement_identifier() async {
@@ -2184,7 +2185,7 @@
class A {int x;}
class _B { }''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
typedef int F2(int blat);
class Clz = Object with Object;
class C {foo(){^} void bar() {}}''');
@@ -2212,7 +2213,7 @@
B T1;
class B{}''');
addTestSource('''
- import "/testA.dart";
+ import "${convertPathForImport("/testA.dart")}";
class C {a() {C ^}}''');
await computeSuggestions();
@@ -2224,7 +2225,7 @@
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addTestSource('''
- import "/testA.dart";
+ import "${convertPathForImport("/testA.dart")}";
class C {A ^}''');
await computeSuggestions();
@@ -2236,7 +2237,7 @@
// FieldDeclaration
addSource('/testA.dart', 'class A { }');
addTestSource('''
- import "/testA.dart";
+ import "${convertPathForImport("/testA.dart")}";
class C {var ^}''');
await computeSuggestions();
@@ -2551,7 +2552,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -2581,7 +2582,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -2611,7 +2612,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -2774,7 +2775,7 @@
F1() { }
class A {int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
class B {int x;}
@@ -2802,7 +2803,7 @@
F1() { }
class A {int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
class B {int x;}
@@ -2834,7 +2835,7 @@
F1() { }
class A {A(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
import "dart:async";
int T2;
F2() { }
@@ -2879,7 +2880,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -2910,7 +2911,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -2982,7 +2983,7 @@
foo() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class Y {Y.c(); Y._d(); z() {}}
main() {var x; if (x is ^) { }}''');
await computeSuggestions();
@@ -3099,7 +3100,7 @@
nowIsIt() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
String newer() {}
var m;
main() {new^ X.c();}''');
@@ -3162,7 +3163,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -3192,7 +3193,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -3215,7 +3216,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -3344,7 +3345,7 @@
static c3() {}
static var c4;}''');
addTestSource('''
-import "/testC.dart";
+import "${convertPathForImport("/testC.dart")}";
class B extends C {
b1() {}
var b2;
@@ -3484,7 +3485,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -3513,7 +3514,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -3542,7 +3543,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -3571,7 +3572,7 @@
typedef D1();
class C1 {C1(this.x) { } int x;}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
int T2;
F2() { }
typedef D2();
@@ -3680,7 +3681,7 @@
class X {X.c(); X._d(); z() {}}''');
addSource('/testA.dart', '''
library libA;
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
part "$testFile";
class A { }
var m;''');
@@ -3717,7 +3718,7 @@
class B { }''');
addTestSource('''
library libA;
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
part "/testA.dart";
class A { A({String boo: 'hoo'}) { } }
main() {new ^}
@@ -3756,7 +3757,7 @@
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class A extends B {
static const String scA = 'foo';
w() { }}
@@ -3800,7 +3801,7 @@
m(X x) {} I _n(X x) {}}
class X{}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
main() {A a; a.^}''');
await computeSuggestions();
@@ -3874,7 +3875,7 @@
class X { }
class Y { }''');
addTestSource('''
-import "/testB.dart" as b;
+import "${convertPathForImport("/testB.dart")}" as b;
var T2;
class A { }
main() {b.^}''');
@@ -3901,7 +3902,7 @@
class X { }
class Y { }''');
addTestSource('''
-import "/testB.dart" as b;
+import "${convertPathForImport("/testB.dart")}" as b;
var T2;
class A { }
foo(b.^ f) {}''');
@@ -3928,7 +3929,7 @@
class X { }
class Y { }''');
addTestSource('''
-import "/testB.dart" as b;
+import "${convertPathForImport("/testB.dart")}" as b;
var T2;
class A { }
foo(b.^) {}''');
@@ -3955,7 +3956,7 @@
class X extends _W {}
class M{}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
foo(X x) {x.^}''');
await computeSuggestions();
@@ -3972,7 +3973,7 @@
class A {static int bar = 10;}
_B() {}''');
addTestSource('''
-import "/testA.dart";
+import "${convertPathForImport("/testA.dart")}";
class X {foo(){A^.bar}}''');
await computeSuggestions();
@@ -4458,7 +4459,7 @@
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
-import "/testA.dart";'
+import "${convertPathForImport("/testA.dart")}";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@@ -4484,7 +4485,7 @@
F1() => 0;
typedef String T1(int blat);''');
addTestSource('''
-import "/testA.dart";'
+import "${convertPathForImport("/testA.dart")}";'
class C2 {int x;}
F2() => 0;
typedef int T2(int blat);
@@ -4507,7 +4508,7 @@
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class Y {Y.c(); Y._d(); z() {}}
main() {var ^}''');
await computeSuggestions();
@@ -4534,7 +4535,7 @@
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
class Y {Y.c(); Y._d(); z() {}}
class C {bar(){var f; {var x;} var e = ^}}''');
await computeSuggestions();
@@ -4560,7 +4561,7 @@
class _B { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
-import "/testB.dart";
+import "${convertPathForImport("/testB.dart")}";
foo2() { }
void bar2() { }
class Y {Y.c(); Y._d(); z() {}}
diff --git a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
index f753d8a..499eb2b 100644
--- a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
@@ -51,7 +51,7 @@
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
- import "/testB.dart";
+ import "${convertPathForImport("/testB.dart")}";
var m;
main() {new X.^}''');
@@ -75,7 +75,7 @@
F1() { }
class X {X.c(); X._d(); z() {}}''');
addTestSource('''
- import "/testB.dart";
+ import "${convertPathForImport("/testB.dart")}";
var m;
main() {new X.^}''');
// Assume that imported libraries are NOT resolved
@@ -100,7 +100,7 @@
F1() { }
class X {factory X.c(); factory X._d(); z() {}}''');
addTestSource('''
- import "/testB.dart";
+ import "${convertPathForImport("/testB.dart")}";
var m;
main() {new X.^}''');
diff --git a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
index 1c37c8f..9b27990 100644
--- a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
@@ -38,46 +38,65 @@
}
''');
await computeSuggestions();
- _assertOverride('''@override
+ _assertOverride('''
+@override
A suggested1(int x) {
// TODO: implement suggested1
return super.suggested1(x);
}''',
displayText: 'suggested1(int x) { … }',
- selectionOffset: 74,
+ selectionOffset: 72,
selectionLength: 27);
- _assertOverride(
- '''@override\n A suggested1(int x) {\n // TODO: implement suggested1\n return super.suggested1(x);\n }''',
+ _assertOverride('''
+@override
+ A suggested1(int x) {
+ // TODO: implement suggested1
+ return super.suggested1(x);
+ }''',
displayText: 'suggested1(int x) { … }',
- selectionOffset: 74,
+ selectionOffset: 72,
selectionLength: 27);
- _assertOverride(
- '''@override\n B suggested2(String y) {\n // TODO: implement suggested2\n return super.suggested2(y);\n }''',
+ _assertOverride('''
+@override
+ B suggested2(String y) {
+ // TODO: implement suggested2
+ return super.suggested2(y);
+ }''',
displayText: 'suggested2(String y) { … }',
+ selectionOffset: 75,
+ selectionLength: 27);
+ _assertOverride('''
+@override
+ C suggested3([String z]) {
+ // TODO: implement suggested3
+ return super.suggested3(z);
+ }''',
+ displayText: 'suggested3([String z]) { … }',
selectionOffset: 77,
selectionLength: 27);
- _assertOverride(
- '''@override\n C suggested3([String z]) {\n // TODO: implement suggested3\n return super.suggested3(z);\n }''',
- displayText: 'suggested3([String z]) { … }',
- selectionOffset: 79,
- selectionLength: 27);
- _assertOverride(
- '''@override\n void suggested4() {\n // TODO: implement suggested4\n super.suggested4();\n }''',
+ _assertOverride('''
+@override
+ void suggested4() {
+ // TODO: implement suggested4
+ super.suggested4();
+ }''',
displayText: 'suggested4() { … }',
- selectionOffset: 72,
+ selectionOffset: 70,
selectionLength: 19);
- _assertOverride(
- '''@override\n // TODO: implement suggested5\n int get suggested5 => super.suggested5;''',
+ _assertOverride('''
+@override
+ // TODO: implement suggested5
+ int get suggested5 => super.suggested5;''',
displayText: 'suggested5 => …',
- selectionOffset: 68,
+ selectionOffset: 66,
selectionLength: 16);
}
test_fromPart() async {
addSource('/myLib.dart', '''
library myLib;
-part '$testFile'
-part '/otherPart.dart'
+part '${convertPathForImport(testFile)}'
+part '${convertPathForImport('/otherPart.dart')}'
class A {
A suggested1(int x) => null;
B suggested2(String y) => null;
@@ -99,26 +118,62 @@
// assume information for context.getLibrariesContaining has been cached
await computeLibrariesContaining();
await computeSuggestions();
- _assertOverride('''@override
+ _assertOverride('''
+@override
A suggested1(int x) {
// TODO: implement suggested1
return super.suggested1(x);
}''', displayText: 'suggested1(int x) { … }');
- _assertOverride(
- '''@override\n A suggested1(int x) {\n // TODO: implement suggested1\n return super.suggested1(x);\n }''',
+ _assertOverride('''
+@override
+ A suggested1(int x) {
+ // TODO: implement suggested1
+ return super.suggested1(x);
+ }''',
displayText: 'suggested1(int x) { … }',
- selectionOffset: 74,
+ selectionOffset: 72,
selectionLength: 27);
- _assertOverride(
- '''@override\n B suggested2(String y) {\n // TODO: implement suggested2\n return super.suggested2(y);\n }''',
+ _assertOverride('''
+@override
+ B suggested2(String y) {
+ // TODO: implement suggested2
+ return super.suggested2(y);
+ }''',
displayText: 'suggested2(String y) { … }',
+ selectionOffset: 75,
+ selectionLength: 27);
+ _assertOverride('''
+@override
+ C suggested3([String z]) {
+ // TODO: implement suggested3
+ return super.suggested3(z);
+ }''',
+ displayText: 'suggested3([String z]) { … }',
selectionOffset: 77,
selectionLength: 27);
- _assertOverride(
- '''@override\n C suggested3([String z]) {\n // TODO: implement suggested3\n return super.suggested3(z);\n }''',
- displayText: 'suggested3([String z]) { … }',
- selectionOffset: 79,
- selectionLength: 27);
+ }
+
+ test_withExistingOverride() async {
+ addTestSource('''
+class A {
+ method() {}
+ int age;
+}
+
+class B extends A {
+ @override
+ meth^
+}
+''');
+ await computeSuggestions();
+ _assertOverride('''
+method() {
+ // TODO: implement method
+ return super.method();
+ }''',
+ displayText: 'method() { … }',
+ selectionOffset: 45,
+ selectionLength: 22);
}
CompletionSuggestion _assertOverride(String completion,
diff --git a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
index da59376..2987710 100644
--- a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
@@ -97,6 +97,27 @@
assertSuggestField('values', 'List<E>', isDeprecated: true);
}
+ test_implicitCreation() async {
+ configurePreviewDart2();
+ addSource('/a.dart', '''
+class A {
+ A.foo();
+ A.bar();
+}
+''');
+ addTestSource('''
+import 'a.dart';
+
+main() {
+ A.^;
+}
+''');
+ await computeSuggestions();
+
+ assertSuggestConstructor('foo', elementName: 'foo');
+ assertSuggestConstructor('bar', elementName: 'bar');
+ }
+
test_keyword() async {
addTestSource('class C { static C get instance => null; } main() {C.in^}');
await computeSuggestions();
diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
index 4a49744..005f97e 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -465,7 +465,7 @@
change = assist.change;
// verify
{
- var testFileEdit = change.getFileEdit('/app.dart');
+ var testFileEdit = change.getFileEdit(convertPath('/app.dart'));
var resultCode = SourceEdit.applySequence(appCode, testFileEdit.edits);
expect(resultCode, '''
library my_app;
@@ -476,7 +476,7 @@
''');
}
{
- var testFileEdit = change.getFileEdit('/test.dart');
+ var testFileEdit = change.getFileEdit(convertPath('/test.dart'));
var resultCode = SourceEdit.applySequence(testCode, testFileEdit.edits);
expect(resultCode, '''
part of my_app;
@@ -1195,6 +1195,138 @@
''');
}
+ test_convertToDoubleQuotedString_BAD_one_embeddedTarget() async {
+ await resolveTestUnit('''
+main() {
+ print('a"b"c');
+}
+''');
+ await assertNoAssistAt(
+ "'a", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING);
+ }
+
+ test_convertToDoubleQuotedString_BAD_one_enclosingTarget() async {
+ await resolveTestUnit('''
+main() {
+ print("abc");
+}
+''');
+ await assertNoAssistAt(
+ '"ab', DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING);
+ }
+
+ test_convertToDoubleQuotedString_BAD_three_embeddedTarget() async {
+ await resolveTestUnit("""
+main() {
+ print('''a""\"c''');
+}
+""");
+ await assertNoAssistAt(
+ "'a", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING);
+ }
+
+ test_convertToDoubleQuotedString_BAD_three_enclosingTarget() async {
+ await resolveTestUnit('''
+main() {
+ print("""abc""");
+}
+''');
+ await assertNoAssistAt(
+ '"ab', DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING);
+ }
+
+ test_convertToDoubleQuotedString_OK_one_interpolation() async {
+ await resolveTestUnit(r'''
+main() {
+ var b = 'b';
+ var c = 'c';
+ print('a $b-${c} d');
+}
+''');
+ await assertHasAssistAt(
+ r"'a $b", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING, r'''
+main() {
+ var b = 'b';
+ var c = 'c';
+ print("a $b-${c} d");
+}
+''');
+ }
+
+ test_convertToDoubleQuotedString_OK_one_raw() async {
+ await resolveTestUnit('''
+main() {
+ print(r'abc');
+}
+''');
+ await assertHasAssistAt(
+ "'ab", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING, '''
+main() {
+ print(r"abc");
+}
+''');
+ }
+
+ test_convertToDoubleQuotedString_OK_one_simple() async {
+ await resolveTestUnit('''
+main() {
+ print('abc');
+}
+''');
+ await assertHasAssistAt(
+ "'ab", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING, '''
+main() {
+ print("abc");
+}
+''');
+ }
+
+ test_convertToDoubleQuotedString_OK_three_interpolation() async {
+ await resolveTestUnit(r"""
+main() {
+ var b = 'b';
+ var c = 'c';
+ print('''a $b-${c} d''');
+}
+""");
+ await assertHasAssistAt(
+ r"'a $b", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING, r'''
+main() {
+ var b = 'b';
+ var c = 'c';
+ print("""a $b-${c} d""");
+}
+''');
+ }
+
+ test_convertToDoubleQuotedString_OK_three_raw() async {
+ await resolveTestUnit("""
+main() {
+ print(r'''abc''');
+}
+""");
+ await assertHasAssistAt(
+ "'ab", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING, '''
+main() {
+ print(r"""abc""");
+}
+''');
+ }
+
+ test_convertToDoubleQuotedString_OK_three_simple() async {
+ await resolveTestUnit("""
+main() {
+ print('''abc''');
+}
+""");
+ await assertHasAssistAt(
+ "'ab", DartAssistKind.CONVERT_TO_DOUBLE_QUOTED_STRING, '''
+main() {
+ print("""abc""");
+}
+''');
+ }
+
test_convertToExpressionBody_BAD_already() async {
await resolveTestUnit('''
fff() => 42;
@@ -2236,6 +2368,138 @@
''');
}
+ test_convertToSingleQuotedString_BAD_one_embeddedTarget() async {
+ await resolveTestUnit('''
+main() {
+ print("a'b'c");
+}
+''');
+ await assertNoAssistAt(
+ '"a', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING);
+ }
+
+ test_convertToSingleQuotedString_BAD_one_enclosingTarget() async {
+ await resolveTestUnit('''
+main() {
+ print('abc');
+}
+''');
+ await assertNoAssistAt(
+ "'ab", DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING);
+ }
+
+ test_convertToSingleQuotedString_BAD_three_embeddedTarget() async {
+ await resolveTestUnit('''
+main() {
+ print("""a''\'bc""");
+}
+''');
+ await assertNoAssistAt(
+ '"a', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING);
+ }
+
+ test_convertToSingleQuotedString_BAD_three_enclosingTarget() async {
+ await resolveTestUnit("""
+main() {
+ print('''abc''');
+}
+""");
+ await assertNoAssistAt(
+ "'ab", DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING);
+ }
+
+ test_convertToSingleQuotedString_OK_one_interpolation() async {
+ await resolveTestUnit(r'''
+main() {
+ var b = 'b';
+ var c = 'c';
+ print("a $b-${c} d");
+}
+''');
+ await assertHasAssistAt(
+ r'"a $b', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING, r'''
+main() {
+ var b = 'b';
+ var c = 'c';
+ print('a $b-${c} d');
+}
+''');
+ }
+
+ test_convertToSingleQuotedString_OK_one_raw() async {
+ await resolveTestUnit('''
+main() {
+ print(r"abc");
+}
+''');
+ await assertHasAssistAt(
+ '"ab', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING, '''
+main() {
+ print(r'abc');
+}
+''');
+ }
+
+ test_convertToSingleQuotedString_OK_one_simple() async {
+ await resolveTestUnit('''
+main() {
+ print("abc");
+}
+''');
+ await assertHasAssistAt(
+ '"ab', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING, '''
+main() {
+ print('abc');
+}
+''');
+ }
+
+ test_convertToSingleQuotedString_OK_three_interpolation() async {
+ await resolveTestUnit(r'''
+main() {
+ var b = 'b';
+ var c = 'c';
+ print("""a $b-${c} d""");
+}
+''');
+ await assertHasAssistAt(
+ r'"a $b', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING, r"""
+main() {
+ var b = 'b';
+ var c = 'c';
+ print('''a $b-${c} d''');
+}
+""");
+ }
+
+ test_convertToSingleQuotedString_OK_three_raw() async {
+ await resolveTestUnit('''
+main() {
+ print(r"""abc""");
+}
+''');
+ await assertHasAssistAt(
+ '"ab', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING, """
+main() {
+ print(r'''abc''');
+}
+""");
+ }
+
+ test_convertToSingleQuotedString_OK_three_simple() async {
+ await resolveTestUnit('''
+main() {
+ print("""abc""");
+}
+''');
+ await assertHasAssistAt(
+ '"ab', DartAssistKind.CONVERT_TO_SINGLE_QUOTED_STRING, """
+main() {
+ print('''abc''');
+}
+""");
+ }
+
test_encapsulateField_BAD_alreadyPrivate() async {
await resolveTestUnit('''
class A {
@@ -2779,8 +3043,8 @@
new Column(
children: <Widget>[
new Text('aaa'),
- /*caret*/new Text('bbb'),
- new Text('ccc'),
+ /*caret*/new Text('bbbbbb'),
+ new Text('ccccccccc'),
],
);
}
@@ -2792,12 +3056,13 @@
new Column(
children: <Widget>[
new Text('aaa'),
- /*caret*/new Text('ccc'),
- new Text('bbb'),
+ /*caret*/new Text('ccccccccc'),
+ new Text('bbbbbb'),
],
);
}
''');
+ _assertExitPosition(before: "new Text('bbbbbb')");
}
test_flutterMoveWidgetUp_BAD_first() async {
@@ -2840,8 +3105,8 @@
new Column(
children: <Widget>[
new Text('aaa'),
- /*caret*/new Text('bbb'),
- new Text('ccc'),
+ /*caret*/new Text('bbbbbb'),
+ new Text('ccccccccc'),
],
);
}
@@ -2852,13 +3117,14 @@
main() {
new Column(
children: <Widget>[
- new Text('bbb'),
+ new Text('bbbbbb'),
/*caret*/new Text('aaa'),
- new Text('ccc'),
+ new Text('ccccccccc'),
],
);
}
''');
+ _assertExitPosition(before: "new Text('bbbbbb')");
}
test_flutterRemoveWidget_BAD_childrenMultipleIntoChild() async {
@@ -3258,7 +3524,7 @@
}
test_flutterWrapCenter_OK_implicitNew() async {
- _configurePreviewDart2();
+ configurePreviewDart2();
addFlutterPackage();
await resolveTestUnit('''
import 'package:flutter/widgets.dart';
@@ -3352,7 +3618,7 @@
}
test_flutterWrapColumn_OK_implicitNew() async {
- _configurePreviewDart2();
+ configurePreviewDart2();
addFlutterPackage();
await resolveTestUnit('''
import 'package:flutter/widgets.dart';
@@ -5134,7 +5400,7 @@
}
''');
_assertLinkedGroup(change.linkedEditGroups[0], ['condition);']);
- _assertExitPosition('condition);');
+ _assertExitPosition(after: 'condition);');
}
test_surroundWith_for() async {
@@ -5161,7 +5427,7 @@
_assertLinkedGroup(change.linkedEditGroups[1], ['init;']);
_assertLinkedGroup(change.linkedEditGroups[2], ['condition;']);
_assertLinkedGroup(change.linkedEditGroups[3], ['increment']);
- _assertExitPosition(' }');
+ _assertExitPosition(after: ' }');
}
test_surroundWith_forIn() async {
@@ -5186,7 +5452,7 @@
''');
_assertLinkedGroup(change.linkedEditGroups[0], ['item']);
_assertLinkedGroup(change.linkedEditGroups[1], ['iterable']);
- _assertExitPosition(' }');
+ _assertExitPosition(after: ' }');
}
test_surroundWith_if() async {
@@ -5210,7 +5476,7 @@
}
''');
_assertLinkedGroup(change.linkedEditGroups[0], ['condition']);
- _assertExitPosition(' }');
+ _assertExitPosition(after: ' }');
}
test_surroundWith_tryCatch() async {
@@ -5238,7 +5504,7 @@
_assertLinkedGroup(change.linkedEditGroups[0], ['Exception']);
_assertLinkedGroup(change.linkedEditGroups[1], ['e) {']);
_assertLinkedGroup(change.linkedEditGroups[2], ['// TODO']);
- _assertExitPosition('// TODO');
+ _assertExitPosition(after: '// TODO');
}
test_surroundWith_tryFinally() async {
@@ -5264,7 +5530,7 @@
}
''');
_assertLinkedGroup(change.linkedEditGroups[0], ['// TODO']);
- _assertExitPosition('// TODO');
+ _assertExitPosition(after: '// TODO');
}
test_surroundWith_while() async {
@@ -5288,14 +5554,20 @@
}
''');
_assertLinkedGroup(change.linkedEditGroups[0], ['condition']);
- _assertExitPosition(' }');
+ _assertExitPosition(after: ' }');
}
- void _assertExitPosition(String after) {
+ void _assertExitPosition({String before, String after}) {
Position exitPosition = change.selection;
expect(exitPosition, isNotNull);
expect(exitPosition.file, testFile);
- expect(exitPosition.offset, resultCode.indexOf(after) + after.length);
+ if (before != null) {
+ expect(exitPosition.offset, resultCode.indexOf(before));
+ } else if (after != null) {
+ expect(exitPosition.offset, resultCode.indexOf(after) + after.length);
+ } else {
+ fail("One of 'before' or 'after' expected.");
+ }
}
/**
@@ -5330,12 +5602,6 @@
return await processor.compute();
}
- void _configurePreviewDart2() {
- driver.configure(
- analysisOptions: new AnalysisOptionsImpl.from(driver.analysisOptions)
- ..previewDart2 = true);
- }
-
List<Position> _findResultPositions(List<String> searchStrings) {
List<Position> positions = <Position>[];
for (String search in searchStrings) {
diff --git a/pkg/analysis_server/test/services/correction/status_test.dart b/pkg/analysis_server/test/services/correction/status_test.dart
index 041ee1e..776fa14 100644
--- a/pkg/analysis_server/test/services/correction/status_test.dart
+++ b/pkg/analysis_server/test/services/correction/status_test.dart
@@ -29,7 +29,7 @@
Element element = findElement('MyClass');
// check
Location location = newLocation_fromElement(element);
- expect(location.file, '/test.dart');
+ expect(location.file, convertPath('/test.dart'));
expect(location.offset, 6);
expect(location.length, 7);
expect(location.startLine, 1);
@@ -52,7 +52,7 @@
sourceRange);
// check
Location location = newLocation_fromMatch(match);
- expect(location.file, '/test.dart');
+ expect(location.file, convertPath('/test.dart'));
expect(location.offset, sourceRange.offset);
expect(location.length, sourceRange.length);
}
@@ -65,7 +65,7 @@
AstNode node = findNodeAtString('main');
// check
Location location = newLocation_fromNode(node);
- expect(location.file, '/test.dart');
+ expect(location.file, convertPath('/test.dart'));
expect(location.offset, node.offset);
expect(location.length, node.length);
}
@@ -75,7 +75,7 @@
SourceRange sourceRange = new SourceRange(10, 20);
// check
Location location = newLocation_fromUnit(testUnit, sourceRange);
- expect(location.file, '/test.dart');
+ expect(location.file, convertPath('/test.dart'));
expect(location.offset, sourceRange.offset);
expect(location.length, sourceRange.length);
}
diff --git a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
index 090e1ea..2685442 100644
--- a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
+++ b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
@@ -56,7 +56,7 @@
*/
void assertFileChangeResult(String path, String expectedCode) {
// prepare FileEdit
- SourceFileEdit fileEdit = refactoringChange.getFileEdit(path);
+ SourceFileEdit fileEdit = refactoringChange.getFileEdit(convertPath(path));
expect(fileEdit, isNotNull, reason: 'No file edit for $path');
// validate resulting code
File file = getFile(path);
diff --git a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
index 6cbfdff..f248500 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
@@ -722,7 +722,7 @@
}
''');
await indexTestUnit('''
-import '$pkgLib';
+import '${convertPathForImport(pkgLib)}';
class A {
test() {}
}
@@ -737,7 +737,7 @@
refactoring.newName = 'newName';
// validate change
await assertSuccessfulRefactoring('''
-import '/.pub-cache/lib.dart';
+import '${convertPathForImport('/.pub-cache/lib.dart')}';
class A {
newName() {}
}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
index 56dc78a..6285bbd 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
@@ -219,7 +219,7 @@
class A {}
''');
await indexTestUnit('''
-import '/.pub-cache/lib.dart';
+import "${convertPathForImport('/.pub-cache/lib.dart')}";
main() {
A a;
}
@@ -238,7 +238,7 @@
class A {}
''');
await indexTestUnit('''
-import '/Pub/Cache/lib.dart';
+import "${convertPathForImport('/Pub/Cache/lib.dart')}";
main() {
A a;
}
diff --git a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
index 5d3e5b9a..72440be 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
@@ -483,13 +483,15 @@
expect(packagesFile.exists, isTrue);
String content = packagesFile.readAsStringSync();
List<String> lines = content.split('\n');
+ String asFileUri(String input) =>
+ new Uri.file(convertPath(input)).toString();
expect(
lines,
unorderedEquals([
- 'plugin:file:///workspaceRoot/third_party/dart/plugin/lib',
- 'b:file:///workspaceRoot/third_party/dart/b/lib',
- 'c:file:///workspaceRoot/third_party/dart/c/lib',
- 'd:file:///workspaceRoot/third_party/dart/d/lib',
+ 'plugin:${asFileUri('/workspaceRoot/third_party/dart/plugin/lib')}',
+ 'b:${asFileUri('/workspaceRoot/third_party/dart/b/lib')}',
+ 'c:${asFileUri('/workspaceRoot/third_party/dart/c/lib')}',
+ 'd:${asFileUri('/workspaceRoot/third_party/dart/d/lib')}',
''
]));
}
@@ -756,6 +758,9 @@
String packageName = line.substring(0, index + 1);
String relativePath = line.substring(index + 1);
String absolutePath = path.join(sdkDirPath, relativePath);
+ // Convert to file:/// URI since that's how absolute paths in
+ // .packages must be for windows
+ absolutePath = new Uri.file(absolutePath).toString();
buffer.write(packageName);
buffer.writeln(absolutePath);
}
diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
index 1c3bc3b..f1f2401 100644
--- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
+++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
@@ -733,8 +733,13 @@
* {@code search.getElementDeclarations}
*
* Return top-level and class member declarations.
+ *
+ * @param pattern The regular expression used to match the names of declarations. If this field is
+ * missing, return all declarations.
+ * @param maxResults The maximum number of declarations to return. If this field is missing, return
+ * all matching declarations.
*/
- public void search_getElementDeclarations(GetElementDeclarationsConsumer consumer);
+ public void search_getElementDeclarations(String pattern, int maxResults, GetElementDeclarationsConsumer consumer);
/**
* {@code search.getTypeHierarchy}
diff --git a/pkg/analysis_server/tool/spec/generated/java/types/ElementDeclaration.java b/pkg/analysis_server/tool/spec/generated/java/types/ElementDeclaration.java
index da38ec3..04da8df 100644
--- a/pkg/analysis_server/tool/spec/generated/java/types/ElementDeclaration.java
+++ b/pkg/analysis_server/tool/spec/generated/java/types/ElementDeclaration.java
@@ -66,22 +66,44 @@
private final int column;
/**
+ * The offset of the first character of the declaration code in the file.
+ */
+ private final int codeOffset;
+
+ /**
+ * The length of the declaration code in the file.
+ */
+ private final int codeLength;
+
+ /**
* The name of the class enclosing this declaration. If the declaration is not a class member, this
* field will be absent.
*/
private final String className;
/**
+ * The parameter list for the element. If the element is not a method or function this field will
+ * not be defined. If the element doesn't have parameters (e.g. getter), this field will not be
+ * defined. If the element has zero parameters, this field will have a value of "()". The value
+ * should not be treated as exact presentation of parameters, it is just approximation of
+ * parameters to give the user general idea.
+ */
+ private final String parameters;
+
+ /**
* Constructor for {@link ElementDeclaration}.
*/
- public ElementDeclaration(String name, String kind, int fileIndex, int offset, int line, int column, String className) {
+ public ElementDeclaration(String name, String kind, int fileIndex, int offset, int line, int column, int codeOffset, int codeLength, String className, String parameters) {
this.name = name;
this.kind = kind;
this.fileIndex = fileIndex;
this.offset = offset;
this.line = line;
this.column = column;
+ this.codeOffset = codeOffset;
+ this.codeLength = codeLength;
this.className = className;
+ this.parameters = parameters;
}
@Override
@@ -95,7 +117,10 @@
other.offset == offset &&
other.line == line &&
other.column == column &&
- ObjectUtilities.equals(other.className, className);
+ other.codeOffset == codeOffset &&
+ other.codeLength == codeLength &&
+ ObjectUtilities.equals(other.className, className) &&
+ ObjectUtilities.equals(other.parameters, parameters);
}
return false;
}
@@ -107,8 +132,11 @@
int offset = jsonObject.get("offset").getAsInt();
int line = jsonObject.get("line").getAsInt();
int column = jsonObject.get("column").getAsInt();
+ int codeOffset = jsonObject.get("codeOffset").getAsInt();
+ int codeLength = jsonObject.get("codeLength").getAsInt();
String className = jsonObject.get("className") == null ? null : jsonObject.get("className").getAsString();
- return new ElementDeclaration(name, kind, fileIndex, offset, line, column, className);
+ String parameters = jsonObject.get("parameters") == null ? null : jsonObject.get("parameters").getAsString();
+ return new ElementDeclaration(name, kind, fileIndex, offset, line, column, codeOffset, codeLength, className, parameters);
}
public static List<ElementDeclaration> fromJsonArray(JsonArray jsonArray) {
@@ -132,6 +160,20 @@
}
/**
+ * The length of the declaration code in the file.
+ */
+ public int getCodeLength() {
+ return codeLength;
+ }
+
+ /**
+ * The offset of the first character of the declaration code in the file.
+ */
+ public int getCodeOffset() {
+ return codeOffset;
+ }
+
+ /**
* The one-based index of the column containing the declaration name.
*/
public int getColumn() {
@@ -173,6 +215,17 @@
return offset;
}
+ /**
+ * The parameter list for the element. If the element is not a method or function this field will
+ * not be defined. If the element doesn't have parameters (e.g. getter), this field will not be
+ * defined. If the element has zero parameters, this field will have a value of "()". The value
+ * should not be treated as exact presentation of parameters, it is just approximation of
+ * parameters to give the user general idea.
+ */
+ public String getParameters() {
+ return parameters;
+ }
+
@Override
public int hashCode() {
HashCodeBuilder builder = new HashCodeBuilder();
@@ -182,7 +235,10 @@
builder.append(offset);
builder.append(line);
builder.append(column);
+ builder.append(codeOffset);
+ builder.append(codeLength);
builder.append(className);
+ builder.append(parameters);
return builder.toHashCode();
}
@@ -194,9 +250,14 @@
jsonObject.addProperty("offset", offset);
jsonObject.addProperty("line", line);
jsonObject.addProperty("column", column);
+ jsonObject.addProperty("codeOffset", codeOffset);
+ jsonObject.addProperty("codeLength", codeLength);
if (className != null) {
jsonObject.addProperty("className", className);
}
+ if (parameters != null) {
+ jsonObject.addProperty("parameters", parameters);
+ }
return jsonObject;
}
@@ -216,8 +277,14 @@
builder.append(line + ", ");
builder.append("column=");
builder.append(column + ", ");
+ builder.append("codeOffset=");
+ builder.append(codeOffset + ", ");
+ builder.append("codeLength=");
+ builder.append(codeLength + ", ");
builder.append("className=");
- builder.append(className);
+ builder.append(className + ", ");
+ builder.append("parameters=");
+ builder.append(parameters);
builder.append("]");
return builder.toString();
}
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index e448ad2..cab50c6 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -7,7 +7,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
- <version>1.18.6</version>
+ <version>1.18.7</version>
</h1>
<p>
This document contains a specification of the API provided by the
@@ -1578,6 +1578,22 @@
<p>
Return top-level and class member declarations.
</p>
+ <params>
+ <field name="pattern" optional="true">
+ <ref>String</ref>
+ <p>
+ The regular expression used to match the names of declarations.
+ If this field is missing, return all declarations.
+ </p>
+ </field>
+ <field name="maxResults" optional="true">
+ <ref>int</ref>
+ <p>
+ The maximum number of declarations to return.
+ If this field is missing, return all matching declarations.
+ </p>
+ </field>
+ </params>
<result>
<field name="declarations">
<list>
@@ -2945,6 +2961,18 @@
The one-based index of the column containing the declaration name.
</p>
</field>
+ <field name="codeOffset">
+ <ref>int</ref>
+ <p>
+ The offset of the first character of the declaration code in the file.
+ </p>
+ </field>
+ <field name="codeLength">
+ <ref>int</ref>
+ <p>
+ The length of the declaration code in the file.
+ </p>
+ </field>
<field name="className" optional="true">
<ref>String</ref>
<p>
@@ -2952,6 +2980,18 @@
is not a class member, this field will be absent.
</p>
</field>
+ <field name="parameters" optional="true">
+ <ref>String</ref>
+ <p>
+ The parameter list for the element. If the element is not a method or
+ function this field will not be defined. If the element doesn't have
+ parameters (e.g. getter), this field will not be defined. If the
+ element has zero parameters, this field will have a value of "()".
+
+ The value should not be treated as exact presentation of parameters,
+ it is just approximation of parameters to give the user general idea.
+ </p>
+ </field>
</object>
</type>
<type name="ExecutableFile">
diff --git a/pkg/analyzer/lib/dart/analysis/context_locator.dart b/pkg/analyzer/lib/dart/analysis/context_locator.dart
index 9c7f979..ce4d07a 100644
--- a/pkg/analyzer/lib/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/dart/analysis/context_locator.dart
@@ -1,8 +1,9 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/analysis/analysis_context.dart';
+import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/context_locator.dart';
import 'package:meta/meta.dart';
@@ -11,6 +12,8 @@
* Determines the list of analysis contexts that can be used to analyze the
* files and folders that should be analyzed given a list of included files and
* folders and a list of excluded files and folders.
+ *
+ * Clients may not extend, implement or mix-in this class.
*/
abstract class ContextLocator {
/**
@@ -26,16 +29,43 @@
* files that are included by the list of [includedPaths] and not excluded by
* the list of [excludedPaths].
*
- * If the [packagesFile] is specified, then it is assumed to be the path to
- * the `.packages` file that should be used in place of the one that would be
+ * If an [optionsFile] is specified, then it is assumed to be the path to the
+ * `analysis_options.yaml` (or `.analysis_options`) file that should be used
+ * in place of the ones that would be found by looking in the directories
+ * containing the context roots.
+ *
+ * If a [packagesFile] is specified, then it is assumed to be the path to the
+ * `.packages` file that should be used in place of the one that would be
* found by looking in the directories containing the context roots.
*
* If the [sdkPath] is specified, then it is used as the path to the root of
* the SDK that should be used during analysis.
*/
+ @deprecated
List<AnalysisContext> locateContexts(
{@required List<String> includedPaths,
List<String> excludedPaths: const <String>[],
+ String optionsFile: null,
String packagesFile: null,
String sdkPath: null});
+
+ /**
+ * Return a list of the context roots that should be used to analyze the files
+ * that are included by the list of [includedPaths] and not excluded by the
+ * list of [excludedPaths].
+ *
+ * If an [optionsFile] is specified, then it is assumed to be the path to the
+ * `analysis_options.yaml` (or `.analysis_options`) file that should be used
+ * in place of the ones that would be found by looking in the directories
+ * containing the context roots.
+ *
+ * If a [packagesFile] is specified, then it is assumed to be the path to the
+ * `.packages` file that should be used in place of the one that would be
+ * found by looking in the directories containing the context roots.
+ */
+ List<ContextRoot> locateRoots(
+ {@required List<String> includedPaths,
+ List<String> excludedPaths: null,
+ String optionsFile: null,
+ String packagesFile: null});
}
diff --git a/pkg/analyzer/lib/dart/analysis/context_root.dart b/pkg/analyzer/lib/dart/analysis/context_root.dart
new file mode 100644
index 0000000..f710dbd
--- /dev/null
+++ b/pkg/analyzer/lib/dart/analysis/context_root.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/file_system/file_system.dart';
+
+/**
+ * Information about the root directory associated with an analysis context.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ContextRoot {
+ /**
+ * A list of the files and directories within the root directory that should
+ * not be analyzed.
+ */
+ List<Resource> get excluded;
+
+ /**
+ * A collection of the absolute, normalized paths of files and directories
+ * within the root directory that should not be analyzed.
+ */
+ Iterable<String> get excludedPaths;
+
+ /**
+ * A list of the files and directories within the root directory that should
+ * be analyzed. If all of the files in the root directory (other than those
+ * that are explicitly excluded) should be analyzed, then this list will
+ * contain the root directory.
+ */
+ List<Resource> get included;
+
+ /**
+ * A collection of the absolute, normalized paths of files within the root
+ * directory that should be analyzed. If all of the files in the root
+ * directory (other than those that are explicitly excluded) should be
+ * analyzed, then this collection will contain the path of the root directory.
+ */
+ Iterable<String> get includedPaths;
+
+ /**
+ * The analysis options file that should be used when analyzing the files
+ * within this context root, or `null` if there is no options file.
+ */
+ File get optionsFile;
+
+ /**
+ * The packages file that should be used when analyzing the files within this
+ * context root, or `null` if there is no options file.
+ */
+ File get packagesFile;
+
+ /**
+ * The root directory containing the files to be analyzed.
+ */
+ Folder get root;
+}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 87a0ee4..95df0b9 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -473,6 +473,7 @@
ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES,
ParserErrorCode.TOP_LEVEL_OPERATOR,
ParserErrorCode.TYPEDEF_IN_CLASS,
+ ParserErrorCode.TYPE_ARGUMENTS_ON_TYPE_VARIABLE,
ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP,
ParserErrorCode.UNEXPECTED_TOKEN,
ParserErrorCode.VAR_AND_TYPE,
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
index 0a7ca25..e9fbaa9 100644
--- a/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/context_locator.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -7,11 +7,13 @@
import 'package:analyzer/context/context_root.dart' as old;
import 'package:analyzer/dart/analysis/analysis_context.dart';
import 'package:analyzer/dart/analysis/context_locator.dart';
+import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart'
show PhysicalResourceProvider;
import 'package:analyzer/src/context/builder.dart'
show ContextBuilder, ContextBuilderOptions;
+import 'package:analyzer/src/dart/analysis/context_root.dart';
import 'package:analyzer/src/dart/analysis/driver.dart'
show AnalysisDriver, AnalysisDriverScheduler;
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
@@ -68,18 +70,22 @@
String get _defaultSdkPath =>
FolderBasedDartSdk.defaultSdkDirectory(resourceProvider).path;
+ @deprecated
@override
List<AnalysisContext> locateContexts(
{@required List<String> includedPaths,
List<String> excludedPaths: null,
+ String optionsFile: null,
String packagesFile: null,
String sdkPath: null}) {
- if (includedPaths == null || includedPaths.isEmpty) {
- throw new ArgumentError('There must be at least one included path');
+ List<ContextRoot> roots = locateRoots(
+ includedPaths: includedPaths,
+ excludedPaths: excludedPaths,
+ optionsFile: optionsFile,
+ packagesFile: packagesFile);
+ if (roots.isEmpty) {
+ return const <AnalysisContext>[];
}
- List<AnalysisContext> contextList = <AnalysisContext>[];
- List<ContextRoot> roots =
- locateRoots(includedPaths, excludedPaths: excludedPaths);
PerformanceLog performanceLog = new PerformanceLog(new StringBuffer());
AnalysisDriverScheduler scheduler =
new AnalysisDriverScheduler(performanceLog);
@@ -97,33 +103,33 @@
builder.byteStore = new MemoryByteStore();
builder.fileContentOverlay = new FileContentOverlay();
builder.performanceLog = performanceLog;
+ List<AnalysisContext> contextList = <AnalysisContext>[];
for (ContextRoot root in roots) {
old.ContextRoot contextRoot =
- new old.ContextRoot(root.root.path, root.excludedPaths);
+ new old.ContextRoot(root.root.path, root.excludedPaths.toList());
AnalysisDriver driver = builder.buildDriver(contextRoot);
DriverBasedAnalysisContext context =
new DriverBasedAnalysisContext(resourceProvider, driver);
- context.includedPaths = root.includedPaths;
- context.excludedPaths = root.excludedPaths;
+ context.includedPaths = root.includedPaths.toList();
+ context.excludedPaths = root.excludedPaths.toList();
contextList.add(context);
}
return contextList;
}
- /**
- * Return a list of the context roots that should be used to analyze the files
- * that are included by the list of [includedPaths] and not excluded by the
- * list of [excludedPaths].
- */
- @visibleForTesting
- List<ContextRoot> locateRoots(List<String> includedPaths,
- {List<String> excludedPaths}) {
+ @override
+ List<ContextRoot> locateRoots(
+ {@required List<String> includedPaths,
+ List<String> excludedPaths: null,
+ String optionsFile: null,
+ String packagesFile: null}) {
//
// Compute the list of folders and files that are to be included.
//
List<Folder> includedFolders = <Folder>[];
List<File> includedFiles = <File>[];
- _resourcesFromPaths(includedPaths, includedFolders, includedFiles);
+ _resourcesFromPaths(
+ includedPaths ?? const <String>[], includedFolders, includedFiles);
//
// Compute the list of folders and files that are to be excluded.
//
@@ -151,19 +157,42 @@
// analyzed. For each, walk the directory structure and figure out where to
// create context roots.
//
+ File defaultOptionsFile;
+ if (optionsFile != null) {
+ defaultOptionsFile = resourceProvider.getFile(optionsFile);
+ if (!defaultOptionsFile.exists) {
+ defaultOptionsFile = null;
+ }
+ }
+ File defaultPackagesFile;
+ if (packagesFile != null) {
+ defaultPackagesFile = resourceProvider.getFile(packagesFile);
+ if (!defaultPackagesFile.exists) {
+ defaultPackagesFile = null;
+ }
+ }
List<ContextRoot> roots = <ContextRoot>[];
for (Folder folder in includedFolders) {
- _createContextRoots(roots, folder, excludedFolders, null);
+ ContextRootImpl root = new ContextRootImpl(folder);
+ root.packagesFile = defaultPackagesFile ?? _findPackagesFile(folder);
+ root.optionsFile = defaultOptionsFile ?? _findOptionsFile(folder);
+ root.included.add(folder);
+ roots.add(root);
+ _createContextRootsIn(roots, folder, excludedFolders, root,
+ defaultOptionsFile, defaultPackagesFile);
}
+ Map<Folder, ContextRoot> rootMap = <Folder, ContextRoot>{};
for (File file in includedFiles) {
Folder parent = file.parent;
- ContextRoot root = new ContextRoot(file);
- root.packagesFile = _findPackagesFile(parent);
- root.optionsFile = _findOptionsFile(parent);
+ ContextRoot root = rootMap.putIfAbsent(parent, () {
+ ContextRootImpl root = new ContextRootImpl(parent);
+ root.packagesFile = defaultPackagesFile ?? _findPackagesFile(parent);
+ root.optionsFile = defaultOptionsFile ?? _findOptionsFile(parent);
+ roots.add(root);
+ return root;
+ });
root.included.add(file);
- roots.add(root);
}
-
return roots;
}
@@ -174,31 +203,74 @@
bool _containedInAny(Iterable<Folder> folders, Resource resource) =>
folders.any((Folder folder) => folder.contains(resource.path));
- void _createContextRoots(List<ContextRoot> roots, Folder folder,
- List<Folder> excludedFolders, ContextRoot containingRoot) {
+ /**
+ * If the given [folder] should be the root of a new analysis context, then
+ * create a new context root for it and add it to the list of context [roots].
+ * The [containingRoot] is the context root from an enclosing directory and is
+ * used to inherit configuration information that isn't overridden.
+ *
+ * If either the [optionsFile] or [packagesFile] is non-`null` then the given
+ * file will be used even if there is a local version of the file.
+ *
+ * For each directory within the given [folder] that is not in the list of
+ * [excludedFolders], recursively search for nested context roots.
+ */
+ void _createContextRoots(
+ List<ContextRoot> roots,
+ Folder folder,
+ List<Folder> excludedFolders,
+ ContextRoot containingRoot,
+ File optionsFile,
+ File packagesFile) {
//
- // Create a context root for the given [folder] is appropriate.
+ // If the options and packages files are allowed to be locally specified,
+ // then look to see whether they are.
//
- if (containingRoot == null) {
- ContextRoot root = new ContextRoot(folder);
- root.packagesFile = _findPackagesFile(folder);
- root.optionsFile = _findOptionsFile(folder);
+ File localOptionsFile;
+ if (optionsFile == null) {
+ localOptionsFile = _getOptionsFile(folder);
+ }
+ File localPackagesFile;
+ if (packagesFile == null) {
+ localPackagesFile = _getPackagesFile(folder);
+ }
+ //
+ // Create a context root for the given [folder] if at least one of the
+ // options and packages file is locally specified.
+ //
+ if (localPackagesFile != null || localOptionsFile != null) {
+ if (optionsFile != null) {
+ localOptionsFile = optionsFile;
+ }
+ if (packagesFile != null) {
+ localPackagesFile = packagesFile;
+ }
+ ContextRootImpl root = new ContextRootImpl(folder);
+ root.packagesFile = localPackagesFile ?? containingRoot.packagesFile;
+ root.optionsFile = localOptionsFile ?? containingRoot.optionsFile;
root.included.add(folder);
+ containingRoot.excluded.add(folder);
roots.add(root);
containingRoot = root;
- } else {
- File packagesFile = _getPackagesFile(folder);
- File optionsFile = _getOptionsFile(folder);
- if (packagesFile != null || optionsFile != null) {
- ContextRoot root = new ContextRoot(folder);
- root.packagesFile = packagesFile ?? containingRoot.packagesFile;
- root.optionsFile = optionsFile ?? containingRoot.optionsFile;
- root.included.add(folder);
- containingRoot.excluded.add(folder);
- roots.add(root);
- containingRoot = root;
- }
}
+ _createContextRootsIn(roots, folder, excludedFolders, containingRoot,
+ optionsFile, packagesFile);
+ }
+
+ /**
+ * For each directory within the given [folder] that is not in the list of
+ * [excludedFolders], recursively search for nested context roots.
+ *
+ * If either the [optionsFile] or [packagesFile] is non-`null` then the given
+ * file will be used even if there is a local version of the file.
+ */
+ void _createContextRootsIn(
+ List<ContextRoot> roots,
+ Folder folder,
+ List<Folder> excludedFolders,
+ ContextRoot containingRoot,
+ File optionsFile,
+ File packagesFile) {
//
// Check each of the subdirectories to see whether a context root needs to
// be added for it.
@@ -211,7 +283,8 @@
folder.shortName == PACKAGES_DIR_NAME) {
containingRoot.excluded.add(folder);
} else {
- _createContextRoots(roots, child, excludedFolders, containingRoot);
+ _createContextRoots(roots, child, excludedFolders, containingRoot,
+ optionsFile, packagesFile);
}
}
}
@@ -311,28 +384,3 @@
return sortedPaths;
}
}
-
-@visibleForTesting
-class ContextRoot {
- final Resource root;
- final List<Resource> included = <Resource>[];
- final List<Resource> excluded = <Resource>[];
- File packagesFile;
- File optionsFile;
-
- ContextRoot(this.root);
-
- List<String> get excludedPaths =>
- excluded.map((Resource folder) => folder.path).toList();
-
- @override
- int get hashCode => root.path.hashCode;
-
- List<String> get includedPaths =>
- included.map((Resource folder) => folder.path).toList();
-
- @override
- bool operator ==(Object other) {
- return other is ContextRoot && root.path == other.root.path;
- }
-}
diff --git a/pkg/analyzer/lib/src/dart/analysis/context_root.dart b/pkg/analyzer/lib/src/dart/analysis/context_root.dart
new file mode 100644
index 0000000..607c9d2
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/analysis/context_root.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/analysis/context_root.dart';
+import 'package:analyzer/file_system/file_system.dart';
+
+/**
+ * An implementation of a context root.
+ */
+class ContextRootImpl implements ContextRoot {
+ @override
+ final Folder root;
+
+ @override
+ final List<Resource> included = <Resource>[];
+
+ @override
+ final List<Resource> excluded = <Resource>[];
+
+ @override
+ File optionsFile;
+
+ @override
+ File packagesFile;
+
+ /**
+ * Initialize a newly created context root.
+ */
+ ContextRootImpl(this.root);
+
+ @override
+ Iterable<String> get excludedPaths =>
+ excluded.map((Resource folder) => folder.path);
+
+ @override
+ int get hashCode => root.path.hashCode;
+
+ @override
+ Iterable<String> get includedPaths =>
+ included.map((Resource folder) => folder.path);
+
+ @override
+ bool operator ==(Object other) {
+ return other is ContextRoot && root.path == other.root.path;
+ }
+}
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
index 03356db..558b2a1 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver_based_analysis_context.dart
@@ -44,14 +44,16 @@
@override
Iterable<String> analyzedFiles() sync* {
for (String path in includedPaths) {
- Resource resource = resourceProvider.getResource(path);
- if (resource is File) {
- yield path;
- } else if (resource is Folder) {
- yield* _includedFilesInFolder(resource);
- } else {
- Type type = resource.runtimeType;
- throw new StateError('Unknown resource at path "$path" ($type)');
+ if (!_isExcluded(path)) {
+ Resource resource = resourceProvider.getResource(path);
+ if (resource is File) {
+ yield path;
+ } else if (resource is Folder) {
+ yield* _includedFilesInFolder(resource);
+ } else {
+ Type type = resource.runtimeType;
+ throw new StateError('Unknown resource at path "$path" ($type)');
+ }
}
}
}
@@ -67,14 +69,16 @@
*/
Iterable<String> _includedFilesInFolder(Folder folder) sync* {
for (Resource resource in folder.getChildren()) {
- if (resource is File) {
- yield resource.path;
- } else if (resource is Folder) {
- yield* _includedFilesInFolder(resource);
- } else {
- String path = resource.path;
- Type type = resource.runtimeType;
- throw new StateError('Unknown resource at path "$path" ($type)');
+ String path = resource.path;
+ if (!_isExcluded(path)) {
+ if (resource is File) {
+ yield path;
+ } else if (resource is Folder) {
+ yield* _includedFilesInFolder(resource);
+ } else {
+ Type type = resource.runtimeType;
+ throw new StateError('Unknown resource at path "$path" ($type)');
+ }
}
}
}
@@ -85,6 +89,11 @@
*/
bool _isExcluded(String path) {
Context context = resourceProvider.pathContext;
+ String name = context.basename(path);
+ if (name.startsWith('.') ||
+ (name == 'packages' && resourceProvider.getResource(path) is Folder)) {
+ return true;
+ }
for (String excludedPath in excludedPaths) {
if (context.isAbsolute(excludedPath)) {
if (context.isWithin(excludedPath, path)) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index f9a7103..90b0d6a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -35,10 +35,22 @@
final int offset;
final int line;
final int column;
+ final int codeOffset;
+ final int codeLength;
final String className;
+ final String parameters;
- Declaration(this.fileIndex, this.name, this.kind, this.offset, this.line,
- this.column, this.className);
+ Declaration(
+ this.fileIndex,
+ this.name,
+ this.kind,
+ this.offset,
+ this.line,
+ this.column,
+ this.codeOffset,
+ this.codeLength,
+ this.className,
+ this.parameters);
}
/**
@@ -96,12 +108,20 @@
/**
* Return top-level and class member declarations.
*
+ * If [regExp] is not `null`, only declaration with names matching it are
+ * returned. Otherwise, all declarations are returned.
+ *
+ * If [maxResults] is not `null`, it sets the maximum number of returned
+ * declarations.
+ *
* The path of each file with at least one declaration is added to [files].
* The list is for searched, there might be duplicates, but this is OK,
* we just want reduce amount of data, not to make it absolute minimum.
*/
- Future<List<Declaration>> declarations(List<String> files) async {
+ Future<List<Declaration>> declarations(
+ RegExp regExp, int maxResults, List<String> files) async {
List<Declaration> declarations = <Declaration>[];
+ UnlinkedUnit unlinkedUnit;
DeclarationKind getExecutableKind(
UnlinkedExecutable executable, bool topLevel) {
@@ -121,72 +141,151 @@
}
}
- for (String path in _driver.addedFiles) {
- FileState file = _driver.fsState.getFileForPath(path);
- int fileIndex;
+ void appendParameter(StringBuffer buffer, UnlinkedParam parameter) {
+ EntityRef type = parameter.type;
+ if (type?.entityKind == EntityRefKind.named) {
+ if (type.reference != null) {
+ UnlinkedReference typeRef = unlinkedUnit.references[type.reference];
+ buffer.write(typeRef.name);
+ buffer.write(' ');
+ }
+ }
+ buffer.write(parameter.name);
+ }
- void addDeclaration(String name, DeclarationKind kind, int offset,
- [String className]) {
- if (fileIndex == null) {
- fileIndex = files.length;
- files.add(file.path);
+ String getParametersString(List<UnlinkedParam> parameters) {
+ var buffer = new StringBuffer();
+ buffer.write('(');
+
+ bool isFirstParameter = true;
+ for (var parameter in parameters) {
+ if (isFirstParameter) {
+ isFirstParameter = false;
+ } else {
+ buffer.write(', ');
}
- if (name.endsWith('=')) {
- name = name.substring(0, name.length - 1);
- }
- var location = file.lineInfo.getLocation(offset);
- declarations.add(new Declaration(fileIndex, name, kind, offset,
- location.lineNumber, location.columnNumber, className));
+ appendParameter(buffer, parameter);
}
- for (var class_ in file.unlinked.classes) {
- String className = class_.name;
- addDeclaration(
- className,
- class_.isMixinApplication
- ? DeclarationKind.CLASS_TYPE_ALIAS
- : DeclarationKind.CLASS,
- class_.nameOffset);
+ buffer.write(')');
+ return buffer.toString();
+ }
- for (var field in class_.fields) {
- addDeclaration(
- field.name, DeclarationKind.FIELD, field.nameOffset, className);
+ String getExecutableParameters(UnlinkedExecutable executable) {
+ if (executable.kind == UnlinkedExecutableKind.getter) {
+ return null;
+ }
+ return getParametersString(executable.parameters);
+ }
+
+ try {
+ for (String path in _driver.addedFiles) {
+ FileState file = _driver.fsState.getFileForPath(path);
+ int fileIndex;
+
+ void addDeclaration(String name, DeclarationKind kind, int offset,
+ int codeOffset, int codeLength,
+ {String className, String parameters}) {
+ if (maxResults != null && declarations.length >= maxResults) {
+ throw const _MaxNumberOfDeclarationsError();
+ }
+
+ if (name.endsWith('=')) {
+ name = name.substring(0, name.length - 1);
+ }
+ if (regExp != null && !regExp.hasMatch(name)) {
+ return;
+ }
+
+ if (fileIndex == null) {
+ fileIndex = files.length;
+ files.add(file.path);
+ }
+ var location = file.lineInfo.getLocation(offset);
+ declarations.add(new Declaration(
+ fileIndex,
+ name,
+ kind,
+ offset,
+ location.lineNumber,
+ location.columnNumber,
+ codeOffset,
+ codeLength,
+ className,
+ parameters));
}
- for (var executable in class_.executables) {
- if (executable.name.isNotEmpty) {
- addDeclaration(
- executable.name,
- getExecutableKind(executable, false),
- executable.nameOffset,
- className);
+ unlinkedUnit = file.unlinked;
+ for (var class_ in unlinkedUnit.classes) {
+ String className = class_.name;
+ addDeclaration(
+ className,
+ class_.isMixinApplication
+ ? DeclarationKind.CLASS_TYPE_ALIAS
+ : DeclarationKind.CLASS,
+ class_.nameOffset,
+ class_.codeRange.offset,
+ class_.codeRange.length);
+
+ for (var field in class_.fields) {
+ addDeclaration(field.name, DeclarationKind.FIELD, field.nameOffset,
+ field.codeRange.offset, field.codeRange.length,
+ className: className);
+ }
+
+ for (var executable in class_.executables) {
+ if (executable.name.isNotEmpty) {
+ addDeclaration(
+ executable.name,
+ getExecutableKind(executable, false),
+ executable.nameOffset,
+ executable.codeRange.offset,
+ executable.codeRange.length,
+ className: className,
+ parameters: getExecutableParameters(executable));
+ }
}
}
- }
- for (var enum_ in file.unlinked.enums) {
- addDeclaration(enum_.name, DeclarationKind.ENUM, enum_.nameOffset);
- for (var value in enum_.values) {
+ for (var enum_ in unlinkedUnit.enums) {
+ addDeclaration(enum_.name, DeclarationKind.ENUM, enum_.nameOffset,
+ enum_.codeRange.offset, enum_.codeRange.length);
+ for (var value in enum_.values) {
+ addDeclaration(value.name, DeclarationKind.ENUM_CONSTANT,
+ value.nameOffset, value.nameOffset, value.name.length);
+ }
+ }
+
+ for (var executable in unlinkedUnit.executables) {
addDeclaration(
- value.name, DeclarationKind.ENUM_CONSTANT, value.nameOffset);
+ executable.name,
+ getExecutableKind(executable, true),
+ executable.nameOffset,
+ executable.codeRange.offset,
+ executable.codeRange.length,
+ parameters: getExecutableParameters(executable));
+ }
+
+ for (var typedef_ in unlinkedUnit.typedefs) {
+ addDeclaration(
+ typedef_.name,
+ DeclarationKind.FUNCTION_TYPE_ALIAS,
+ typedef_.nameOffset,
+ typedef_.codeRange.offset,
+ typedef_.codeRange.length,
+ parameters: getParametersString(typedef_.parameters));
+ }
+
+ for (var variable in unlinkedUnit.variables) {
+ addDeclaration(
+ variable.name,
+ DeclarationKind.VARIABLE,
+ variable.nameOffset,
+ variable.codeRange.offset,
+ variable.codeRange.length);
}
}
-
- for (var executable in file.unlinked.executables) {
- addDeclaration(executable.name, getExecutableKind(executable, true),
- executable.nameOffset);
- }
-
- for (var typedef_ in file.unlinked.typedefs) {
- addDeclaration(typedef_.name, DeclarationKind.FUNCTION_TYPE_ALIAS,
- typedef_.nameOffset);
- }
-
- for (var variable in file.unlinked.variables) {
- addDeclaration(
- variable.name, DeclarationKind.VARIABLE, variable.nameOffset);
- }
- }
+ } on _MaxNumberOfDeclarationsError {}
return declarations;
}
@@ -1073,3 +1172,10 @@
enclosingElement, kind, node.offset, node.length, true, isQualified));
}
}
+
+/**
+ * The marker class that is thrown to stop adding declarations.
+ */
+class _MaxNumberOfDeclarationsError {
+ const _MaxNumberOfDeclarationsError();
+}
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
index 87fcd46..489af14 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
@@ -944,6 +944,12 @@
"moving it to a class, or "
"converting it to be a function.");
+ static const ParserErrorCode TYPE_ARGUMENTS_ON_TYPE_VARIABLE =
+ const ParserErrorCode(
+ 'TYPE_ARGUMENTS_ON_TYPE_VARIABLE',
+ "Can't use type arguments with type variable '{0}'.",
+ "Try removing the type arguments.");
+
static const ParserErrorCode TYPEDEF_IN_CLASS = const ParserErrorCode(
'TYPEDEF_IN_CLASS',
"Typedefs can't be declared inside classes.",
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index e09ed08..a5e5ca7 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -33,7 +33,11 @@
show
Message,
codeExpectedFunctionBody,
+ messageConstConstructorWithBody,
+ messageConstMethod,
+ messageConstructorWithReturnType,
messageDirectiveAfterDeclaration,
+ messageFieldInitializerOutsideConstructor,
messageIllegalAssignmentToNonAssignable,
messageMissingAssignableSelector,
messageNativeClauseShouldBeAnnotation,
@@ -669,7 +673,7 @@
}
void handleInvalidTopLevelBlock(Token token) {
- // TODO(danrubel): Consider improved recovery by adding a this block
+ // TODO(danrubel): Consider improved recovery by adding this block
// as part of a synthetic top level function.
pop(); // block
}
@@ -1354,8 +1358,8 @@
// TODO(danrubel): The fasta parser does not have enough context to
// report this error. Consider moving it to the resolution phase
// or at least to common location that can be shared by all listeners.
- parser.reportRecoverableError(
- expression.endToken, messageMissingAssignableSelector);
+ handleRecoverableError(messageMissingAssignableSelector,
+ expression.endToken, expression.endToken);
}
push(ast.prefixExpression(operator, expression));
}
@@ -1369,8 +1373,8 @@
// TODO(danrubel): The fasta parser does not have enough context to
// report this error. Consider moving it to the resolution phase
// or at least to common location that can be shared by all listeners.
- parser.reportRecoverableError(
- operator, messageIllegalAssignmentToNonAssignable);
+ handleRecoverableError(
+ messageIllegalAssignmentToNonAssignable, operator, operator);
}
push(ast.postfixExpression(expression, operator));
}
@@ -2055,6 +2059,35 @@
}
@override
+ void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
+ Token varFinalOrConst, Token name) {
+ _Modifiers modifiers = new _Modifiers();
+ if (externalToken != null) {
+ assert(externalToken.isModifier);
+ modifiers.externalKeyword = externalToken;
+ }
+ if (staticToken != null) {
+ assert(staticToken.isModifier);
+ if (name?.lexeme == classDeclaration.name.name) {
+ // This error is also reported in OutlineBuilder.beginMethod
+ handleRecoverableError(
+ messageStaticConstructor, staticToken, staticToken);
+ } else {
+ modifiers.staticKeyword = staticToken;
+ }
+ }
+ if (covariantToken != null) {
+ assert(covariantToken.isModifier);
+ modifiers.covariantKeyword = covariantToken;
+ }
+ if (varFinalOrConst != null) {
+ assert(varFinalOrConst.isModifier);
+ modifiers.finalConstOrVarKeyword = varFinalOrConst;
+ }
+ push(modifiers);
+ }
+
+ @override
void endMethod(
Token getOrSet, Token beginToken, Token beginParam, Token endToken) {
assert(getOrSet == null ||
@@ -2112,13 +2145,19 @@
}
void constructor(
- SimpleIdentifier returnType, Token period, SimpleIdentifier name) {
- if (modifiers?.staticKeyword != null) {
- // TODO(danrubel): The fasta parser does not have enough context to
- // report this error. Consider moving it to the resolution phase
- // or at least to common location that can be shared by all listeners.
- parser.reportRecoverableError(
- modifiers.staticKeyword, messageStaticConstructor);
+ SimpleIdentifier prefixOrName, Token period, SimpleIdentifier name) {
+ if (modifiers?.constKeyword != null &&
+ body != null &&
+ (body.length > 1 || body.beginToken?.lexeme != ';')) {
+ // This error is also reported in BodyBuilder.finishFunction
+ Token bodyToken = body.beginToken ?? modifiers.constKeyword;
+ handleRecoverableError(
+ messageConstConstructorWithBody, bodyToken, bodyToken);
+ }
+ if (returnType != null) {
+ // This error is also reported in OutlineBuilder.endMethod
+ handleRecoverableError(messageConstructorWithReturnType,
+ returnType.beginToken, returnType.beginToken);
}
classDeclaration.members.add(ast.constructorDeclaration(
comment,
@@ -2126,7 +2165,7 @@
modifiers?.externalKeyword,
modifiers?.finalConstOrVarKeyword,
null, // TODO(paulberry): factoryKeyword
- ast.simpleIdentifier(returnType.token),
+ ast.simpleIdentifier(prefixOrName.token),
period,
name,
parameters,
@@ -2137,6 +2176,23 @@
}
void method(Token operatorKeyword, SimpleIdentifier name) {
+ if (modifiers?.constKeyword != null &&
+ body != null &&
+ (body.length > 1 || body.beginToken?.lexeme != ';')) {
+ // This error is also reported in OutlineBuilder.endMethod
+ handleRecoverableError(
+ messageConstMethod, modifiers.constKeyword, modifiers.constKeyword);
+ }
+ if (parameters?.parameters != null) {
+ parameters.parameters.forEach((FormalParameter param) {
+ if (param is FieldFormalParameter) {
+ // Added comment in OutlineBuilder.endMethod at the location
+ // where this error could be reported.
+ handleRecoverableError(messageFieldInitializerOutsideConstructor,
+ param.thisKeyword, param.thisKeyword);
+ }
+ });
+ }
classDeclaration.members.add(ast.methodDeclaration(
comment,
metadata,
@@ -2812,28 +2868,30 @@
Token staticKeyword;
Token covariantKeyword;
- _Modifiers(List<Token> modifierTokens) {
+ _Modifiers([List<Token> modifierTokens]) {
// No need to check the order and uniqueness of the modifiers, or that
// disallowed modifiers are not used; the parser should do that.
// TODO(paulberry,ahe): implement the necessary logic in the parser.
- for (var token in modifierTokens) {
- var s = token.lexeme;
- if (identical('abstract', s)) {
- abstractKeyword = token;
- } else if (identical('const', s)) {
- finalConstOrVarKeyword = token;
- } else if (identical('external', s)) {
- externalKeyword = token;
- } else if (identical('final', s)) {
- finalConstOrVarKeyword = token;
- } else if (identical('static', s)) {
- staticKeyword = token;
- } else if (identical('var', s)) {
- finalConstOrVarKeyword = token;
- } else if (identical('covariant', s)) {
- covariantKeyword = token;
- } else {
- unhandled("$s", "modifier", token.charOffset, null);
+ if (modifierTokens != null) {
+ for (var token in modifierTokens) {
+ var s = token.lexeme;
+ if (identical('abstract', s)) {
+ abstractKeyword = token;
+ } else if (identical('const', s)) {
+ finalConstOrVarKeyword = token;
+ } else if (identical('external', s)) {
+ externalKeyword = token;
+ } else if (identical('final', s)) {
+ finalConstOrVarKeyword = token;
+ } else if (identical('static', s)) {
+ staticKeyword = token;
+ } else if (identical('var', s)) {
+ finalConstOrVarKeyword = token;
+ } else if (identical('covariant', s)) {
+ covariantKeyword = token;
+ } else {
+ unhandled("$s", "modifier", token.charOffset, null);
+ }
}
}
}
@@ -2858,4 +2916,11 @@
}
return firstToken;
}
+
+ /// Return the `const` keyword or `null`.
+ Token get constKeyword {
+ return identical('const', finalConstOrVarKeyword?.lexeme)
+ ? finalConstOrVarKeyword
+ : null;
+ }
}
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index f3042e4..81e09c5 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -25,9 +25,12 @@
String stringOrTokenLexeme() {
var text = arguments['string'];
if (text == null) {
- Token token = arguments['token'];
- if (token != null) {
- text = token.lexeme;
+ text = arguments['name'];
+ if (text == null) {
+ Token token = arguments['token'];
+ if (token != null) {
+ text = token.lexeme;
+ }
}
}
return text;
@@ -90,15 +93,27 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.CONST_CLASS, offset, length);
return;
+ case "CONST_CONSTRUCTOR_WITH_BODY":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, offset, length);
+ return;
case "CONST_FACTORY":
errorReporter?.reportErrorForOffset(
ParserErrorCode.CONST_FACTORY, offset, length);
return;
+ case "CONST_METHOD":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.CONST_METHOD, offset, length);
+ return;
case "CONST_NOT_INITIALIZED":
String name = arguments['name'];
errorReporter?.reportErrorForOffset(
CompileTimeErrorCode.CONST_NOT_INITIALIZED, offset, length, [name]);
return;
+ case "CONSTRUCTOR_WITH_RETURN_TYPE":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, offset, length);
+ return;
case "CONTINUE_OUTSIDE_OF_LOOP":
errorReporter?.reportErrorForOffset(
ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP, offset, length);
@@ -234,6 +249,12 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION, offset, length);
return;
+ case "FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
+ offset,
+ length);
+ return;
case "FINAL_AND_COVARIANT":
errorReporter?.reportErrorForOffset(
ParserErrorCode.FINAL_AND_COVARIANT, offset, length);
@@ -491,6 +512,14 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.TOP_LEVEL_OPERATOR, offset, length);
return;
+ case "TYPE_ARGUMENTS_ON_TYPE_VARIABLE":
+ String text = stringOrTokenLexeme();
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.TYPE_ARGUMENTS_ON_TYPE_VARIABLE,
+ offset,
+ length,
+ [text]);
+ return;
case "TYPEDEF_IN_CLASS":
errorReporter?.reportErrorForOffset(
ParserErrorCode.TYPEDEF_IN_CLASS, offset, length);
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 2fad14c..fb56381 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -977,7 +977,9 @@
}
// Check that the type is resolvable, and is not "void"
DartType returnTypeType = returnType.type;
- if (returnTypeType == null || returnTypeType.isVoid) {
+ if (returnTypeType == null ||
+ returnTypeType.isVoid ||
+ (body.isAsynchronous && _isFutureVoid(returnTypeType))) {
return;
}
// For async, give no hint if the return type does not matter, i.e.
@@ -1233,6 +1235,19 @@
}
/**
+ * Return `true` if the given [type] represents `Future<void>`.
+ */
+ bool _isFutureVoid(DartType type) {
+ if (type.isDartAsyncFuture) {
+ List<DartType> typeArgs = (type as InterfaceType).typeArguments;
+ if (typeArgs.length == 1 && typeArgs[0].isVoid) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Given a parenthesized expression, this returns the parent (or recursively grand-parent) of the
* expression that is a parenthesized expression, but whose parent is not a parenthesized
* expression.
diff --git a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
index 6f6b6e5..d89deab 100644
--- a/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
+++ b/pkg/analyzer/lib/src/test_utilities/resource_provider_mixin.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:io';
+import 'dart:io' hide File;
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
diff --git a/pkg/analyzer/test/generated/element_resolver_test.dart b/pkg/analyzer/test/generated/element_resolver_test.dart
index a766bdc4..61b34e6 100644
--- a/pkg/analyzer/test/generated/element_resolver_test.dart
+++ b/pkg/analyzer/test/generated/element_resolver_test.dart
@@ -1387,6 +1387,40 @@
}
/**
+ * Test that the call to a constructor with an implicit unnamed constructor is
+ * re-written as an InstanceCreationExpression AST node from a
+ * MethodInvocation.
+ *
+ * C(), where class C has no constructors
+ */
+ test_visitMethodInvocations_implicit_implicit() async {
+ String code = '''
+class A {}
+main() {
+ A();
+}
+ ''';
+ CompilationUnit unit = await resolveSource(code);
+ var statements = AstFinder.getStatementsInTopLevelFunction(unit, 'main');
+
+ ExpressionStatement statement = statements[0];
+ InstanceCreationExpression creation = statement.expression;
+ ConstructorElement constructor = creation.staticElement;
+
+ expect(constructor, _isConstructorElement);
+ expect(creation.staticType, isNotNull);
+
+ expect(creation.constructorName.staticElement, constructor);
+
+ expect(creation.constructorName.type.type, isNotNull);
+ expect(creation.constructorName.type.name.staticElement, _isClassElement);
+
+ expect(creation.constructorName.name, isNull);
+
+ expect(creation.argumentList.arguments, isEmpty);
+ }
+
+ /**
* Test that the call to a constructor with an implicit named constructor is
* re-written as an InstanceCreationExpression AST node from a
* MethodInvocation.
diff --git a/pkg/analyzer/test/generated/non_hint_code_test.dart b/pkg/analyzer/test/generated/non_hint_code_test.dart
index 05be2c7..5d0f10b 100644
--- a/pkg/analyzer/test/generated/non_hint_code_test.dart
+++ b/pkg/analyzer/test/generated/non_hint_code_test.dart
@@ -495,6 +495,16 @@
verify([source]);
}
+ test_missingReturn_futureVoidReturnType() async {
+ Source source = addSource('''
+import 'dart:async';
+Future<void> f() async {}
+''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
test_missingReturn_noReturnType() async {
Source source = addSource("f() {}");
await computeAnalysisResult(source);
diff --git a/pkg/analyzer/test/generated/parser_fasta_listener.dart b/pkg/analyzer/test/generated/parser_fasta_listener.dart
index ebdc78c..5dd1085 100644
--- a/pkg/analyzer/test/generated/parser_fasta_listener.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_listener.dart
@@ -376,8 +376,10 @@
}
@override
- void beginMethod() {
- super.beginMethod();
+ void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
+ Token varFinalOrConst, Token name) {
+ super.beginMethod(
+ externalToken, staticToken, covariantToken, varFinalOrConst, name);
begin('Method');
}
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 713cc7a..b28d44d 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -115,40 +115,6 @@
with ErrorParserTestMixin {
@override
@failingTest
- void test_constConstructorWithBody() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, found 0
- //
- // This error is produced by kernel, rather than in the parser.
- super.test_constConstructorWithBody();
- }
-
- @override
- @failingTest
- void test_constFactory() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.CONST_FACTORY, found 0
- super.test_constFactory();
- }
-
- @override
- @failingTest
- void test_constMethod() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.CONST_METHOD, found 0
- super.test_constMethod();
- }
-
- @override
- @failingTest
- void test_constructorWithReturnType() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, found 0
- super.test_constructorWithReturnType();
- }
-
- @override
- @failingTest
void test_duplicateLabelInSwitchStatement() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, found 0
@@ -341,14 +307,6 @@
@override
@failingTest
- void test_fieldInitializerOutsideConstructor() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, found 0
- super.test_fieldInitializerOutsideConstructor();
- }
-
- @override
- @failingTest
void test_getterInFunction_block_noReturnType() {
// TODO(brianwilkerson) Does not recover.
// type 'ExpressionStatementImpl' is not a subtype of type 'FunctionDeclarationStatement' of 'statement' where
@@ -485,22 +443,6 @@
@override
@failingTest
- void test_invalidConstructorName_with() {
- // TODO(brianwilkerson) Does not recover.
- // type 'DeclaredSimpleIdentifier' is not a subtype of type 'TypeAnnotation' of 'returnType' where
- // DeclaredSimpleIdentifier is from package:analyzer/src/dart/ast/ast.dart
- // TypeAnnotation is from package:analyzer/dart/ast/ast.dart
- //
- // package:analyzer/src/fasta/ast_builder.dart 1620:33 AstBuilder.endMethod
- // test/generated/parser_fasta_listener.dart 926:14 ForwardingTestListener.endMethod
- // package:front_end/src/fasta/parser/parser.dart 2433:14 Parser.parseMethod
- // package:front_end/src/fasta/parser/parser.dart 2323:11 Parser.parseMember
- // test/generated/parser_fasta_test.dart 3179:39 ParserProxy._run
- super.test_invalidConstructorName_with();
- }
-
- @override
- @failingTest
void test_invalidHexEscape_invalidDigit() {
// TODO(brianwilkerson) Does not recover.
// Internal problem: Compiler cannot run without a compiler context.
@@ -590,14 +532,6 @@
@override
@failingTest
- void test_invalidOperatorForSuper() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, found 0
- super.test_invalidOperatorForSuper();
- }
-
- @override
- @failingTest
void test_invalidStarAfterAsync() {
// TODO(brianwilkerson) Does not recover.
// Expected: an object with length of <1>
@@ -1008,23 +942,6 @@
@override
@failingTest
- void test_missingStatement() {
- // TODO(brianwilkerson) Does not recover.
- // 'package:front_end/src/fasta/source/stack_listener.dart': Failed assertion: line 311 pos 12: 'arrayLength > 0': is not true.
- // dart:core _AssertionError._throwNew
- // package:front_end/src/fasta/source/stack_listener.dart 311:12 Stack.pop
- // package:front_end/src/fasta/source/stack_listener.dart 95:25 StackListener.pop
- // package:analyzer/src/fasta/ast_builder.dart 262:34 AstBuilder.endExpressionStatement
- // test/generated/parser_fasta_listener.dart 724:14 ForwardingTestListener.endExpressionStatement
- // package:front_end/src/fasta/parser/parser.dart 2863:14 Parser.parseExpressionStatement
- // package:front_end/src/fasta/parser/parser.dart 2790:14 Parser.parseStatementX
- // package:front_end/src/fasta/parser/parser.dart 2722:20 Parser.parseStatement
- // test/generated/parser_fasta_test.dart 3640:39 ParserProxy._run
- super.test_missingStatement();
- }
-
- @override
- @failingTest
void test_missingStatement_afterVoid() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.MISSING_STATEMENT, found 0
@@ -1861,7 +1778,7 @@
Uri get fileUri => uri;
@override
- void addCompileTimeError(Message message, int charOffset, Uri uri,
+ void addCompileTimeError(Message message, int charOffset, int length, Uri uri,
{bool silent: false, bool wasHandled: false, LocatedMessage context}) {
fail('${message.message}');
}
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index e300956..9a03215 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -2562,7 +2562,7 @@
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
listener.assertErrors(
- [expectedError(ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, 10, 2)]);
+ [expectedError(ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, 10, 1)]);
}
void test_constEnum() {
@@ -3233,11 +3233,8 @@
createParser('external factory C() {}');
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
- // TODO(brianwilkerson) Convert codes to errors when highlighting is fixed.
- listener.assertErrorsWithCodes(
- [ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY]);
-// listener.assertErrors(
-// [expectedError(ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, 21, 2)]);
+ listener.assertErrors(
+ [expectedError(ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, 21, 1)]);
}
void test_externalConstructorWithBody_named() {
@@ -3462,7 +3459,7 @@
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
listener.assertErrors([
- expectedError(ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, 7, 6)
+ expectedError(ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, 7, 4)
]);
}
@@ -3534,6 +3531,21 @@
errors: [expectedError(ParserErrorCode.FINAL_TYPEDEF, 0, 5)]);
}
+ void test_functionTypedField_invalidType_abstract() {
+ if (usingFastaParser) {
+ parseCompilationUnit("Function(abstract) x = null;", errors: [
+ expectedError(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, 9, 8)
+ ]);
+ }
+ }
+
+ void test_functionTypedField_invalidType_class() {
+ if (usingFastaParser) {
+ parseCompilationUnit("Function(class) x = null;",
+ errors: [expectedError(ParserErrorCode.EXPECTED_TYPE_NAME, 9, 5)]);
+ }
+ }
+
void test_functionTypedParameter_const() {
parseCompilationUnit("void f(const x()) {}",
errors: usingFastaParser
@@ -3784,8 +3796,11 @@
createParser("C.with();");
ClassMember member = parser.parseClassMember('C');
expectNotNullIfNoErrors(member);
- listener.assertErrors(
- [expectedError(ParserErrorCode.INVALID_CONSTRUCTOR_NAME, 0, 1)]);
+ listener.assertErrors([
+ usingFastaParser
+ ? expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 4)
+ : expectedError(ParserErrorCode.INVALID_CONSTRUCTOR_NAME, 0, 1)
+ ]);
}
void test_invalidHexEscape_invalidDigit() {
@@ -3867,8 +3882,11 @@
createParser('++super');
Expression expression = parser.parseUnaryExpression();
expectNotNullIfNoErrors(expression);
- listener.assertErrors(
- [expectedError(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, 0, 2)]);
+ listener.assertErrors([
+ usingFastaParser
+ ? expectedError(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, 2, 5)
+ : expectedError(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, 0, 2)
+ ]);
}
void test_invalidStarAfterAsync() {
@@ -4513,8 +4531,12 @@
void test_missingStatement() {
parseStatement("is");
- listener
- .assertErrors([expectedError(ParserErrorCode.MISSING_STATEMENT, 2, 0)]);
+ listener.assertErrors(usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 0, 2),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 2, 0)
+ ]
+ : [expectedError(ParserErrorCode.MISSING_STATEMENT, 2, 0)]);
}
void test_missingStatement_afterVoid() {
@@ -15647,8 +15669,22 @@
for (Keyword keyword in Keyword.values) {
if (keyword.isBuiltIn || keyword.isPseudo) {
String lexeme = keyword.lexeme;
- parseCompilationUnit('$lexeme<T>(x) => 0;');
- parseCompilationUnit('class C {$lexeme<T>(x) => 0;}');
+ List<ExpectedError> expectedErrors = [];
+ if (lexeme == 'dynamic') {
+ expectedErrors = [
+ expectedError(
+ ParserErrorCode.TYPE_ARGUMENTS_ON_TYPE_VARIABLE, 7, 1)
+ ];
+ }
+ parseCompilationUnit('$lexeme<T>(x) => 0;', errors: expectedErrors);
+ if (lexeme == 'dynamic') {
+ expectedErrors = [
+ expectedError(
+ ParserErrorCode.TYPE_ARGUMENTS_ON_TYPE_VARIABLE, 16, 1)
+ ];
+ }
+ parseCompilationUnit('class C {$lexeme<T>(x) => 0;}',
+ errors: expectedErrors);
}
}
}
diff --git a/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart b/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
index 029ad6b..b3f133b 100644
--- a/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/context_locator_test.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/dart/analysis/context_root.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/dart/analysis/context_locator.dart';
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
@@ -56,8 +57,8 @@
File outerPackagesFile = newPackagesFile('/test/outer');
Folder innerRootFolder = newFolder('/test/outer/examples/inner');
- List<ContextRoot> roots = contextLocator
- .locateRoots([outerRootFolder.path, innerRootFolder.path]);
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outerRootFolder.path, innerRootFolder.path]);
expect(roots, hasLength(1));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -73,8 +74,8 @@
File outerPackagesFile = newPackagesFile('/test/outer');
File testFile = newFile('/test/outer/examples/inner/test.dart');
- List<ContextRoot> roots =
- contextLocator.locateRoots([outerRootFolder.path, testFile.path]);
+ List<ContextRoot> roots = contextLocator
+ .locateRoots(includedPaths: [outerRootFolder.path, testFile.path]);
expect(roots, hasLength(1));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -93,8 +94,8 @@
File outer2OptionsFile = newOptionsFile('/test/outer2');
File outer2PackagesFile = newPackagesFile('/test/outer2');
- List<ContextRoot> roots = contextLocator
- .locateRoots([outer1RootFolder.path, outer2RootFolder.path]);
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outer1RootFolder.path, outer2RootFolder.path]);
expect(roots, hasLength(2));
ContextRoot outer1Root = findRoot(roots, outer1RootFolder);
@@ -119,8 +120,8 @@
File outer2PackagesFile = newPackagesFile('/test/outer2');
File testFile = newFile('/test/outer2/test.dart');
- List<ContextRoot> roots =
- contextLocator.locateRoots([outer1RootFolder.path, testFile.path]);
+ List<ContextRoot> roots = contextLocator
+ .locateRoots(includedPaths: [outer1RootFolder.path, testFile.path]);
expect(roots, hasLength(2));
ContextRoot outer1Root = findRoot(roots, outer1RootFolder);
@@ -129,7 +130,7 @@
expect(outer1Root.optionsFile, outer1OptionsFile);
expect(outer1Root.packagesFile, outer1PackagesFile);
- ContextRoot outer2Root = findRoot(roots, testFile);
+ ContextRoot outer2Root = findRoot(roots, testFile.parent);
expect(outer2Root.includedPaths, unorderedEquals([testFile.path]));
expect(outer2Root.excludedPaths, isEmpty);
expect(outer2Root.optionsFile, outer2OptionsFile);
@@ -161,21 +162,16 @@
File testFile1 = newFile('/test/root/test1.dart');
File testFile2 = newFile('/test/root/test2.dart');
- List<ContextRoot> roots =
- contextLocator.locateRoots([testFile1.path, testFile2.path]);
- expect(roots, hasLength(2));
+ List<ContextRoot> roots = contextLocator
+ .locateRoots(includedPaths: [testFile1.path, testFile2.path]);
+ expect(roots, hasLength(1));
- ContextRoot outer1Root = findRootFromIncluded(roots, testFile1.path);
- expect(outer1Root.includedPaths, unorderedEquals([testFile1.path]));
- expect(outer1Root.excludedPaths, isEmpty);
- expect(outer1Root.optionsFile, optionsFile);
- expect(outer1Root.packagesFile, packagesFile);
-
- ContextRoot outer2Root = findRootFromIncluded(roots, testFile2.path);
- expect(outer2Root.includedPaths, unorderedEquals([testFile2.path]));
- expect(outer2Root.excludedPaths, isEmpty);
- expect(outer2Root.optionsFile, optionsFile);
- expect(outer2Root.packagesFile, packagesFile);
+ ContextRoot root = findRootFromIncluded(roots, testFile1.path);
+ expect(
+ root.includedPaths, unorderedEquals([testFile1.path, testFile2.path]));
+ expect(root.excludedPaths, isEmpty);
+ expect(root.optionsFile, optionsFile);
+ expect(root.packagesFile, packagesFile);
}
void test_locateRoots_nested_excluded_dot() {
@@ -186,7 +182,7 @@
newOptionsFile('/test/outer/.examples/inner');
List<ContextRoot> roots =
- contextLocator.locateRoots([outerRootFolder.path]);
+ contextLocator.locateRoots(includedPaths: [outerRootFolder.path]);
expect(roots, hasLength(1));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -203,7 +199,8 @@
Folder excludedFolder = newFolder('/test/outer/examples');
newOptionsFile('/test/outer/examples/inner');
- List<ContextRoot> roots = contextLocator.locateRoots([outerRootFolder.path],
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outerRootFolder.path],
excludedPaths: [excludedFolder.path]);
expect(roots, hasLength(1));
@@ -222,7 +219,7 @@
newOptionsFile('/test/outer/packages/inner');
List<ContextRoot> roots =
- contextLocator.locateRoots([outerRootFolder.path]);
+ contextLocator.locateRoots(includedPaths: [outerRootFolder.path]);
expect(roots, hasLength(1));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -242,7 +239,7 @@
File inner2PackagesFile = newPackagesFile('/test/outer/examples/inner2');
List<ContextRoot> roots =
- contextLocator.locateRoots([outerRootFolder.path]);
+ contextLocator.locateRoots(includedPaths: [outerRootFolder.path]);
expect(roots, hasLength(3));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -273,7 +270,7 @@
File innerOptionsFile = newOptionsFile('/test/outer/examples/inner');
List<ContextRoot> roots =
- contextLocator.locateRoots([outerRootFolder.path]);
+ contextLocator.locateRoots(includedPaths: [outerRootFolder.path]);
expect(roots, hasLength(2));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -289,6 +286,52 @@
expect(innerRoot.packagesFile, outerPackagesFile);
}
+ void test_locateRoots_nested_options_overriddenOptions() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ newFolder('/test/outer/examples/inner');
+ newOptionsFile('/test/outer/examples/inner');
+ File overrideOptionsFile = newOptionsFile('/test/override');
+
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outerRootFolder.path],
+ optionsFile: overrideOptionsFile.path);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, isEmpty);
+ expect(outerRoot.optionsFile, overrideOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+ }
+
+ void test_locateRoots_nested_options_overriddenPackages() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ newPackagesFile('/test/outer');
+ Folder innerRootFolder = newFolder('/test/outer/examples/inner');
+ File innerOptionsFile = newOptionsFile('/test/outer/examples/inner');
+ File overridePackagesFile = newPackagesFile('/test/override');
+
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outerRootFolder.path],
+ packagesFile: overridePackagesFile.path);
+ expect(roots, hasLength(2));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, overridePackagesFile);
+
+ ContextRoot innerRoot = findRoot(roots, innerRootFolder);
+ expect(innerRoot.includedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(innerRoot.excludedPaths, isEmpty);
+ expect(innerRoot.optionsFile, innerOptionsFile);
+ expect(innerRoot.packagesFile, overridePackagesFile);
+ }
+
void test_locateRoots_nested_optionsAndPackages() {
Folder outerRootFolder = newFolder('/test/outer');
File outerOptionsFile = newOptionsFile('/test/outer');
@@ -298,7 +341,7 @@
File innerPackagesFile = newPackagesFile('/test/outer/examples/inner');
List<ContextRoot> roots =
- contextLocator.locateRoots([outerRootFolder.path]);
+ contextLocator.locateRoots(includedPaths: [outerRootFolder.path]);
expect(roots, hasLength(2));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -314,6 +357,29 @@
expect(innerRoot.packagesFile, innerPackagesFile);
}
+ void test_locateRoots_nested_optionsAndPackages_overriddenBoth() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ newOptionsFile('/test/outer');
+ newPackagesFile('/test/outer');
+ newFolder('/test/outer/examples/inner');
+ newOptionsFile('/test/outer/examples/inner');
+ newPackagesFile('/test/outer/examples/inner');
+ File overrideOptionsFile = newOptionsFile('/test/override');
+ File overridePackagesFile = newPackagesFile('/test/override');
+
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outerRootFolder.path],
+ optionsFile: overrideOptionsFile.path,
+ packagesFile: overridePackagesFile.path);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, isEmpty);
+ expect(outerRoot.optionsFile, overrideOptionsFile);
+ expect(outerRoot.packagesFile, overridePackagesFile);
+ }
+
void test_locateRoots_nested_packages() {
Folder outerRootFolder = newFolder('/test/outer');
File outerOptionsFile = newOptionsFile('/test/outer');
@@ -322,7 +388,7 @@
File innerPackagesFile = newPackagesFile('/test/outer/examples/inner');
List<ContextRoot> roots =
- contextLocator.locateRoots([outerRootFolder.path]);
+ contextLocator.locateRoots(includedPaths: [outerRootFolder.path]);
expect(roots, hasLength(2));
ContextRoot outerRoot = findRoot(roots, outerRootFolder);
@@ -338,12 +404,59 @@
expect(innerRoot.packagesFile, innerPackagesFile);
}
+ void test_locateRoots_nested_packages_overriddenOptions() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ newOptionsFile('/test/outer');
+ File outerPackagesFile = newPackagesFile('/test/outer');
+ Folder innerRootFolder = newFolder('/test/outer/examples/inner');
+ File innerPackagesFile = newPackagesFile('/test/outer/examples/inner');
+ File overrideOptionsFile = newOptionsFile('/test/override');
+
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outerRootFolder.path],
+ optionsFile: overrideOptionsFile.path);
+ expect(roots, hasLength(2));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(outerRoot.optionsFile, overrideOptionsFile);
+ expect(outerRoot.packagesFile, outerPackagesFile);
+
+ ContextRoot innerRoot = findRoot(roots, innerRootFolder);
+ expect(innerRoot.includedPaths, unorderedEquals([innerRootFolder.path]));
+ expect(innerRoot.excludedPaths, isEmpty);
+ expect(innerRoot.optionsFile, overrideOptionsFile);
+ expect(innerRoot.packagesFile, innerPackagesFile);
+ }
+
+ void test_locateRoots_nested_packages_overriddenPackages() {
+ Folder outerRootFolder = newFolder('/test/outer');
+ File outerOptionsFile = newOptionsFile('/test/outer');
+ newPackagesFile('/test/outer');
+ newFolder('/test/outer/examples/inner');
+ newPackagesFile('/test/outer/examples/inner');
+ File overridePackagesFile = newPackagesFile('/test/override');
+
+ List<ContextRoot> roots = contextLocator.locateRoots(
+ includedPaths: [outerRootFolder.path],
+ packagesFile: overridePackagesFile.path);
+ expect(roots, hasLength(1));
+
+ ContextRoot outerRoot = findRoot(roots, outerRootFolder);
+ expect(outerRoot.includedPaths, unorderedEquals([outerRootFolder.path]));
+ expect(outerRoot.excludedPaths, isEmpty);
+ expect(outerRoot.optionsFile, outerOptionsFile);
+ expect(outerRoot.packagesFile, overridePackagesFile);
+ }
+
void test_locateRoots_single_dir_directOptions_directPackages() {
Folder rootFolder = newFolder('/test/root');
File optionsFile = newOptionsFile('/test/root');
File packagesFile = newPackagesFile('/test/root');
- List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ List<ContextRoot> roots =
+ contextLocator.locateRoots(includedPaths: [rootFolder.path]);
expect(roots, hasLength(1));
ContextRoot package1Root = findRoot(roots, rootFolder);
@@ -358,7 +471,8 @@
File optionsFile = newOptionsFile('/test/root');
File packagesFile = newPackagesFile('/test');
- List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ List<ContextRoot> roots =
+ contextLocator.locateRoots(includedPaths: [rootFolder.path]);
expect(roots, hasLength(1));
ContextRoot package1Root = findRoot(roots, rootFolder);
@@ -373,7 +487,8 @@
File optionsFile = newOptionsFile('/test');
File packagesFile = newPackagesFile('/test/root');
- List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ List<ContextRoot> roots =
+ contextLocator.locateRoots(includedPaths: [rootFolder.path]);
expect(roots, hasLength(1));
ContextRoot package1Root = findRoot(roots, rootFolder);
@@ -388,7 +503,8 @@
File optionsFile = newOptionsFile('/test');
File packagesFile = newPackagesFile('/test');
- List<ContextRoot> roots = contextLocator.locateRoots([rootFolder.path]);
+ List<ContextRoot> roots =
+ contextLocator.locateRoots(includedPaths: [rootFolder.path]);
expect(roots, hasLength(1));
ContextRoot package1Root = findRoot(roots, rootFolder);
@@ -403,10 +519,11 @@
File packagesFile = newPackagesFile('/test/root');
File testFile = newFile('/test/root/test.dart');
- List<ContextRoot> roots = contextLocator.locateRoots([testFile.path]);
+ List<ContextRoot> roots =
+ contextLocator.locateRoots(includedPaths: [testFile.path]);
expect(roots, hasLength(1));
- ContextRoot package1Root = findRoot(roots, testFile);
+ ContextRoot package1Root = findRoot(roots, testFile.parent);
expect(package1Root.includedPaths, unorderedEquals([testFile.path]));
expect(package1Root.excludedPaths, isEmpty);
expect(package1Root.optionsFile, optionsFile);
diff --git a/pkg/analyzer/test/src/dart/analysis/search_test.dart b/pkg/analyzer/test/src/dart/analysis/search_test.dart
index 5761eb3..d2a4e23 100644
--- a/pkg/analyzer/test/src/dart/analysis/search_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart
@@ -110,28 +110,105 @@
}
''');
var files = <String>[];
- List<Declaration> declarations = await driver.search.declarations(files);
- _assertHasDeclaration(declarations, 'C', DeclarationKind.CLASS, 6);
- _assertHasDeclaration(declarations, 'f', DeclarationKind.FIELD, 16, 'C');
- _assertHasDeclaration(
- declarations, 'named', DeclarationKind.CONSTRUCTOR, 30, 'C');
- _assertHasDeclaration(declarations, 'g', DeclarationKind.GETTER, 49, 'C');
- _assertHasDeclaration(declarations, 's', DeclarationKind.SETTER, 68, 'C');
- _assertHasDeclaration(declarations, 'm', DeclarationKind.METHOD, 83, 'C');
+ List<Declaration> declarations =
+ await driver.search.declarations(null, null, files);
+ _assertHasDeclaration(declarations, 'C', DeclarationKind.CLASS,
+ offset: 6, codeOffset: 0, codeLength: 91);
+ _assertHasDeclaration(declarations, 'f', DeclarationKind.FIELD,
+ offset: 16, codeOffset: 12, codeLength: 6, className: 'C');
+ _assertHasDeclaration(declarations, 'named', DeclarationKind.CONSTRUCTOR,
+ offset: 30, codeOffset: 28, codeLength: 10, className: 'C');
+ _assertHasDeclaration(declarations, 'g', DeclarationKind.GETTER,
+ offset: 49, codeOffset: 41, codeLength: 15, className: 'C');
+ _assertHasDeclaration(declarations, 's', DeclarationKind.SETTER,
+ offset: 68, codeOffset: 59, codeLength: 16, className: 'C');
+ _assertHasDeclaration(declarations, 'm', DeclarationKind.METHOD,
+ offset: 83, codeOffset: 78, codeLength: 11, className: 'C');
}
test_declarations_enum() async {
await _resolveTestUnit('''
enum E {
- a, b, c
+ a, bb, ccc
}
''');
var files = <String>[];
- List<Declaration> declarations = await driver.search.declarations(files);
- _assertHasDeclaration(declarations, 'E', DeclarationKind.ENUM, 5);
- _assertHasDeclaration(declarations, 'a', DeclarationKind.ENUM_CONSTANT, 11);
- _assertHasDeclaration(declarations, 'b', DeclarationKind.ENUM_CONSTANT, 14);
- _assertHasDeclaration(declarations, 'c', DeclarationKind.ENUM_CONSTANT, 17);
+ List<Declaration> declarations =
+ await driver.search.declarations(null, null, files);
+ _assertHasDeclaration(declarations, 'E', DeclarationKind.ENUM,
+ offset: 5, codeOffset: 0, codeLength: 23);
+ _assertHasDeclaration(declarations, 'a', DeclarationKind.ENUM_CONSTANT,
+ offset: 11, codeOffset: 11, codeLength: 1);
+ _assertHasDeclaration(declarations, 'bb', DeclarationKind.ENUM_CONSTANT,
+ offset: 14, codeOffset: 14, codeLength: 2);
+ _assertHasDeclaration(declarations, 'ccc', DeclarationKind.ENUM_CONSTANT,
+ offset: 18, codeOffset: 18, codeLength: 3);
+ }
+
+ test_declarations_maxResults() async {
+ await _resolveTestUnit('''
+class A {}
+class B {}
+class C {}
+''');
+ var files = <String>[];
+ List<Declaration> declarations =
+ await driver.search.declarations(null, 2, files);
+ expect(declarations, hasLength(2));
+ }
+
+ test_declarations_regExp() async {
+ await _resolveTestUnit('''
+class A {}
+class B {}
+class C {}
+class D {}
+''');
+ var files = <String>[];
+ List<Declaration> declarations =
+ await driver.search.declarations(new RegExp(r'[A-C]'), null, files);
+ _assertHasDeclaration(declarations, 'A', DeclarationKind.CLASS);
+ _assertHasDeclaration(declarations, 'B', DeclarationKind.CLASS);
+ _assertHasDeclaration(declarations, 'C', DeclarationKind.CLASS);
+ _assertNoDeclaration(declarations, 'D');
+ }
+
+ test_declarations_parameters() async {
+ await _resolveTestUnit('''
+class C {
+ int get g => 0;
+ void m(int a, double b) {}
+}
+void f(bool a, String b) {}
+typedef F(int a);
+''');
+ var files = <String>[];
+ List<Declaration> declarations =
+ await driver.search.declarations(null, null, files);
+
+ Declaration declaration;
+
+ declaration =
+ _assertHasDeclaration(declarations, 'C', DeclarationKind.CLASS);
+ expect(declaration.parameters, isNull);
+
+ declaration = _assertHasDeclaration(
+ declarations, 'g', DeclarationKind.GETTER,
+ className: 'C');
+ expect(declaration.parameters, isNull);
+
+ declaration = _assertHasDeclaration(
+ declarations, 'm', DeclarationKind.METHOD,
+ className: 'C');
+ expect(declaration.parameters, '(int a, double b)');
+
+ declaration =
+ _assertHasDeclaration(declarations, 'f', DeclarationKind.FUNCTION);
+ expect(declaration.parameters, '(bool a, String b)');
+
+ declaration = _assertHasDeclaration(
+ declarations, 'F', DeclarationKind.FUNCTION_TYPE_ALIAS);
+ expect(declaration.parameters, '(int a)');
}
test_declarations_top() async {
@@ -144,15 +221,28 @@
typedef tf2<T> = int Function<S>(T tp, S sp);
''');
var files = <String>[];
- List<Declaration> declarations = await driver.search.declarations(files);
- _assertHasDeclaration(declarations, 'g', DeclarationKind.GETTER, 8);
- _assertHasDeclaration(declarations, 's', DeclarationKind.SETTER, 25);
- _assertHasDeclaration(declarations, 'f', DeclarationKind.FUNCTION, 38);
- _assertHasDeclaration(declarations, 'v', DeclarationKind.VARIABLE, 54);
+ List<Declaration> declarations =
+ await driver.search.declarations(null, null, files);
+ _assertHasDeclaration(declarations, 'g', DeclarationKind.GETTER,
+ offset: 8, codeOffset: 0, codeLength: 15);
+ _assertHasDeclaration(declarations, 's', DeclarationKind.SETTER,
+ offset: 25, codeOffset: 16, codeLength: 16);
_assertHasDeclaration(
- declarations, 'tf1', DeclarationKind.FUNCTION_TYPE_ALIAS, 70);
+ declarations,
+ 'f',
+ DeclarationKind.FUNCTION,
+ offset: 38,
+ codeOffset: 33,
+ codeLength: 16,
+ );
+ _assertHasDeclaration(declarations, 'v', DeclarationKind.VARIABLE,
+ offset: 54, codeOffset: 50, codeLength: 6);
_assertHasDeclaration(
- declarations, 'tf2', DeclarationKind.FUNCTION_TYPE_ALIAS, 85);
+ declarations, 'tf1', DeclarationKind.FUNCTION_TYPE_ALIAS,
+ offset: 70, codeOffset: 57, codeLength: 19);
+ _assertHasDeclaration(
+ declarations, 'tf2', DeclarationKind.FUNCTION_TYPE_ALIAS,
+ offset: 85, codeOffset: 77, codeLength: 45);
// No declaration for type variables.
_assertNoDeclaration(declarations, 'T');
_assertNoDeclaration(declarations, 'S');
@@ -1248,22 +1338,25 @@
unorderedEquals([a, b, c, d, e]));
}
- void _assertHasDeclaration(List<Declaration> declarations, String name,
- DeclarationKind kind, int offset,
- [String className]) {
+ Declaration _assertHasDeclaration(
+ List<Declaration> declarations, String name, DeclarationKind kind,
+ {int offset, int codeOffset, int codeLength, String className}) {
for (var declaration in declarations) {
if (declaration.name == name &&
declaration.kind == kind &&
- declaration.offset == offset &&
+ (offset == null || declaration.offset == offset) &&
+ (codeOffset == null || declaration.codeOffset == codeOffset) &&
+ (codeLength == null || declaration.codeLength == codeLength) &&
declaration.className == className) {
- return;
+ return declaration;
}
}
var actual = declarations
- .map((d) => '(name=${d.name}, kind=${d.kind}, offset=${d.offset})')
+ .map((d) => '(name=${d.name}, kind=${d.kind}, offset=${d.offset}, '
+ 'codeOffset=${d.codeOffset}, codeLength=${d.codeLength})')
.join('\n');
- fail(
- 'Exected to find (name=$name, kind=$kind, offset=$offset) in\n$actual');
+ fail('Exected to find (name=$name, kind=$kind, offset=$offset, '
+ 'codeOffset=$codeOffset, codeLength=$codeLength) in\n$actual');
}
void _assertNoDeclaration(List<Declaration> declarations, String name) {
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
index c821b21..2669e5c 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
@@ -62,6 +62,10 @@
AnalysisOptionsImpl createOptions() =>
super.createOptions()..strongMode = true;
+ @failingTest // See dartbug.com/32290
+ test_const_constructor_inferred_args() =>
+ test_const_constructor_inferred_args();
+
@override
@failingTest
test_instantiateToBounds_functionTypeAlias_simple() async {
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 4c392b1..84a0684 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -2474,6 +2474,41 @@
}
}
+ test_const_constructor_inferred_args() async {
+ if (!isStrongMode) return;
+ var library = await checkLibrary('''
+class C<T> {
+ final T t;
+ const C(this.t);
+ const C.named(this.t);
+}
+const Object x = const C(0);
+const Object y = const C.named(0);
+''');
+ checkElementText(library, '''
+class C<T> {
+ final T t;
+ const C(T this.t);
+ const C.named(T this.t);
+}
+const Object x = const
+ C/*location: test.dart;C*/(0);
+const Object y = const
+ C/*location: test.dart;C*/.
+ named/*location: test.dart;C;named*/(0);
+''');
+ TopLevelVariableElementImpl x =
+ library.definingCompilationUnit.topLevelVariables[0];
+ InstanceCreationExpression xExpr = x.constantInitializer;
+ var xType = xExpr.constructorName.staticElement.returnType;
+ expect(xType.toString(), 'C<int>');
+ TopLevelVariableElementImpl y =
+ library.definingCompilationUnit.topLevelVariables[0];
+ InstanceCreationExpression yExpr = y.constantInitializer;
+ var yType = yExpr.constructorName.staticElement.returnType;
+ expect(yType.toString(), 'C<int>');
+ }
+
test_const_finalField_hasConstConstructor() async {
var library = await checkLibrary(r'''
class C {
diff --git a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
index 668c30f..9f18b85 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
@@ -147,6 +147,10 @@
await super.test_class_type_parameters_bound();
}
+ @failingTest // See dartbug.com/32290
+ test_const_constructor_inferred_args() =>
+ test_const_constructor_inferred_args();
+
@failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30258')
test_constructor_redirected_factory_named_generic() async {
diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart
index 0f45305..bca19f8 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -46,7 +46,7 @@
AnalysisOptions get analysisOptions => context.analysisOptions;
- configureContext(String optionsSource) =>
+ void configureContext(String optionsSource) =>
applyToAnalysisOptions(analysisOptions, parseOptions(optionsSource));
Map<String, YamlNode> parseOptions(String source) =>
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index f7ee91b..b4a13f5 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -360,6 +360,8 @@
}
});
+ String rootPath =
+ options.sourceFiles.isEmpty ? null : options.sourceFiles.first;
DartSdk sdk;
logger.run('Add SDK bundle', () {
PackageBundle sdkBundle;
@@ -375,7 +377,7 @@
options.strongMode);
dartSdk.analysisOptions =
Driver.createAnalysisOptionsForCommandLineOptions(
- resourceProvider, options);
+ resourceProvider, options, rootPath);
dartSdk.useSummary = !options.buildSummaryOnly;
sdk = dartSdk;
sdkBundle = dartSdk.getSummarySdkBundle(options.strongMode);
@@ -392,7 +394,7 @@
]);
analysisOptions = Driver.createAnalysisOptionsForCommandLineOptions(
- resourceProvider, options);
+ resourceProvider, options, rootPath);
AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(logger);
analysisDriver = new AnalysisDriver(
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index a2ecdf1..ef33b5b 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -252,23 +252,60 @@
outSink.writeln("Analyzing ${fileNames.join(', ')}...");
}
- // Create a context, or re-use the previous one.
- try {
- _createContextAndAnalyze(options);
- } on _DriverError catch (error) {
- outSink.writeln(error.msg);
- return ErrorSeverity.ERROR;
+ // These are used to do part file analysis across sources.
+ Set<Uri> libUris = new Set<Uri>();
+ Set<Source> danglingParts = new Set<Source>();
+
+ // Note: This references _context via closure, so it will change over time
+ // during the following analysis.
+ SeverityProcessor defaultSeverityProcessor = (AnalysisError error) {
+ return determineProcessedSeverity(
+ error, options, _context.analysisOptions);
+ };
+
+ // We currently print out to stderr to ensure that when in batch mode we
+ // print to stderr, this is because the prints from batch are made to
+ // stderr. The reason that options.shouldBatch isn't used is because when
+ // the argument flags are constructed in BatchRunner and passed in from
+ // batch mode which removes the batch flag to prevent the "cannot have the
+ // batch flag and source file" error message.
+ ErrorFormatter formatter;
+ if (options.machineFormat) {
+ formatter = new MachineErrorFormatter(errorSink, options, stats,
+ severityProcessor: defaultSeverityProcessor);
+ } else {
+ formatter = new HumanErrorFormatter(outSink, options, stats,
+ severityProcessor: defaultSeverityProcessor);
}
- // Add all the files to be analyzed en masse to the context. Skip any
- // files that were added earlier (whether explicitly or implicitly) to
- // avoid causing those files to be unnecessarily re-read.
- Set<Source> knownSources = context.sources.toSet();
- Set<Source> sourcesToAnalyze = new Set<Source>();
- ChangeSet changeSet = new ChangeSet();
+ ErrorSeverity allResult = ErrorSeverity.NONE;
+
+ void reportPartError(Source partSource) {
+ errorSink
+ .writeln("${partSource.fullName} is a part and cannot be analyzed.");
+ errorSink.writeln("Please pass in a library that contains this part.");
+ io.exitCode = ErrorSeverity.ERROR.ordinal;
+ allResult = allResult.max(ErrorSeverity.ERROR);
+ }
+
for (String sourcePath in options.sourceFiles) {
sourcePath = sourcePath.trim();
+ // Create a context, or re-use the previous one.
+ try {
+ _createContextAndAnalyze(options, sourcePath);
+ } on _DriverError catch (error) {
+ outSink.writeln(error.msg);
+ return ErrorSeverity.ERROR;
+ }
+
+ // Add all the files to be analyzed en masse to the context. Skip any
+ // files that were added earlier (whether explicitly or implicitly) to
+ // avoid causing those files to be unnecessarily re-read.
+ Set<Source> knownSources = context.sources.toSet();
+ Set<Source> sourcesToAnalyze = new Set<Source>();
+ ChangeSet changeSet = new ChangeSet();
+
// Collect files for analysis.
// Note that these files will all be analyzed in the same context.
// This should be updated when the ContextManager re-work is complete
@@ -292,109 +329,102 @@
if (analysisDriver == null) {
context.applyChanges(changeSet);
}
- }
- // Analyze the libraries.
- ErrorSeverity allResult = ErrorSeverity.NONE;
- List<Uri> libUris = <Uri>[];
- Set<Source> partSources = new Set<Source>();
+ // Analyze the libraries.
+ Set<Source> partSources = new Set<Source>();
- SeverityProcessor defaultSeverityProcessor = (AnalysisError error) {
- return determineProcessedSeverity(
- error, options, _context.analysisOptions);
- };
-
- // We currently print out to stderr to ensure that when in batch mode we
- // print to stderr, this is because the prints from batch are made to
- // stderr. The reason that options.shouldBatch isn't used is because when
- // the argument flags are constructed in BatchRunner and passed in from
- // batch mode which removes the batch flag to prevent the "cannot have the
- // batch flag and source file" error message.
- ErrorFormatter formatter;
- if (options.machineFormat) {
- formatter = new MachineErrorFormatter(errorSink, options, stats,
- severityProcessor: defaultSeverityProcessor);
- } else {
- formatter = new HumanErrorFormatter(outSink, options, stats,
- severityProcessor: defaultSeverityProcessor);
- }
-
- for (Source source in sourcesToAnalyze) {
- if (analysisDriver != null &&
- (source.shortName == AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE ||
- source.shortName == AnalysisEngine.ANALYSIS_OPTIONS_FILE)) {
- file_system.File file = resourceProvider.getFile(source.fullName);
- String content = file.readAsStringSync();
- LineInfo lineInfo = new LineInfo.fromContent(content);
- List<AnalysisError> errors =
- GenerateOptionsErrorsTask.analyzeAnalysisOptions(
- file.createSource(), content, analysisDriver.sourceFactory);
- formatter.formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
- for (AnalysisError error in errors) {
- allResult = allResult.max(determineProcessedSeverity(
- error, options, _context.analysisOptions));
- }
- } else if (source.shortName == AnalysisEngine.PUBSPEC_YAML_FILE) {
- try {
+ for (Source source in sourcesToAnalyze) {
+ if (analysisDriver != null &&
+ (source.shortName == AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE ||
+ source.shortName == AnalysisEngine.ANALYSIS_OPTIONS_FILE)) {
file_system.File file = resourceProvider.getFile(source.fullName);
String content = file.readAsStringSync();
- YamlNode node = loadYamlNode(content);
- if (node is YamlMap) {
- PubspecValidator validator =
- new PubspecValidator(resourceProvider, file.createSource());
- LineInfo lineInfo = new LineInfo.fromContent(content);
- List<AnalysisError> errors = validator.validate(node.nodes);
- formatter
- .formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
- for (AnalysisError error in errors) {
- allResult = allResult.max(determineProcessedSeverity(
- error, options, _context.analysisOptions));
+ LineInfo lineInfo = new LineInfo.fromContent(content);
+ List<AnalysisError> errors =
+ GenerateOptionsErrorsTask.analyzeAnalysisOptions(
+ file.createSource(), content, analysisDriver.sourceFactory);
+ formatter.formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
+ for (AnalysisError error in errors) {
+ allResult = allResult.max(determineProcessedSeverity(
+ error, options, _context.analysisOptions));
+ }
+ } else if (source.shortName == AnalysisEngine.PUBSPEC_YAML_FILE) {
+ try {
+ file_system.File file = resourceProvider.getFile(source.fullName);
+ String content = file.readAsStringSync();
+ YamlNode node = loadYamlNode(content);
+ if (node is YamlMap) {
+ PubspecValidator validator =
+ new PubspecValidator(resourceProvider, file.createSource());
+ LineInfo lineInfo = new LineInfo.fromContent(content);
+ List<AnalysisError> errors = validator.validate(node.nodes);
+ formatter
+ .formatErrors([new AnalysisErrorInfoImpl(errors, lineInfo)]);
+ for (AnalysisError error in errors) {
+ allResult = allResult.max(determineProcessedSeverity(
+ error, options, _context.analysisOptions));
+ }
+ }
+ } catch (exception) {
+ // If the file cannot be analyzed, ignore it.
+ }
+ } else {
+ SourceKind sourceKind = analysisDriver != null
+ ? await analysisDriver.getSourceKind(source.fullName)
+ : context.computeKindOf(source);
+ if (sourceKind == SourceKind.PART) {
+ partSources.add(source);
+ continue;
+ }
+ ErrorSeverity status = await _runAnalyzer(source, options, formatter);
+ allResult = allResult.max(status);
+ libUris.add(source.uri);
+ if (analysisDriver != null) {
+ // With [AnalysisDriver], we can easily mark previously dangling
+ // parts as no longer dangling once we process the lib.
+ var libFile =
+ analysisDriver.fsState.getFileForPath(source.fullName);
+ for (FileState part in libFile.partedFiles) {
+ danglingParts.remove(part.source);
}
}
- } catch (exception) {
- // If the file cannot be analyzed, ignore it.
}
- } else {
- SourceKind sourceKind = analysisDriver != null
- ? await analysisDriver.getSourceKind(source.fullName)
- : context.computeKindOf(source);
- if (sourceKind == SourceKind.PART) {
- partSources.add(source);
- continue;
- }
- ErrorSeverity status = await _runAnalyzer(source, options, formatter);
- allResult = allResult.max(status);
- libUris.add(source.uri);
}
+
+ // Check that each part has a corresponding source in the input list.
+ for (Source partSource in partSources) {
+ if (analysisDriver != null) {
+ var partFile =
+ analysisDriver.fsState.getFileForPath(partSource.fullName);
+ if (!libUris.contains(partFile.library?.uri)) {
+ // With [AnalysisDriver], we can mark this as dangling, for now, and
+ // later on remove it from this list if its containing lib is found.
+ danglingParts.add(partSource);
+ }
+ } else {
+ final potentialLibs = context.getLibrariesContaining(partSource);
+ bool found = false;
+ for (var lib in potentialLibs) {
+ if (libUris.contains(lib.uri)) {
+ found = true;
+ }
+ }
+ if (!found) {
+ // Without an analysis driver, we can't easily mark it dangling "for
+ // now", but this path is deprecated anyway. Just give up now.
+ reportPartError(partSource);
+ }
+ }
+ }
+ }
+
+ // Any dangling parts still in this list were definitely dangling.
+ for (Source partSource in danglingParts) {
+ reportPartError(partSource);
}
formatter.flush();
- // Check that each part has a corresponding source in the input list.
- for (Source partSource in partSources) {
- bool found = false;
- if (analysisDriver != null) {
- var partFile =
- analysisDriver.fsState.getFileForPath(partSource.fullName);
- if (libUris.contains(partFile.library?.uri)) {
- found = true;
- }
- } else {
- for (var lib in context.getLibrariesContaining(partSource)) {
- if (libUris.contains(lib.uri)) {
- found = true;
- }
- }
- }
- if (!found) {
- errorSink.writeln(
- "${partSource.fullName} is a part and cannot be analyzed.");
- errorSink.writeln("Please pass in a library that contains this part.");
- io.exitCode = ErrorSeverity.ERROR.ordinal;
- allResult = allResult.max(ErrorSeverity.ERROR);
- }
- }
-
if (!options.machineFormat) {
stats.print(outSink);
}
@@ -605,7 +635,7 @@
/// Create an analysis context that is prepared to analyze sources according
/// to the given [options], and store it in [_context].
- void _createContextAndAnalyze(CommandLineOptions options) {
+ void _createContextAndAnalyze(CommandLineOptions options, String source) {
// If not the same command-line options, clear cached information.
if (!_equalCommandLineOptions(_previousOptions, options)) {
_previousOptions = options;
@@ -615,7 +645,8 @@
}
AnalysisOptionsImpl analysisOptions =
- createAnalysisOptionsForCommandLineOptions(resourceProvider, options);
+ createAnalysisOptionsForCommandLineOptions(
+ resourceProvider, options, source);
analysisOptions.analyzeFunctionBodiesPredicate =
_chooseDietParsingPolicy(options);
@@ -861,7 +892,9 @@
}
static AnalysisOptionsImpl createAnalysisOptionsForCommandLineOptions(
- ResourceProvider resourceProvider, CommandLineOptions options) {
+ ResourceProvider resourceProvider,
+ CommandLineOptions options,
+ String source) {
if (options.analysisOptionsFile != null) {
file_system.File file =
resourceProvider.getFile(options.analysisOptionsFile);
@@ -875,9 +908,10 @@
if (options.sourceFiles.isEmpty) {
contextRoot = path.current;
} else {
- contextRoot = options.sourceFiles[0];
- if (!path.isAbsolute(contextRoot)) {
- contextRoot = path.absolute(contextRoot);
+ if (path.isAbsolute(source)) {
+ contextRoot = source;
+ } else {
+ contextRoot = path.absolute(source);
}
}
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index 6158de5..f31943d 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -70,19 +70,34 @@
String source, {
String options: emptyOptionsFile,
List<String> args: const <String>[],
+ }) {
+ return driveMany([source], options: options, args: args);
+ }
+
+ /// An ability to use [drive] with many sources instead of one.
+ Future<Null> driveMany(
+ List<String> sources, {
+ String options: emptyOptionsFile,
+ List<String> args: const <String>[],
}) async {
driver = new Driver(isTesting: true);
- var cmd = <String>[
- '--options',
- path.join(testDirectory, options),
- _adjustFileSpec(source)
- ]..addAll(args);
+ var cmd = <String>[];
+
+ if (options != null)
+ cmd.addAll([
+ '--options',
+ path.join(testDirectory, options),
+ ]);
+
+ cmd..addAll(sources.map(_adjustFileSpec))..addAll(args);
+
if (usePreviewDart2) {
cmd.insert(0, '--preview-dart-2');
}
if (useCFE) {
cmd.insert(0, '--use-cfe');
}
+
await driver.start(cmd);
}
@@ -624,6 +639,15 @@
expect(exitCode, 0);
}
+ test_partFile_reversed() async {
+ Driver driver = new Driver(isTesting: true);
+ await driver.start([
+ path.join(testDirectory, 'data/library_and_parts/part1.dart'),
+ path.join(testDirectory, 'data/library_and_parts/lib.dart')
+ ]);
+ expect(exitCode, 0);
+ }
+
test_partFile_dangling() async {
await drive('data/library_and_parts/part2.dart');
expect(exitCode, 3);
@@ -928,6 +952,21 @@
expect(outSink.toString(), contains("1 error and 1 warning found."));
}
+ test_analyzeFilesInDifferentContexts() async {
+ await driveMany([
+ 'data/linter_project/test_file.dart',
+ 'data/no_lints_project/test_file.dart',
+ ], options: null);
+
+ // Should have the lint in the project with lint rules enabled.
+ expect(
+ bulletToDash(outSink),
+ contains(path.join('linter_project', 'test_file.dart') +
+ ':7:7 - camel_case_types'));
+ // Should be just one lint in total.
+ expect(outSink.toString(), contains('1 lint found.'));
+ }
+
Future<Null> _driveBasic() async {
await drive('data/options_tests_project/test_file.dart',
options: 'data/options_tests_project/$optionsFileName');
diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
index 83f9c30..b9740ce 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -108,6 +107,12 @@
CompletionSuggestionKind suggestKind = CompletionSuggestionKind.INVOCATION;
/**
+ * The type that is required by the context in which the completion was
+ * activated, or `null` if there is no such type, or it cannot be determined.
+ */
+ DartType _requiredType = null;
+
+ /**
* Determine the suggestions that should be made based upon the given
* [CompletionTarget] and [offset].
*/
@@ -125,6 +130,20 @@
target.containingNode.getAncestor((p) => p is MethodDeclaration);
optype.inStaticMethodBody =
mthDecl is MethodDeclaration && mthDecl.isStatic;
+
+ // If a value should be suggested, suggest also constructors.
+ if (optype.includeReturnValueSuggestions) {
+ // Careful: in angular plugin, `target.unit` may be null!
+ CompilationUnitElement unitElement = target.unit?.element;
+ if (unitElement != null &&
+ unitElement.context.analysisOptions.previewDart2) {
+ optype.includeConstructorSuggestions = true;
+ }
+ }
+
+ // Compute the type required by the context and set filters.
+ optype._computeRequiredTypeAndFilters(target);
+
return optype;
}
@@ -159,6 +178,58 @@
!includeReturnValueSuggestions &&
!includeVoidReturnSuggestions;
+ /**
+ * Try to determine the required context type, and configure filters.
+ */
+ void _computeRequiredTypeAndFilters(CompletionTarget target) {
+ var node = target.containingNode;
+ if (node is Expression) {
+ AstNode parent = node.parent;
+ if (parent is VariableDeclaration) {
+ _requiredType = parent.element?.type;
+ } else if (parent is AssignmentExpression) {
+ _requiredType = parent.leftHandSide.staticType;
+ } else if (node.staticParameterElement != null) {
+ _requiredType = node.staticParameterElement.type;
+ } else if (parent is NamedExpression &&
+ parent.staticParameterElement != null) {
+ _requiredType = parent.staticParameterElement.type;
+ }
+ }
+ if (_requiredType == null) {
+ return;
+ }
+ if (_requiredType.isDynamic || _requiredType.isObject) {
+ _requiredType = null;
+ return;
+ }
+
+ constructorSuggestionsFilter = (DartType dartType, int relevance) {
+ if (dartType != null) {
+ if (dartType == _requiredType) {
+ return relevance + DART_RELEVANCE_BOOST_TYPE;
+ } else if (dartType.isSubtypeOf(_requiredType)) {
+ return relevance + DART_RELEVANCE_BOOST_SUBTYPE;
+ }
+ if (target.containingNode is InstanceCreationExpression) {
+ return null;
+ }
+ }
+ return relevance;
+ };
+
+ returnValueSuggestionsFilter = (DartType dartType, int relevance) {
+ if (dartType != null) {
+ if (dartType == _requiredType) {
+ return relevance + DART_RELEVANCE_BOOST_TYPE;
+ } else if (dartType.isSubtypeOf(_requiredType)) {
+ return relevance + DART_RELEVANCE_BOOST_SUBTYPE;
+ }
+ }
+ return relevance;
+ };
+ }
+
/// Return the statement before [entity]
/// where [entity] can be a statement or the `}` closing the given block.
static Statement getPreviousStatement(Block node, Object entity) {
@@ -630,31 +701,6 @@
void visitInstanceCreationExpression(InstanceCreationExpression node) {
if (identical(entity, node.constructorName)) {
optype.includeConstructorSuggestions = true;
- optype.constructorSuggestionsFilter = (DartType dartType, int relevance) {
- DartType localTypeAssertion = null;
- AstNode parent = node.parent;
- if (parent is VariableDeclaration) {
- localTypeAssertion = parent.element?.type;
- } else if (parent is AssignmentExpression) {
- localTypeAssertion = parent.leftHandSide.staticType;
- } else if (node.staticParameterElement != null) {
- localTypeAssertion = node.staticParameterElement.type;
- } else if (parent is NamedExpression &&
- parent.staticParameterElement != null) {
- localTypeAssertion = parent.staticParameterElement.type;
- }
- if (localTypeAssertion == null ||
- dartType == null ||
- localTypeAssertion.isDynamic) {
- return relevance;
- } else if (localTypeAssertion == dartType) {
- return relevance + DART_RELEVANCE_INCREMENT;
- } else if (dartType.isSubtypeOf(localTypeAssertion)) {
- return relevance;
- } else {
- return null;
- }
- };
}
}
@@ -723,28 +769,6 @@
void visitNamedExpression(NamedExpression node) {
if (identical(entity, node.expression)) {
optype.includeReturnValueSuggestions = true;
- optype.returnValueSuggestionsFilter = (DartType dartType, int relevance) {
- DartType type = resolutionMap.elementForNamedExpression(node)?.type;
- bool isEnum = type != null &&
- type.element is ClassElement &&
- (type.element as ClassElement).isEnum;
- if (isEnum) {
- if (type == dartType) {
- return relevance + DART_RELEVANCE_INCREMENT;
- } else {
- return null;
- }
- }
- if (type != null &&
- dartType != null &&
- !type.isDynamic &&
- dartType.isSubtypeOf(type)) {
- // is correct type
- return relevance + DART_RELEVANCE_INCREMENT;
- } else {
- return relevance;
- }
- };
optype.includeTypeNameSuggestions = true;
// Check for named parameters in constructor calls.
@@ -992,7 +1016,8 @@
bool _isEntityPrevTokenSynthetic() {
Object entity = this.entity;
- if (entity is AstNode && entity.beginToken.previous?.isSynthetic ?? false) {
+ if (entity is AstNode &&
+ (entity.beginToken.previous?.isSynthetic ?? false)) {
return true;
}
return false;
diff --git a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart
index 8dafe81..c3ee9cd 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart
@@ -186,7 +186,9 @@
@override
void visitNode(AstNode node) {
- node.parent.accept(this);
+ // Support the case of searching partial ASTs by aborting on nodes with no
+ // parents. This is useful for the angular plugin.
+ node.parent?.accept(this);
}
@override
diff --git a/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart b/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart
index cb9b1ca..d2d37f0 100644
--- a/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart
+++ b/pkg/analyzer_plugin/lib/utilities/completion/relevance.dart
@@ -7,10 +7,11 @@
// suggestions in Dart code.
//
+const int DART_RELEVANCE_BOOST_SUBTYPE = 100;
+const int DART_RELEVANCE_BOOST_TYPE = 200;
const int DART_RELEVANCE_COMMON_USAGE = 1200;
const int DART_RELEVANCE_DEFAULT = 1000;
const int DART_RELEVANCE_HIGH = 2000;
-const int DART_RELEVANCE_INCREMENT = 100;
const int DART_RELEVANCE_INHERITED_ACCESSOR = 1057;
const int DART_RELEVANCE_INHERITED_FIELD = 1058;
const int DART_RELEVANCE_INHERITED_METHOD = 1057;
diff --git a/pkg/compiler/lib/src/commandline_options.dart b/pkg/compiler/lib/src/commandline_options.dart
index c419478..b44128c 100644
--- a/pkg/compiler/lib/src/commandline_options.dart
+++ b/pkg/compiler/lib/src/commandline_options.dart
@@ -39,6 +39,10 @@
/// using the kernel representation.
/// See [CompilerOptions.useKernel] for details.
static const String useKernel = '--use-kernel';
+
+ /// Temporary flag to revert to the old front-end once the new common
+ /// front-end is the default.
+ static const String useOldFrontend = '--use-old-frontend';
static const String strongMode = '--strong';
static const String platformBinaries = '--platform-binaries=.+';
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index f92e7cc..ddf776e 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -431,8 +431,8 @@
}
} else {
if (loadedLibraries.containsLibrary(Uris.dart_mirrors)) {
- reporter.reportErrorMessage(NO_LOCATION_SPANNABLE,
- MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_KERNEL);
+ reporter.reportWarningMessage(NO_LOCATION_SPANNABLE,
+ MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_CFE);
}
}
backend.onLibrariesLoaded(frontendStrategy.commonElements, loadedLibraries);
diff --git a/pkg/compiler/lib/src/constant_system_dart.dart b/pkg/compiler/lib/src/constant_system_dart.dart
index 36ec90b..b7201df 100644
--- a/pkg/compiler/lib/src/constant_system_dart.dart
+++ b/pkg/compiler/lib/src/constant_system_dart.dart
@@ -437,6 +437,7 @@
final truncatingDivide = const TruncatingDivideOperation();
final codeUnitAt = const CodeUnitAtOperation();
final round = const UnfoldedUnaryOperation('round');
+ final abs = const UnfoldedUnaryOperation('abs');
const DartConstantSystem();
diff --git a/pkg/compiler/lib/src/constants/constant_system.dart b/pkg/compiler/lib/src/constants/constant_system.dart
index cc0ceca..2a3d5ee 100644
--- a/pkg/compiler/lib/src/constants/constant_system.dart
+++ b/pkg/compiler/lib/src/constants/constant_system.dart
@@ -55,6 +55,7 @@
BinaryOperation get codeUnitAt;
UnaryOperation get round;
+ UnaryOperation get abs;
const ConstantSystem();
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index b8f6ab0..27943d1 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -348,6 +348,7 @@
'--output-type=dart|--output-type=dart-multi|--output-type=js',
setOutputType),
new OptionHandler(Flags.useKernel, setUseKernel),
+ new OptionHandler(Flags.useOldFrontend, ignoreOption),
new OptionHandler(Flags.platformBinaries, setPlatformBinaries),
new OptionHandler(Flags.noFrequencyBasedMinification, passThrough),
new OptionHandler(Flags.verbose, setVerbose),
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index 0d03766..e04dcab 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -647,7 +647,8 @@
work() {
var queue = new WorkQueue(this.importSets);
- _isMirrorsUsed = closedWorld.backendUsage.isMirrorsUsed;
+ _isMirrorsUsed =
+ closedWorld.backendUsage.isMirrorsUsed && !compiler.options.useKernel;
// Add `main` and their recursive dependencies to the main output unit.
// We do this upfront to avoid wasting time visiting these elements when
@@ -689,7 +690,7 @@
}
emptyQueue();
- if (closedWorld.backendUsage.isMirrorsUsed) {
+ if (_isMirrorsUsed) {
addDeferredMirrorElements(queue);
emptyQueue();
}
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index 35e0838..99f7f7f 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -289,7 +289,7 @@
MIRRORS_EXPECTED_STRING_OR_TYPE,
MIRRORS_EXPECTED_STRING_TYPE_OR_LIST,
MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND,
- MIRRORS_LIBRARY_NOT_SUPPORT_WITH_KERNEL,
+ MIRRORS_LIBRARY_NOT_SUPPORT_WITH_CFE,
MISSING_ARGUMENT,
MISSING_ENUM_CASES,
MISSING_FACTORY_KEYWORD,
@@ -3803,10 +3803,12 @@
"""
$MIRRORS_NOT_SUPPORTED_BY_BACKEND_PADDING#{importChain}"""),
- MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_KERNEL:
- const MessageTemplate(
- MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_KERNEL, """
-dart:mirrors library is not supported when using the new kernel front end."""),
+ MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_CFE: const MessageTemplate(
+ MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_CFE, """
+dart2js no longer supports the dart:mirrors library.
+
+APIs from this library will throw a runtime error at this time, but they will
+become a compile-time error in the future."""),
MessageKind.DIRECTLY_THROWING_NSM: const MessageTemplate(
MessageKind.DIRECTLY_THROWING_NSM,
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
index 4313798..13514a2 100644
--- a/pkg/compiler/lib/src/elements/types.dart
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -389,9 +389,19 @@
final int index;
/// The bound of this function type variable.
- final DartType bound;
+ DartType _bound;
- FunctionTypeVariable(this.index, this.bound);
+ FunctionTypeVariable(this.index);
+
+ DartType get bound {
+ assert(_bound != null, "Bound hasn't been set.");
+ return _bound;
+ }
+
+ void set bound(DartType value) {
+ assert(_bound == null, "Bound has already been set.");
+ _bound = value;
+ }
@override
bool get isFunctionTypeVariable => true;
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 9a025ac..648eba8 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -544,6 +544,8 @@
return _rtiChecksBuilder;
}
+ RuntimeTypesChecksBuilder get rtiChecksBuilderForTesting => _rtiChecksBuilder;
+
RuntimeTypesSubstitutions get rtiSubstitutions {
assert(
_rtiSubstitutions != null,
diff --git a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
index fa32df8..cbeefd6 100644
--- a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
@@ -258,6 +258,7 @@
const TruncatingDivideOperation());
final codeUnitAt = const CodeUnitAtRuntimeOperation();
final round = const JavaScriptRoundOperation();
+ final abs = const UnfoldedUnaryOperation('abs');
const JavaScriptConstantSystem();
diff --git a/pkg/compiler/lib/src/js_backend/mirrors_data.dart b/pkg/compiler/lib/src/js_backend/mirrors_data.dart
index a32d4cb..07ca9c50 100644
--- a/pkg/compiler/lib/src/js_backend/mirrors_data.dart
+++ b/pkg/compiler/lib/src/js_backend/mirrors_data.dart
@@ -555,7 +555,8 @@
void computeMembersNeededForReflection(
ResolutionWorldBuilder worldBuilder, ClosedWorld closedWorld) {
if (_membersNeededForReflection != null) return;
- if (!closedWorld.backendUsage.isMirrorsUsed) {
+ if (!closedWorld.backendUsage.isMirrorsUsed ||
+ _compiler.options.useKernel) {
createImmutableSets();
return;
}
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 3a880dc..9963c4c 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -24,6 +24,8 @@
import 'backend_usage.dart';
import 'namer.dart';
+bool cacheRtiDataForTesting = false;
+
/// For each class, stores the possible class subtype tests that could succeed.
abstract class TypeChecks {
/// Get the set of checks required for class [element].
@@ -1399,6 +1401,8 @@
@override
TypeChecks get _requiredChecks => cachedRequiredChecks;
+ Map<ClassEntity, ClassUse> classUseMapForTesting;
+
@override
void registerTypeVariableBoundsSubtypeCheck(
DartType typeArgument, DartType bound) {
@@ -1414,6 +1418,9 @@
Set<DartType> implicitIsChecks = typeVariableTests.implicitIsChecks;
Map<ClassEntity, ClassUse> classUseMap = <ClassEntity, ClassUse>{};
+ if (cacheRtiDataForTesting) {
+ classUseMapForTesting = classUseMap;
+ }
Set<ClassEntity> checkedClasses = new Set<ClassEntity>();
Set<FunctionType> checkedFunctionTypes = new Set<FunctionType>();
@@ -1437,15 +1444,6 @@
}
});
- void processType(DartType t) {
- if (t is FunctionType) {
- checkedFunctionTypes.add(t);
- } else if (t is InterfaceType) {
- checkedClasses.add(t.element);
- }
- testedTypeVisitor.visitType(t, false);
- }
-
codegenWorldBuilder.instantiatedTypes.forEach((t) {
liveTypeVisitor.visitType(t, false);
ClassUse classUse =
@@ -1458,8 +1456,26 @@
testedTypeVisitor.visitType(t, false);
});
- explicitIsChecks.forEach(processType);
- implicitIsChecks.forEach(processType);
+ void processMethodTypeArguments(_, Set<DartType> typeArguments) {
+ for (DartType typeArgument in typeArguments) {
+ liveTypeVisitor.visit(typeArgument, true);
+ }
+ }
+
+ codegenWorldBuilder.forEachStaticTypeArgument(processMethodTypeArguments);
+ codegenWorldBuilder.forEachDynamicTypeArgument(processMethodTypeArguments);
+
+ void processCheckedType(DartType t) {
+ if (t is FunctionType) {
+ checkedFunctionTypes.add(t);
+ } else if (t is InterfaceType) {
+ checkedClasses.add(t.element);
+ }
+ testedTypeVisitor.visitType(t, false);
+ }
+
+ explicitIsChecks.forEach(processCheckedType);
+ implicitIsChecks.forEach(processCheckedType);
cachedRequiredChecks = _computeChecks(classUseMap);
rtiChecksBuilderClosed = true;
diff --git a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
index e329e9d..0ac5234 100644
--- a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
@@ -359,6 +359,19 @@
return receiver[a0] = a1;
''', typeCheck);
}
+ } else if (selector.isCall) {
+ if (selector.name == 'abs' && selector.argumentCount == 0) {
+ return js.statement(r'''
+ if (typeof receiver === "number") return Math.abs(receiver);
+ ''');
+ }
+ } else if (selector.isGetter) {
+ if (selector.name == 'sign') {
+ return js.statement(r'''
+ if (typeof receiver === "number")
+ return receiver > 0 ? 1 : receiver < 0 ? -1 : receiver;
+ ''');
+ }
}
return null;
}
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 3a68f98..0b7ac2b 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -759,7 +759,7 @@
List<StubMethod> isChecks = <StubMethod>[];
if (_nativeData.isJsInteropClass(cls)) {
typeTests.forEachProperty(_sorter, (js.Name name, js.Node code) {
- _classes[_commonElements.jsInterceptorClass]
+ _classes[_commonElements.jsJavaScriptObjectClass]
.isChecks
.add(_buildStubMethod(name, code));
});
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index 0214083..0462d15 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -116,6 +116,7 @@
// Mixes in the properties of [mixin] into [cls].
function mixin(cls, mixin) {
copyProperties(mixin.prototype, cls.prototype);
+ cls.prototype.constructor = cls;
}
// Creates a lazy field.
diff --git a/pkg/compiler/lib/src/js_model/closure.dart b/pkg/compiler/lib/src/js_model/closure.dart
index ab6b21e..d1dff65 100644
--- a/pkg/compiler/lib/src/js_model/closure.dart
+++ b/pkg/compiler/lib/src/js_model/closure.dart
@@ -221,7 +221,8 @@
allBoxedVariables,
classNeedsTypeArguments,
methodNeedsTypeArguments,
- localFunctionNeedsTypeArguments);
+ localFunctionNeedsTypeArguments,
+ needsSignature: localFunctionNeedsSignature(functionNode));
// Add also for the call method.
_scopeMap[closureClassInfo.callMethod] = closureClassInfo;
_scopeMap[closureClassInfo.signatureMethod] = closureClassInfo;
@@ -245,13 +246,15 @@
Map<Local, JRecordField> boxedVariables,
bool Function(ClassEntity) classNeedsTypeArguments,
bool Function(FunctionEntity) methodNeedsTypeArguments,
- bool Function(ir.Node) localFunctionNeedsTypeArguments) {
+ bool Function(ir.Node) localFunctionNeedsTypeArguments,
+ {bool needsSignature}) {
_updateScopeBasedOnRtiNeed(info, node.parent, classNeedsTypeArguments,
methodNeedsTypeArguments, localFunctionNeedsTypeArguments, member);
KernelToLocalsMap localsMap = _globalLocalsMap.getLocalsMap(member);
KernelClosureClassInfo closureClassInfo =
closedWorldBuilder.buildClosureClass(
- member, node, member.library, boxedVariables, info, localsMap);
+ member, node, member.library, boxedVariables, info, localsMap,
+ needsSignature: needsSignature);
// We want the original declaration where that function is used to point
// to the correct closure class.
@@ -260,7 +263,7 @@
_memberClosureRepresentationMap[closureClassInfo.signatureMethod] =
closureClassInfo;
_globalLocalsMap.setLocalsMap(closureClassInfo.callMethod, localsMap);
- if (_strongMode) {
+ if (needsSignature) {
_globalLocalsMap.setLocalsMap(
closureClassInfo.signatureMethod, localsMap);
}
@@ -847,10 +850,11 @@
final TypeVariableKind kind;
final ir.TreeNode typeDeclaration;
+ /// [context] can be either an ir.Member or a ir.FunctionDeclaration or
+ /// ir.FunctionExpression.
factory TypeVariableTypeWithContext(
- ir.TypeParameterType type, ir.Member memberContext) {
+ ir.TypeParameterType type, ir.TreeNode context) {
TypeVariableKind kind;
- ir.TreeNode context = memberContext;
ir.TreeNode typeDeclaration = type.parameter.parent;
if (typeDeclaration == null) {
// We have a function type variable, like `T` in `void Function<T>(int)`.
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 0d0e81b..0a09460 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -523,7 +523,8 @@
JLibrary enclosingLibrary,
Map<Local, JRecordField> boxedVariables,
KernelScopeInfo info,
- KernelToLocalsMap localsMap) {
+ KernelToLocalsMap localsMap,
+ {bool needsSignature}) {
ClassEntity superclass = _commonElements.closureClass;
KernelClosureClassInfo closureClassInfo = _elementMap.constructClosureClass(
@@ -533,7 +534,8 @@
boxedVariables,
info,
localsMap,
- new InterfaceType(superclass, const []));
+ new InterfaceType(superclass, const []),
+ needsSignature: needsSignature);
// Tell the hierarchy that this is the super class. then we can use
// .getSupertypes(class)
@@ -692,6 +694,9 @@
final Entity Function(Entity) toBackendEntity;
TypeConverter(this.toBackendEntity);
+ Map<FunctionTypeVariable, FunctionTypeVariable> _functionTypeVariables =
+ <FunctionTypeVariable, FunctionTypeVariable>{};
+
DartType convert(DartType type) => type.accept(this, null);
DartType visitVoidType(VoidType type, _) => type;
@@ -702,8 +707,7 @@
}
DartType visitFunctionTypeVariable(FunctionTypeVariable type, _) {
- var bound = type.bound?.accept(this, null);
- return new FunctionTypeVariable(type.index, bound);
+ return _functionTypeVariables[type];
}
DartType visitFunctionType(FunctionType type, _) {
@@ -711,9 +715,18 @@
var parameterTypes = _visitList(type.parameterTypes);
var optionalParameterTypes = _visitList(type.optionalParameterTypes);
var namedParameterTypes = _visitList(type.namedParameterTypes);
- var typeVariables = type.typeVariables
- .map<FunctionTypeVariable>((t) => t.accept<DartType, Null>(this, null))
- .toList();
+ List<FunctionTypeVariable> typeVariables = <FunctionTypeVariable>[];
+ for (FunctionTypeVariable typeVariable in type.typeVariables) {
+ typeVariables.add(_functionTypeVariables[typeVariable] =
+ new FunctionTypeVariable(typeVariable.index));
+ }
+ for (FunctionTypeVariable typeVariable in type.typeVariables) {
+ _functionTypeVariables[typeVariable].bound =
+ typeVariable.bound?.accept(this, null);
+ }
+ for (FunctionTypeVariable typeVariable in type.typeVariables) {
+ _functionTypeVariables.remove(typeVariable);
+ }
var typedefType = type.typedefType?.accept(this, null);
return new FunctionType(returnType, parameterTypes, optionalParameterTypes,
type.namedParameters, namedParameterTypes, typeVariables, typedefType);
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index 48a03a8..af6f30a 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -36,6 +36,7 @@
///
/// Use this for sharing maps between members that share IR nodes.
void setLocalsMap(MemberEntity member, KernelToLocalsMap localsMap) {
+ assert(member != null, "No member provided.");
assert(!_localsMaps.containsKey(member),
"Locals map already created for $member.");
_localsMaps[member] = localsMap;
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 980faf4..ddb3abb 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -447,8 +447,7 @@
}
typeVariables = new List<FunctionTypeVariable>.generate(
node.typeParameters.length,
- (int index) => new FunctionTypeVariable(
- index, getDartType(node.typeParameters[index].bound)));
+ (int index) => new FunctionTypeVariable(index));
DartType subst(DartType type) {
return type.subst(typeVariables, typeParameters);
@@ -457,6 +456,10 @@
parameterTypes = parameterTypes.map(subst).toList();
optionalParameterTypes = optionalParameterTypes.map(subst).toList();
namedParameterTypes = namedParameterTypes.map(subst).toList();
+ for (int index = 0; index < typeVariables.length; index++) {
+ typeVariables[index].bound =
+ subst(getDartType(node.typeParameters[index].bound));
+ }
} else {
typeVariables = const <FunctionTypeVariable>[];
}
@@ -921,6 +924,10 @@
createTypeVariable(_getMethod(procedure), node.name, index),
new TypeVariableData(node));
}
+ } else {
+ throw new UnsupportedError(
+ 'Unsupported function type parameter parent '
+ 'node ${func.parent}.');
}
}
throw new UnsupportedError('Unsupported type parameter type node $node.');
@@ -1277,10 +1284,15 @@
localFunction = _localFunctionMap[node] =
new KLocalFunction(name, memberContext, executableContext, node);
int index = 0;
+ List<KLocalTypeVariable> typeVariables = <KLocalTypeVariable>[];
for (ir.TypeParameter typeParameter in function.typeParameters) {
- KLocalTypeVariable typeVariable = _typeVariableMap[typeParameter] =
- new KLocalTypeVariable(localFunction, typeParameter.name, index);
- typeVariable.bound = getDartType(typeParameter.bound);
+ typeVariables.add(_typeVariableMap[typeParameter] =
+ new KLocalTypeVariable(localFunction, typeParameter.name, index));
+ index++;
+ }
+ index = 0;
+ for (ir.TypeParameter typeParameter in function.typeParameters) {
+ typeVariables[index].bound = getDartType(typeParameter.bound);
index++;
}
localFunction.functionType = getFunctionType(function);
@@ -1648,11 +1660,7 @@
List<FunctionTypeVariable> typeVariables;
for (ir.TypeParameter typeParameter in node.typeParameters) {
if (elementMap.options.strongMode) {
- // TODO(johnniwinther): Support recursive type variable bounds, like
- // `void Function<T extends Foo<T>>(T t)` when #31531 is fixed.
- DartType bound = typeParameter.bound.accept(this);
- FunctionTypeVariable typeVariable =
- new FunctionTypeVariable(index, bound);
+ FunctionTypeVariable typeVariable = new FunctionTypeVariable(index);
currentFunctionTypeParameters[typeParameter] = typeVariable;
typeVariables ??= <FunctionTypeVariable>[];
typeVariables.add(typeVariable);
@@ -1661,6 +1669,12 @@
}
index++;
}
+ if (typeVariables != null) {
+ for (int index = 0; index < typeVariables.length; index++) {
+ typeVariables[index].bound =
+ node.typeParameters[index].bound.accept(this);
+ }
+ }
DartType typedefType =
node.typedef == null ? null : elementMap.getTypedefType(node.typedef);
@@ -2441,7 +2455,8 @@
Map<Local, JRecordField> recordFieldsVisibleInScope,
KernelScopeInfo info,
KernelToLocalsMap localsMap,
- InterfaceType supertype) {
+ InterfaceType supertype,
+ {bool needsSignature}) {
InterfaceType memberThisType = member.enclosingClass != null
? _elementEnvironment.getThisType(member.enclosingClass)
: null;
@@ -2510,7 +2525,7 @@
_buildClosureClassFields(closureClassInfo, member, memberThisType, info,
localsMap, recordFieldsVisibleInScope, memberMap);
- if (options.strongMode) {
+ if (needsSignature) {
_constructSignatureMethod(closureClassInfo, memberMap, node,
memberThisType, location, typeVariableAccess);
}
diff --git a/pkg/compiler/lib/src/kernel/element_map_mixins.dart b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
index 9138c5f..c064fbb 100644
--- a/pkg/compiler/lib/src/kernel/element_map_mixins.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_mixins.dart
@@ -490,6 +490,8 @@
final bool requireConstant;
final KernelToElementMapBaseMixin elementMap;
ir.TreeNode failNode;
+ final Map<ir.VariableDeclaration, ConstantExpression> _initializerLocals =
+ <ir.VariableDeclaration, ConstantExpression>{};
Constantifier(this.elementMap, {this.requireConstant: true});
@@ -557,6 +559,10 @@
@override
ConstantExpression visitVariableGet(ir.VariableGet node) {
+ ConstantExpression constant = _initializerLocals[node.variable];
+ if (constant != null) {
+ return constant;
+ }
if (node.variable.parent is ir.FunctionNode) {
ir.FunctionNode function = node.variable.parent;
int index = function.positionalParameters.indexOf(node.variable);
@@ -902,19 +908,20 @@
{'constructorName': constructorName});
return new ErroneousConstantConstructor();
} else if (initializer is ir.LocalInitializer) {
- // TODO(johnniwinther): Support this where it makes sense. Currently
- // invalid initializers are currently encoded as local initializers with
- // a throwing initializer.
- // TODO(johnniwinther): Use [_ErroneousInitializerVisitor] in
- // `ssa/builder_kernel.dart` to identify erroneous initializer.
- // TODO(johnniwinther) Handle local initializers that are valid as
- // constants, if any.
- String constructorName = '${cls.name}.${node.name}';
- elementMap.reporter.reportErrorMessage(
- computeSourceSpanFromTreeNode(initializer),
- MessageKind.INVALID_CONSTANT_CONSTRUCTOR,
- {'constructorName': constructorName});
- return new ErroneousConstantConstructor();
+ ir.VariableDeclaration variable = initializer.variable;
+ ConstantExpression constant = visit(variable.initializer);
+ if (constant != null) {
+ _initializerLocals[variable] = constant;
+ } else {
+ // TODO(johnniwinther): Use [_ErroneousInitializerVisitor] in
+ // `ssa/builder_kernel.dart` to identify erroneous initializer.
+ String constructorName = '${cls.name}.${node.name}';
+ elementMap.reporter.reportErrorMessage(
+ computeSourceSpanFromTreeNode(initializer),
+ MessageKind.INVALID_CONSTANT_CONSTRUCTOR,
+ {'constructorName': constructorName});
+ return new ErroneousConstantConstructor();
+ }
} else {
throw new UnsupportedError(
'Unexpected initializer $initializer (${initializer.runtimeType})');
diff --git a/pkg/compiler/lib/src/kernel/front_end_adapter.dart b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
index bb70bb5..2dd227a 100644
--- a/pkg/compiler/lib/src/kernel/front_end_adapter.dart
+++ b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
@@ -99,6 +99,9 @@
case fe.Severity.nit:
reporter.reportHintMessage(span, kind, {'text': message.message});
break;
+ case fe.Severity.context:
+ reporter.reportInfo(span, kind, {'text': message.message});
+ break;
default:
throw new UnimplementedError('unhandled severity ${message.severity}');
}
diff --git a/pkg/compiler/lib/src/parser/node_listener.dart b/pkg/compiler/lib/src/parser/node_listener.dart
index 4293c57..342c4cd 100644
--- a/pkg/compiler/lib/src/parser/node_listener.dart
+++ b/pkg/compiler/lib/src/parser/node_listener.dart
@@ -748,6 +748,29 @@
}
@override
+ void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
+ Token varFinalOrConst, Token name) {
+ Link<Node> modifiers = const Link<Node>();
+ if (varFinalOrConst != null) {
+ modifiers = modifiers.prepend(new Identifier(varFinalOrConst));
+ }
+ if (covariantToken != null) {
+ modifiers = modifiers.prepend(new Identifier(covariantToken));
+ }
+ if (staticToken != null) {
+ modifiers = modifiers.prepend(new Identifier(staticToken));
+ }
+ if (externalToken != null) {
+ modifiers = modifiers.prepend(new Identifier(externalToken));
+ }
+ if (modifiers.isEmpty) {
+ pushNode(Modifiers.EMPTY);
+ } else {
+ pushNode(new Modifiers(new NodeList(null, modifiers, null, ' ')));
+ }
+ }
+
+ @override
void endMethod(
Token getOrSet, Token beginToken, Token beginParam, Token endToken) {
Statement body = popNode();
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 25170a9..3492172 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -1487,6 +1487,13 @@
visitNegate(HNegate node) => visitInvokeUnary(node, '-');
+ visitAbs(HAbs node) {
+ use(node.operand);
+ push(js
+ .js('Math.abs(#)', pop())
+ .withSourceInformation(node.sourceInformation));
+ }
+
visitLess(HLess node) => visitRelational(node, '<');
visitLessEqual(HLessEqual node) => visitRelational(node, '<=');
visitGreater(HGreater node) => visitRelational(node, '>');
diff --git a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
index bb5bef1..d98db39 100644
--- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
+++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
@@ -87,6 +87,7 @@
if (selector.namedArguments.length == 0) {
int argumentCount = selector.argumentCount;
if (argumentCount == 0) {
+ if (name == 'abs') return const AbsSpecializer();
if (name == 'round') return const RoundSpecializer();
if (name == 'trim') return const TrimSpecializer();
} else if (argumentCount == 1) {
@@ -232,6 +233,45 @@
}
}
+class AbsSpecializer extends InvokeDynamicSpecializer {
+ const AbsSpecializer();
+
+ UnaryOperation operation(ConstantSystem constantSystem) {
+ return constantSystem.abs;
+ }
+
+ TypeMask computeTypeFromInputTypes(
+ HInvokeDynamic instruction,
+ GlobalTypeInferenceResults results,
+ CompilerOptions options,
+ ClosedWorld closedWorld) {
+ HInstruction input = instruction.inputs[1];
+ if (input.isNumberOrNull(closedWorld)) {
+ return input.instructionType.nonNullable();
+ }
+ return super
+ .computeTypeFromInputTypes(instruction, results, options, closedWorld);
+ }
+
+ HInstruction tryConvertToBuiltin(
+ HInvokeDynamic instruction,
+ HGraph graph,
+ GlobalTypeInferenceResults results,
+ CompilerOptions options,
+ CommonElements commonElements,
+ ClosedWorld closedWorld) {
+ HInstruction input = instruction.inputs[1];
+ if (input.isNumber(closedWorld)) {
+ return new HAbs(
+ input,
+ instruction.selector,
+ computeTypeFromInputTypes(
+ instruction, results, options, closedWorld));
+ }
+ return null;
+ }
+}
+
abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
const BinaryArithmeticSpecializer();
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index 081642d..423a94d 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -26,6 +26,7 @@
import 'validate.dart';
abstract class HVisitor<R> {
+ R visitAbs(HAbs node);
R visitAdd(HAdd node);
R visitAwait(HAwait node);
R visitBitAnd(HBitAnd node);
@@ -382,6 +383,7 @@
visitFieldAccess(HFieldAccess node) => visitInstruction(node);
visitRelational(HRelational node) => visitInvokeBinary(node);
+ visitAbs(HAbs node) => visitInvokeUnary(node);
visitAdd(HAdd node) => visitBinaryArithmetic(node);
visitBitAnd(HBitAnd node) => visitBinaryBitOp(node);
visitBitNot(HBitNot node) => visitInvokeUnary(node);
@@ -931,6 +933,7 @@
static const int FOREIGN_CODE_TYPECODE = 41;
static const int REMAINDER_TYPECODE = 42;
static const int GET_LENGTH_TYPECODE = 43;
+ static const int ABS_TYPECODE = 44;
HInstruction(this.inputs, this.instructionType)
: id = idCounter++,
@@ -2372,6 +2375,17 @@
bool dataEquals(HInstruction other) => true;
}
+class HAbs extends HInvokeUnary {
+ HAbs(HInstruction input, Selector selector, TypeMask type)
+ : super(input, selector, type);
+ accept(HVisitor visitor) => visitor.visitAbs(this);
+
+ UnaryOperation operation(ConstantSystem constantSystem) => constantSystem.abs;
+ int typeCode() => HInstruction.ABS_TYPECODE;
+ bool typeEquals(other) => other is HAbs;
+ bool dataEquals(HInstruction other) => true;
+}
+
class HBitNot extends HInvokeUnary {
HBitNot(HInstruction input, Selector selector, TypeMask type)
: super(input, selector, type);
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index 00e0fac..c05bf1f 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -164,6 +164,11 @@
return '$opcode: $left $right';
}
+ String visitAbs(HAbs node) {
+ String operand = temporaryId(node.operand);
+ return "Abs: $operand";
+ }
+
String visitAdd(HAdd node) => handleInvokeBinary(node, 'Add');
String visitBitAnd(HBitAnd node) => handleInvokeBinary(node, 'BitAnd');
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index 643aad9..3fea8fd 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -161,6 +161,11 @@
return instruction.operand.instructionType;
}
+ TypeMask visitAbs(HAbs instruction) {
+ // TODO(sra): Can narrow to non-negative type for integers.
+ return instruction.operand.instructionType;
+ }
+
TypeMask visitInstruction(HInstruction instruction) {
assert(instruction.instructionType != null);
return instruction.instructionType;
@@ -348,22 +353,28 @@
TypeMask visitInvokeDynamic(HInvokeDynamic instruction) {
if (instruction.isInterceptedCall) {
- // We cannot do the following optimization now, because we have
- // to wait for the type propagation to be stable. The receiver
- // of [instruction] might move from number to dynamic.
- pendingOptimizations.putIfAbsent(
- instruction,
- () => () {
- Selector selector = instruction.selector;
- if (selector.isOperator && selector.name != '==') {
- if (checkReceiver(instruction)) {
- addAllUsersBut(instruction, instruction.inputs[1]);
- }
- if (!selector.isUnaryOperator && checkArgument(instruction)) {
- addAllUsersBut(instruction, instruction.inputs[2]);
- }
- }
- });
+ // We cannot do the following optimization now, because we have to wait
+ // for the type propagation to be stable. The receiver of [instruction]
+ // might move from number to dynamic.
+ void checkInputs() {
+ Selector selector = instruction.selector;
+ if (selector.isOperator && selector.name != '==') {
+ if (checkReceiver(instruction)) {
+ addAllUsersBut(instruction, instruction.inputs[1]);
+ }
+ if (!selector.isUnaryOperator && checkArgument(instruction)) {
+ addAllUsersBut(instruction, instruction.inputs[2]);
+ }
+ } else if (selector.isCall) {
+ if (selector.name == 'abs' && selector.argumentCount == 0) {
+ if (checkReceiver(instruction)) {
+ addAllUsersBut(instruction, instruction.inputs[1]);
+ }
+ }
+ }
+ }
+
+ pendingOptimizations.putIfAbsent(instruction, () => checkInputs);
}
HInstruction receiver = instruction.getDartReceiver(closedWorld);
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index 80cf145..383507a 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -44,12 +44,12 @@
import '../js_ast/js_ast.dart' show js;
import '../js_ast/source_map_printer.dart' show NodeEnd, NodeSpan, HoverComment;
import 'ast_builder.dart';
-import 'module_compiler.dart' show BuildUnit, CompilerOptions, JSModuleFile;
import 'element_helpers.dart';
import 'extension_types.dart' show ExtensionTypeSet;
import 'js_interop.dart';
import 'js_typeref_codegen.dart' show JSTypeRefCodegen;
import 'js_typerep.dart' show JSTypeRep, JSType;
+import 'module_compiler.dart' show BuildUnit, CompilerOptions, JSModuleFile;
import 'nullable_type_inference.dart' show NullableTypeInference;
import 'property_model.dart';
import 'reify_coercions.dart' show CoercionReifier;
@@ -457,7 +457,7 @@
bool _isExternal(Element e) =>
e is ExecutableElement && e.isExternal ||
e is PropertyInducingElement &&
- (e.getter?.isExternal ?? false || e.setter?.isExternal ?? false);
+ ((e.getter?.isExternal ?? false) || (e.setter?.isExternal ?? false));
bool _isJSElement(Element e) =>
e?.library != null &&
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_ddc.status b/pkg/dev_compiler/test/sourcemap/stacktrace_ddc.status
index 3c3311b..4e909a6 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_ddc.status
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_ddc.status
@@ -2,11 +2,11 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
-/null_interceptor_field: Crash
-/throw_in_constructor_from_async: Crash
-/throw_in_instance_method: Crash
-/throw_in_static_method: Crash # Test works, but DDC's hover support means the expected column in the test is wrong
+null_interceptor_field: Crash
+throw_in_constructor_from_async: Crash
+throw_in_instance_method: Crash
+throw_in_static_method: Crash # Test works, but DDC's hover support means the expected column in the test is wrong
-/throw_in_async: Crash # dartbug.com/31451
-/throw_in_awaited_async: Crash # dartbug.com/31451
-/throw_in_top_level_method_from_async: Crash # dartbug.com/31451
\ No newline at end of file
+throw_in_async: Crash # dartbug.com/31451
+throw_in_awaited_async: Crash # dartbug.com/31451
+throw_in_top_level_method_from_async: Crash # dartbug.com/31451
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_ddk.status b/pkg/dev_compiler/test/sourcemap/stacktrace_ddk.status
index c817e53..0a07791 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_ddk.status
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_ddk.status
@@ -1,9 +1,9 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
-/throw_in_async: Crash # dartbug.com/31451
-/throw_in_awaited_async: Crash # dartbug.com/31451
-/throw_in_constructor_from_async: Crash # dartbug.com/31451
-/throw_in_instance_method: Crash # Test works, but DDC's hover support means the expected column in the test is wrong
-/throw_in_top_level_method_from_async: Crash # dartbug.com/31451
+throw_in_async: Crash # dartbug.com/31451
+throw_in_awaited_async: Crash # dartbug.com/31451
+throw_in_constructor_from_async: Crash # dartbug.com/31451
+throw_in_instance_method: Crash # Test works, but DDC's hover support means the expected column in the test is wrong
+throw_in_top_level_method_from_async: Crash # dartbug.com/31451
diff --git a/pkg/front_end/lib/src/api_prototype/kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/kernel_generator.dart
index e37423a..753cb83 100644
--- a/pkg/front_end/lib/src/api_prototype/kernel_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/kernel_generator.dart
@@ -6,16 +6,23 @@
library front_end.kernel_generator;
import 'dart:async' show Future;
-import 'dart:async';
import 'package:kernel/kernel.dart' show Program;
-import 'compiler_options.dart';
-import '../base/processed_options.dart';
-import '../fasta/fasta_codes.dart';
-import '../fasta/compiler_context.dart';
-import '../fasta/severity.dart';
-import '../kernel_generator_impl.dart';
+import '../base/processed_options.dart' show ProcessedOptions;
+
+import '../fasta/compiler_context.dart' show CompilerContext;
+
+import '../fasta/fasta_codes.dart' show messageMissingMain;
+
+import '../fasta/parser.dart' show noLength;
+
+import '../fasta/severity.dart' show Severity;
+
+import '../kernel_generator_impl.dart'
+ show generateKernel, generateKernelInternal;
+
+import 'compiler_options.dart' show CompilerOptions;
/// Generates a kernel representation of the program whose main library is in
/// the given [source].
@@ -44,8 +51,9 @@
if (program == null) return null;
if (program.mainMethod == null) {
- context.options
- .report(messageMissingMain.withLocation(source, -1), Severity.error);
+ context.options.report(
+ messageMissingMain.withLocation(source, -1, noLength),
+ Severity.error);
return null;
}
return program;
diff --git a/pkg/front_end/lib/src/api_unstable/compiler_state.dart b/pkg/front_end/lib/src/api_unstable/compiler_state.dart
index f950fe1..13d1327 100644
--- a/pkg/front_end/lib/src/api_unstable/compiler_state.dart
+++ b/pkg/front_end/lib/src/api_unstable/compiler_state.dart
@@ -2,10 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:front_end/src/base/processed_options.dart';
+import '../api_prototype/compiler_options.dart' show CompilerOptions;
-import '../api_prototype/compiler_options.dart';
-import '../base/processed_options.dart';
+import '../base/processed_options.dart' show ProcessedOptions;
class InitializedCompilerState {
final CompilerOptions options;
diff --git a/pkg/front_end/lib/src/api_unstable/dart2js.dart b/pkg/front_end/lib/src/api_unstable/dart2js.dart
index a7adc1f..57f3e25 100644
--- a/pkg/front_end/lib/src/api_unstable/dart2js.dart
+++ b/pkg/front_end/lib/src/api_unstable/dart2js.dart
@@ -4,21 +4,30 @@
import 'dart:async' show Future;
-import 'package:front_end/src/base/processed_options.dart';
-import 'package:front_end/src/kernel_generator_impl.dart';
import 'package:kernel/kernel.dart' show Program;
+
import 'package:kernel/target/targets.dart' show Target;
-import '../api_prototype/compiler_options.dart';
-import '../api_prototype/file_system.dart';
-import '../base/processed_options.dart';
-import '../fasta/compiler_context.dart';
-import '../fasta/fasta_codes.dart';
-import '../fasta/severity.dart';
-import '../kernel_generator_impl.dart';
-import 'compiler_state.dart';
+import '../api_prototype/compiler_options.dart'
+ show CompilerOptions, ErrorHandler;
-export 'compiler_state.dart';
+import '../api_prototype/file_system.dart' show FileSystem;
+
+import '../base/processed_options.dart' show ProcessedOptions;
+
+import '../fasta/compiler_context.dart' show CompilerContext;
+
+import '../fasta/fasta_codes.dart' show messageMissingMain;
+
+import '../fasta/parser.dart' show noLength;
+
+import '../fasta/severity.dart' show Severity;
+
+import '../kernel_generator_impl.dart' show generateKernelInternal;
+
+import 'compiler_state.dart' show InitializedCompilerState;
+
+export 'compiler_state.dart' show InitializedCompilerState;
InitializedCompilerState initializeCompiler(InitializedCompilerState oldState,
Target target, Uri sdkUri, Uri packagesFileUri) {
@@ -58,8 +67,8 @@
Program program = compilerResult?.program;
if (program == null) return null;
if (program.mainMethod == null) {
- context.options
- .report(messageMissingMain.withLocation(input, -1), Severity.error);
+ context.options.report(
+ messageMissingMain.withLocation(input, -1, noLength), Severity.error);
return null;
}
return compilerResult;
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 4346164..78da339 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -2,37 +2,75 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
-import 'package:front_end/src/api_prototype/compilation_message.dart';
-import 'package:front_end/src/api_prototype/byte_store.dart';
-import 'package:front_end/src/api_prototype/compiler_options.dart';
-import 'package:front_end/src/api_prototype/file_system.dart';
-import 'package:front_end/src/base/performance_logger.dart';
-import 'package:front_end/src/fasta/fasta_codes.dart';
-import 'package:front_end/src/fasta/problems.dart' show unimplemented;
-import 'package:front_end/src/fasta/severity.dart';
-import 'package:front_end/src/fasta/ticker.dart';
-import 'package:front_end/src/fasta/uri_translator.dart';
-import 'package:front_end/src/fasta/uri_translator_impl.dart';
-import 'package:kernel/kernel.dart' show CanonicalName, Location, Program;
-import 'package:kernel/target/targets.dart';
-import 'package:kernel/target/vm.dart';
-import 'package:package_config/packages.dart' show Packages;
-import 'package:package_config/src/packages_impl.dart'
- show NonFilePackagesDirectoryPackages, MapPackages;
-import 'package:package_config/packages_file.dart' as package_config;
-import 'package:source_span/source_span.dart' show SourceSpan, SourceLocation;
-import 'package:front_end/src/fasta/command_line_reporting.dart'
- as command_line_reporting;
+import 'dart:async' show Future;
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
-import '../fasta/messages.dart' show getLocation;
+import 'package:kernel/kernel.dart' show CanonicalName, Location, Program;
+
+import 'package:kernel/target/targets.dart' show Target, TargetFlags;
+
+import 'package:kernel/target/vm.dart' show VmTarget;
+
+import 'package:package_config/packages.dart' show Packages;
+
+import 'package:package_config/packages_file.dart' as package_config;
+
+import 'package:package_config/src/packages_impl.dart'
+ show NonFilePackagesDirectoryPackages, MapPackages;
+
+import 'package:source_span/source_span.dart' show SourceSpan, SourceLocation;
+
+import '../api_prototype/byte_store.dart' show ByteStore;
+
+import '../api_prototype/compilation_message.dart' show CompilationMessage;
+
+import '../api_prototype/compiler_options.dart' show CompilerOptions;
+
+import '../api_prototype/file_system.dart'
+ show FileSystem, FileSystemEntity, FileSystemException;
+
+import '../base/performance_logger.dart' show PerformanceLog;
+
+import '../fasta/command_line_reporting.dart' as command_line_reporting;
import '../fasta/deprecated_problems.dart' show deprecated_InputError;
-import 'libraries_specification.dart';
+import '../fasta/fasta_codes.dart'
+ show
+ LocatedMessage,
+ Message,
+ messageCantInferPackagesFromManyInputs,
+ messageCantInferPackagesFromPackageUri,
+ messageInternalProblemProvidedBothCompileSdkAndSdkSummary,
+ messageMissingInput,
+ templateCannotReadPackagesFile,
+ templateCannotReadSdkSpecification,
+ templateInputFileNotFound,
+ templateInternalProblemUnsupported,
+ templateSdkRootNotFound,
+ templateSdkSpecificationNotFound,
+ templateSdkSummaryNotFound;
+
+import '../fasta/messages.dart' show getLocation;
+
+import '../fasta/parser.dart' show noLength;
+
+import '../fasta/problems.dart' show unimplemented;
+
+import '../fasta/severity.dart' show Severity;
+
+import '../fasta/ticker.dart' show Ticker;
+
+import '../fasta/uri_translator.dart' show UriTranslator;
+
+import '../fasta/uri_translator_impl.dart' show UriTranslatorImpl;
+
+import 'libraries_specification.dart'
+ show
+ LibrariesSpecification,
+ LibrariesSpecificationException,
+ TargetLibrariesSpecification;
/// All options needed for the front end implementation.
///
@@ -198,7 +236,7 @@
void reportWithoutLocation(Message message, Severity severity) {
if (_raw.onProblem != null) {
_raw.onProblem(
- message.withLocation(null, -1),
+ message.withLocation(null, -1, noLength),
severity,
command_line_reporting.formatWithoutLocation(message, severity),
-1,
@@ -214,8 +252,8 @@
return;
}
if (_raw.onError != null) {
- _raw.onError(
- new _CompilationMessage(message.withLocation(null, -1), severity));
+ _raw.onError(new _CompilationMessage(
+ message.withLocation(null, -1, noLength), severity));
}
if (_reportMessages) {
@@ -422,7 +460,9 @@
if (input.scheme == 'dart') return _packages = Packages.noPackages;
if (input.scheme == 'packages') {
- report(messageCantInferPackagesFromPackageUri.withLocation(input, -1),
+ report(
+ messageCantInferPackagesFromPackageUri.withLocation(
+ input, -1, noLength),
Severity.error);
return _packages = Packages.noPackages;
}
@@ -440,7 +480,7 @@
report(
templateCannotReadPackagesFile
.withArguments("$e")
- .withLocation(file, -1),
+ .withLocation(file, -1, noLength),
Severity.error);
return Packages.noPackages;
}
diff --git a/pkg/front_end/lib/src/fasta/builder/class_builder.dart b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
index 7043564..80d8055 100644
--- a/pkg/front_end/lib/src/fasta/builder/class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
@@ -217,12 +217,14 @@
null);
}
- void addCompileTimeError(Message message, int charOffset,
+ void addCompileTimeError(Message message, int charOffset, int length,
{LocatedMessage context}) {
- library.addCompileTimeError(message, charOffset, fileUri, context: context);
+ library.addCompileTimeError(message, charOffset, length, fileUri,
+ context: context);
}
- void addProblem(Message message, int charOffset, {LocatedMessage context}) {
- library.addProblem(message, charOffset, fileUri, context: context);
+ void addProblem(Message message, int charOffset, int length,
+ {LocatedMessage context}) {
+ library.addProblem(message, charOffset, length, fileUri, context: context);
}
}
diff --git a/pkg/front_end/lib/src/fasta/builder/constructor_reference_builder.dart b/pkg/front_end/lib/src/fasta/builder/constructor_reference_builder.dart
index eb2b923..65cd053 100644
--- a/pkg/front_end/lib/src/fasta/builder/constructor_reference_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/constructor_reference_builder.dart
@@ -4,6 +4,10 @@
library fasta.constructor_reference_builder;
+import '../messages.dart' show templateConstructorNotFound;
+
+import '../parser.dart' show noLength;
+
import 'builder.dart'
show
Builder,
@@ -14,8 +18,6 @@
Scope,
TypeBuilder;
-import '../messages.dart' show templateConstructorNotFound;
-
class ConstructorReferenceBuilder extends Builder {
final Object name;
@@ -62,6 +64,7 @@
accessingLibrary.addProblem(
templateConstructorNotFound.withArguments(fullNameForErrors),
charOffset,
+ noLength,
fileUri);
}
}
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index a858fa1a..aa42f64 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -78,18 +78,19 @@
/// arguments passed to this method.
///
/// If [fileUri] is null, it defaults to `this.fileUri`.
- void addCompileTimeError(Message message, int charOffset, Uri fileUri,
+ void addCompileTimeError(
+ Message message, int charOffset, int length, Uri fileUri,
{bool wasHandled: false, LocatedMessage context}) {
fileUri ??= this.fileUri;
- loader.addCompileTimeError(message, charOffset, fileUri,
+ loader.addCompileTimeError(message, charOffset, length, fileUri,
wasHandled: wasHandled, context: context);
}
/// Add a problem with a severity determined by the severity of the message.
- void addProblem(Message message, int charOffset, Uri fileUri,
+ void addProblem(Message message, int charOffset, int length, Uri fileUri,
{LocatedMessage context}) {
fileUri ??= this.fileUri;
- loader.addProblem(message, charOffset, fileUri, context: context);
+ loader.addProblem(message, charOffset, length, fileUri, context: context);
}
/// Returns true if the export scope was modified.
diff --git a/pkg/front_end/lib/src/fasta/command_line_reporting.dart b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
index 3efcc4d..02802e0 100644
--- a/pkg/front_end/lib/src/fasta/command_line_reporting.dart
+++ b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
@@ -12,7 +12,7 @@
import 'package:kernel/ast.dart' show Location;
-import 'colors.dart' show cyan, magenta, red;
+import 'colors.dart' show cyan, green, magenta, red;
import 'compiler_context.dart' show CompilerContext;
@@ -23,6 +23,8 @@
import 'messages.dart' show getLocation, getSourceLine, isVerbose;
+import 'parser.dart' show noLength;
+
import 'problems.dart' show unexpected;
import 'severity.dart' show Severity;
@@ -37,9 +39,15 @@
///
/// This is shared implementation used by methods below, and isn't intended to
/// be called directly.
-String formatInternal(Message message, Severity severity, Uri uri, int offset,
+String formatInternal(
+ Message message, Severity severity, Uri uri, int offset, int length,
{Location location}) {
try {
+ if (length < 1) {
+ // TODO(ahe): Throw in this situation. It is normally an error caused by
+ // empty names.
+ length = 1;
+ }
String text =
"${severityName(severity, capitalized: true)}: ${message.message}";
if (message.tip != null) {
@@ -60,6 +68,10 @@
text = magenta(text);
break;
+ case Severity.context:
+ text = green(text);
+ break;
+
default:
return unexpected("$severity", "formatInternal", -1, null);
}
@@ -71,12 +83,21 @@
String sourceLine = getSourceLine(location);
if (sourceLine == null) {
sourceLine = "";
- } else {
- // TODO(ahe): We only print a single point in the source line as we
- // don't have end positions. Also, we should be able to use
- // package:source_span to produce this.
- sourceLine = "\n$sourceLine\n"
- "${' ' * (location.column - 1)}^";
+ } else if (sourceLine.isNotEmpty) {
+ String indentation = " " * (location.column - 1);
+ String pointer = indentation + ("^" * length);
+ if (pointer.length > sourceLine.length) {
+ // Truncate the carets to handle messages that span multiple lines.
+ int pointerLength = sourceLine.length;
+ // Add one to cover the case of a parser error pointing to EOF when
+ // the last line doesn't end with a newline. For messages spanning
+ // multiple lines, this also provides a minor visual clue that can be
+ // useful for debugging Fasta.
+ pointerLength += 1;
+ pointer = pointer.substring(0, pointerLength);
+ pointer += "...";
+ }
+ sourceLine = "\n$sourceLine\n$pointer";
}
String position =
location == null ? "" : ":${location.line}:${location.column}";
@@ -98,6 +119,7 @@
switch (severity) {
case Severity.error:
case Severity.internalProblem:
+ case Severity.context:
return false;
case Severity.nit:
@@ -127,6 +149,9 @@
case Severity.warning:
return CompilerContext.current.options.throwOnWarningsForDebugging;
+ case Severity.context:
+ return false;
+
default:
return unexpected("$severity", "shouldThrowOn", -1, null);
}
@@ -147,6 +172,9 @@
case Severity.warning:
return capitalized ? "Warning" : "warning";
+ case Severity.context:
+ return capitalized ? "Context" : "context";
+
default:
return unexpected("$severity", "severityName", -1, null);
}
@@ -187,6 +215,7 @@
case Severity.nit:
case Severity.warning:
+ case Severity.context:
return false;
}
return unexpected("$severity", "isCompileTimeError", -1, null);
@@ -224,8 +253,8 @@
/// This method isn't intended to be called directly. Use
/// [CompilerContext.format] instead.
String format(LocatedMessage message, Severity severity, {Location location}) {
- return formatInternal(
- message.messageObject, severity, message.uri, message.charOffset,
+ return formatInternal(message.messageObject, severity, message.uri,
+ message.charOffset, message.length,
location: location);
}
@@ -234,5 +263,5 @@
/// This method isn't intended to be called directly. Use
/// [CompilerContext.formatWithoutLocation] instead.
String formatWithoutLocation(Message message, Severity severity) {
- return formatInternal(message, severity, null, -1);
+ return formatInternal(message, severity, null, -1, noLength);
}
diff --git a/pkg/front_end/lib/src/fasta/deprecated_problems.dart b/pkg/front_end/lib/src/fasta/deprecated_problems.dart
index 9a85000..b69bb9d 100644
--- a/pkg/front_end/lib/src/fasta/deprecated_problems.dart
+++ b/pkg/front_end/lib/src/fasta/deprecated_problems.dart
@@ -15,6 +15,8 @@
import 'messages.dart' show LocatedMessage, isVerbose, templateUnspecified;
+import 'parser.dart' show noLength;
+
import 'severity.dart' show Severity;
const String defaultServerAddress = "http://127.0.0.1:59410/";
@@ -64,7 +66,7 @@
static LocatedMessage toMessage(deprecated_InputError error) {
return templateUnspecified
.withArguments(safeToString(error.error))
- .withLocation(error.uri, error.charOffset);
+ .withLocation(error.uri, error.charOffset, noLength);
}
}
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes.dart b/pkg/front_end/lib/src/fasta/fasta_codes.dart
index 5e36e3d..4d2a4d3 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes.dart
@@ -44,8 +44,8 @@
const Message(this.code, {this.message, this.tip, this.arguments});
- LocatedMessage withLocation(Uri uri, int charOffset) {
- return new LocatedMessage(uri, charOffset, this);
+ LocatedMessage withLocation(Uri uri, int charOffset, int length) {
+ return new LocatedMessage(uri, charOffset, length, this);
}
}
@@ -69,8 +69,9 @@
Code get code => this;
- LocatedMessage withLocation(Uri uri, int charOffset) {
- return new LocatedMessage(uri, charOffset, this);
+ @override
+ LocatedMessage withLocation(Uri uri, int charOffset, int length) {
+ return new LocatedMessage(uri, charOffset, length, this);
}
}
@@ -89,9 +90,12 @@
final int charOffset;
+ final int length;
+
final Message messageObject;
- const LocatedMessage(this.uri, this.charOffset, this.messageObject);
+ const LocatedMessage(
+ this.uri, this.charOffset, this.length, this.messageObject);
Code get code => messageObject.code;
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index fadbf55..caab6a4 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -288,6 +288,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageCandidateFound = const MessageCode("CandidateFound",
+ severity: Severity.context,
message: r"""Found this candidate, but the arguments don't match.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -302,9 +303,9 @@
const Code<Message Function(String name)>
codeCandidateFoundIsDefaultConstructor =
const Code<Message Function(String name)>(
- "CandidateFoundIsDefaultConstructor",
- templateCandidateFoundIsDefaultConstructor,
-);
+ "CandidateFoundIsDefaultConstructor",
+ templateCandidateFoundIsDefaultConstructor,
+ severity: Severity.context);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsCandidateFoundIsDefaultConstructor(String name) {
@@ -635,7 +636,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageConflictsWithTypeVariableCause = const MessageCode(
"ConflictsWithTypeVariableCause",
- severity: Severity.error,
+ severity: Severity.context,
message: r"""This is the type variable.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -709,6 +710,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageConstConstructorNonFinalFieldCause = const MessageCode(
"ConstConstructorNonFinalFieldCause",
+ severity: Severity.context,
message: r"""Field isn't final, but constructor is 'const'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -717,7 +719,10 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageConstConstructorWithBody = const MessageCode(
"ConstConstructorWithBody",
- message: r"""A const constructor can't have a body.""");
+ analyzerCode: "CONST_CONSTRUCTOR_WITH_BODY",
+ dart2jsCode: "*fatal*",
+ message: r"""A const constructor can't have a body.""",
+ tip: r"""Try removing either the 'const' keyword or the body.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeConstFactory = messageConstFactory;
@@ -758,6 +763,17 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstMethod = messageConstMethod;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstMethod = const MessageCode("ConstMethod",
+ analyzerCode: "CONST_METHOD",
+ dart2jsCode: "*fatal*",
+ message:
+ r"""Getters, setters and methods can't be declared to be 'const'.""",
+ tip: r"""Try removing the 'const' keyword.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(String name)>
templateConstructorHasNoSuchNamedParameter =
@@ -801,6 +817,18 @@
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeConstructorWithReturnType =
+ messageConstructorWithReturnType;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageConstructorWithReturnType = const MessageCode(
+ "ConstructorWithReturnType",
+ analyzerCode: "CONSTRUCTOR_WITH_RETURN_TYPE",
+ dart2jsCode: "*fatal*",
+ message: r"""Constructors can't have a return type.""",
+ tip: r"""Try removing the return type.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeContinueOutsideOfLoop = messageContinueOutsideOfLoop;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -984,9 +1012,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeDeferredPrefixDuplicatedCause =
const Code<Message Function(String name)>(
- "DeferredPrefixDuplicatedCause",
- templateDeferredPrefixDuplicatedCause,
-);
+ "DeferredPrefixDuplicatedCause", templateDeferredPrefixDuplicatedCause,
+ severity: Severity.context);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsDeferredPrefixDuplicatedCause(String name) {
@@ -1292,9 +1319,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeDuplicatedParameterNameCause =
const Code<Message Function(String name)>(
- "DuplicatedParameterNameCause",
- templateDuplicatedParameterNameCause,
-);
+ "DuplicatedParameterNameCause", templateDuplicatedParameterNameCause,
+ severity: Severity.context);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsDuplicatedParameterNameCause(String name) {
@@ -1641,7 +1667,9 @@
const Code<Message Function(Token token)> codeExpectedType =
const Code<Message Function(Token token)>(
"ExpectedType", templateExpectedType,
- analyzerCode: "EXPECTED_TYPE_NAME", dart2jsCode: "*fatal*");
+ analyzerCode: "EXPECTED_TYPE_NAME",
+ dart2jsCode: "*fatal*",
+ severity: Severity.error);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsExpectedType(Token token) {
@@ -1996,6 +2024,19 @@
-h Display this message (add -v for information about all options).""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeFieldInitializerOutsideConstructor =
+ messageFieldInitializerOutsideConstructor;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageFieldInitializerOutsideConstructor = const MessageCode(
+ "FieldInitializerOutsideConstructor",
+ analyzerCode: "FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR",
+ dart2jsCode: "*fatal*",
+ message: r"""Field formal parameters can only be used in a constructor.""",
+ tip:
+ r"""Try replacing the field formal parameter with a normal parameter.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFinalAndCovariant = messageFinalAndCovariant;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -2081,7 +2122,7 @@
const Code<Message Function(String name)>(
"FinalInstanceVariableAlreadyInitializedCause",
templateFinalInstanceVariableAlreadyInitializedCause,
- severity: Severity.errorLegacyWarning);
+ severity: Severity.context);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsFinalInstanceVariableAlreadyInitializedCause(
@@ -2261,9 +2302,9 @@
const Code<Message Function(String name)>
codeIllegalMixinDueToConstructorsCause =
const Code<Message Function(String name)>(
- "IllegalMixinDueToConstructorsCause",
- templateIllegalMixinDueToConstructorsCause,
-);
+ "IllegalMixinDueToConstructorsCause",
+ templateIllegalMixinDueToConstructorsCause,
+ severity: Severity.context);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsIllegalMixinDueToConstructorsCause(String name) {
@@ -3865,9 +3906,8 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeOverriddenMethodCause =
const Code<Message Function(String name)>(
- "OverriddenMethodCause",
- templateOverriddenMethodCause,
-);
+ "OverriddenMethodCause", templateOverriddenMethodCause,
+ severity: Severity.context);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsOverriddenMethodCause(String name) {
@@ -4260,6 +4300,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messagePatchClassOrigin = const MessageCode(
"PatchClassOrigin",
+ severity: Severity.context,
message: r"""This is the origin class.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -4286,6 +4327,7 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messagePatchDeclarationOrigin = const MessageCode(
"PatchDeclarationOrigin",
+ severity: Severity.context,
message: r"""This is the origin declaration.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -5182,18 +5224,22 @@
const Template<Message Function(String name)>(
messageTemplate:
r"""Can't use type arguments with type variable '#name'.""",
+ tipTemplate: r"""Try removing the type arguments.""",
withArguments: _withArgumentsTypeArgumentsOnTypeVariable);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeTypeArgumentsOnTypeVariable =
const Code<Message Function(String name)>(
"TypeArgumentsOnTypeVariable", templateTypeArgumentsOnTypeVariable,
+ analyzerCode: "TYPE_ARGUMENTS_ON_TYPE_VARIABLE",
+ dart2jsCode: "*fatal*",
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTypeArgumentsOnTypeVariable(String name) {
return new Message(codeTypeArgumentsOnTypeVariable,
message: """Can't use type arguments with type variable '$name'.""",
+ tip: """Try removing the type arguments.""",
arguments: {'name': name});
}
@@ -5233,10 +5279,9 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeTypeVariableDuplicatedNameCause =
- const Code<Message Function(String name)>(
- "TypeVariableDuplicatedNameCause",
- templateTypeVariableDuplicatedNameCause,
-);
+ const Code<Message Function(String name)>("TypeVariableDuplicatedNameCause",
+ templateTypeVariableDuplicatedNameCause,
+ severity: Severity.context);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTypeVariableDuplicatedNameCause(String name) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 5633f5f..60992ba 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -22,6 +22,10 @@
IdentifierContext,
MemberKind,
closeBraceTokenFor,
+ lengthForToken,
+ lengthOfSpan,
+ noLength,
+ offsetForToken,
optional;
import '../parser/class_member_parser.dart' show ClassMemberParser;
@@ -65,8 +69,6 @@
getRedirectingFactoryBody,
getRedirectionTarget;
-import 'utils.dart' show offsetForToken;
-
import 'forest.dart' show Forest;
import 'fangorn.dart' show Fangorn;
@@ -81,9 +83,13 @@
import 'kernel_builder.dart';
-final Forest<Expression, Statement> _forest = new Fangorn();
+final Forest _forest = new Fangorn();
-class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
+// TODO(ahe): Remove this and ensure all nodes have a location.
+const noLocation = null;
+
+class BodyBuilder<Arguments> extends ScopeListener<JumpTarget>
+ implements BuilderHelper<Arguments> {
@override
final KernelLibraryBuilder library;
@@ -201,7 +207,7 @@
super(scope);
@override
- Forest<Expression, Statement> get forest => _forest;
+ Forest<Expression, Statement, Token, Arguments> get forest => _forest;
bool get hasParserError => recoverableErrors.isNotEmpty;
@@ -238,9 +244,9 @@
"A library can't be used as an expression.");
} else if (node is SuperInitializer) {
return buildCompileTimeError(
- fasta.messageSuperAsExpression, node.fileOffset);
+ fasta.messageSuperAsExpression, node.fileOffset, noLength);
} else if (node is ProblemBuilder) {
- return buildProblemExpression(node, -1);
+ return buildProblemExpression(node, -1, noLength);
} else {
return unhandled("${node.runtimeType}", "toValue", -1, uri);
}
@@ -360,7 +366,7 @@
// Reports the error on `print(x)`.
library.addCompileTimeError(
- error.messageObject, error.charOffset, error.uri);
+ error.messageObject, error.charOffset, error.length, error.uri);
}
}
@@ -572,7 +578,11 @@
initializer = node.buildFieldInitializer(initializedFields);
} else if (node is ConstructorInvocation) {
initializer = buildSuperInitializer(
- false, node.target, node.arguments, token.charOffset);
+ false,
+ node.target,
+ node.arguments
+ as dynamic, // TODO(ahe): Remove this cast when buildSuperInitializer is moved to [Forest].
+ token.charOffset);
} else {
Expression value = toValue(node);
if (node is! Throw) {
@@ -613,8 +623,10 @@
bool hasMore = formalBuilders.moveNext();
assert(hasMore);
VariableDeclaration realParameter = formalBuilders.current.target;
- Expression initializer =
- parameter.initializer ?? new ShadowNullLiteral();
+ Expression initializer = parameter.initializer ?? forest.literalNull(
+ // TODO(ahe): Should store: realParameter.fileOffset
+ // https://github.com/dart-lang/sdk/issues/32289
+ null);
realParameter.initializer = initializer..parent = realParameter;
_typeInferrer.inferParameterInitializer(
this, initializer, realParameter.type);
@@ -699,7 +711,7 @@
/// >unless the enclosing class is class Object.
Constructor superTarget = lookupConstructor(emptyName, isSuper: true);
Initializer initializer;
- Arguments arguments = new Arguments.empty();
+ Arguments arguments = forest.argumentsEmpty(noLocation);
if (superTarget == null ||
checkArguments(
new FunctionTypeAccessor.fromNode(superTarget.function),
@@ -791,10 +803,9 @@
named = new List<NamedExpression>.from(seenNames.values);
}
}
- push(new ShadowArguments(positional, named: named)
- ..fileOffset = beginToken.charOffset);
+ push(forest.arguments(positional, beginToken, named: named));
} else {
- push(new ShadowArguments(arguments)..fileOffset = beginToken.charOffset);
+ push(forest.arguments(arguments, beginToken));
}
}
@@ -812,8 +823,8 @@
List<DartType> typeArguments = pop();
Object receiver = pop();
if (arguments != null && typeArguments != null) {
- assert(arguments.types.isEmpty);
- ShadowArguments.setExplicitArgumentTypes(arguments, typeArguments);
+ assert(forest.argumentsTypes(arguments).isEmpty);
+ forest.argumentsSetExplicitArgumentTypes(arguments, typeArguments);
} else {
assert(typeArguments == null);
}
@@ -927,7 +938,7 @@
"Not an operator: '$operator'.", token.charOffset);
} else {
Expression result = buildMethodInvocation(a, new Name(operator),
- new ShadowArguments(<Expression>[b]), token.charOffset,
+ forest.arguments(<Expression>[b], noLocation), token.charOffset,
// This *could* be a constant expression, we can't know without
// evaluating [a] and [b].
isConstantExpression: !isSuper,
@@ -968,9 +979,10 @@
push(send.withReceiver(pop(), token.charOffset, isNullAware: true));
} else {
pop();
- Message message =
- fasta.templateExpectedIdentifier.withArguments(token.next);
- push(buildCompileTimeError(message, token.next.charOffset));
+ token = token.next;
+ Message message = fasta.templateExpectedIdentifier.withArguments(token);
+ push(buildCompileTimeError(
+ message, offsetForToken(token), lengthForToken(token)));
}
}
@@ -981,9 +993,10 @@
push(send.withReceiver(receiver, token.charOffset));
} else {
pop();
- Message message =
- fasta.templateExpectedIdentifier.withArguments(token.next);
- push(buildCompileTimeError(message, token.next.charOffset));
+ token = token.next;
+ Message message = fasta.templateExpectedIdentifier.withArguments(token);
+ push(buildCompileTimeError(
+ message, offsetForToken(token), lengthForToken(token)));
}
}
@@ -1008,14 +1021,16 @@
Uri uri = candidate.location.file;
int offset = candidate.fileOffset;
Message message;
+ int length = noLength;
if (offset == -1 && candidate is Constructor) {
offset = candidate.enclosingClass.fileOffset;
message = fasta.templateCandidateFoundIsDefaultConstructor
.withArguments(candidate.enclosingClass.name);
} else {
+ length = name.length;
message = fasta.messageCandidateFound;
}
- context = message.withLocation(uri, offset);
+ context = message.withLocation(uri, offset, length);
}
if (isGetter) {
@@ -1032,7 +1047,8 @@
if (argMessage != null) {
message = argMessage.messageObject;
charOffset = argMessage.charOffset;
- addProblemErrorIfConst(message, charOffset, 1, context: context);
+ addProblemErrorIfConst(message, charOffset, argMessage.length,
+ context: context);
} else {
message = warnUnresolvedMethod(kernelName, charOffset,
isSuper: isSuper,
@@ -1044,10 +1060,11 @@
// TODO(ahe): Use [error] below instead of building a compile-time error,
// should be:
// return library.loader.throwCompileConstantError(error, charOffset);
- return buildCompileTimeError(message, charOffset, context: context);
+ return buildCompileTimeError(message, charOffset, noLength,
+ context: context);
} else {
Expression error = library.loader.instantiateNoSuchMethodError(
- receiver, name, arguments, charOffset,
+ receiver, name, forest.castArguments(arguments), charOffset,
isMethod: !isGetter && !isSetter,
isGetter: isGetter,
isSetter: isSetter,
@@ -1086,12 +1103,22 @@
@override
Message warnUnresolvedMethod(Name name, int charOffset,
{bool isSuper: false, bool reportWarning: true, LocatedMessage context}) {
+ String plainName = name.name;
+ int dotIndex = plainName.lastIndexOf(".");
+ if (dotIndex != -1) {
+ plainName = plainName.substring(dotIndex + 1);
+ }
+ // TODO(ahe): This is rather brittle. We would probably be better off with
+ // more precise location information in this case.
+ int length = plainName.length;
+ if (plainName.startsWith("[")) {
+ length = 1;
+ }
Message message = isSuper
? fasta.templateSuperclassHasNoMethod.withArguments(name.name)
: fasta.templateMethodNotFound.withArguments(name.name);
if (reportWarning) {
- addProblemErrorIfConst(message, charOffset, name.name.length,
- context: context);
+ addProblemErrorIfConst(message, charOffset, length, context: context);
}
return message;
}
@@ -1246,7 +1273,7 @@
} else if (ignoreMainInGetMainClosure &&
name == "main" &&
member?.name == "_getMainClosure") {
- return new ShadowNullLiteral()..fileOffset = charOffset;
+ return storeOffset(forest.literalNull(null), charOffset);
} else {
return new UnresolvedAccessor(this, n, token);
}
@@ -1381,7 +1408,7 @@
if (interpolationCount == 0) {
Token token = pop();
String value = unescapeString(token.lexeme);
- push(new ShadowStringLiteral(value)..fileOffset = offsetForToken(token));
+ push(forest.literalString(value, token));
} else {
List parts = popList(1 + interpolationCount * 2);
Token first = parts.first;
@@ -1392,8 +1419,7 @@
if (first.lexeme.length > 1) {
String value = unescapeFirstStringPart(first.lexeme, quote);
if (value.isNotEmpty) {
- expressions.add(new ShadowStringLiteral(value)
- ..fileOffset = offsetForToken(first));
+ expressions.add(forest.literalString(value, first));
}
}
for (int i = 1; i < parts.length - 1; i++) {
@@ -1401,8 +1427,7 @@
if (part is Token) {
if (part.lexeme.length != 0) {
String value = unescape(part.lexeme, quote);
- expressions.add(new ShadowStringLiteral(value)
- ..fileOffset = offsetForToken(part));
+ expressions.add(forest.literalString(value, part));
}
} else {
expressions.add(toValue(part));
@@ -1412,8 +1437,7 @@
if (last.lexeme.length > 1) {
String value = unescapeLastStringPart(last.lexeme, quote);
if (value.isNotEmpty) {
- expressions.add(new ShadowStringLiteral(value)
- ..fileOffset = offsetForToken(last));
+ expressions.add(forest.literalString(value, last));
}
}
push(new ShadowStringConcatenation(expressions)
@@ -1425,8 +1449,7 @@
void handleNativeClause(Token nativeToken, bool hasName) {
debugEvent("NativeClause");
if (hasName) {
- var ignoredNativeName = pop();
- assert(ignoredNativeName is ShadowStringLiteral);
+ forest.asLiteralString(pop());
}
}
@@ -1464,7 +1487,7 @@
if (value == null) {
push(new LargeIntAccessor(this, token));
} else {
- push(forest.literalInt(value, offsetForToken(token)));
+ push(forest.literalInt(value, token));
}
}
@@ -1573,7 +1596,7 @@
debugEvent("NoFieldInitializer");
if (constantExpressionRequired) {
// Creating a null value to prevent the Dart VM from crashing.
- push(new ShadowNullLiteral()..fileOffset = offsetForToken(token));
+ push(forest.literalNull(token));
} else {
push(NullValue.FieldInitializer);
}
@@ -1635,7 +1658,8 @@
Expression value = popForValue();
var accessor = pop();
if (accessor is! FastaAccessor) {
- push(buildCompileTimeError(fasta.messageNotAnLvalue, token.charOffset));
+ push(buildCompileTimeError(fasta.messageNotAnLvalue,
+ offsetForToken(token), lengthForToken(token)));
} else {
push(new DelayedAssignment(
this, token, accessor, value, token.stringValue));
@@ -1750,16 +1774,19 @@
typeArgument = typeArguments.first;
if (typeArguments.length > 1) {
typeArgument = null;
- addProblem(fasta.messageListLiteralTooManyTypeArguments,
- beginToken.charOffset);
- } else {
+ addProblem(
+ fasta.messageListLiteralTooManyTypeArguments,
+ offsetForToken(beginToken),
+ lengthOfSpan(beginToken, closeBraceTokenFor(beginToken)));
+ } else if (library.loader.target.strongMode) {
typeArgument = instantiateToBounds(typeArgument, coreTypes.objectClass);
}
}
- push(new ShadowListLiteral(expressions,
- typeArgument: typeArgument,
- isConst: constKeyword != null || constantExpressionRequired)
- ..fileOffset = offsetForToken(constKeyword ?? beginToken));
+ push(forest.literalList(
+ typeArgument,
+ expressions,
+ constKeyword != null || constantExpressionRequired,
+ constKeyword ?? beginToken));
}
@override
@@ -1767,27 +1794,27 @@
debugEvent("LiteralBool");
bool value = optional("true", token);
assert(value || optional("false", token));
- push(new ShadowBoolLiteral(value)..fileOffset = offsetForToken(token));
+ push(forest.literalBool(value, token));
}
@override
void handleLiteralDouble(Token token) {
debugEvent("LiteralDouble");
- push(new ShadowDoubleLiteral(double.parse(token.lexeme))
- ..fileOffset = offsetForToken(token));
+ push(forest.literalDouble(double.parse(token.lexeme), token));
}
@override
void handleLiteralNull(Token token) {
debugEvent("LiteralNull");
- push(new ShadowNullLiteral()..fileOffset = offsetForToken(token));
+ push(forest.literalNull(token));
}
@override
void handleLiteralMap(
int count, Token beginToken, Token constKeyword, Token endToken) {
debugEvent("LiteralMap");
- List<MapEntry> entries = popList(count) ?? <MapEntry>[];
+ List entries = forest.mapEntryList(count);
+ popList(count, entries);
List<DartType> typeArguments = pop();
DartType keyType;
DartType valueType;
@@ -1795,20 +1822,29 @@
if (typeArguments.length != 2) {
keyType = null;
valueType = null;
- addProblem(fasta.messageListLiteralTypeArgumentMismatch,
- beginToken.charOffset);
+ addProblem(
+ fasta.messageListLiteralTypeArgumentMismatch,
+ offsetForToken(beginToken),
+ lengthOfSpan(beginToken, closeBraceTokenFor(beginToken)));
} else {
- keyType = instantiateToBounds(typeArguments[0], coreTypes.objectClass);
- valueType =
- instantiateToBounds(typeArguments[1], coreTypes.objectClass);
+ if (library.loader.target.strongMode) {
+ keyType =
+ instantiateToBounds(typeArguments[0], coreTypes.objectClass);
+ valueType =
+ instantiateToBounds(typeArguments[1], coreTypes.objectClass);
+ } else {
+ keyType = typeArguments[0];
+ valueType = typeArguments[1];
+ }
}
}
- push(new ShadowMapLiteral(entries,
- keyType: keyType,
- valueType: valueType,
- isConst: constKeyword != null || constantExpressionRequired)
- ..fileOffset = constKeyword?.charOffset ?? offsetForToken(beginToken));
+ push(forest.literalMap(
+ keyType,
+ valueType,
+ entries,
+ constKeyword != null || constantExpressionRequired,
+ constKeyword ?? beginToken));
}
@override
@@ -1816,7 +1852,7 @@
debugEvent("LiteralMapEntry");
Expression value = popForValue();
Expression key = popForValue();
- push(new MapEntry(key, value));
+ push(forest.mapEntry(key, value, colon));
}
String symbolPartToString(name) {
@@ -1842,8 +1878,7 @@
value += ".${symbolPartToString(parts[i])}";
}
}
- push(
- new ShadowSymbolLiteral(value)..fileOffset = offsetForToken(hashToken));
+ push(forest.literalSymbol(value, hashToken));
}
@override
@@ -1867,7 +1902,7 @@
} else {
String displayName = debugName(getNodeName(prefix), suffix.name);
addProblem(fasta.templateNotAType.withArguments(displayName),
- beginToken.charOffset);
+ offsetForToken(beginToken), lengthOfSpan(beginToken, suffix.token));
push(const InvalidType());
return;
}
@@ -1878,7 +1913,7 @@
push(name.build(library));
} else if (name is PrefixBuilder) {
addProblem(fasta.templateNotAType.withArguments(name.name),
- beginToken.charOffset);
+ offsetForToken(beginToken), lengthForToken(beginToken));
push(const InvalidType());
} else {
unhandled(
@@ -2239,7 +2274,7 @@
int value =
int.parse("-" + receiver.token.lexeme, onError: (_) => null);
if (value != null) {
- push(forest.literalInt(value, offsetForToken(token)));
+ push(forest.literalInt(value, token));
return;
}
}
@@ -2254,7 +2289,7 @@
receiverValue = toValue(receiver);
}
push(buildMethodInvocation(receiverValue, new Name(operator),
- new Arguments.empty(), token.charOffset,
+ forest.argumentsEmpty(noLocation), token.charOffset,
// This *could* be a constant expression, we can't know without
// evaluating [receiver].
isConstantExpression: !isSuper,
@@ -2395,17 +2430,21 @@
charOffset,
typeParameters);
if (argMessage != null) {
- return throwNoSuchMethodError(new NullLiteral()..fileOffset = charOffset,
- target.name.name, arguments, charOffset,
- candidate: target, argMessage: argMessage);
+ return throwNoSuchMethodError(
+ storeOffset(forest.literalNull(null), charOffset),
+ target.name.name,
+ arguments,
+ charOffset,
+ candidate: target,
+ argMessage: argMessage);
}
if (target is Constructor) {
if (isConst && !target.isConst) {
return deprecated_buildCompileTimeError(
"Not a const constructor.", charOffset);
}
- return new ShadowConstructorInvocation(
- target, targetTypeArguments, initialTarget, arguments,
+ return new ShadowConstructorInvocation(target, targetTypeArguments,
+ initialTarget, forest.castArguments(arguments),
isConst: isConst)
..fileOffset = charOffset;
} else {
@@ -2414,12 +2453,14 @@
return deprecated_buildCompileTimeError(
"Not a const factory.", charOffset);
} else if (procedure.isFactory) {
- return new ShadowFactoryConstructorInvocation(
- target, targetTypeArguments, initialTarget, arguments,
+ return new ShadowFactoryConstructorInvocation(target,
+ targetTypeArguments, initialTarget, forest.castArguments(arguments),
isConst: isConst)
..fileOffset = charOffset;
} else {
- return new ShadowStaticInvocation(target, arguments, isConst: isConst)
+ return new ShadowStaticInvocation(
+ target, forest.castArguments(arguments),
+ isConst: isConst)
..fileOffset = charOffset;
}
}
@@ -2429,7 +2470,8 @@
LocatedMessage checkArguments(FunctionTypeAccessor function,
Arguments arguments, CalleeDesignation calleeKind, int offset,
[List<TypeParameter> typeParameters]) {
- if (arguments.positional.length < function.requiredParameterCount) {
+ if (forest.argumentsPositional(arguments).length <
+ function.requiredParameterCount) {
Template<Message Function(int count, int count2)> template;
switch (calleeKind) {
case CalleeDesignation.Function:
@@ -2443,11 +2485,12 @@
break;
}
return template
- .withArguments(
- function.requiredParameterCount, arguments.positional.length)
- .withLocation(uri, offset);
+ .withArguments(function.requiredParameterCount,
+ forest.argumentsPositional(arguments).length)
+ .withLocation(uri, offset, noLength);
}
- if (arguments.positional.length > function.positionalParameterCount) {
+ if (forest.argumentsPositional(arguments).length >
+ function.positionalParameterCount) {
Template<Message Function(int count, int count2)> template;
switch (calleeKind) {
case CalleeDesignation.Function:
@@ -2461,13 +2504,14 @@
break;
}
return template
- .withArguments(
- function.positionalParameterCount, arguments.positional.length)
- .withLocation(uri, offset);
+ .withArguments(function.positionalParameterCount,
+ forest.argumentsPositional(arguments).length)
+ .withLocation(uri, offset, noLength);
}
- if (arguments.named.isNotEmpty) {
+ List named = forest.argumentsNamed(arguments);
+ if (named.isNotEmpty) {
Set<String> names = function.namedParameterNames;
- for (NamedExpression argument in arguments.named) {
+ for (NamedExpression argument in named) {
if (!names.remove(argument.name)) {
Template<Message Function(String name)> template;
switch (calleeKind) {
@@ -2483,18 +2527,18 @@
}
return template
.withArguments(argument.name)
- .withLocation(uri, argument.fileOffset);
+ .withLocation(uri, argument.fileOffset, argument.name.length);
}
}
}
- if (typeParameters != null &&
- typeParameters.length != arguments.types.length) {
+ List types = forest.argumentsTypes(arguments);
+ if (typeParameters != null && typeParameters.length != types.length) {
// TODO(paulberry): Report error in this case as well,
// after https://github.com/dart-lang/sdk/issues/32130 is fixed.
- arguments.types.clear();
+ types.clear();
for (int i = 0; i < typeParameters.length; i++) {
- arguments.types.add(const DynamicType());
+ types.add(const DynamicType());
}
}
@@ -2538,7 +2582,7 @@
void endNewExpression(Token token) {
debugEvent("NewExpression");
Token nameToken = token.next;
- ShadowArguments arguments = pop();
+ Arguments arguments = pop();
String name = pop();
List<DartType> typeArguments = pop();
@@ -2576,11 +2620,8 @@
} else if (type is ErrorAccessor) {
push(type.buildError(arguments));
} else {
- push(throwNoSuchMethodError(
- new NullLiteral()..fileOffset = token.charOffset,
- debugName(getNodeName(type), name),
- arguments,
- nameToken.charOffset));
+ push(throwNoSuchMethodError(forest.literalNull(token),
+ debugName(getNodeName(type), name), arguments, nameToken.charOffset));
}
constantExpressionRequired = savedConstantExpressionRequired;
}
@@ -2600,8 +2641,8 @@
}
if (typeArguments != null) {
- assert(arguments.types.isEmpty);
- ShadowArguments.setExplicitArgumentTypes(arguments, typeArguments);
+ assert(forest.argumentsTypes(arguments).isEmpty);
+ forest.argumentsSetExplicitArgumentTypes(arguments, typeArguments);
}
String errorName;
@@ -2673,8 +2714,11 @@
errorName = debugName(getNodeName(type), name);
}
errorName ??= name;
- return throwNoSuchMethodError(new NullLiteral()..fileOffset = charOffset,
- errorName, arguments, nameToken.charOffset);
+ return throwNoSuchMethodError(
+ storeOffset(forest.literalNull(null), charOffset),
+ errorName,
+ arguments,
+ nameToken.charOffset);
}
@override
@@ -3429,9 +3473,8 @@
// TODO(danrubel): Ignore this error until we deprecate `native` support.
return;
}
- int start = offsetForToken(startToken);
- int length = (start == -1) ? 1 : (offsetForToken(endToken) - start);
- addCompileTimeError(message, start, length);
+ addCompileTimeError(message, offsetForToken(startToken),
+ lengthOfSpan(startToken, endToken));
}
@override
@@ -3457,17 +3500,17 @@
Expression deprecated_buildCompileTimeError(String error,
[int charOffset = -1]) {
return buildCompileTimeError(
- fasta.templateUnspecified.withArguments(error), charOffset);
+ fasta.templateUnspecified.withArguments(error), charOffset, noLength);
}
@override
- Expression buildCompileTimeError(Message message, int charOffset,
+ Expression buildCompileTimeError(Message message, int charOffset, int length,
{LocatedMessage context}) {
- library.addCompileTimeError(message, charOffset, uri,
+ library.addCompileTimeError(message, charOffset, length, uri,
wasHandled: true, context: context);
return new ShadowSyntheticExpression(library.loader
- .throwCompileConstantError(
- library.loader.buildCompileTimeError(message, charOffset, uri)));
+ .throwCompileConstantError(library.loader
+ .buildCompileTimeError(message, charOffset, length, uri)));
}
Expression wrapInCompileTimeError(Expression expression, Message message) {
@@ -3476,12 +3519,12 @@
return new Let(
new VariableDeclaration.forValue(expression)
..fileOffset = expression.fileOffset,
- buildCompileTimeError(message, expression.fileOffset))
+ buildCompileTimeError(message, expression.fileOffset, noLength))
..fileOffset = expression.fileOffset;
}
Expression buildFallThroughError(int charOffset) {
- addProblem(fasta.messageSwitchCaseFallThrough, charOffset);
+ addProblem(fasta.messageSwitchCaseFallThrough, charOffset, noLength);
// TODO(ahe): The following doesn't make sense for the Analyzer. It should
// be moved to [Forest] or conditional on `forest is Fangorn`.
@@ -3491,10 +3534,11 @@
return new Throw(buildStaticInvocation(
library.loader.coreTypes.fallThroughErrorUrlAndLineConstructor,
- new Arguments(<Expression>[
- new StringLiteral("${location?.file ?? uri}"),
- forest.literalInt(location?.line ?? 0, charOffset),
- ]),
+ forest.arguments(<Expression>[
+ storeOffset(forest.literalString("${location?.file ?? uri}", null),
+ charOffset),
+ storeOffset(forest.literalInt(location?.line ?? 0, null), charOffset),
+ ], noLocation),
charOffset: charOffset));
}
@@ -3502,9 +3546,13 @@
Message message, String className,
[int charOffset = -1]) {
addProblemErrorIfConst(message, charOffset, className.length);
+ // TODO(ahe): The following doesn't make sense to Analyzer AST.
Builder constructor = library.loader.getAbstractClassInstantiationError();
- return new Throw(buildStaticInvocation(constructor.target,
- new ShadowArguments(<Expression>[new StringLiteral(className)])));
+ return new Throw(buildStaticInvocation(
+ constructor.target,
+ forest.arguments(<Expression>[
+ storeOffset(forest.literalString(className, null), charOffset)
+ ], noLocation)));
}
Statement deprecated_buildCompileTimeErrorStatement(error,
@@ -3516,7 +3564,7 @@
Statement buildCompileTimeErrorStatement(Message message, int charOffset,
{LocatedMessage context}) {
return new ShadowExpressionStatement(
- buildCompileTimeError(message, charOffset, context: context));
+ buildCompileTimeError(message, charOffset, noLength, context: context));
}
Statement wrapInCompileTimeErrorStatement(
@@ -3564,16 +3612,19 @@
addProblem(
fasta.templateFinalInstanceVariableAlreadyInitialized
.withArguments(name),
- offset);
- addProblem(
- fasta.templateFinalInstanceVariableAlreadyInitializedCause
- .withArguments(name),
- builder.charOffset);
+ offset,
+ noLength,
+ context: fasta.templateFinalInstanceVariableAlreadyInitializedCause
+ .withArguments(name)
+ .withLocation(uri, builder.charOffset, noLength));
Builder constructor =
library.loader.getDuplicatedFieldInitializerError();
return buildInvalidInitializer(
- new Throw(buildStaticInvocation(constructor.target,
- new Arguments(<Expression>[new StringLiteral(name)]),
+ new Throw(buildStaticInvocation(
+ constructor.target,
+ forest.arguments(<Expression>[
+ storeOffset(forest.literalString(name, null), offset)
+ ], noLocation),
charOffset: offset)),
offset);
} else {
@@ -3600,7 +3651,8 @@
charOffset);
}
needsImplicitSuperInitializer = false;
- return new ShadowSuperInitializer(constructor, arguments)
+ return new ShadowSuperInitializer(
+ constructor, forest.castArguments(arguments))
..fileOffset = charOffset
..isSynthetic = isSynthetic;
}
@@ -3610,13 +3662,15 @@
Constructor constructor, Arguments arguments,
[int charOffset = -1]) {
needsImplicitSuperInitializer = false;
- return new ShadowRedirectingInitializer(constructor, arguments)
+ return new ShadowRedirectingInitializer(
+ constructor, forest.castArguments(arguments))
..fileOffset = charOffset;
}
@override
- Expression buildProblemExpression(ProblemBuilder builder, int charOffset) {
- return buildCompileTimeError(builder.message, charOffset);
+ Expression buildProblemExpression(
+ ProblemBuilder builder, int charOffset, int length) {
+ return buildCompileTimeError(builder.message, charOffset, length);
}
@override
@@ -3632,12 +3686,15 @@
}
@override
- dynamic deprecated_addCompileTimeError(int charOffset, String message,
+ void deprecated_addCompileTimeError(int charOffset, String message,
{bool wasHandled: false}) {
// TODO(ahe): If constantExpressionRequired is set, set it to false to
// avoid a long list of errors.
return library.addCompileTimeError(
- fasta.templateUnspecified.withArguments(message), charOffset, uri,
+ fasta.templateUnspecified.withArguments(message),
+ charOffset,
+ noLength,
+ uri,
wasHandled: wasHandled);
}
@@ -3678,8 +3735,8 @@
Arguments arguments, Expression expression) {
if (arguments == null) return expression;
List<Expression> expressions =
- new List<Expression>.from(arguments.positional);
- for (NamedExpression named in arguments.named) {
+ new List<Expression>.from(forest.argumentsPositional(arguments));
+ for (NamedExpression named in forest.argumentsNamed(arguments)) {
expressions.add(named.value);
}
for (Expression argument in expressions.reversed) {
@@ -3721,14 +3778,16 @@
offset,
name.name.length);
}
- return new ShadowSuperMethodInvocation(name, arguments, target)
+ return new ShadowSuperMethodInvocation(
+ name, forest.castArguments(arguments), target)
..fileOffset = offset;
}
receiver = new ShadowSuperPropertyGet(name, target)..fileOffset = offset;
- return new ShadowMethodInvocation(receiver, callName, arguments,
+ return new ShadowMethodInvocation(
+ receiver, callName, forest.castArguments(arguments),
isImplicitCall: true)
- ..fileOffset = arguments.fileOffset;
+ ..fileOffset = forest.readOffset(arguments);
}
if (isNullAware) {
@@ -3737,28 +3796,32 @@
variable,
new ConditionalExpression(
buildIsNull(new VariableGet(variable), offset),
- new NullLiteral(),
- new MethodInvocation(
- new VariableGet(variable), name, arguments, interfaceTarget)
+ storeOffset(forest.literalNull(null), offset),
+ new MethodInvocation(new VariableGet(variable), name,
+ forest.castArguments(arguments), interfaceTarget)
..fileOffset = offset,
null)
..fileOffset = offset)
..fileOffset = offset;
} else {
- return new ShadowMethodInvocation(receiver, name, arguments,
+ return new ShadowMethodInvocation(
+ receiver, name, forest.castArguments(arguments),
isImplicitCall: isImplicitCall, interfaceTarget: interfaceTarget)
..fileOffset = offset;
}
}
@override
- void addCompileTimeError(Message message, int charOffset, int length) {
- library.addCompileTimeError(message, charOffset, uri);
+ void addCompileTimeError(Message message, int charOffset, int length,
+ {LocatedMessage context}) {
+ library.addCompileTimeError(message, charOffset, length, uri,
+ context: context);
}
@override
- void addProblem(Message message, int charOffset) {
- library.addProblem(message, charOffset, uri);
+ void addProblem(Message message, int charOffset, int length,
+ {LocatedMessage context}) {
+ library.addProblem(message, charOffset, length, uri, context: context);
}
@override
@@ -3768,9 +3831,9 @@
// take two messages: one to use when a constant expression is
// required and one to use otherwise.
if (constantExpressionRequired) {
- addCompileTimeError(message, charOffset, length);
+ addCompileTimeError(message, charOffset, length, context: context);
} else {
- library.addProblem(message, charOffset, uri, context: context);
+ library.addProblem(message, charOffset, length, uri, context: context);
}
}
@@ -3792,6 +3855,13 @@
..fileOffset = charOffset;
return new ShadowDeferredCheck(check, expression);
}
+
+ @override
+ T storeOffset<T>(T object, int offset) {
+ TreeNode node = object as TreeNode;
+ node.fileOffset = offset;
+ return object;
+ }
}
class Identifier {
@@ -3831,7 +3901,7 @@
String toString() => "label($name)";
}
-abstract class ContextAccessor extends FastaAccessor {
+abstract class ContextAccessor<Arguments> extends FastaAccessor<Arguments> {
final BuilderHelper helper;
final FastaAccessor accessor;
@@ -3895,7 +3965,7 @@
}
}
-class DelayedAssignment extends ContextAccessor {
+class DelayedAssignment<Arguments> extends ContextAccessor<Arguments> {
final Expression value;
final String assignmentOperator;
@@ -3973,7 +4043,7 @@
}
}
-class DelayedPostfixIncrement extends ContextAccessor {
+class DelayedPostfixIncrement<Arguments> extends ContextAccessor<Arguments> {
final Name binaryOperator;
final Procedure interfaceTarget;
diff --git a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
index f102ac7..6771997 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
@@ -4,14 +4,136 @@
library fasta.fangorn;
-import 'kernel_shadow_ast.dart';
+import 'dart:core' hide MapEntry;
+
+import 'package:kernel/ast.dart'
+ show
+ Arguments,
+ DartType,
+ Expression,
+ MapEntry,
+ NamedExpression,
+ Statement,
+ TreeNode;
+
+import '../parser.dart' show offsetForToken;
+
+import '../scanner.dart' show Token;
+
+import 'kernel_shadow_ast.dart'
+ show
+ ShadowArguments,
+ ShadowBoolLiteral,
+ ShadowDoubleLiteral,
+ ShadowIntLiteral,
+ ShadowListLiteral,
+ ShadowMapLiteral,
+ ShadowNullLiteral,
+ ShadowStringLiteral,
+ ShadowSymbolLiteral,
+ ShadowTypeLiteral;
import 'forest.dart' show Forest;
/// A shadow tree factory.
-class Fangorn extends Forest<ShadowExpression, ShadowStatement> {
+class Fangorn extends Forest<Expression, Statement, Token, Arguments> {
@override
- ShadowExpression literalInt(int value, int offset) {
- return new ShadowIntLiteral(value)..fileOffset = offset;
+ ShadowArguments arguments(List<Expression> positional, Token token,
+ {List<DartType> types, List<NamedExpression> named}) {
+ return new ShadowArguments(positional, types: types, named: named)
+ ..fileOffset = offsetForToken(token);
}
+
+ @override
+ ShadowArguments argumentsEmpty(Token token) {
+ return arguments(<Expression>[], token);
+ }
+
+ @override
+ List<NamedExpression> argumentsNamed(Arguments arguments) {
+ return arguments.named;
+ }
+
+ @override
+ List<Expression> argumentsPositional(Arguments arguments) {
+ return arguments.positional;
+ }
+
+ @override
+ List<DartType> argumentsTypes(Arguments arguments) {
+ return arguments.types;
+ }
+
+ @override
+ void argumentsSetExplicitArgumentTypes(
+ Arguments arguments, List<DartType> types) {
+ ShadowArguments.setExplicitArgumentTypes(arguments, types);
+ }
+
+ @override
+ ShadowStringLiteral asLiteralString(Expression value) => value;
+
+ @override
+ ShadowBoolLiteral literalBool(bool value, Token token) {
+ return new ShadowBoolLiteral(value)..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowDoubleLiteral literalDouble(double value, Token token) {
+ return new ShadowDoubleLiteral(value)..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowIntLiteral literalInt(int value, Token token) {
+ return new ShadowIntLiteral(value)..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowListLiteral literalList(covariant typeArgument,
+ List<Expression> expressions, bool isConst, Token token) {
+ return new ShadowListLiteral(expressions,
+ typeArgument: typeArgument, isConst: isConst)
+ ..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowMapLiteral literalMap(DartType keyType, DartType valueType,
+ List<MapEntry> entries, bool isConst, Token token) {
+ return new ShadowMapLiteral(entries,
+ keyType: keyType, valueType: valueType, isConst: isConst)
+ ..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowNullLiteral literalNull(Token token) {
+ return new ShadowNullLiteral()..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowStringLiteral literalString(String value, Token token) {
+ return new ShadowStringLiteral(value)..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowSymbolLiteral literalSymbol(String value, Token token) {
+ return new ShadowSymbolLiteral(value)..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ ShadowTypeLiteral literalType(DartType type, Token token) {
+ return new ShadowTypeLiteral(type)..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ MapEntry mapEntry(Expression key, Expression value, Token token) {
+ return new MapEntry(key, value)..fileOffset = offsetForToken(token);
+ }
+
+ @override
+ List<MapEntry> mapEntryList(int length) {
+ return new List<MapEntry>.filled(length, null, growable: true);
+ }
+
+ @override
+ int readOffset(TreeNode node) => node.fileOffset;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
index ee89d72..2a3d2d5 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
@@ -22,13 +22,16 @@
import '../names.dart' show callName, lengthName;
+import '../parser.dart'
+ show lengthForToken, lengthOfSpan, noLength, offsetForToken;
+
import '../problems.dart' show unhandled, unimplemented, unsupported;
import '../scope.dart' show AccessErrorBuilder, ProblemBuilder, Scope;
import '../type_inference/type_promotion.dart' show TypePromoter;
-import 'body_builder.dart' show Identifier;
+import 'body_builder.dart' show Identifier, noLocation;
import 'forest.dart' show Forest;
@@ -55,6 +58,7 @@
import 'kernel_builder.dart'
show
Builder,
+ BuiltinTypeBuilder,
FunctionTypeAliasBuilder,
KernelClassBuilder,
KernelFunctionTypeAliasBuilder,
@@ -67,11 +71,9 @@
TypeDeclarationBuilder,
KernelTypeBuilder;
-import 'utils.dart' show offsetForToken;
-
import 'type_algorithms.dart' show calculateBoundsForDeclaration;
-abstract class BuilderHelper {
+abstract class BuilderHelper<Arguments> {
LibraryBuilder get library;
Uri get uri;
@@ -82,7 +84,7 @@
bool get constantExpressionRequired;
- Forest<Expression, Statement> get forest;
+ Forest<Expression, Statement, Token, Arguments> get forest;
Constructor lookupConstructor(Name name, {bool isSuper});
@@ -95,7 +97,7 @@
finishSend(Object receiver, Arguments arguments, int offset);
- Expression buildCompileTimeError(Message message, int charOffset);
+ Expression buildCompileTimeError(Message message, int charOffset, int length);
Expression wrapInCompileTimeError(Expression expression, Message message);
@@ -117,7 +119,8 @@
Expression buildStaticInvocation(Procedure target, Arguments arguments,
{bool isConst, int charOffset, Member initialTarget});
- Expression buildProblemExpression(ProblemBuilder builder, int offset);
+ Expression buildProblemExpression(
+ ProblemBuilder builder, int offset, int length);
Expression throwNoSuchMethodError(
Expression receiver, String name, Arguments arguments, int offset,
@@ -161,7 +164,7 @@
DartType validatedTypeVariableUse(
TypeParameterType type, int offset, bool nonInstanceAccessIsError);
- void addProblem(Message message, int charOffset);
+ void addProblem(Message message, int charOffset, int length);
void addProblemErrorIfConst(Message message, int charOffset, int length);
@@ -172,6 +175,8 @@
Message warnUnresolvedMethod(Name name, int charOffset, {bool isSuper});
void warnTypeArgumentsMismatch(String name, int expected, int charOffset);
+
+ T storeOffset<T>(T node, int offset);
}
// The name used to refer to a call target kind
@@ -203,9 +208,11 @@
this.positionalParameterCount, this._namedParameters);
}
-abstract class FastaAccessor implements Accessor {
+abstract class FastaAccessor<Arguments> implements Accessor<Arguments> {
BuilderHelper get helper;
+ Forest<Expression, Statement, Token, Arguments> get forest => helper.forest;
+
String get plainNameForRead;
Uri get uri => helper.uri;
@@ -214,26 +221,29 @@
bool get isInitializer => false;
+ T storeOffset<T>(T node, int offset) {
+ return helper.storeOffset(node, offset);
+ }
+
Expression buildForEffect() => buildSimpleRead();
Initializer buildFieldInitializer(Map<String, int> initializedFields) {
int offset = offsetForToken(token);
return helper.buildInvalidInitializer(
- helper.buildCompileTimeError(messageInvalidInitializer, offset),
+ helper.buildCompileTimeError(
+ messageInvalidInitializer, offset, lengthForToken(token)),
offset);
}
Expression makeInvalidRead() {
return buildThrowNoSuchMethodError(
- new NullLiteral()..fileOffset = offsetForToken(token),
- new Arguments.empty(),
+ forest.literalNull(token), forest.argumentsEmpty(noLocation),
isGetter: true);
}
Expression makeInvalidWrite(Expression value) {
- return buildThrowNoSuchMethodError(
- new NullLiteral()..fileOffset = offsetForToken(token),
- new ShadowArguments(<Expression>[value]),
+ return buildThrowNoSuchMethodError(forest.literalNull(token),
+ forest.arguments(<Expression>[value], noLocation),
isSetter: true);
}
@@ -258,8 +268,8 @@
DartType buildTypeWithBuiltArguments(List<DartType> arguments,
{bool nonInstanceAccessIsError: false}) {
- helper.addProblem(
- templateNotAType.withArguments(token.lexeme), token.charOffset);
+ helper.addProblem(templateNotAType.withArguments(token.lexeme),
+ offsetForToken(token), lengthForToken(token));
return const InvalidType();
}
@@ -288,7 +298,7 @@
new ShadowIllegalAssignment(rhs);
}
-abstract class ErrorAccessor implements FastaAccessor {
+abstract class ErrorAccessor<Arguments> implements FastaAccessor<Arguments> {
/// Pass [arguments] that must be evaluated before throwing an error. At
/// most one of [isGetter] and [isSetter] should be true and they're passed
/// to [BuilderHelper.buildThrowNoSuchMethodError] if it is used.
@@ -307,7 +317,7 @@
@override
Initializer buildFieldInitializer(Map<String, int> initializedFields) {
return helper.buildInvalidInitializer(
- buildError(new Arguments.empty(), isSetter: true));
+ buildError(forest.argumentsEmpty(noLocation), isSetter: true));
}
@override
@@ -335,7 +345,8 @@
@override
Expression buildAssignment(Expression value, {bool voidContext: false}) {
- return buildError(new ShadowArguments(<Expression>[value]), isSetter: true);
+ return buildError(forest.arguments(<Expression>[value], noLocation),
+ isSetter: true);
}
@override
@@ -344,7 +355,8 @@
bool voidContext: false,
Procedure interfaceTarget,
bool isPreIncDec: false}) {
- return buildError(new ShadowArguments(<Expression>[value]), isGetter: true);
+ return buildError(forest.arguments(<Expression>[value], token),
+ isGetter: true);
}
@override
@@ -355,7 +367,9 @@
// TODO(ahe): For the Analyzer, we probably need to build a prefix
// increment node that wraps an error.
return buildError(
- new ShadowArguments(<Expression>[helper.forest.literalInt(1, offset)]),
+ forest.arguments(
+ <Expression>[storeOffset(forest.literalInt(1, null), offset)],
+ noLocation),
isGetter: true);
}
@@ -367,7 +381,9 @@
// TODO(ahe): For the Analyzer, we probably need to build a post increment
// node that wraps an error.
return buildError(
- new ShadowArguments(<Expression>[helper.forest.literalInt(1, offset)]),
+ forest.arguments(
+ <Expression>[storeOffset(forest.literalInt(1, null), offset)],
+ noLocation),
isGetter: true);
}
@@ -375,24 +391,26 @@
Expression buildNullAwareAssignment(
Expression value, DartType type, int offset,
{bool voidContext: false}) {
- return buildError(new ShadowArguments(<Expression>[value]), isSetter: true);
+ return buildError(forest.arguments(<Expression>[value], noLocation),
+ isSetter: true);
}
@override
Expression buildSimpleRead() =>
- buildError(new Arguments.empty(), isGetter: true);
+ buildError(forest.argumentsEmpty(noLocation), isGetter: true);
@override
Expression makeInvalidRead() =>
- buildError(new Arguments.empty(), isGetter: true);
+ buildError(forest.argumentsEmpty(noLocation), isGetter: true);
@override
Expression makeInvalidWrite(Expression value) {
- return buildError(new ShadowArguments(<Expression>[value]), isSetter: true);
+ return buildError(forest.arguments(<Expression>[value], noLocation),
+ isSetter: true);
}
}
-class ThisAccessor extends FastaAccessor {
+class ThisAccessor<Arguments> extends FastaAccessor<Arguments> {
final BuilderHelper helper;
final Token token;
@@ -413,8 +431,8 @@
if (!isSuper) {
return new ShadowThisExpression();
} else {
- return helper.buildCompileTimeError(
- messageSuperAsExpression, offsetForToken(token));
+ return helper.buildCompileTimeError(messageSuperAsExpression,
+ offsetForToken(token), lengthForToken(token));
}
}
@@ -468,7 +486,8 @@
if (isInitializer) {
return buildConstructorInitializer(offset, new Name(""), arguments);
} else if (isSuper) {
- return helper.buildCompileTimeError(messageSuperAsExpression, offset);
+ return helper.buildCompileTimeError(
+ messageSuperAsExpression, offset, noLength);
} else {
return helper.buildMethodInvocation(
new ShadowThisExpression(), callName, arguments, offset,
@@ -490,7 +509,7 @@
if (constructor == null || argMessage != null) {
return helper.buildInvalidInitializer(
buildThrowNoSuchMethodError(
- new NullLiteral()..fileOffset = offset, arguments,
+ storeOffset(forest.literalNull(null), offset), arguments,
isSuper: isSuper,
name: name.name,
offset: offset,
@@ -549,7 +568,7 @@
}
}
-abstract class IncompleteSend extends FastaAccessor {
+abstract class IncompleteSend<Arguments> extends FastaAccessor<Arguments> {
final BuilderHelper helper;
@override
@@ -564,7 +583,8 @@
Arguments get arguments => null;
}
-class IncompleteError extends IncompleteSend with ErrorAccessor {
+class IncompleteError<Arguments> extends IncompleteSend<Arguments>
+ with ErrorAccessor<Arguments> {
final Message message;
IncompleteError(BuilderHelper helper, Token token, this.message)
@@ -573,8 +593,12 @@
@override
Expression buildError(Arguments arguments,
{bool isGetter: false, bool isSetter: false, int offset}) {
- return helper.buildCompileTimeError(
- message, offset ?? offsetForToken(this.token));
+ int length = noLength;
+ if (offset == null) {
+ offset = offsetForToken(token);
+ length = lengthForToken(token);
+ }
+ return helper.buildCompileTimeError(message, offset, length);
}
@override
@@ -582,7 +606,8 @@
helper.addProblem(
templateNotAPrefixInTypeAnnotation.withArguments(
token.lexeme, suffix.name),
- offsetForToken(token));
+ offsetForToken(token),
+ lengthOfSpan(token, suffix.token));
return const InvalidType();
}
@@ -590,7 +615,7 @@
doInvocation(int offset, Arguments arguments) => this;
}
-class SendAccessor extends IncompleteSend {
+class SendAccessor<Arguments> extends IncompleteSend<Arguments> {
@override
final Arguments arguments;
@@ -667,7 +692,7 @@
}
}
-class IncompletePropertyAccessor extends IncompleteSend {
+class IncompletePropertyAccessor<Arguments> extends IncompleteSend<Arguments> {
IncompletePropertyAccessor(BuilderHelper helper, Token token, Name name)
: super(helper, token, name);
@@ -738,7 +763,8 @@
}
}
-class IndexAccessor extends kernel.IndexAccessor with FastaAccessor {
+class IndexAccessor<Arguments> extends kernel.IndexAccessor<Arguments>
+ with FastaAccessor<Arguments> {
final BuilderHelper helper;
IndexAccessor.internal(this.helper, Token token, Expression receiver,
@@ -751,7 +777,7 @@
Expression doInvocation(int offset, Arguments arguments) {
return helper.buildMethodInvocation(
- buildSimpleRead(), callName, arguments, arguments.fileOffset,
+ buildSimpleRead(), callName, arguments, forest.readOffset(arguments),
isImplicitCall: true);
}
@@ -777,7 +803,8 @@
new ShadowIndexAssign(receiver, index, rhs);
}
-class PropertyAccessor extends kernel.PropertyAccessor with FastaAccessor {
+class PropertyAccessor<Arguments> extends kernel.PropertyAccessor<Arguments>
+ with FastaAccessor<Arguments> {
final BuilderHelper helper;
PropertyAccessor.internal(this.helper, Token token, Expression receiver,
@@ -818,7 +845,8 @@
new ShadowPropertyAssign(receiver, rhs);
}
-class StaticAccessor extends kernel.StaticAccessor with FastaAccessor {
+class StaticAccessor<Arguments> extends kernel.StaticAccessor<Arguments>
+ with FastaAccessor<Arguments> {
StaticAccessor(
BuilderHelper helper, Token token, Member readTarget, Member writeTarget)
: super(helper, readTarget, writeTarget, token) {
@@ -874,8 +902,8 @@
new ShadowStaticAssignment(rhs);
}
-class LoadLibraryAccessor extends kernel.LoadLibraryAccessor
- with FastaAccessor {
+class LoadLibraryAccessor<Arguments> extends kernel
+ .LoadLibraryAccessor<Arguments> with FastaAccessor<Arguments> {
LoadLibraryAccessor(
BuilderHelper helper, Token token, LoadLibraryBuilder builder)
: super(helper, token, builder);
@@ -883,7 +911,8 @@
String get plainNameForRead => 'loadLibrary';
Expression doInvocation(int offset, Arguments arguments) {
- if (arguments.positional.length > 0 || arguments.named.length > 0) {
+ if (forest.argumentsPositional(arguments).length > 0 ||
+ forest.argumentsNamed(arguments).length > 0) {
helper.addProblemErrorIfConst(
messageLoadLibraryTakesNoArguments, offset, 'loadLibrary'.length);
}
@@ -891,7 +920,8 @@
}
}
-class DeferredAccessor extends kernel.DeferredAccessor with FastaAccessor {
+class DeferredAccessor<Arguments> extends kernel.DeferredAccessor<Arguments>
+ with FastaAccessor<Arguments> {
DeferredAccessor(BuilderHelper helper, Token token, PrefixBuilder builder,
FastaAccessor expression)
: super(helper, token, builder, expression);
@@ -923,7 +953,8 @@
accessor.buildTypeWithBuiltArguments(arguments,
nonInstanceAccessIsError: nonInstanceAccessIsError),
builder.name),
- token.charOffset);
+ offsetForToken(token),
+ lengthForToken(token));
return const InvalidType();
}
@@ -933,8 +964,8 @@
}
}
-class SuperPropertyAccessor extends kernel.SuperPropertyAccessor
- with FastaAccessor {
+class SuperPropertyAccessor<Arguments> extends kernel
+ .SuperPropertyAccessor<Arguments> with FastaAccessor<Arguments> {
SuperPropertyAccessor(BuilderHelper helper, Token token, Name name,
Member getter, Member setter)
: super(helper, name, getter, setter, token);
@@ -967,7 +998,8 @@
new ShadowPropertyAssign(null, rhs, isSuper: true);
}
-class ThisIndexAccessor extends kernel.ThisIndexAccessor with FastaAccessor {
+class ThisIndexAccessor<Arguments> extends kernel.ThisIndexAccessor<Arguments>
+ with FastaAccessor<Arguments> {
ThisIndexAccessor(BuilderHelper helper, Token token, Expression index,
Procedure getter, Procedure setter)
: super(helper, index, getter, setter, token);
@@ -989,7 +1021,8 @@
new ShadowIndexAssign(null, index, rhs);
}
-class SuperIndexAccessor extends kernel.SuperIndexAccessor with FastaAccessor {
+class SuperIndexAccessor<Arguments> extends kernel.SuperIndexAccessor<Arguments>
+ with FastaAccessor<Arguments> {
SuperIndexAccessor(BuilderHelper helper, Token token, Expression index,
Member getter, Member setter)
: super(helper, index, getter, setter, token);
@@ -1011,8 +1044,8 @@
new ShadowIndexAssign(null, index, rhs, isSuper: true);
}
-class ThisPropertyAccessor extends kernel.ThisPropertyAccessor
- with FastaAccessor {
+class ThisPropertyAccessor<Arguments> extends kernel
+ .ThisPropertyAccessor<Arguments> with FastaAccessor<Arguments> {
final BuilderHelper helper;
ThisPropertyAccessor(
@@ -1045,8 +1078,8 @@
new ShadowPropertyAssign(null, rhs);
}
-class NullAwarePropertyAccessor extends kernel.NullAwarePropertyAccessor
- with FastaAccessor {
+class NullAwarePropertyAccessor<Arguments> extends kernel
+ .NullAwarePropertyAccessor<Arguments> with FastaAccessor<Arguments> {
final BuilderHelper helper;
NullAwarePropertyAccessor(this.helper, Token token, Expression receiver,
@@ -1072,7 +1105,8 @@
return offset + (name?.length ?? 0);
}
-class VariableAccessor extends kernel.VariableAccessor with FastaAccessor {
+class VariableAccessor<Arguments> extends kernel.VariableAccessor<Arguments>
+ with FastaAccessor<Arguments> {
VariableAccessor(
BuilderHelper helper, Token token, VariableDeclaration variable,
[DartType promotedType])
@@ -1093,7 +1127,8 @@
new ShadowVariableAssignment(rhs);
}
-class ReadOnlyAccessor extends kernel.ReadOnlyAccessor with FastaAccessor {
+class ReadOnlyAccessor<Arguments> extends kernel.ReadOnlyAccessor<Arguments>
+ with FastaAccessor<Arguments> {
final String plainNameForRead;
ReadOnlyAccessor(BuilderHelper helper, Expression expression,
@@ -1107,20 +1142,24 @@
}
}
-class LargeIntAccessor extends kernel.DelayedErrorAccessor with FastaAccessor {
+class LargeIntAccessor<Arguments> extends kernel.DelayedErrorAccessor<Arguments>
+ with FastaAccessor<Arguments> {
final String plainNameForRead = null;
LargeIntAccessor(BuilderHelper helper, Token token) : super(helper, token);
@override
- Expression buildError() => helper.buildCompileTimeError(
- templateIntegerLiteralIsOutOfRange.withArguments(token),
- token.charOffset);
+ Expression buildError() {
+ return helper.buildCompileTimeError(
+ templateIntegerLiteralIsOutOfRange.withArguments(token),
+ offsetForToken(token),
+ lengthForToken(token));
+ }
Expression doInvocation(int offset, Arguments arguments) => buildError();
}
-class ParenthesizedExpression extends ReadOnlyAccessor {
+class ParenthesizedExpression<Arguments> extends ReadOnlyAccessor<Arguments> {
ParenthesizedExpression(
BuilderHelper helper, Expression expression, Token token)
: super(helper, expression, null, token);
@@ -1131,7 +1170,7 @@
}
}
-class TypeDeclarationAccessor extends ReadOnlyAccessor {
+class TypeDeclarationAccessor<Arguments> extends ReadOnlyAccessor<Arguments> {
/// The import prefix preceding the [declaration] reference, or `null` if
/// the reference is not prefixed.
final PrefixBuilder prefix;
@@ -1158,14 +1197,13 @@
KernelInvalidTypeBuilder declaration = this.declaration;
helper.addProblemErrorIfConst(
declaration.message.messageObject, offset, token.length);
- super.expression = new Throw(
- new StringLiteral(declaration.message.message)
- ..fileOffset = offsetForToken(token))
- ..fileOffset = offset;
+ super.expression =
+ new Throw(forest.literalString(declaration.message.message, token))
+ ..fileOffset = offset;
} else {
- super.expression = new ShadowTypeLiteral(
- buildTypeWithBuiltArguments(null, nonInstanceAccessIsError: true))
- ..fileOffset = offsetForToken(token);
+ super.expression = forest.literalType(
+ buildTypeWithBuiltArguments(null, nonInstanceAccessIsError: true),
+ token);
}
}
return super.expression;
@@ -1173,8 +1211,9 @@
Expression makeInvalidWrite(Expression value) {
return buildThrowNoSuchMethodError(
- new NullLiteral()..fileOffset = offsetForToken(token),
- new Arguments(<Expression>[value])..fileOffset = value.fileOffset,
+ forest.literalNull(token),
+ storeOffset(
+ forest.arguments(<Expression>[value], null), value.fileOffset),
isSetter: true);
}
@@ -1242,6 +1281,9 @@
expected = declaration.target.typeParameters.length;
} else if (declaration is KernelTypeVariableBuilder) {
// Type arguments on a type variable - error reported elsewhere.
+ } else if (declaration is BuiltinTypeBuilder) {
+ // Type arguments on a built-in type, for example, dynamic or void.
+ expected = 0;
} else {
return unhandled(
"${declaration.runtimeType}",
@@ -1335,7 +1377,8 @@
}
}
-class UnresolvedAccessor extends FastaAccessor with ErrorAccessor {
+class UnresolvedAccessor<Arguments> extends FastaAccessor<Arguments>
+ with ErrorAccessor<Arguments> {
@override
final Token token;
@@ -1356,7 +1399,8 @@
helper.addProblem(
templateUnresolvedPrefixInTypeAnnotation.withArguments(
name.name, suffix.name),
- offsetForToken(token));
+ offsetForToken(token),
+ lengthOfSpan(token, suffix.token));
return const InvalidType();
}
@@ -1364,9 +1408,13 @@
Expression buildError(Arguments arguments,
{bool isGetter: false, bool isSetter: false, int offset}) {
offset ??= offsetForToken(this.token);
- return helper.throwNoSuchMethodError(new NullLiteral()..fileOffset = offset,
- plainNameForRead, arguments, offset,
- isGetter: isGetter, isSetter: isSetter);
+ return helper.throwNoSuchMethodError(
+ storeOffset(forest.literalNull(null), offset),
+ plainNameForRead,
+ arguments,
+ offset,
+ isGetter: isGetter,
+ isSetter: isSetter);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/forest.dart b/pkg/front_end/lib/src/fasta/kernel/forest.dart
index 283d8cc..3ff5778 100644
--- a/pkg/front_end/lib/src/fasta/kernel/forest.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/forest.dart
@@ -4,7 +4,56 @@
library fasta.forest;
+// TODO(ahe): Remove this import.
+import 'package:kernel/ast.dart' as kernel show Arguments;
+
/// A tree factory.
-abstract class Forest<Expression, Statement> {
- Expression literalInt(int value, int offset);
+abstract class Forest<Expression, Statement, Location, Arguments> {
+ Arguments arguments(List<Expression> positional, Location location,
+ {covariant List types, covariant List named});
+
+ Arguments argumentsEmpty(Location location);
+
+ List argumentsNamed(Arguments arguments);
+
+ List<Expression> argumentsPositional(Arguments arguments);
+
+ List argumentsTypes(Arguments arguments);
+
+ void argumentsSetExplicitArgumentTypes(
+ Arguments arguments, covariant List types);
+
+ Expression asLiteralString(Expression value);
+
+ Expression literalBool(bool value, Location location);
+
+ Expression literalDouble(double value, Location location);
+
+ Expression literalInt(int value, Location location);
+
+ Expression literalList(covariant typeArgument, List<Expression> expressions,
+ bool isConst, Location location);
+
+ Expression literalMap(covariant keyType, covariant valueType,
+ covariant List entries, bool isConst, Location location);
+
+ Expression literalNull(Location location);
+
+ Expression literalString(String value, Location location);
+
+ Expression literalSymbol(String value, Location location);
+
+ Expression literalType(covariant type, Location location);
+
+ Object mapEntry(Expression key, Expression value, Location location);
+
+ List mapEntryList(int length);
+
+ int readOffset(covariant node);
+
+ // TODO(ahe): Remove this method when all users are moved here.
+ kernel.Arguments castArguments(Arguments arguments) {
+ dynamic a = arguments;
+ return a;
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
index bc25472..7bbec74 100644
--- a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
@@ -11,6 +11,8 @@
import '../names.dart' show equalsName, indexGetName, indexSetName;
+import '../parser.dart' show offsetForToken;
+
import '../problems.dart' show unhandled;
import 'fasta_accessors.dart' show BuilderHelper;
@@ -33,8 +35,6 @@
ShadowVariableDeclaration,
ShadowVariableGet;
-import 'utils.dart' show offsetForToken;
-
/// An [Accessor] represents a subexpression for which we can't yet build a
/// kernel [Expression] because we don't yet know the context in which it is
/// used.
@@ -47,7 +47,7 @@
/// generate an invocation of `operator[]` or `operator[]=`, so we generate an
/// [Accessor] object. Later, after `= b` is parsed, [buildAssignment] will be
/// called.
-abstract class Accessor {
+abstract class Accessor<Arguments> {
final BuilderHelper helper;
final Token token;
@@ -198,7 +198,7 @@
new ShadowIllegalAssignment(rhs);
}
-abstract class VariableAccessor extends Accessor {
+abstract class VariableAccessor<Arguments> extends Accessor<Arguments> {
VariableDeclaration variable;
DartType promotedType;
@@ -228,7 +228,7 @@
}
}
-class PropertyAccessor extends Accessor {
+class PropertyAccessor<Arguments> extends Accessor<Arguments> {
VariableDeclaration _receiverVariable;
Expression receiver;
Name name;
@@ -289,7 +289,7 @@
/// Special case of [PropertyAccessor] to avoid creating an indirect access to
/// 'this'.
-class ThisPropertyAccessor extends Accessor {
+class ThisPropertyAccessor<Arguments> extends Accessor<Arguments> {
Name name;
Member getter, setter;
@@ -319,7 +319,7 @@
}
}
-class NullAwarePropertyAccessor extends Accessor {
+class NullAwarePropertyAccessor<Arguments> extends Accessor<Arguments> {
VariableDeclaration receiver;
Expression receiverExpression;
Name name;
@@ -367,7 +367,7 @@
}
}
-class SuperPropertyAccessor extends Accessor {
+class SuperPropertyAccessor<Arguments> extends Accessor<Arguments> {
Name name;
Member getter, setter;
@@ -399,7 +399,7 @@
}
}
-class IndexAccessor extends Accessor {
+class IndexAccessor<Arguments> extends Accessor<Arguments> {
Expression receiver;
Expression index;
VariableDeclaration receiverVariable;
@@ -504,7 +504,7 @@
/// Special case of [IndexAccessor] to avoid creating an indirect access to
/// 'this'.
-class ThisIndexAccessor extends Accessor {
+class ThisIndexAccessor<Arguments> extends Accessor<Arguments> {
Expression index;
VariableDeclaration indexVariable;
Procedure getter, setter;
@@ -578,7 +578,7 @@
}
}
-class SuperIndexAccessor extends Accessor {
+class SuperIndexAccessor<Arguments> extends Accessor<Arguments> {
Expression index;
VariableDeclaration indexVariable;
Member getter, setter;
@@ -668,7 +668,7 @@
}
}
-class StaticAccessor extends Accessor {
+class StaticAccessor<Arguments> extends Accessor<Arguments> {
Member readTarget;
Member writeTarget;
@@ -700,7 +700,7 @@
}
}
-abstract class LoadLibraryAccessor extends Accessor {
+abstract class LoadLibraryAccessor<Arguments> extends Accessor<Arguments> {
final LoadLibraryBuilder builder;
LoadLibraryAccessor(BuilderHelper helper, Token token, this.builder)
@@ -720,7 +720,7 @@
}
}
-abstract class DeferredAccessor extends Accessor {
+abstract class DeferredAccessor<Arguments> extends Accessor<Arguments> {
final PrefixBuilder builder;
final Accessor accessor;
@@ -747,7 +747,7 @@
}
}
-class ReadOnlyAccessor extends Accessor {
+class ReadOnlyAccessor<Arguments> extends Accessor<Arguments> {
Expression expression;
VariableDeclaration value;
@@ -773,7 +773,7 @@
super._finish(makeLet(value, body), complexAssignment);
}
-abstract class DelayedErrorAccessor extends Accessor {
+abstract class DelayedErrorAccessor<Arguments> extends Accessor<Arguments> {
DelayedErrorAccessor(BuilderHelper helper, Token token)
: super(helper, token);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
index 472ab0b..c340ea7 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
@@ -8,7 +8,6 @@
export 'package:kernel/ast.dart'
show
- Arguments,
AssertStatement,
AsyncMarker,
Block,
@@ -35,13 +34,11 @@
Let,
Library,
Location,
- MapEntry,
Member,
MethodInvocation,
Name,
NamedExpression,
NamedType,
- NullLiteral,
Procedure,
ProcedureKind,
Rethrow,
@@ -49,7 +46,6 @@
Statement,
StaticGet,
StringConcatenation,
- StringLiteral,
SuperInitializer,
SwitchCase,
ThisExpression,
@@ -64,13 +60,11 @@
export 'kernel_shadow_ast.dart'
show
- ShadowArguments,
ShadowAsExpression,
ShadowAssertInitializer,
ShadowAssertStatement,
ShadowAwaitExpression,
ShadowBlock,
- ShadowBoolLiteral,
ShadowBreakStatement,
ShadowCascadeExpression,
ShadowComplexAssignment,
@@ -79,7 +73,6 @@
ShadowContinueSwitchStatement,
ShadowDeferredCheck,
ShadowDoStatement,
- ShadowDoubleLiteral,
ShadowExpressionStatement,
ShadowFactoryConstructorInvocation,
ShadowFieldInitializer,
@@ -95,15 +88,12 @@
ShadowIsExpression,
ShadowIsNotExpression,
ShadowLabeledStatement,
- ShadowListLiteral,
ShadowLogicalExpression,
ShadowLoopAssignmentStatement,
- ShadowMapLiteral,
ShadowMethodInvocation,
ShadowNamedFunctionExpression,
ShadowNot,
ShadowNullAwareMethodInvocation,
- ShadowNullLiteral,
ShadowPropertyAssign,
ShadowRedirectingInitializer,
ShadowRethrow,
@@ -112,18 +102,15 @@
ShadowStaticGet,
ShadowStaticInvocation,
ShadowStringConcatenation,
- ShadowStringLiteral,
ShadowSuperInitializer,
ShadowSuperMethodInvocation,
ShadowSuperPropertyGet,
ShadowSwitchStatement,
- ShadowSymbolLiteral,
ShadowSyntheticExpression,
ShadowThisExpression,
ShadowThrow,
ShadowTryCatch,
ShadowTryFinally,
- ShadowTypeLiteral,
ShadowVariableAssignment,
ShadowVariableDeclaration,
ShadowVariableGet,
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index 4bcc0c7..d542d10 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -50,6 +50,8 @@
templateOverrideTypeVariablesMismatch,
templateRedirectionTargetNotFound;
+import '../parser.dart' show noLength;
+
import '../problems.dart' show unexpected, unhandled, unimplemented;
import '../type_inference/type_schema.dart' show UnknownType;
@@ -208,9 +210,9 @@
var message = templateRedirectionTargetNotFound
.withArguments(redirectionTarget.fullNameForErrors);
if (builder.isConst) {
- addCompileTimeError(message, builder.charOffset);
+ addCompileTimeError(message, builder.charOffset, noLength);
} else {
- addProblem(message, builder.charOffset);
+ addProblem(message, builder.charOffset, noLength);
}
// CoreTypes aren't computed yet, and this is the outline
// phase. So we can't and shouldn't create a method body.
@@ -310,10 +312,11 @@
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
declaredMember.fileOffset,
+ noLength,
context: templateOverriddenMethodCause
.withArguments(interfaceMember.name.name)
- .withLocation(
- _getMemberUri(interfaceMember), interfaceMember.fileOffset));
+ .withLocation(_getMemberUri(interfaceMember),
+ interfaceMember.fileOffset, noLength));
} else if (library.loader.target.backendTarget.strongMode &&
declaredFunction?.typeParameters != null) {
var substitution = <TypeParameter, DartType>{};
@@ -372,11 +375,11 @@
interfaceType);
fileOffset = declaredParameter.fileOffset;
}
- library.addCompileTimeError(message, fileOffset, fileUri,
+ library.addCompileTimeError(message, fileOffset, noLength, fileUri,
context: templateOverriddenMethodCause
.withArguments(interfaceMember.name.name)
- .withLocation(
- _getMemberUri(interfaceMember), interfaceMember.fileOffset));
+ .withLocation(_getMemberUri(interfaceMember),
+ interfaceMember.fileOffset, noLength));
return true;
}
return false;
@@ -423,10 +426,11 @@
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
declaredMember.fileOffset,
+ noLength,
context: templateOverriddenMethodCause
.withArguments(interfaceMember.name.name)
- .withLocation(
- interfaceMember.fileUri, interfaceMember.fileOffset));
+ .withLocation(interfaceMember.fileUri, interfaceMember.fileOffset,
+ noLength));
}
if (interfaceFunction.requiredParameterCount <
declaredFunction.requiredParameterCount) {
@@ -436,10 +440,11 @@
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
declaredMember.fileOffset,
+ noLength,
context: templateOverriddenMethodCause
.withArguments(interfaceMember.name.name)
- .withLocation(
- interfaceMember.fileUri, interfaceMember.fileOffset));
+ .withLocation(interfaceMember.fileUri, interfaceMember.fileOffset,
+ noLength));
}
for (int i = 0;
i < declaredFunction.positionalParameters.length &&
@@ -468,15 +473,26 @@
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
declaredMember.fileOffset,
+ noLength,
context: templateOverriddenMethodCause
.withArguments(interfaceMember.name.name)
- .withLocation(
- interfaceMember.fileUri, interfaceMember.fileOffset));
+ .withLocation(interfaceMember.fileUri, interfaceMember.fileOffset,
+ noLength));
}
+ int compareNamedParameters(VariableDeclaration p0, VariableDeclaration p1) {
+ return p0.name.compareTo(p1.name);
+ }
+
+ List<VariableDeclaration> sortedFromDeclared =
+ new List.from(declaredFunction.namedParameters)
+ ..sort(compareNamedParameters);
+ List<VariableDeclaration> sortedFromInterface =
+ new List.from(interfaceFunction.namedParameters)
+ ..sort(compareNamedParameters);
Iterator<VariableDeclaration> declaredNamedParameters =
- declaredFunction.namedParameters.iterator;
+ sortedFromDeclared.iterator;
Iterator<VariableDeclaration> interfaceNamedParameters =
- interfaceFunction.namedParameters.iterator;
+ sortedFromInterface.iterator;
outer:
while (declaredNamedParameters.moveNext() &&
interfaceNamedParameters.moveNext()) {
@@ -490,10 +506,11 @@
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
declaredMember.fileOffset,
+ noLength,
context: templateOverriddenMethodCause
.withArguments(interfaceMember.name.name)
- .withLocation(
- interfaceMember.fileUri, interfaceMember.fileOffset));
+ .withLocation(interfaceMember.fileUri,
+ interfaceMember.fileOffset, noLength));
break outer;
}
}
@@ -589,8 +606,9 @@
int patchLength = patch.typeVariables?.length ?? 0;
if (originLength != patchLength) {
patch.addCompileTimeError(
- messagePatchClassTypeVariablesMismatch, patch.charOffset,
- context: messagePatchClassOrigin.withLocation(fileUri, charOffset));
+ messagePatchClassTypeVariablesMismatch, patch.charOffset, noLength,
+ context: messagePatchClassOrigin.withLocation(
+ fileUri, charOffset, noLength));
} else if (typeVariables != null) {
int count = 0;
for (KernelTypeVariableBuilder t in patch.typeVariables) {
@@ -598,10 +616,10 @@
}
}
} else {
- library.addCompileTimeError(
- messagePatchDeclarationMismatch, patch.charOffset, patch.fileUri,
- context:
- messagePatchDeclarationOrigin.withLocation(fileUri, charOffset));
+ library.addCompileTimeError(messagePatchDeclarationMismatch,
+ patch.charOffset, noLength, patch.fileUri,
+ context: messagePatchDeclarationOrigin.withLocation(
+ fileUri, charOffset, noLength));
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
index a97e69a..b915987 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_enum_builder.dart
@@ -37,6 +37,8 @@
import '../modifier.dart' show constMask, finalMask, staticMask;
+import '../parser.dart' show noLength;
+
import '../source/source_class_builder.dart' show SourceClassBuilder;
import 'kernel_builder.dart'
@@ -164,7 +166,7 @@
String documentationComment = constantNamesAndOffsetsAndDocs[i + 2];
if (members.containsKey(name)) {
parent.addCompileTimeError(templateDuplicatedName.withArguments(name),
- charOffset, parent.fileUri);
+ charOffset, noLength, parent.fileUri);
constantNamesAndOffsetsAndDocs[i] = null;
continue;
}
@@ -172,6 +174,7 @@
parent.addCompileTimeError(
templateEnumConstantSameNameAsEnclosing.withArguments(name),
charOffset,
+ noLength,
parent.fileUri);
constantNamesAndOffsetsAndDocs[i] = null;
continue;
@@ -264,7 +267,7 @@
// unnamed constructor requires no arguments. But that information isn't
// always available at this point, and it's not really a situation that
// can happen unless you start modifying the SDK sources.
- addCompileTimeError(messageNoUnnamedConstructorInObject, -1);
+ addCompileTimeError(messageNoUnnamedConstructorInObject, -1, noLength);
} else {
constructor.initializers.add(
new SuperInitializer(superConstructor.target, new Arguments.empty())
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
index 6cd24dd..044e692 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart
@@ -15,6 +15,8 @@
import 'package:kernel/type_algebra.dart' show substitute;
+import '../parser.dart' show noLength;
+
import '../fasta_codes.dart' show templateCyclicTypedef;
import 'kernel_builder.dart'
@@ -58,8 +60,8 @@
DartType buildThisType(LibraryBuilder library) {
if (thisType != null) {
if (const InvalidType() == thisType) {
- library.addCompileTimeError(
- templateCyclicTypedef.withArguments(name), charOffset, fileUri);
+ library.addCompileTimeError(templateCyclicTypedef.withArguments(name),
+ charOffset, noLength, fileUri);
return const DynamicType();
}
return thisType;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
index a3424b3..63a43ad 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
@@ -15,6 +15,8 @@
import '../fasta_codes.dart' show messageSupertypeIsFunction;
+import '../parser.dart' show noLength;
+
import '../problems.dart' show unsupported;
import 'kernel_builder.dart'
@@ -76,7 +78,7 @@
Supertype buildSupertype(
LibraryBuilder library, int charOffset, Uri fileUri) {
library.addCompileTimeError(
- messageSupertypeIsFunction, charOffset, fileUri);
+ messageSupertypeIsFunction, charOffset, noLength, fileUri);
return null;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart
index 68c8f62..dffdd01 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart
@@ -8,6 +8,8 @@
import '../fasta_codes.dart' show LocatedMessage, Message, templateTypeNotFound;
+import '../parser.dart' show noLength;
+
import 'kernel_builder.dart'
show InvalidTypeBuilder, KernelTypeBuilder, LibraryBuilder;
@@ -19,7 +21,7 @@
KernelInvalidTypeBuilder(String name, int charOffset, Uri fileUri,
[Message message])
: message = (message ?? templateTypeNotFound.withArguments(name))
- .withLocation(fileUri, charOffset),
+ .withLocation(fileUri, charOffset, noLength),
super(name, charOffset, fileUri);
DartType buildType(
@@ -30,7 +32,8 @@
/// [Arguments] have already been built.
DartType buildTypesWithBuiltArguments(
LibraryBuilder library, List<DartType> arguments) {
- library.addProblem(message.messageObject, message.charOffset, message.uri);
+ library.addProblem(
+ message.messageObject, message.charOffset, message.length, message.uri);
return const InvalidType();
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 2a04c1e..78bc875 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -6,12 +6,12 @@
import 'dart:convert' show JSON;
-import 'package:front_end/src/fasta/export.dart';
-import 'package:front_end/src/fasta/import.dart';
import 'package:kernel/ast.dart';
import '../../scanner/token.dart' show Token;
+import '../export.dart' show Export;
+
import '../fasta_codes.dart'
show
Message,
@@ -24,7 +24,6 @@
templateDuplicatedImport,
templateDuplicatedImportInType,
templateExportHidesExport,
- templateIllegalMethodName,
templateImportHidesImport,
templateLoadLibraryHidesMember,
templateLocalDefinitionHidesExport,
@@ -32,11 +31,15 @@
templatePatchInjectionFailed,
templateTypeVariableDuplicatedNameCause;
+import '../import.dart' show Import;
+
import '../loader.dart' show Loader;
import '../modifier.dart'
show abstractMask, namedMixinApplicationMask, staticMask;
+import '../parser.dart' show noLength;
+
import '../problems.dart' show unhandled;
import '../source/source_class_builder.dart' show SourceClassBuilder;
@@ -75,7 +78,6 @@
NamedTypeBuilder,
PrefixBuilder,
ProcedureBuilder,
- QualifiedName,
Scope,
TypeBuilder,
TypeVariableBuilder,
@@ -203,9 +205,10 @@
if (tv != null) {
cls.addCompileTimeError(
templateConflictsWithTypeVariable.withArguments(name),
- member.charOffset);
- cls.addCompileTimeError(
- messageConflictsWithTypeVariableCause, tv.charOffset);
+ member.charOffset,
+ name.length,
+ context: messageConflictsWithTypeVariableCause.withLocation(
+ tv.fileUri, tv.charOffset, name.length));
}
}
setParent(name, member);
@@ -227,20 +230,20 @@
for (TypeVariableBuilder tv in typeVariables) {
TypeVariableBuilder existing = typeVariablesByName[tv.name];
if (existing != null) {
- addCompileTimeError(
- messageTypeVariableDuplicatedName, tv.charOffset, fileUri);
- addCompileTimeError(
- templateTypeVariableDuplicatedNameCause.withArguments(tv.name),
- existing.charOffset,
- fileUri);
+ addCompileTimeError(messageTypeVariableDuplicatedName, tv.charOffset,
+ tv.name.length, fileUri,
+ context: templateTypeVariableDuplicatedNameCause
+ .withArguments(tv.name)
+ .withLocation(
+ fileUri, existing.charOffset, existing.name.length));
} else {
typeVariablesByName[tv.name] = tv;
if (owner is ClassBuilder) {
// Only classes and type variables can't have the same name. See
// [#29555](https://github.com/dart-lang/sdk/issues/29555).
if (tv.name == owner.name) {
- addCompileTimeError(
- messageTypeVariableSameNameAsEnclosing, tv.charOffset, fileUri);
+ addCompileTimeError(messageTypeVariableSameNameAsEnclosing,
+ tv.charOffset, tv.name.length, fileUri);
}
}
}
@@ -554,29 +557,40 @@
?.setDocumentationComment(builder.target, documentationComment);
}
- String computeAndValidateConstructorName(Object name, int charOffset) {
- String className = currentDeclaration.name;
- String prefix;
- String suffix;
- if (name is QualifiedName) {
- prefix = name.prefix;
- suffix = name.suffix;
- } else {
- prefix = name;
- suffix = null;
- }
- if (prefix == className) {
- return suffix ?? "";
- }
- if (suffix == null) {
- // A legal name for a regular method, but not for a constructor.
- return null;
- }
- addCompileTimeError(
- templateIllegalMethodName.withArguments("$name", "$className.$suffix"),
+ void addConstructor(
+ String documentationComment,
+ List<MetadataBuilder> metadata,
+ int modifiers,
+ KernelTypeBuilder returnType,
+ final Object name,
+ String constructorName,
+ List<TypeVariableBuilder> typeVariables,
+ List<FormalParameterBuilder> formals,
+ int charOffset,
+ int charOpenParenOffset,
+ int charEndOffset,
+ String nativeMethodName) {
+ MetadataCollector metadataCollector = loader.target.metadataCollector;
+ ProcedureBuilder procedure = new KernelConstructorBuilder(
+ metadata,
+ modifiers & ~abstractMask,
+ returnType,
+ constructorName,
+ typeVariables,
+ formals,
+ this,
charOffset,
- fileUri);
- return suffix;
+ charOpenParenOffset,
+ charEndOffset,
+ nativeMethodName);
+ metadataCollector?.setDocumentationComment(
+ procedure.target, documentationComment);
+ metadataCollector?.setConstructorNameOffset(procedure.target, name);
+ checkTypeVariables(typeVariables, procedure);
+ addBuilder(constructorName, procedure, charOffset);
+ if (nativeMethodName != null) {
+ addNativeMethod(procedure);
+ }
}
void addProcedure(
@@ -584,7 +598,7 @@
List<MetadataBuilder> metadata,
int modifiers,
KernelTypeBuilder returnType,
- final Object name,
+ String name,
List<TypeVariableBuilder> typeVariables,
List<FormalParameterBuilder> formals,
ProcedureKind kind,
@@ -593,55 +607,24 @@
int charEndOffset,
String nativeMethodName,
{bool isTopLevel}) {
- // Nested declaration began in `OutlineBuilder.beginMethod` or
- // `OutlineBuilder.beginTopLevelMethod`.
- endNestedDeclaration("#method").resolveTypes(typeVariables, this);
- String procedureName;
- ProcedureBuilder procedure;
MetadataCollector metadataCollector = loader.target.metadataCollector;
- String constructorName = isTopLevel ||
- kind == ProcedureKind.Getter ||
- kind == ProcedureKind.Setter
- ? null
- : computeAndValidateConstructorName(name, charOffset);
- if (constructorName != null) {
- procedureName = constructorName;
- procedure = new KernelConstructorBuilder(
- metadata,
- modifiers & ~abstractMask,
- returnType,
- constructorName,
- typeVariables,
- formals,
- this,
- charOffset,
- charOpenParenOffset,
- charEndOffset,
- nativeMethodName);
- metadataCollector?.setDocumentationComment(
- procedure.target, documentationComment);
- metadataCollector?.setConstructorNameOffset(procedure.target, name);
- } else {
- assert(name is String);
- procedureName = name;
- procedure = new KernelProcedureBuilder(
- metadata,
- modifiers,
- returnType,
- name,
- typeVariables,
- formals,
- kind,
- this,
- charOffset,
- charOpenParenOffset,
- charEndOffset,
- nativeMethodName);
- metadataCollector?.setDocumentationComment(
- procedure.target, documentationComment);
- }
+ ProcedureBuilder procedure = new KernelProcedureBuilder(
+ metadata,
+ modifiers,
+ returnType,
+ name,
+ typeVariables,
+ formals,
+ kind,
+ this,
+ charOffset,
+ charOpenParenOffset,
+ charEndOffset,
+ nativeMethodName);
+ metadataCollector?.setDocumentationComment(
+ procedure.target, documentationComment);
checkTypeVariables(typeVariables, procedure);
- addBuilder(procedureName, procedure, charOffset);
+ addBuilder(name, procedure, charOffset);
if (nativeMethodName != null) {
addNativeMethod(procedure);
}
@@ -981,16 +964,16 @@
var template = isExport
? templateLocalDefinitionHidesExport
: templateLocalDefinitionHidesImport;
- addProblem(
- template.withArguments(name, hiddenUri), charOffset, fileUri);
+ addProblem(template.withArguments(name, hiddenUri), charOffset,
+ noLength, fileUri);
} else if (isLoadLibrary) {
addProblem(templateLoadLibraryHidesMember.withArguments(preferredUri),
- charOffset, fileUri);
+ charOffset, noLength, fileUri);
} else {
var template =
isExport ? templateExportHidesExport : templateImportHidesImport;
addProblem(template.withArguments(name, preferredUri, hiddenUri),
- charOffset, fileUri);
+ charOffset, noLength, fileUri);
}
return preferred;
}
@@ -1009,7 +992,7 @@
var template =
isExport ? templateDuplicatedExport : templateDuplicatedImport;
Message message = template.withArguments(name, uri, otherUri);
- addProblem(message, charOffset, fileUri);
+ addProblem(message, charOffset, noLength, fileUri);
var builderTemplate = isExport
? templateDuplicatedExportInType
: templateDuplicatedImportInType;
@@ -1183,7 +1166,7 @@
void exportMemberFromPatch(String name, Builder member) {
if (uri.scheme != "dart" || !uri.path.startsWith("_")) {
addCompileTimeError(templatePatchInjectionFailed.withArguments(name, uri),
- member.charOffset, member.fileUri);
+ member.charOffset, noLength, member.fileUri);
}
// Platform-private libraries, such as "dart:_internal" have special
// semantics: public members are injected into the origin library.
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
index ced686f..299756e 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
@@ -9,6 +9,8 @@
import '../messages.dart'
show templateSupertypeIsIllegal, templateSupertypeIsTypeVariable;
+import '../parser.dart' show noLength;
+
import 'kernel_builder.dart'
show
KernelClassBuilder,
@@ -37,7 +39,7 @@
? templateSupertypeIsTypeVariable
: templateSupertypeIsIllegal;
library.addCompileTimeError(
- template.withArguments("$name"), charOffset, fileUri);
+ template.withArguments("$name"), charOffset, noLength, fileUri);
return null;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
index fabb3ee..2f12afa 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
@@ -45,13 +45,14 @@
import '../messages.dart'
show
- messageConstConstructorWithBody,
messageInternalProblemBodyOnAbstractMethod,
messageNonInstanceTypeVariableUse,
messagePatchDeclarationMismatch,
messagePatchDeclarationOrigin,
messagePatchNonExternal;
+import '../parser.dart' show noLength;
+
import '../problems.dart' show internalProblem, unexpected;
import '../deprecated_problems.dart' show deprecated_inputError;
@@ -107,10 +108,6 @@
return internalProblem(messageInternalProblemBodyOnAbstractMethod,
newBody.fileOffset, fileUri);
}
- if (isConstructor && isConst) {
- return library.addCompileTimeError(
- messageConstConstructorWithBody, newBody.fileOffset, fileUri);
- }
}
actualBody = newBody;
if (function != null) {
@@ -194,7 +191,7 @@
}
}
library.addProblem(
- messageNonInstanceTypeVariableUse, charOffset, fileUri);
+ messageNonInstanceTypeVariableUse, charOffset, noLength, fileUri);
return substitute(type, substitution);
}
@@ -237,19 +234,19 @@
bool checkPatch(KernelFunctionBuilder patch) {
if (!isExternal) {
patch.library.addCompileTimeError(
- messagePatchNonExternal, patch.charOffset, patch.fileUri,
- context:
- messagePatchDeclarationOrigin.withLocation(fileUri, charOffset));
+ messagePatchNonExternal, patch.charOffset, noLength, patch.fileUri,
+ context: messagePatchDeclarationOrigin.withLocation(
+ fileUri, charOffset, noLength));
return false;
}
return true;
}
void reportPatchMismatch(Builder patch) {
- library.addCompileTimeError(
- messagePatchDeclarationMismatch, patch.charOffset, patch.fileUri,
- context:
- messagePatchDeclarationOrigin.withLocation(fileUri, charOffset));
+ library.addCompileTimeError(messagePatchDeclarationMismatch,
+ patch.charOffset, noLength, patch.fileUri,
+ context: messagePatchDeclarationOrigin.withLocation(
+ fileUri, charOffset, noLength));
}
}
@@ -618,6 +615,7 @@
@override
Procedure build(SourceLibraryBuilder library) {
Procedure result = super.build(library);
+ result.isRedirectingFactoryConstructor = true;
if (redirectionTarget.typeArguments != null) {
typeArguments =
new List<DartType>(redirectionTarget.typeArguments.length);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 9ae28c9..af03b4f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -58,6 +58,8 @@
messageConstConstructorNonFinalFieldCause,
templateSuperclassHasNoDefaultConstructor;
+import '../parser.dart' show noLength;
+
import '../problems.dart' show unhandled;
import '../severity.dart' show Severity;
@@ -613,7 +615,8 @@
builder.addCompileTimeError(
templateSuperclassHasNoDefaultConstructor
.withArguments(cls.superclass.name),
- constructor.fileOffset);
+ constructor.fileOffset,
+ noLength);
initializer = new InvalidInitializer();
} else {
initializer =
@@ -638,11 +641,15 @@
}
fieldInitializers[constructor] = myFieldInitializers;
if (constructor.isConst && nonFinalFields.isNotEmpty) {
- builder.addCompileTimeError(
- messageConstConstructorNonFinalField, constructor.fileOffset);
+ builder.addCompileTimeError(messageConstConstructorNonFinalField,
+ constructor.fileOffset, noLength);
+ // TODO(askesc): Put as context argument when multiple contexts
+ // are supported.
for (Field field in nonFinalFields) {
builder.addCompileTimeError(
- messageConstConstructorNonFinalFieldCause, field.fileOffset);
+ messageConstConstructorNonFinalFieldCause,
+ field.fileOffset,
+ noLength);
}
nonFinalFields.clear();
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
index db58c93..00ef2e1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_type_variable_builder.dart
@@ -49,6 +49,7 @@
library.addProblem(
templateTypeArgumentsOnTypeVariable.withArguments(name),
charOffset,
+ name.length,
fileUri);
}
return new TypeParameterType(parameter);
diff --git a/pkg/front_end/lib/src/fasta/kernel/utils.dart b/pkg/front_end/lib/src/fasta/kernel/utils.dart
index cb00003..4a9bd7f0 100644
--- a/pkg/front_end/lib/src/fasta/kernel/utils.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/utils.dart
@@ -2,19 +2,18 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-import 'dart:io';
+import 'dart:async' show Future;
-import 'package:front_end/src/scanner/token.dart' show Token;
-import 'package:kernel/ast.dart';
-import 'package:kernel/binary/ast_to_binary.dart';
-import 'package:kernel/binary/limited_ast_to_binary.dart';
-import 'package:kernel/text/ast_to_text.dart';
+import 'dart:io' show BytesBuilder, File, IOSink;
-/// A null-aware alternative to `token.offset`. If [token] is `null`, returns
-/// `TreeNode.noOffset`.
-int offsetForToken(Token token) =>
- token == null ? TreeNode.noOffset : token.offset;
+import 'package:kernel/ast.dart' show Library, Program;
+
+import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
+
+import 'package:kernel/binary/limited_ast_to_binary.dart'
+ show LimitedBinaryPrinter;
+
+import 'package:kernel/text/ast_to_text.dart' show Printer;
/// Print the given [program]. Do nothing if it is `null`. If the
/// [libraryFilter] is provided, then only libraries that satisfy it are
diff --git a/pkg/front_end/lib/src/fasta/kernel/verifier.dart b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
index 5473540..045c9f3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/verifier.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/verifier.dart
@@ -30,6 +30,8 @@
import '../fasta_codes.dart'
show LocatedMessage, templateInternalVerificationError;
+import '../parser.dart' show noLength;
+
import '../severity.dart' show Severity;
import '../type_inference/type_schema.dart' show TypeSchemaVisitor, UnknownType;
@@ -105,7 +107,7 @@
Uri uri = file == null ? null : file;
LocatedMessage message = templateInternalVerificationError
.withArguments(details)
- .withLocation(uri, offset);
+ .withLocation(uri, offset, noLength);
CompilerContext.current.report(message, Severity.error);
errors.add(message);
}
diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart
index 6bba731..ad04feb 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -22,6 +22,8 @@
templateInternalProblemMissingSeverity,
templateSourceBodySummary;
+import 'parser.dart' show noLength;
+
import 'problems.dart' show internalProblem;
import 'severity.dart' show Severity;
@@ -135,8 +137,8 @@
!accessor.isPatch &&
!target.backendTarget
.allowPlatformPrivateLibraryAccess(accessor.uri, uri)) {
- accessor.addCompileTimeError(
- messagePlatformPrivateLibraryAccess, charOffset, accessor.fileUri);
+ accessor.addCompileTimeError(messagePlatformPrivateLibraryAccess,
+ charOffset, noLength, accessor.fileUri);
}
return builder;
}
@@ -198,19 +200,20 @@
///
/// If [wasHandled] is true, this error is added to [handledErrors],
/// otherwise it is added to [unhandledErrors].
- void addCompileTimeError(Message message, int charOffset, Uri fileUri,
+ void addCompileTimeError(
+ Message message, int charOffset, int length, Uri fileUri,
{bool wasHandled: false, LocatedMessage context}) {
- addMessage(message, charOffset, fileUri, Severity.error,
+ addMessage(message, charOffset, length, fileUri, Severity.error,
wasHandled: wasHandled, context: context);
}
/// Register [message] as a problem with a severity determined by the
/// intrinsic severity of the message.
- void addProblem(Message message, int charOffset, Uri fileUri,
+ void addProblem(Message message, int charOffset, int length, Uri fileUri,
{LocatedMessage context}) {
Severity severity = message.code.severity;
if (severity == null) {
- addMessage(message, charOffset, fileUri, Severity.error,
+ addMessage(message, charOffset, length, fileUri, Severity.error,
context: context);
internalProblem(
templateInternalProblemMissingSeverity
@@ -222,7 +225,8 @@
severity =
target.backendTarget.strongMode ? Severity.error : Severity.warning;
}
- addMessage(message, charOffset, fileUri, severity, context: context);
+ addMessage(message, charOffset, length, fileUri, severity,
+ context: context);
}
/// All messages reported by the compiler (errors, warnings, etc.) are routed
@@ -231,8 +235,8 @@
/// Returns true if the message is new, that is, not previously
/// reported. This is important as some parser errors may be reported up to
/// three times by `OutlineBuilder`, `DietListener`, and `BodyBuilder`.
- bool addMessage(
- Message message, int charOffset, Uri fileUri, Severity severity,
+ bool addMessage(Message message, int charOffset, int length, Uri fileUri,
+ Severity severity,
{bool wasHandled: false, LocatedMessage context}) {
String trace = """
message: ${message.message}
@@ -241,14 +245,16 @@
severity: $severity
""";
if (!seenMessages.add(trace)) return false;
- target.context.report(message.withLocation(fileUri, charOffset), severity);
+ target.context
+ .report(message.withLocation(fileUri, charOffset, length), severity);
if (context != null) {
- target.context.report(context, severity);
+ target.context.report(context, Severity.context);
}
- recordMessage(severity, message, charOffset, fileUri, context: context);
+ recordMessage(severity, message, charOffset, length, fileUri,
+ context: context);
if (severity == Severity.error) {
(wasHandled ? handledErrors : unhandledErrors)
- .add(message.withLocation(fileUri, charOffset));
+ .add(message.withLocation(fileUri, charOffset, length));
}
return true;
}
@@ -265,8 +271,8 @@
Builder getNativeAnnotation() => target.getNativeAnnotation(this);
- void recordMessage(
- Severity severity, Message message, int charOffset, Uri fileUri,
+ void recordMessage(Severity severity, Message message, int charOffset,
+ int length, Uri fileUri,
{LocatedMessage context}) {}
}
diff --git a/pkg/front_end/lib/src/fasta/parser.dart b/pkg/front_end/lib/src/fasta/parser.dart
index b59b8a3..8419609 100644
--- a/pkg/front_end/lib/src/fasta/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser.dart
@@ -30,7 +30,14 @@
export 'parser/top_level_parser.dart' show TopLevelParser;
-export 'parser/util.dart' show closeBraceTokenFor, optional;
+export 'parser/util.dart'
+ show
+ closeBraceTokenFor,
+ lengthForToken,
+ lengthOfSpan,
+ noLength,
+ offsetForToken,
+ optional;
List<ParserError> parse(Token tokens) {
Listener listener = new Listener();
diff --git a/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart b/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
index 04095bd..d60e675 100644
--- a/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
@@ -281,8 +281,10 @@
}
@override
- void beginMethod() {
- listener?.beginMethod();
+ void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
+ Token varFinalOrConst, Token name) {
+ listener?.beginMethod(
+ externalToken, staticToken, covariantToken, varFinalOrConst, name);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index eefe576..358f63b 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -628,11 +628,13 @@
logEvent("Member");
}
- void beginMethod() {}
+ /// Handle the beginning of a method declaration. Substructures:
+ /// - metadata
+ void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
+ Token varFinalOrConst, Token name) {}
/// Handle the end of a method declaration. Substructures:
/// - metadata
- /// - modifiers
/// - return type
/// - method name (identifier, possibly qualified)
/// - type variables
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 57623b8..cb8a1f9 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -1412,17 +1412,7 @@
next = token.next;
if (next.type != TokenType.IDENTIFIER) {
String value = next.stringValue;
- if (identical(value, 'get') || identical(value, 'set')) {
- // Found a type reference, but missing an identifier after the period.
- rewriteAndRecover(
- token,
- fasta.templateExpectedIdentifier.withArguments(next),
- new SyntheticStringToken(
- TokenType.IDENTIFIER, '', next.charOffset, 0));
- // Return the newly inserted synthetic token
- // as the end of the type reference.
- return token.next;
- } else if (identical(value, '<')) {
+ if (identical(value, '<')) {
// Found a type reference, but missing an identifier after the period.
rewriteAndRecover(
token,
@@ -2722,8 +2712,16 @@
beforeToken = beforeNameToken;
token = nameToken;
}
- } else if (nameToken.isIdentifier) {
- nameContext = IdentifierContext.formalParameterDeclaration;
+ } else if (nameToken.isKeywordOrIdentifier) {
+ if (untyped) {
+ // Type is required in a function type but name is not.
+ untyped = false;
+ nameContext = null;
+ beforeNameToken = nameToken;
+ nameToken = nameToken.next;
+ } else {
+ nameContext = IdentifierContext.formalParameterDeclaration;
+ }
} else {
// No name required in a function type.
nameContext = null;
@@ -2911,6 +2909,10 @@
Function endStuff, Function handleNoStuff) {
Token next = token.next;
if (optional('<', next)) {
+ if (optional('dynamic', token)) {
+ reportRecoverableError(next,
+ fasta.templateTypeArgumentsOnTypeVariable.withArguments('dynamic'));
+ }
BeginToken begin = next;
rewriteLtEndGroupOpt(begin);
beginStuff(begin);
@@ -3814,49 +3816,39 @@
Token beforeName) {
bool isOperator = getOrSet == null && optional('operator', beforeName.next);
- int modifierCount = 0;
- if (externalToken != null) {
- listener.handleModifier(externalToken);
- ++modifierCount;
- }
if (staticToken != null) {
- if (!isOperator) {
- listener.handleModifier(staticToken);
- ++modifierCount;
- } else {
+ if (isOperator) {
reportRecoverableError(staticToken, fasta.messageStaticOperator);
staticToken = null;
}
} else if (covariantToken != null) {
- if (getOrSet != null && !optional('get', getOrSet)) {
- listener.handleModifier(covariantToken);
- ++modifierCount;
- } else {
+ if (getOrSet == null || optional('get', getOrSet)) {
reportRecoverableError(covariantToken, fasta.messageCovariantMember);
covariantToken = null;
}
}
if (varFinalOrConst != null) {
if (optional('const', varFinalOrConst)) {
- if (getOrSet == null) {
- listener.handleModifier(varFinalOrConst);
- ++modifierCount;
- } else {
+ if (getOrSet != null) {
reportRecoverableErrorWithToken(
varFinalOrConst, fasta.templateExtraneousModifier);
varFinalOrConst = null;
}
} else if (optional('var', varFinalOrConst)) {
reportRecoverableError(varFinalOrConst, fasta.messageVarReturnType);
+ varFinalOrConst = null;
} else {
assert(optional('final', varFinalOrConst));
reportRecoverableErrorWithToken(
varFinalOrConst, fasta.templateExtraneousModifier);
+ varFinalOrConst = null;
}
}
- // TODO(danrubel): Move beginMethod event before handleModifier events
- listener.beginMethod();
- listener.handleModifiers(modifierCount);
+
+ // TODO(danrubel): Consider parsing the name before calling beginMethod
+ // rather than passing the name token into beginMethod.
+ listener.beginMethod(externalToken, staticToken, covariantToken,
+ varFinalOrConst, beforeName.next);
if (beforeType == null) {
listener.handleNoType(beforeName);
@@ -3973,9 +3965,9 @@
token = parseFunctionBody(token, false, true);
} else {
if (varFinalOrConst != null && !optional('native', next)) {
- // TODO(danrubel): report error to fix
- // test_constFactory in parser_fasta_test.dart
- //reportRecoverableError(constToken, fasta.messageConstFactory);
+ if (optional('const', varFinalOrConst)) {
+ reportRecoverableError(varFinalOrConst, fasta.messageConstFactory);
+ }
}
token = parseFunctionBody(token, false, false);
}
diff --git a/pkg/front_end/lib/src/fasta/parser/util.dart b/pkg/front_end/lib/src/fasta/parser/util.dart
index 9f5cd6c..3a503aa 100644
--- a/pkg/front_end/lib/src/fasta/parser/util.dart
+++ b/pkg/front_end/lib/src/fasta/parser/util.dart
@@ -4,10 +4,14 @@
library fasta.parser.util;
+import 'package:kernel/ast.dart' show TreeNode;
+
import '../scanner.dart' show Token;
import '../../scanner/token.dart' show BeginToken;
+const int noLength = 1;
+
/// Returns true if [token] is the symbol or keyword [value].
bool optional(String value, Token token) {
return identical(value, token.stringValue);
@@ -15,7 +19,9 @@
/// Returns the close brace, bracket, or parenthesis of [left]. For '<', it may
/// return null.
-Token closeBraceTokenFor(BeginToken left) => left.endToken;
+Token closeBraceTokenFor(Token token) {
+ return token is BeginToken ? token.endGroup : null;
+}
/// Returns the token before the close brace, bracket, or parenthesis
/// associated with [left]. For '<', it may return `null`.
@@ -32,3 +38,24 @@
}
return token;
}
+
+/// A null-aware alternative to `token.offset`. If [token] is `null`, returns
+/// `TreeNode.noOffset`.
+int offsetForToken(Token token) {
+ return token == null ? TreeNode.noOffset : token.offset;
+}
+
+/// A null-aware alternative to `token.length`. If [token] is `null`, returns
+/// [noLength].
+int lengthForToken(Token token) {
+ return token == null ? 1 : token.length;
+}
+
+/// Returns the length of the span from [begin] to [end] (inclusive). If both
+/// tokens are null, return [noLength]. If one of the tokens are null, return
+/// the length of the other token.
+int lengthOfSpan(Token begin, Token end) {
+ if (begin == null) return lengthForToken(end);
+ if (end == null) return lengthForToken(begin);
+ return end.offset + end.length - begin.offset;
+}
diff --git a/pkg/front_end/lib/src/fasta/problems.dart b/pkg/front_end/lib/src/fasta/problems.dart
index c485b18..d9b0777 100644
--- a/pkg/front_end/lib/src/fasta/problems.dart
+++ b/pkg/front_end/lib/src/fasta/problems.dart
@@ -14,6 +14,8 @@
templateInternalProblemUnimplemented,
templateInternalProblemUnsupported;
+import 'parser.dart' show noLength;
+
import 'severity.dart' show Severity;
/// Used to report an internal error.
@@ -26,8 +28,9 @@
///
/// Before printing the message, the string `"Internal error: "` is prepended.
dynamic internalProblem(Message message, int charOffset, Uri uri) {
- throw CompilerContext.current
- .format(message.withLocation(uri, charOffset), Severity.internalProblem);
+ throw CompilerContext.current.format(
+ message.withLocation(uri, charOffset, noLength),
+ Severity.internalProblem);
}
dynamic unimplemented(String what, int charOffset, Uri uri) {
diff --git a/pkg/front_end/lib/src/fasta/scope.dart b/pkg/front_end/lib/src/fasta/scope.dart
index dec6321..33e5379 100644
--- a/pkg/front_end/lib/src/fasta/scope.dart
+++ b/pkg/front_end/lib/src/fasta/scope.dart
@@ -209,7 +209,7 @@
if (usedNames?.containsKey(name) ?? false) {
return templatePreviousUseOfName
.withArguments(name)
- .withLocation(fileUri, usedNames[name]);
+ .withLocation(fileUri, usedNames[name], name.length);
}
recordUse(name, charOffset, fileUri);
local[name] = builder;
diff --git a/pkg/front_end/lib/src/fasta/severity.dart b/pkg/front_end/lib/src/fasta/severity.dart
index b0c4add..02da071 100644
--- a/pkg/front_end/lib/src/fasta/severity.dart
+++ b/pkg/front_end/lib/src/fasta/severity.dart
@@ -5,9 +5,10 @@
library fasta.severity;
enum Severity {
+ context,
error,
+ errorLegacyWarning,
internalProblem,
nit,
warning,
- errorLegacyWarning,
}
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 4d9da6f..92cba45 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -788,11 +788,11 @@
@override
void addCompileTimeError(Message message, int charOffset, int length) {
- library.addCompileTimeError(message, charOffset, uri);
+ library.addCompileTimeError(message, charOffset, length, uri);
}
void addProblem(Message message, int charOffset, int length) {
- library.addProblem(message, charOffset, uri);
+ library.addProblem(message, charOffset, length, uri);
}
@override
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index b6b3372..ff5906f 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -14,10 +14,15 @@
import '../fasta_codes.dart'
show
+ LocatedMessage,
Message,
+ messageConstConstructorWithBody,
+ messageConstMethod,
+ messageConstructorWithReturnType,
messageExpectedBlockToSkip,
messageInterpolationInUri,
messageOperatorWithOptionalFormals,
+ messageStaticConstructor,
messageTypedefNotFunction,
templateDuplicatedParameterName,
templateDuplicatedParameterNameCause,
@@ -26,7 +31,18 @@
templateOperatorParameterMismatch1,
templateOperatorParameterMismatch2;
-import '../modifier.dart' show abstractMask, externalMask, Modifier;
+import '../modifier.dart'
+ show
+ Const,
+ Covariant,
+ External,
+ Final,
+ Modifier,
+ Static,
+ Var,
+ abstractMask,
+ constMask,
+ externalMask;
import '../operator.dart'
show
@@ -450,6 +466,9 @@
List<MetadataBuilder> metadata = pop();
String documentationComment = getDocumentationComment(beginToken);
checkEmpty(beginToken.charOffset);
+ library
+ .endNestedDeclaration("#method")
+ .resolveTypes(typeVariables, library);
library.addProcedure(
documentationComment,
metadata,
@@ -507,7 +526,35 @@
}
@override
- void beginMethod() {
+ void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
+ Token varFinalOrConst, Token name) {
+ List<Modifier> modifiers = <Modifier>[];
+ if (externalToken != null) {
+ modifiers.add(External);
+ }
+ if (staticToken != null) {
+ if (name?.lexeme == library.currentDeclaration.name) {
+ handleRecoverableError(
+ messageStaticConstructor, staticToken, staticToken);
+ } else {
+ modifiers.add(Static);
+ }
+ }
+ if (covariantToken != null) {
+ modifiers.add(Covariant);
+ }
+ if (varFinalOrConst != null) {
+ String lexeme = varFinalOrConst.lexeme;
+ if (identical('var', lexeme)) {
+ modifiers.add(Var);
+ } else if (identical('final', lexeme)) {
+ modifiers.add(Final);
+ } else {
+ modifiers.add(Const);
+ }
+ }
+ push(varFinalOrConst ?? NullValue.VarFinalOrConstToken);
+ push(modifiers);
library.beginNestedDeclaration("#method", hasMembers: false);
}
@@ -587,22 +634,71 @@
if ((modifiers & externalMask) != 0) {
modifiers &= ~abstractMask;
}
+ Token varFinalOrConst = pop(NullValue.VarFinalOrConstToken);
List<MetadataBuilder> metadata = pop();
String documentationComment = getDocumentationComment(beginToken);
- library.addProcedure(
- documentationComment,
- metadata,
- modifiers,
- returnType,
- name,
- typeVariables,
- formals,
- kind,
- charOffset,
- formalsOffset,
- endToken.charOffset,
- nativeMethodName,
- isTopLevel: false);
+ library
+ .endNestedDeclaration("#method")
+ .resolveTypes(typeVariables, library);
+ String constructorName =
+ kind == ProcedureKind.Getter || kind == ProcedureKind.Setter
+ ? null
+ : library.computeAndValidateConstructorName(name, charOffset);
+ if (constructorName != null) {
+ if (varFinalOrConst != null) {
+ if (optional('const', varFinalOrConst) &&
+ (endToken != null && !optional(';', endToken))) {
+ handleRecoverableError(messageConstConstructorWithBody,
+ varFinalOrConst, varFinalOrConst);
+ varFinalOrConst = null;
+ modifiers &= ~constMask;
+ }
+ }
+ if (returnType != null) {
+ // TODO(danrubel): Report this error on the return type
+ handleRecoverableError(
+ messageConstructorWithReturnType, beginToken, beginToken);
+ returnType = null;
+ }
+ library.addConstructor(
+ documentationComment,
+ metadata,
+ modifiers,
+ returnType,
+ name,
+ constructorName,
+ typeVariables,
+ formals,
+ charOffset,
+ formalsOffset,
+ endToken.charOffset,
+ nativeMethodName);
+ } else {
+ if (varFinalOrConst != null) {
+ if (optional('const', varFinalOrConst)) {
+ handleRecoverableError(
+ messageConstMethod, varFinalOrConst, varFinalOrConst);
+ varFinalOrConst = null;
+ modifiers &= ~constMask;
+ }
+ }
+ // TODO(danrubel): report messageFieldInitializerOutsideConstructor
+ // for any parameter of the form `this.fieldName`.
+ library.addProcedure(
+ documentationComment,
+ metadata,
+ modifiers,
+ returnType,
+ name,
+ typeVariables,
+ formals,
+ kind,
+ charOffset,
+ formalsOffset,
+ endToken.charOffset,
+ nativeMethodName,
+ isTopLevel: false);
+ }
nativeMethodName = null;
}
@@ -748,12 +844,11 @@
addCompileTimeError(
templateDuplicatedParameterName.withArguments(formals[1].name),
formals[1].charOffset,
- formals[1].name.length);
- addCompileTimeError(
- templateDuplicatedParameterNameCause
- .withArguments(formals[1].name),
- formals[0].charOffset,
- formals[0].name.length);
+ formals[1].name.length,
+ context: templateDuplicatedParameterNameCause
+ .withArguments(formals[1].name)
+ .withLocation(
+ uri, formals[0].charOffset, formals[0].name.length));
}
} else if (formals.length > 2) {
Map<String, FormalParameterBuilder> seenNames =
@@ -1064,12 +1159,15 @@
}
@override
- void addCompileTimeError(Message message, int charOffset, int length) {
- library.addCompileTimeError(message, charOffset, uri);
+ void addCompileTimeError(Message message, int charOffset, int length,
+ {LocatedMessage context}) {
+ library.addCompileTimeError(message, charOffset, length, uri,
+ context: context);
}
- void addProblem(Message message, int charOffset, int length) {
- library.addProblem(message, charOffset, uri);
+ void addProblem(Message message, int charOffset, int length,
+ {LocatedMessage context}) {
+ library.addProblem(message, charOffset, length, uri, context: context);
}
/// Return the documentation comment for the entity that starts at the
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 7886eff..a09cdd2 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -4,14 +4,11 @@
library fasta.source_class_builder;
-import 'package:front_end/src/base/instrumentation.dart' show Instrumentation;
-
-import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
- show ShadowClass;
-
import 'package:kernel/ast.dart'
show Class, Constructor, Member, Supertype, TreeNode, setParents;
+import '../../base/instrumentation.dart' show Instrumentation;
+
import '../dill/dill_member_builder.dart' show DillMemberBuilder;
import '../fasta_codes.dart'
@@ -40,6 +37,10 @@
TypeVariableBuilder,
compareProcedures;
+import '../kernel/kernel_shadow_ast.dart' show ShadowClass;
+
+import '../parser.dart' show noLength;
+
import '../problems.dart' show unexpected, unhandled;
import 'source_library_builder.dart' show SourceLibraryBuilder;
@@ -151,35 +152,39 @@
constructors.forEach((String name, Builder constructor) {
Builder member = scopeBuilder[name];
if (member == null) return;
- // TODO(ahe): charOffset is missing.
+ // TODO(ahe): Revisit these messages. It seems like the last two should
+ // be `context` parameter to this message.
addCompileTimeError(templateConflictsWithMember.withArguments(name),
- constructor.charOffset);
+ constructor.charOffset, noLength);
if (constructor.isFactory) {
addCompileTimeError(
templateConflictsWithFactory.withArguments("${this.name}.${name}"),
- member.charOffset);
+ member.charOffset,
+ noLength);
} else {
addCompileTimeError(
templateConflictsWithConstructor
.withArguments("${this.name}.${name}"),
- member.charOffset);
+ member.charOffset,
+ noLength);
}
});
scope.setters.forEach((String name, Builder setter) {
Builder member = scopeBuilder[name];
if (member == null || !member.isField || member.isFinal) return;
- // TODO(ahe): charOffset is missing.
if (member.isInstanceMember == setter.isInstanceMember) {
- addProblem(
- templateConflictsWithMember.withArguments(name), setter.charOffset);
- addProblem(
- templateConflictsWithSetter.withArguments(name), member.charOffset);
+ addProblem(templateConflictsWithMember.withArguments(name),
+ setter.charOffset, noLength);
+ // TODO(ahe): Context argument to previous message?
+ addProblem(templateConflictsWithSetter.withArguments(name),
+ member.charOffset, noLength);
} else {
addProblem(templateConflictsWithMemberWarning.withArguments(name),
- setter.charOffset);
+ setter.charOffset, noLength);
+ // TODO(ahe): Context argument to previous message?
addProblem(templateConflictsWithSetterWarning.withArguments(name),
- member.charOffset);
+ member.charOffset, noLength);
}
});
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index cc8fd0a..01d6e4b 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -40,14 +40,15 @@
import '../fasta_codes.dart'
show
messageExpectedUri,
- messagePartOfSelf,
messageMemberWithSameNameAsClass,
+ messagePartOfSelf,
templateConflictsWithMember,
templateConflictsWithSetter,
templateCouldNotParseUri,
templateDeferredPrefixDuplicated,
templateDeferredPrefixDuplicatedCause,
templateDuplicatedDefinition,
+ templateIllegalMethodName,
templateMissingPartOf,
templatePartOfLibraryNameMismatch,
templatePartOfUriMismatch,
@@ -58,6 +59,8 @@
import '../configuration.dart' show Configuration;
+import '../parser.dart' show noLength;
+
import '../problems.dart' show unhandled;
import 'source_loader.dart' show SourceLoader;
@@ -164,7 +167,7 @@
Uri resolve(Uri baseUri, String uri, int uriOffset, {isPart: false}) {
if (uri == null) {
- addCompileTimeError(messageExpectedUri, uriOffset, this.uri);
+ addCompileTimeError(messageExpectedUri, uriOffset, noLength, this.uri);
return new Uri(scheme: MALFORMED_URI_SCHEME);
}
Uri parsedUri;
@@ -177,6 +180,7 @@
addCompileTimeError(
templateCouldNotParseUri.withArguments(uri, e.message),
uriOffset + 1 + (e.offset ?? -1),
+ 1,
this.uri);
return new Uri(
scheme: MALFORMED_URI_SCHEME, query: Uri.encodeQueryComponent(uri));
@@ -189,6 +193,32 @@
}
}
+ String computeAndValidateConstructorName(Object name, int charOffset) {
+ String className = currentDeclaration.name;
+ String prefix;
+ String suffix;
+ if (name is QualifiedName) {
+ prefix = name.prefix;
+ suffix = name.suffix;
+ } else {
+ prefix = name;
+ suffix = null;
+ }
+ if (prefix == className) {
+ return suffix ?? "";
+ }
+ if (suffix == null) {
+ // A legal name for a regular method, but not for a constructor.
+ return null;
+ }
+ addCompileTimeError(
+ templateIllegalMethodName.withArguments("$name", "$className.$suffix"),
+ charOffset,
+ noLength,
+ fileUri);
+ return suffix;
+ }
+
void addExport(
List<MetadataBuilder> metadata,
String uri,
@@ -338,12 +368,26 @@
}
}
+ void addConstructor(
+ String documentationComment,
+ List<MetadataBuilder> metadata,
+ int modifiers,
+ T returnType,
+ final Object name,
+ String constructorName,
+ List<TypeVariableBuilder> typeVariables,
+ List<FormalParameterBuilder> formals,
+ int charOffset,
+ int charOpenParenOffset,
+ int charEndOffset,
+ String nativeMethodName);
+
void addProcedure(
String documentationComment,
List<MetadataBuilder> metadata,
int modifiers,
T returnType,
- Object name,
+ String name,
List<TypeVariableBuilder> typeVariables,
List<FormalParameterBuilder> formals,
ProcedureKind kind,
@@ -416,7 +460,7 @@
!builder.isSetter &&
name == currentDeclaration.name) {
addCompileTimeError(
- messageMemberWithSameNameAsClass, charOffset, fileUri);
+ messageMemberWithSameNameAsClass, charOffset, noLength, fileUri);
}
Map<String, Builder> members = isConstructor
? currentDeclaration.constructors
@@ -440,11 +484,11 @@
addCompileTimeError(
templateDeferredPrefixDuplicated.withArguments(name),
deferred.charOffset,
- fileUri);
- addCompileTimeError(
- templateDeferredPrefixDuplicatedCause.withArguments(name),
- other.charOffset,
- fileUri);
+ noLength,
+ fileUri,
+ context: templateDeferredPrefixDuplicatedCause
+ .withArguments(name)
+ .withLocation(fileUri, other.charOffset, noLength));
}
return existing
..exportScope.merge(builder.exportScope,
@@ -453,7 +497,7 @@
});
} else if (isDuplicatedDefinition(existing, builder)) {
addCompileTimeError(templateDuplicatedDefinition.withArguments(name),
- charOffset, fileUri);
+ charOffset, noLength, fileUri);
}
return members[name] = builder;
}
@@ -500,11 +544,11 @@
scope.setters.forEach((String name, Builder setter) {
Builder member = scopeBuilder[name];
if (member == null || !member.isField || member.isFinal) return;
- // TODO(ahe): charOffset is missing.
addCompileTimeError(templateConflictsWithMember.withArguments(name),
- setter.charOffset, fileUri);
+ setter.charOffset, noLength, fileUri);
+ // TODO(ahe): Context to previous message?
addCompileTimeError(templateConflictsWithSetter.withArguments(name),
- member.charOffset, fileUri);
+ member.charOffset, noLength, fileUri);
});
return null;
@@ -535,12 +579,12 @@
Set<Uri> seenParts = new Set<Uri>();
for (SourceLibraryBuilder<T, R> part in parts.toList()) {
if (part == this) {
- addCompileTimeError(messagePartOfSelf, -1, fileUri);
+ addCompileTimeError(messagePartOfSelf, -1, noLength, fileUri);
} else if (seenParts.add(part.fileUri)) {
includePart(part);
} else {
- addCompileTimeError(
- templatePartTwice.withArguments(part.fileUri), -1, fileUri);
+ addCompileTimeError(templatePartTwice.withArguments(part.fileUri), -1,
+ noLength, fileUri);
}
}
}
@@ -553,6 +597,7 @@
templatePartOfUriMismatch.withArguments(
part.fileUri, uri, part.partOfUri),
-1,
+ noLength,
fileUri);
}
} else if (part.partOfName != null) {
@@ -563,6 +608,7 @@
templatePartOfLibraryNameMismatch.withArguments(
part.fileUri, name, part.partOfName),
-1,
+ noLength,
fileUri);
}
} else {
@@ -571,6 +617,7 @@
templatePartOfUseUri.withArguments(
part.fileUri, fileUri, part.partOfName),
-1,
+ noLength,
fileUri);
}
} else {
@@ -578,8 +625,8 @@
// metadata annotations can be associated with it.
assert(!part.isPart);
if (uriIsValid(part.fileUri)) {
- addCompileTimeError(
- templateMissingPartOf.withArguments(part.fileUri), -1, fileUri);
+ addCompileTimeError(templateMissingPartOf.withArguments(part.fileUri),
+ -1, noLength, fileUri);
}
}
part.forEach((String name, Builder builder) {
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index 0eded02..534367c 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -69,6 +69,8 @@
import '../parser/class_member_parser.dart' show ClassMemberParser;
+import '../parser.dart' show lengthForToken, noLength, offsetForToken;
+
import '../problems.dart' show internalProblem;
import '../scanner.dart' show ErrorToken, ScannerResult, Token, scan;
@@ -159,8 +161,8 @@
while (token is ErrorToken) {
if (!suppressLexicalErrors) {
ErrorToken error = token;
- library.addCompileTimeError(
- error.assertionMessage, token.charOffset, uri);
+ library.addCompileTimeError(error.assertionMessage,
+ offsetForToken(token), lengthForToken(token), uri);
}
token = token.next;
}
@@ -468,15 +470,15 @@
.join("', '");
messages[templateCyclicClassHierarchy
.withArguments(cls.fullNameForErrors, involvedString)
- .withLocation(cls.fileUri, cls.charOffset)] = cls;
+ .withLocation(cls.fileUri, cls.charOffset, noLength)] = cls;
});
// Report all classes involved in a cycle, sorted to ensure stability as
// [cyclicCandidates] is sensitive to if the platform (or other modules)
// are included in [classes].
for (LocatedMessage message in messages.keys.toList()..sort()) {
- messages[message]
- .addCompileTimeError(message.messageObject, message.charOffset);
+ messages[message].addCompileTimeError(
+ message.messageObject, message.charOffset, message.length);
}
}
ticker.logMs("Found cycles");
@@ -496,12 +498,14 @@
if (supertype is EnumBuilder) {
cls.addCompileTimeError(
templateExtendingEnum.withArguments(supertype.name),
- cls.charOffset);
+ cls.charOffset,
+ noLength);
} else if (!cls.library.mayImplementRestrictedTypes &&
blackListedClasses.contains(supertype)) {
cls.addCompileTimeError(
templateExtendingRestricted.withArguments(supertype.name),
- cls.charOffset);
+ cls.charOffset,
+ noLength);
}
}
TypeBuilder mixedInType = cls.mixedInType;
@@ -516,11 +520,12 @@
cls.addCompileTimeError(
templateIllegalMixinDueToConstructors
.withArguments(builder.fullNameForErrors),
- cls.charOffset);
- builder.addCompileTimeError(
- templateIllegalMixinDueToConstructorsCause
- .withArguments(builder.fullNameForErrors),
- constructory.charOffset);
+ cls.charOffset,
+ noLength,
+ context: templateIllegalMixinDueToConstructorsCause
+ .withArguments(builder.fullNameForErrors)
+ .withLocation(constructory.fileUri,
+ constructory.charOffset, noLength));
}
}
}
@@ -528,7 +533,8 @@
if (!isClassBuilder) {
cls.addCompileTimeError(
templateIllegalMixin.withArguments(mixedInType.fullNameForErrors),
- cls.charOffset);
+ cls.charOffset,
+ noLength);
}
}
}
@@ -599,6 +605,7 @@
templateAmbiguousSupertypes.withArguments(
name, a.asInterfaceType, b.asInterfaceType),
cls.fileOffset,
+ noLength,
cls.fileUri);
}
@@ -727,14 +734,15 @@
return target.backendTarget.throwCompileConstantError(coreTypes, error);
}
- Expression buildCompileTimeError(Message message, int offset, Uri uri) {
+ Expression buildCompileTimeError(
+ Message message, int offset, int length, Uri uri) {
String text = target.context
- .format(message.withLocation(uri, offset), Severity.error);
+ .format(message.withLocation(uri, offset, length), Severity.error);
return target.backendTarget.buildCompileTimeError(coreTypes, text, offset);
}
- void recordMessage(
- Severity severity, Message message, int charOffset, Uri fileUri,
+ void recordMessage(Severity severity, Message message, int charOffset,
+ int length, Uri fileUri,
{LocatedMessage context}) {
if (instrumentation == null) return;
@@ -773,6 +781,10 @@
// Use a property name expressing that, in case it slips through.
severityString = "unresolved severity";
break;
+
+ case Severity.context:
+ severityString = "context";
+ break;
}
instrumentation.record(
fileUri,
diff --git a/pkg/front_end/lib/src/fasta/source/stack_listener.dart b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
index 8545689..d440748 100644
--- a/pkg/front_end/lib/src/fasta/source/stack_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
@@ -63,6 +63,7 @@
TypeList,
TypeVariable,
TypeVariables,
+ VarFinalOrConstToken,
WithClause,
}
diff --git a/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart b/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart
index 623aa63..dae1dc7 100644
--- a/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart
+++ b/pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart
@@ -1,17 +1,28 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE.md file.
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-import 'package:front_end/src/base/instrumentation.dart';
-import 'package:front_end/src/fasta/compiler_context.dart' show CompilerContext;
-import 'package:front_end/src/fasta/messages.dart';
-import 'package:front_end/src/fasta/scanner.dart';
-import 'package:front_end/src/fasta/scanner/io.dart';
-import 'package:front_end/src/fasta/severity.dart' show Severity;
-import 'package:front_end/src/scanner/token.dart' as analyzer;
+import 'dart:async' show Future;
+
+import 'dart:convert' show UTF8;
+
+import 'dart:io' show File;
+
+import '../../base/instrumentation.dart';
+
+import '../../scanner/token.dart' as analyzer;
+
+import '../compiler_context.dart' show CompilerContext;
+
+import '../messages.dart' show templateUnspecified;
+
+import '../parser.dart' show noLength;
+
+import '../scanner.dart' show ScannerResult, Token, scan;
+
+import '../scanner/io.dart' show readBytesFromFile;
+
+import '../severity.dart' show Severity;
/// Implementation of [Instrumentation] which checks property/value pairs
/// against expectations encoded in source files using "/*@...*/" comments.
@@ -219,7 +230,7 @@
return CompilerContext.current.format(
templateUnspecified
.withArguments('$desc${stackTrace == null ? '' : '\n$stackTrace'}')
- .withLocation(uri, offset),
+ .withLocation(uri, offset, noLength),
Severity.internalProblem);
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index febb348..be842cf 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -18,6 +18,8 @@
import 'package:kernel/type_algebra.dart';
import 'package:kernel/type_environment.dart';
+import '../parser.dart' show noLength;
+
/// Set this flag to `true` to cause debugging information about covariance
/// checks to be printed to standard output.
const bool debugCovariance = false;
@@ -66,6 +68,7 @@
_library.addCompileTimeError(
templateCantInferTypeDueToCircularity.withArguments(_name),
_offset,
+ noLength,
_fileUri);
} else {
var inferredType = _matchTypes(overriddenTypes, _name, _offset);
@@ -1133,6 +1136,7 @@
_library.addCompileTimeError(
templateCantInferTypeDueToInconsistentOverrides.withArguments(name),
charOffset,
+ noLength,
_fileUri);
return const DynamicType();
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index 18e43e9..5c2b314 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -25,8 +25,11 @@
import 'package:kernel/core_types.dart';
import '../deprecated_problems.dart' show Crash;
+
import '../messages.dart' show getLocationFromNode;
+import '../parser.dart' show noLength;
+
/// Concrete class derived from [InferenceNode] to represent type inference of a
/// field based on its initializer.
class FieldInitializerInferenceNode extends InferenceNode {
@@ -56,6 +59,7 @@
templateCantInferTypeDueToCircularity
.withArguments(field.name.name),
field.fileOffset,
+ noLength,
field.fileUri);
inferredType = const DynamicType();
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 0c41b9b..ae22062 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -9,6 +9,7 @@
AsyncMarker,
BottomType,
Class,
+ ConditionalExpression,
ConstructorInvocation,
DartType,
DispatchCategory,
@@ -28,6 +29,7 @@
Member,
MethodInvocation,
Name,
+ NullLiteral,
Procedure,
ProcedureKind,
PropertyGet,
@@ -65,6 +67,8 @@
import '../kernel/fasta_accessors.dart'
show BuilderHelper, CalleeDesignation, FunctionTypeAccessor;
+import '../kernel/frontend_accessors.dart' show buildIsNull;
+
import '../kernel/kernel_shadow_ast.dart'
show
getExplicitTypeArguments,
@@ -77,6 +81,8 @@
import '../names.dart' show callName;
+import '../parser.dart' show noLength;
+
import '../problems.dart' show unhandled;
import '../source/source_library_builder.dart' show SourceLibraryBuilder;
@@ -229,16 +235,9 @@
: returnOrYieldContext;
if (expectedType != null) {
expectedType = greatestClosure(inferrer.coreTypes, expectedType);
- DartType expectedTypeToCheck = expectedType;
- if (!inferrer.isAssignable(expectedType, type) && isAsync) {
- DartType unfuturedExpectedType =
- inferrer.typeSchemaEnvironment.unfutureType(expectedType);
- if (inferrer.isAssignable(unfuturedExpectedType, type)) {
- expectedTypeToCheck = unfuturedExpectedType;
- }
- }
if (inferrer.ensureAssignable(
- expectedTypeToCheck, type, expression, fileOffset) !=
+ expectedType, type, expression, fileOffset,
+ isReturnFromAsync: isAsync) !=
null) {
type = expectedType;
}
@@ -450,8 +449,25 @@
/// Checks whether [actualType] can be assigned to [expectedType], and inserts
/// an implicit downcast if appropriate.
Expression ensureAssignable(DartType expectedType, DartType actualType,
- Expression expression, int fileOffset) {
+ Expression expression, int fileOffset,
+ {bool isReturnFromAsync = false}) {
assert(expectedType == null || isKnown(expectedType));
+
+ DartType initialExpectedType = expectedType;
+ if (isReturnFromAsync && !isAssignable(expectedType, actualType)) {
+ // If the body of the function is async, the expected return type has the
+ // shape FutureOr<T>. We check both branches for FutureOr here: both T
+ // and Future<T>.
+ DartType unfuturedExpectedType =
+ typeSchemaEnvironment.unfutureType(expectedType);
+ DartType futuredExpectedType = wrapFutureType(unfuturedExpectedType);
+ if (isAssignable(unfuturedExpectedType, actualType)) {
+ expectedType = unfuturedExpectedType;
+ } else if (isAssignable(futuredExpectedType, actualType)) {
+ expectedType = futuredExpectedType;
+ }
+ }
+
// We don't need to insert assignability checks when doing top level type
// inference since top level type inference only cares about the type that
// is inferred (the kernel code is discarded).
@@ -468,12 +484,21 @@
var callMember = classHierarchy.getInterfaceMember(classNode, callName);
if (callMember is Procedure && callMember.kind == ProcedureKind.Method) {
if (_shouldTearOffCall(expectedType, actualType)) {
+ // Replace expression with:
+ // `let t = expression in t == null ? null : t.call`
var parent = expression.parent;
- var tearOff = new PropertyGet(expression, callName, callMember)
+ var t = new VariableDeclaration.forValue(expression, type: actualType)
..fileOffset = fileOffset;
- parent?.replaceChild(expression, tearOff);
- expression = tearOff;
+ var nullCheck = buildIsNull(new VariableGet(t), fileOffset);
+ var tearOff =
+ new PropertyGet(new VariableGet(t), callName, callMember)
+ ..fileOffset = fileOffset;
actualType = getCalleeType(callMember, actualType);
+ var conditional = new ConditionalExpression(nullCheck,
+ new NullLiteral()..fileOffset = fileOffset, tearOff, actualType);
+ var let = new Let(t, conditional);
+ parent?.replaceChild(expression, let);
+ expression = conditional;
}
}
}
@@ -504,7 +529,7 @@
} else {
// Insert an implicit downcast.
var parent = expression.parent;
- var typeCheck = new AsExpression(expression, expectedType)
+ var typeCheck = new AsExpression(expression, initialExpectedType)
..isTypeError = true
..fileOffset = fileOffset;
parent?.replaceChild(expression, typeCheck);
@@ -560,7 +585,8 @@
..fileOffset = receiver.fileOffset,
helper.buildCompileTimeError(
errorTemplate.withArguments(name.name, receiverType),
- fileOffset))
+ fileOffset,
+ noLength))
..fileOffset = fileOffset);
}
return interfaceMember;
@@ -1080,7 +1106,8 @@
calleeKind,
offset);
if (argMessage != null) {
- helper.addProblem(argMessage.messageObject, argMessage.charOffset);
+ helper.addProblem(
+ argMessage.messageObject, argMessage.charOffset, argMessage.length);
} else {
// Argument counts and names match. Compare types.
int numPositionalArgs = arguments.positional.length;
@@ -1681,6 +1708,7 @@
templateMixinInferenceNoMatchingClass.withArguments(mixinClass.name,
baseType.classNode.name, mixinSupertype.asInterfaceType),
mixinClass.fileOffset,
+ noLength,
mixinClass.fileUri);
return;
}
@@ -1728,6 +1756,7 @@
baseType.classNode.name,
mixinSupertype.asInterfaceType),
mixinClass.fileOffset,
+ noLength,
mixinClass.fileUri);
return p;
}
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index b1c9e87..0cb16f1c 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -267,6 +267,7 @@
ExpectedType:
template: "Expected a type, but got '#lexeme'."
+ severity: ERROR
analyzerCode: EXPECTED_TYPE_NAME
dart2jsCode: "*fatal*"
@@ -393,6 +394,22 @@
script:
- "class C { factory const C() = prefix.B.foo; }"
+ConstConstructorWithBody:
+ template: "A const constructor can't have a body."
+ tip: "Try removing either the 'const' keyword or the body."
+ analyzerCode: CONST_CONSTRUCTOR_WITH_BODY
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { const C() {} }"
+
+ConstMethod:
+ template: "Getters, setters and methods can't be declared to be 'const'."
+ tip: "Try removing the 'const' keyword."
+ analyzerCode: CONST_METHOD
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { const C() {} }"
+
CovariantAfterFinal:
template: "The modifier 'covariant' should be before the modifier 'final'."
tip: "Try re-ordering the modifiers."
@@ -916,6 +933,22 @@
template: "Couldn't find constructor '#name'."
severity: ERROR_LEGACY_WARNING
+ConstructorWithReturnType:
+ template: "Constructors can't have a return type."
+ tip: "Try removing the return type."
+ analyzerCode: CONSTRUCTOR_WITH_RETURN_TYPE
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { T C() {} }"
+
+FieldInitializerOutsideConstructor:
+ template: "Field formal parameters can only be used in a constructor."
+ tip: "Try replacing the field formal parameter with a normal parameter."
+ analyzerCode: FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { void m(this.x); }"
+
RedirectionTargetNotFound:
template: "Redirection constructor target not found: '#name'"
severity: ERROR_LEGACY_WARNING
@@ -945,9 +978,11 @@
CandidateFound:
template: "Found this candidate, but the arguments don't match."
+ severity: CONTEXT
CandidateFoundIsDefaultConstructor:
template: "The class '#name' has a constructor that takes no arguments."
+ severity: CONTEXT
TooFewArgumentsToFunction:
template: "Too few positional arguments to function: #count required, #count2 given."
@@ -1282,6 +1317,7 @@
IllegalMixinDueToConstructorsCause:
template: "This constructor prevents using '#name' as a mixin."
+ severity: CONTEXT
ConflictsWithConstructor:
template: "Conflicts with constructor '#name'."
@@ -1312,8 +1348,8 @@
severity: ERROR
ConflictsWithTypeVariableCause:
- template: "This is the type variable."
- severity: ERROR
+ template: "This is the type variable."
+ severity: CONTEXT
IllegalMixin:
template: "The type '#name' can't be mixed in."
@@ -1324,6 +1360,7 @@
OverriddenMethodCause:
template: "This is the overriden method ('#name')."
+ severity: CONTEXT
OverrideMismatchNamedParameter:
template: "The method '#name' doesn't have the named parameter '#name2' of overriden method '#name3'."
@@ -1357,9 +1394,6 @@
template: "'#name' isn't a legal method name."
tip: "Did you mean '#name2'?"
-ConstConstructorWithBody:
- template: "A const constructor can't have a body."
-
PartOfSelf:
template: "A file can't be a part of itself."
@@ -1368,6 +1402,7 @@
TypeVariableDuplicatedNameCause:
template: "The other type variable named '#name'."
+ severity: CONTEXT
TypeVariableSameNameAsEnclosing:
template: "A type variable can't have the same name as its enclosing declaration."
@@ -1537,10 +1572,16 @@
DeferredPrefixDuplicatedCause:
template: "'#name' is used here."
+ severity: CONTEXT
TypeArgumentsOnTypeVariable:
template: "Can't use type arguments with type variable '#name'."
+ tip: "Try removing the type arguments."
severity: ERROR_LEGACY_WARNING
+ analyzerCode: TYPE_ARGUMENTS_ON_TYPE_VARIABLE
+ dart2jsCode: "*fatal*"
+ script:
+ - "dynamic<T>(x) => 0"
DuplicatedDefinition:
template: "Duplicated definition of '#name'."
@@ -1553,6 +1594,7 @@
DuplicatedParameterNameCause:
template: "Other parameter named '#name'."
+ severity: CONTEXT
MemberWithSameNameAsClass:
template: "A class member can't have the same name as the enclosing class."
@@ -1669,7 +1711,7 @@
FinalInstanceVariableAlreadyInitializedCause:
template: "'#name' was initialized here."
- severity: ERROR_LEGACY_WARNING
+ severity: CONTEXT
TypeVariableInStaticContext:
template: "Type variables can't be used in static members."
@@ -1703,6 +1745,7 @@
ConstConstructorNonFinalFieldCause:
template: "Field isn't final, but constructor is 'const'."
+ severity: CONTEXT
AccessError:
template: "Access error: '#name'."
@@ -1823,12 +1866,14 @@
PatchClassOrigin:
template: "This is the origin class."
+ severity: CONTEXT
PatchDeclarationMismatch:
template: "This patch doesn't match origin declaration."
PatchDeclarationOrigin:
template: "This is the origin declaration."
+ severity: CONTEXT
PatchInjectionFailed:
template: "Can't inject '#name' into '#uri'."
diff --git a/pkg/front_end/testcases/annotation_eof.dart.direct.expect b/pkg/front_end/testcases/annotation_eof.dart.direct.expect
index f78b3b6..62142d7 100644
--- a/pkg/front_end/testcases/annotation_eof.dart.direct.expect
+++ b/pkg/front_end/testcases/annotation_eof.dart.direct.expect
@@ -2,9 +2,7 @@
import self as self;
import "dart:core" as core;
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/annotation_eof.dart:10:1: Error: Expected a declaration, but got ''.
-
-^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/annotation_eof.dart:10:1: Error: Expected a declaration, but got ''."]/* from null */;
static method main() → dynamic {
core::print("There is a dangling annotation at the end of this file");
}
diff --git a/pkg/front_end/testcases/annotation_eof.dart.strong.expect b/pkg/front_end/testcases/annotation_eof.dart.strong.expect
index f78b3b6..62142d7 100644
--- a/pkg/front_end/testcases/annotation_eof.dart.strong.expect
+++ b/pkg/front_end/testcases/annotation_eof.dart.strong.expect
@@ -2,9 +2,7 @@
import self as self;
import "dart:core" as core;
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/annotation_eof.dart:10:1: Error: Expected a declaration, but got ''.
-
-^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/annotation_eof.dart:10:1: Error: Expected a declaration, but got ''."]/* from null */;
static method main() → dynamic {
core::print("There is a dangling annotation at the end of this file");
}
diff --git a/pkg/front_end/testcases/check_deferred_as_check.dart.strong.expect b/pkg/front_end/testcases/check_deferred_as_check.dart.strong.expect
index aaf6e75..142e594 100644
--- a/pkg/front_end/testcases/check_deferred_as_check.dart.strong.expect
+++ b/pkg/front_end/testcases/check_deferred_as_check.dart.strong.expect
@@ -4,7 +4,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/check_deferred_as_check.dart:9:8: Error: The type '#lib1::C' is deferred loaded via prefix 'lib' and can't be used as a type annotation.
Try removing 'deferred' from the import of 'lib' or use a supertype of '#lib1::C' that isn't deferred.
x as lib.C;
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method main() → dynamic {}
static method test(dynamic x) → dynamic {
x as invalid-type;
diff --git a/pkg/front_end/testcases/check_deferred_is_check.dart.strong.expect b/pkg/front_end/testcases/check_deferred_is_check.dart.strong.expect
index e7e9db7..ef6d460 100644
--- a/pkg/front_end/testcases/check_deferred_is_check.dart.strong.expect
+++ b/pkg/front_end/testcases/check_deferred_is_check.dart.strong.expect
@@ -5,7 +5,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/check_deferred_is_check.dart:9:14: Error: The type '#lib1::C' is deferred loaded via prefix 'lib' and can't be used as a type annotation.
Try removing 'deferred' from the import of 'lib' or use a supertype of '#lib1::C' that isn't deferred.
print(x is lib.C);
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method main() → dynamic {}
static method test(dynamic x) → dynamic {
core::print(x is invalid-type);
diff --git a/pkg/front_end/testcases/check_deferred_type_declaration.dart.strong.expect b/pkg/front_end/testcases/check_deferred_type_declaration.dart.strong.expect
index cc18211..4d6d46d 100644
--- a/pkg/front_end/testcases/check_deferred_type_declaration.dart.strong.expect
+++ b/pkg/front_end/testcases/check_deferred_type_declaration.dart.strong.expect
@@ -4,7 +4,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/check_deferred_type_declaration.dart:9:3: Error: The type '#lib1::C' is deferred loaded via prefix 'lib' and can't be used as a type annotation.
Try removing 'deferred' from the import of 'lib' or use a supertype of '#lib1::C' that isn't deferred.
lib.C x = null;
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method main() → dynamic
return self::test();
static method test() → dynamic {
diff --git a/pkg/front_end/testcases/expressions.dart.strong.expect b/pkg/front_end/testcases/expressions.dart.strong.expect
index 49f6c0e..1fd98df 100644
--- a/pkg/front_end/testcases/expressions.dart.strong.expect
+++ b/pkg/front_end/testcases/expressions.dart.strong.expect
@@ -4,7 +4,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/expressions.dart:74:16: Error: Method not found: 'int.toString'.
print(int?.toString());
- ^"]/* from null */;
+ ^^^^^^^^"]/* from null */;
static method foo({dynamic fisk = null}) → dynamic {
core::print(fisk);
}
diff --git a/pkg/front_end/testcases/future_or_test.dart b/pkg/front_end/testcases/future_or_test.dart
new file mode 100644
index 0000000..375589d
--- /dev/null
+++ b/pkg/front_end/testcases/future_or_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// The test checks that an expression with static type Future<dynamic> is
+// accepted as a return expression of a method with an async body and the
+// declared return type Future<int>.
+
+import 'dart:async';
+
+class A {
+ dynamic foo() => null;
+}
+
+class B {
+ A a;
+
+ Future<dynamic> bar() async => a.foo();
+}
+
+class C {
+ B b = B();
+
+ Future<int> baz() async => b.bar();
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/future_or_test.dart.direct.expect b/pkg/front_end/testcases/future_or_test.dart.direct.expect
new file mode 100644
index 0000000..ea64edd
--- /dev/null
+++ b/pkg/front_end/testcases/future_or_test.dart.direct.expect
@@ -0,0 +1,29 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic
+ return null;
+}
+class B extends core::Object {
+ field self::A a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method bar() → asy::Future<dynamic> async
+ return this.{self::B::a}.foo();
+}
+class C extends core::Object {
+ field self::B b = new self::B::•();
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method baz() → asy::Future<core::int> async
+ return this.{self::C::b}.bar();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/future_or_test.dart.outline.expect b/pkg/front_end/testcases/future_or_test.dart.outline.expect
new file mode 100644
index 0000000..e69e132
--- /dev/null
+++ b/pkg/front_end/testcases/future_or_test.dart.outline.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+class B extends core::Object {
+ field self::A a;
+ synthetic constructor •() → void
+ ;
+ method bar() → asy::Future<dynamic>
+ ;
+}
+class C extends core::Object {
+ field self::B b;
+ synthetic constructor •() → void
+ ;
+ method baz() → asy::Future<core::int>
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/future_or_test.dart.strong.expect b/pkg/front_end/testcases/future_or_test.dart.strong.expect
new file mode 100644
index 0000000..253d160
--- /dev/null
+++ b/pkg/front_end/testcases/future_or_test.dart.strong.expect
@@ -0,0 +1,29 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:async" as asy;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic
+ return null;
+}
+class B extends core::Object {
+ field self::A a = null;
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method bar() → asy::Future<dynamic> async
+ return this.{self::B::a}.{self::A::foo}();
+}
+class C extends core::Object {
+ field self::B b = new self::B::•();
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method baz() → asy::Future<core::int> async
+ return this.{self::C::b}.{self::B::bar}() as{TypeError} asy::FutureOr<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/illegal_named_function_expression.dart.direct.expect b/pkg/front_end/testcases/illegal_named_function_expression.dart.direct.expect
index 96f3264..dc19dc1 100644
--- a/pkg/front_end/testcases/illegal_named_function_expression.dart.direct.expect
+++ b/pkg/front_end/testcases/illegal_named_function_expression.dart.direct.expect
@@ -4,11 +4,11 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression.dart:6:11: Error: A function expression can't have a return type.
var x = void f<T>(T t) {};
- ^", "pkg/front_end/testcases/illegal_named_function_expression.dart:6:16: Error: A function expression can't have a name.
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:6:16: Error: A function expression can't have a name.
var x = void f<T>(T t) {};
^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:9: Error: A function expression can't have a return type.
print(void g<T>(T t) {});
- ^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:14: Error: A function expression can't have a name.
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:14: Error: A function expression can't have a name.
print(void g<T>(T t) {});
^"]/* from null */;
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/illegal_named_function_expression.dart.strong.expect b/pkg/front_end/testcases/illegal_named_function_expression.dart.strong.expect
index 1bc8dba..f1c5274 100644
--- a/pkg/front_end/testcases/illegal_named_function_expression.dart.strong.expect
+++ b/pkg/front_end/testcases/illegal_named_function_expression.dart.strong.expect
@@ -4,11 +4,11 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression.dart:6:11: Error: A function expression can't have a return type.
var x = void f<T>(T t) {};
- ^", "pkg/front_end/testcases/illegal_named_function_expression.dart:6:16: Error: A function expression can't have a name.
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:6:16: Error: A function expression can't have a name.
var x = void f<T>(T t) {};
^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:9: Error: A function expression can't have a return type.
print(void g<T>(T t) {});
- ^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:14: Error: A function expression can't have a name.
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression.dart:8:14: Error: A function expression can't have a name.
print(void g<T>(T t) {});
^"]/* from null */;
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.direct.expect b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.direct.expect
index 793fc06..0bff178 100644
--- a/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.direct.expect
+++ b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.direct.expect
@@ -4,7 +4,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:9: Error: A function expression can't have a return type.
print(void f() {});
- ^", "pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:14: Error: A function expression can't have a name.
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:14: Error: A function expression can't have a name.
print(void f() {});
^"]/* from null */;
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.strong.expect b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.strong.expect
index fd8b0bb..9c4d9bd 100644
--- a/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.strong.expect
+++ b/pkg/front_end/testcases/illegal_named_function_expression_scope.dart.strong.expect
@@ -4,7 +4,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:9: Error: A function expression can't have a return type.
print(void f() {});
- ^", "pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:14: Error: A function expression can't have a name.
+ ^^^^", "pkg/front_end/testcases/illegal_named_function_expression_scope.dart:7:14: Error: A function expression can't have a name.
print(void f() {});
^"]/* from null */;
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/implicit_new.dart.strong.expect b/pkg/front_end/testcases/implicit_new.dart.strong.expect
index 8c23c2b..d959e33 100644
--- a/pkg/front_end/testcases/implicit_new.dart.strong.expect
+++ b/pkg/front_end/testcases/implicit_new.dart.strong.expect
@@ -26,9 +26,9 @@
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/implicit_new.dart:18:18: Error: Method not found: 'Bar'.
var y = prefix.Bar();
- ^", "pkg/front_end/testcases/implicit_new.dart:19:10: Error: Method not found: 'Bar'.
+ ^^^", "pkg/front_end/testcases/implicit_new.dart:19:10: Error: Method not found: 'Bar'.
prefix.Bar();
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method testNSM() → dynamic {
dynamic y = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#Bar, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#Bar, 32, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
diff --git a/pkg/front_end/testcases/inference/unresolved_super.dart.strong.expect b/pkg/front_end/testcases/inference/unresolved_super.dart.strong.expect
index 75a5d90..f3c83b5 100644
--- a/pkg/front_end/testcases/inference/unresolved_super.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/unresolved_super.dart.strong.expect
@@ -16,13 +16,13 @@
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/unresolved_super.dart:12:38: Error: Superclass has no method named 'foo'.
var /*@type=dynamic*/ v1 = super.foo(/*@typeArgs=dynamic*/ f());
- ^", "pkg/front_end/testcases/inference/unresolved_super.dart:13:38: Error: Superclass has no getter named 'bar'.
+ ^^^", "pkg/front_end/testcases/inference/unresolved_super.dart:13:38: Error: Superclass has no getter named 'bar'.
var /*@type=dynamic*/ v2 = super.bar;
- ^", "pkg/front_end/testcases/inference/unresolved_super.dart:14:37: Error: Superclass has no method named '[]'.
+ ^^^", "pkg/front_end/testcases/inference/unresolved_super.dart:14:37: Error: Superclass has no method named '[]'.
var /*@type=dynamic*/ v3 = super[0];
^", "pkg/front_end/testcases/inference/unresolved_super.dart:15:38: Error: Superclass has no setter named 'bar'.
var /*@type=dynamic*/ v4 = super.bar = /*@typeArgs=dynamic*/ f();
- ^", "pkg/front_end/testcases/inference/unresolved_super.dart:16:37: Error: Superclass has no method named '[]='.
+ ^^^", "pkg/front_end/testcases/inference/unresolved_super.dart:16:37: Error: Superclass has no method named '[]='.
var /*@type=dynamic*/ v5 = super[0] = /*@typeArgs=dynamic*/ f();
^"]/* from null */;
static method f<T extends core::Object>() → self::f::T
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_generic_classes_from_dill.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_generic_classes_from_dill.dart.direct.expect
new file mode 100644
index 0000000..4a8c9a0
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_generic_classes_from_dill.dart.direct.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ col::LinkedListEntry<dynamic> bar;
+ }
+}
+static method main() → dynamic {
+ col::LinkedListEntry<dynamic> bar;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_generic_classes_from_dill.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_generic_classes_from_dill.dart.outline.expect
new file mode 100644
index 0000000..54cb769
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_generic_classes_from_dill.dart.outline.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_literal_list.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list.dart.direct.expect
new file mode 100644
index 0000000..473030f
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list.dart.direct.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ dynamic a = <self::A<dynamic>>[];
+ }
+}
+static method main() → dynamic {
+ dynamic a = <self::A<dynamic>>[];
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_literal_list.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list.dart.outline.expect
new file mode 100644
index 0000000..e894545
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_literal_list_with_generic_argument.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list_with_generic_argument.dart.direct.expect
new file mode 100644
index 0000000..b96b592
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list_with_generic_argument.dart.direct.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<U extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method fun() → dynamic {
+ core::List<self::A<self::B::U>> foo = <self::A<self::B::U>>[];
+ core::List<self::A<core::num>> bar = <self::A<core::num>>[];
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_literal_list_with_generic_argument.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list_with_generic_argument.dart.outline.expect
new file mode 100644
index 0000000..73d2f33
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_literal_list_with_generic_argument.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B<U extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method fun() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_literal_map.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_literal_map.dart.direct.expect
new file mode 100644
index 0000000..571bb1b
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_literal_map.dart.direct.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ dynamic a = <self::A<dynamic>, self::A<dynamic>>{};
+ }
+}
+static method main() → dynamic {
+ dynamic a = <self::A<dynamic>, self::A<dynamic>>{};
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_literal_map.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_literal_map.dart.outline.expect
new file mode 100644
index 0000000..e894545
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_literal_map.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_omitted_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_omitted_bound.dart.direct.expect
new file mode 100644
index 0000000..b7936f1
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_omitted_bound.dart.direct.expect
@@ -0,0 +1,23 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method fun() → dynamic {
+ self::A<dynamic> a;
+ col::DoubleLinkedQueue<dynamic> c;
+ }
+}
+static method main() → dynamic {
+ self::A<dynamic> a;
+ col::DoubleLinkedQueue<dynamic> c;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_omitted_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_omitted_bound.dart.outline.expect
new file mode 100644
index 0000000..09674b8
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_omitted_bound.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method fun() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_super_bounded_type.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_super_bounded_type.dart.direct.expect
new file mode 100644
index 0000000..174756c
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_super_bounded_type.dart.direct.expect
@@ -0,0 +1,20 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends self::A<self::A::T>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ self::A<dynamic> a;
+ }
+}
+static method main() → dynamic {
+ self::A<dynamic> a;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_super_bounded_type.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_super_bounded_type.dart.outline.expect
new file mode 100644
index 0000000..4d3d1cf
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_super_bounded_type.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends self::A<self::A::T>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list.dart.direct.expect
new file mode 100644
index 0000000..7d3b891
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list.dart.direct.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ dynamic a = <(dynamic) → dynamic>[];
+ }
+}
+static method main() → dynamic {
+ dynamic a = <(dynamic) → dynamic>[];
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list.dart.outline.expect
new file mode 100644
index 0000000..145b481
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list.dart.outline.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list_with_generic_argument.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list_with_generic_argument.dart.direct.expect
new file mode 100644
index 0000000..52cb506
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list_with_generic_argument.dart.direct.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class B<U extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method fun() → dynamic {
+ core::List<(self::B::U) → dynamic> foo = <(self::B::U) → dynamic>[];
+ core::List<(core::num) → dynamic> bar = <(core::num) → dynamic>[];
+ }
+}
+static method main() → dynamic {
+ core::List<(core::num) → dynamic> bar = <(core::num) → dynamic>[];
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list_with_generic_argument.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list_with_generic_argument.dart.outline.expect
new file mode 100644
index 0000000..540d4a9
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_list_with_generic_argument.dart.outline.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class B<U extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method fun() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_map.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_map.dart.direct.expect
new file mode 100644
index 0000000..fd38c09
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_map.dart.direct.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ dynamic a = <(dynamic) → dynamic, (dynamic) → dynamic>{};
+ }
+}
+static method main() → dynamic {
+ dynamic a = <(dynamic) → dynamic, (dynamic) → dynamic>{};
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_map.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_map.dart.outline.expect
new file mode 100644
index 0000000..145b481
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_literal_map.dart.outline.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_omitted_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_omitted_bound.dart.direct.expect
new file mode 100644
index 0000000..ff7a612
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_omitted_bound.dart.direct.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ (dynamic) → dynamic a;
+ }
+}
+static method main() → dynamic {
+ (dynamic) → dynamic a;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_omitted_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_omitted_bound.dart.outline.expect
new file mode 100644
index 0000000..3c49af3
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_omitted_bound.dart.outline.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class C extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_super_bounded_type.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_super_bounded_type.dart.direct.expect
new file mode 100644
index 0000000..1712b9b
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_super_bounded_type.dart.direct.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+typedef B<U extends (U) → dynamic> = (U) → dynamic;
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → dynamic {
+ (dynamic) → dynamic b;
+ }
+}
+static method main() → dynamic {
+ (dynamic) → dynamic b;
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/body_typedef_super_bounded_type.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_super_bounded_type.dart.outline.expect
new file mode 100644
index 0000000..78f47f1
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/body_typedef_super_bounded_type.dart.outline.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+typedef B<U extends (U) → dynamic> = (U) → dynamic;
+class C extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/generic_classes_from_dill.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/generic_classes_from_dill.dart.direct.expect
new file mode 100644
index 0000000..2a54655
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/generic_classes_from_dill.dart.direct.expect
@@ -0,0 +1,6 @@
+library;
+import self as self;
+import "dart:collection" as col;
+
+static field col::LinkedListEntry<col::LinkedListEntry<dynamic>> y;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/generic_classes_from_dill.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/generic_classes_from_dill.dart.outline.expect
new file mode 100644
index 0000000..e9f3933
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/generic_classes_from_dill.dart.outline.expect
@@ -0,0 +1,7 @@
+library;
+import self as self;
+import "dart:collection" as col;
+
+static field col::LinkedListEntry<col::LinkedListEntry<dynamic>> y;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_constrained_by_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_constrained_by_bound.dart.direct.expect
new file mode 100644
index 0000000..a268770
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_constrained_by_bound.dart.direct.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ self::A<dynamic> a = new self::A::•<dynamic>();
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_constrained_by_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_constrained_by_bound.dart.outline.expect
new file mode 100644
index 0000000..4bea4fc
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_constrained_by_bound.dart.outline.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_defaults_to_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_defaults_to_bound.dart.direct.expect
new file mode 100644
index 0000000..7d9fe60
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_defaults_to_bound.dart.direct.expect
@@ -0,0 +1,12 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ new self::A::•<dynamic>();
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_defaults_to_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_defaults_to_bound.dart.outline.expect
new file mode 100644
index 0000000..4bea4fc
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_defaults_to_bound.dart.outline.expect
@@ -0,0 +1,10 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_gives_input.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_gives_input.dart.direct.expect
new file mode 100644
index 0000000..964c2f9
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_gives_input.dart.direct.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<T extends core::num, S extends core::List<self::B::T>> extends self::A<self::B::T> {
+ constructor •([self::B::T x = null]) → void
+ : super self::A::•() {}
+}
+static method main() → dynamic {
+ self::B<dynamic, dynamic> x;
+ dynamic y = new self::B::•<dynamic, dynamic>(3);
+ self::A<core::int> z = new self::B::•<dynamic, dynamic>();
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_gives_input.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_gives_input.dart.outline.expect
new file mode 100644
index 0000000..feaa0f3
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_gives_input.dart.outline.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B<T extends core::num, S extends core::List<self::B::T>> extends self::A<self::B::T> {
+ constructor •([self::B::T x]) → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_super_bounded_rejected.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_super_bounded_rejected.dart.direct.expect
new file mode 100644
index 0000000..b7dd39e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_super_bounded_rejected.dart.direct.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<T extends core::Comparable<self::B::T>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic y = new self::B::•<dynamic>();
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/inference_super_bounded_rejected.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/inference_super_bounded_rejected.dart.outline.expect
new file mode 100644
index 0000000..50dad2d
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/inference_super_bounded_rejected.dart.outline.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B<T extends core::Comparable<self::B::T>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic y;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/instantiated_in_outline.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/instantiated_in_outline.dart.direct.expect
new file mode 100644
index 0000000..f455106
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/instantiated_in_outline.dart.direct.expect
@@ -0,0 +1,19 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo(self::A<dynamic> a) → dynamic
+ return null;
+ method bar() → self::A<dynamic>
+ return null;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/instantiated_in_outline.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/instantiated_in_outline.dart.outline.expect
new file mode 100644
index 0000000..792d380
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/instantiated_in_outline.dart.outline.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo(self::A<dynamic> a) → dynamic
+ ;
+ method bar() → self::A<dynamic>
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/literal_list.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/literal_list.dart.direct.expect
new file mode 100644
index 0000000..4d4eb3a
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/literal_list.dart.direct.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic a = <self::A<dynamic>>[];
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/literal_list.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/literal_list.dart.outline.expect
new file mode 100644
index 0000000..303959e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/literal_list.dart.outline.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic a;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/literal_list_with_generic_argument.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/literal_list_with_generic_argument.dart.direct.expect
new file mode 100644
index 0000000..7c0008d
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/literal_list_with_generic_argument.dart.direct.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<S extends core::Object> extends core::Object {
+ final field core::List<self::A<self::B::S>> foo = <self::A<self::B::S>>[];
+ final field core::List<self::A<core::num>> bar = <self::A<core::num>>[];
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/literal_list_with_generic_argument.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/literal_list_with_generic_argument.dart.outline.expect
new file mode 100644
index 0000000..30f1130
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/literal_list_with_generic_argument.dart.outline.expect
@@ -0,0 +1,16 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B<S extends core::Object> extends core::Object {
+ final field core::List<self::A<self::B::S>> foo;
+ final field core::List<self::A<core::num>> bar;
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/literal_map.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/literal_map.dart.direct.expect
new file mode 100644
index 0000000..cde27c3
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/literal_map.dart.direct.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field dynamic a = <self::A<dynamic>, self::A<dynamic>>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/literal_map.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/literal_map.dart.outline.expect
new file mode 100644
index 0000000..303959e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/literal_map.dart.outline.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field dynamic a;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/omitted_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/omitted_bound.dart.direct.expect
new file mode 100644
index 0000000..bd60470
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/omitted_bound.dart.direct.expect
@@ -0,0 +1,22 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → self::A<dynamic>
+ return null;
+ method baz() → col::DoubleLinkedQueue<dynamic>
+ return null;
+}
+static field self::A<dynamic> a;
+static field col::DoubleLinkedQueue<dynamic> c;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/omitted_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/omitted_bound.dart.outline.expect
new file mode 100644
index 0000000..b822c38
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/omitted_bound.dart.outline.expect
@@ -0,0 +1,21 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+class A<T extends core::Object> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → self::A<dynamic>
+ ;
+ method baz() → col::DoubleLinkedQueue<dynamic>
+ ;
+}
+static field self::A<dynamic> a;
+static field col::DoubleLinkedQueue<dynamic> c;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/raw_in_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/raw_in_bound.dart.direct.expect
new file mode 100644
index 0000000..bb24dfc
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/raw_in_bound.dart.direct.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class B<T extends self::A<dynamic>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/raw_in_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/raw_in_bound.dart.outline.expect
new file mode 100644
index 0000000..1cbb0e9
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/raw_in_bound.dart.outline.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends core::num> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class B<T extends self::A<dynamic>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/super_bounded_type.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/super_bounded_type.dart.direct.expect
new file mode 100644
index 0000000..2f1df6b
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/super_bounded_type.dart.direct.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends self::A<self::A::T>> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static field self::A<dynamic> a;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/super_bounded_type.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/super_bounded_type.dart.outline.expect
new file mode 100644
index 0000000..e3addef
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/super_bounded_type.dart.outline.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A<T extends self::A<self::A::T>> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static field self::A<dynamic> a;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/supertypes.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/supertypes.dart.direct.expect
new file mode 100644
index 0000000..159c3d8
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/supertypes.dart.direct.expect
@@ -0,0 +1,23 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "package:expect/expect.dart" as exp;
+
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class X<T extends self::B> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Y extends self::X<dynamic> {
+ synthetic constructor •() → void
+ : super self::X::•()
+ ;
+}
+static method main() → void {
+ exp::Expect::isTrue(new self::Y::•() is self::X<dynamic>);
+}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/supertypes.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/supertypes.dart.outline.expect
new file mode 100644
index 0000000..a9960ece
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/supertypes.dart.outline.expect
@@ -0,0 +1,18 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class X<T extends self::B> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+class Y extends self::X<dynamic> {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → void
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_instantiated_in_outline.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_instantiated_in_outline.dart.direct.expect
new file mode 100644
index 0000000..2e8df2e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_instantiated_in_outline.dart.direct.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo((dynamic) → dynamic a) → dynamic
+ return null;
+ method bar() → (dynamic) → dynamic
+ return null;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_instantiated_in_outline.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_instantiated_in_outline.dart.outline.expect
new file mode 100644
index 0000000..bf24d2c
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_instantiated_in_outline.dart.outline.expect
@@ -0,0 +1,15 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo((dynamic) → dynamic a) → dynamic
+ ;
+ method bar() → (dynamic) → dynamic
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list.dart.direct.expect
new file mode 100644
index 0000000..3e9d62e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list.dart.direct.expect
@@ -0,0 +1,7 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+static field dynamic a = <(dynamic) → dynamic>[];
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list.dart.outline.expect
new file mode 100644
index 0000000..9545c7a
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list.dart.outline.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+static field dynamic a;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.direct.expect
new file mode 100644
index 0000000..b156915
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.direct.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class B<S extends core::Object> extends core::Object {
+ final field core::List<(self::B::S) → dynamic> foo = <(self::B::S) → dynamic>[];
+ final field core::List<(core::num) → dynamic> bar = <(core::num) → dynamic>[];
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.outline.expect
new file mode 100644
index 0000000..fb0ee2e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_list_with_generic_argument.dart.outline.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class B<S extends core::Object> extends core::Object {
+ final field core::List<(self::B::S) → dynamic> foo;
+ final field core::List<(core::num) → dynamic> bar;
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_map.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_map.dart.direct.expect
new file mode 100644
index 0000000..5258ebf
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_map.dart.direct.expect
@@ -0,0 +1,7 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+static field dynamic a = <(dynamic) → dynamic, (dynamic) → dynamic>{};
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_map.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_map.dart.outline.expect
new file mode 100644
index 0000000..9545c7a
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_literal_map.dart.outline.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+static field dynamic a;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_omitted_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_omitted_bound.dart.direct.expect
new file mode 100644
index 0000000..f3c3c27
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_omitted_bound.dart.direct.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo() → (dynamic) → dynamic
+ return null;
+}
+static field (dynamic) → dynamic a;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_omitted_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_omitted_bound.dart.outline.expect
new file mode 100644
index 0000000..6a2e4db
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_omitted_bound.dart.outline.expect
@@ -0,0 +1,14 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+class C extends core::Object {
+ synthetic constructor •() → void
+ ;
+ method foo() → (dynamic) → dynamic
+ ;
+}
+static field (dynamic) → dynamic a;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_raw_in_bound.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_raw_in_bound.dart.direct.expect
new file mode 100644
index 0000000..ddb4888
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_raw_in_bound.dart.direct.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B<T extends (dynamic) → dynamic> extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_raw_in_bound.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_raw_in_bound.dart.outline.expect
new file mode 100644
index 0000000..8e00857
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_raw_in_bound.dart.outline.expect
@@ -0,0 +1,11 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::num> = (T) → dynamic;
+class B<T extends (dynamic) → dynamic> extends core::Object {
+ synthetic constructor •() → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_super_bounded_type.dart.direct.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_super_bounded_type.dart.direct.expect
new file mode 100644
index 0000000..819253e
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_super_bounded_type.dart.direct.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+typedef B<S extends (S) → dynamic> = (S) → dynamic;
+static field (dynamic) → dynamic b;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/instantiate_to_bound/typedef_super_bounded_type.dart.outline.expect b/pkg/front_end/testcases/instantiate_to_bound/typedef_super_bounded_type.dart.outline.expect
new file mode 100644
index 0000000..61fcce0
--- /dev/null
+++ b/pkg/front_end/testcases/instantiate_to_bound/typedef_super_bounded_type.dart.outline.expect
@@ -0,0 +1,9 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef A<T extends core::Object> = (T) → dynamic;
+typedef B<S extends (S) → dynamic> = (S) → dynamic;
+static field (dynamic) → dynamic b;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect b/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect
index 655bd55..58551e4 100644
--- a/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect
+++ b/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect
@@ -25,7 +25,7 @@
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/rasta/mixin_library.dart:16:18: Error: Superclass has no method named 'foo'.
foo() => super.foo() + f();
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method f() → dynamic
return 2;
static method V() → dynamic
diff --git a/pkg/front_end/testcases/rasta/super.dart.strong.expect b/pkg/front_end/testcases/rasta/super.dart.strong.expect
index ad45ff5..5462697 100644
--- a/pkg/front_end/testcases/rasta/super.dart.strong.expect
+++ b/pkg/front_end/testcases/rasta/super.dart.strong.expect
@@ -57,14 +57,14 @@
^").+(invalid-expression "pkg/front_end/testcases/rasta/super.dart:43:6: Error: Can't use 'super' as an expression.
To delegate a constructor to a super constructor, put the super call as an initializer.
+super;
- ^");
+ ^^^^^");
self::use((let final dynamic #t2 = this in let dynamic _ = null in invalid-expression "pkg/front_end/testcases/rasta/super.dart:44:9: Error: The getter '' isn't defined for the class '#lib1::C'.
Try correcting the name to the name of an existing getter, or defining a getter or field named ''.
use(+super);
^").+(invalid-expression "pkg/front_end/testcases/rasta/super.dart:44:10: Error: Can't use 'super' as an expression.
To delegate a constructor to a super constructor, put the super call as an initializer.
use(+super);
- ^"));
+ ^^^^^"));
super.{self::A::==}(87);
self::use(super.{self::A::==}(87));
!super.{self::A::==}(87);
diff --git a/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect b/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect
index d54f59b..fb1ba40 100644
--- a/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect
+++ b/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect
@@ -43,7 +43,7 @@
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/rasta/mixin_library.dart:16:18: Error: Superclass has no method named 'foo'.
foo() => super.foo() + f();
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method main() → dynamic {
core::print(new self::C::•<dynamic>().{mix::Mixin::foo}());
core::print(new self::C2::•<dynamic>().{mix::Mixin::foo}());
diff --git a/pkg/front_end/testcases/regress/issue_29940.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29940.dart.strong.expect
index 7c3b9a7..678b455 100644
--- a/pkg/front_end/testcases/regress/issue_29940.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29940.dart.strong.expect
@@ -4,7 +4,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29940.dart:7:3: Error: 'a.b' isn't a type.
a.b c = null;
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method main() → dynamic {
core::String a = "";
invalid-type c = null;
diff --git a/pkg/front_end/testcases/regress/issue_29941.dart.direct.expect b/pkg/front_end/testcases/regress/issue_29941.dart.direct.expect
index 0e9a426..eea6787 100644
--- a/pkg/front_end/testcases/regress/issue_29941.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_29941.dart.direct.expect
@@ -5,6 +5,6 @@
dynamic a = "";
invalid-expression "pkg/front_end/testcases/regress/issue_29941.dart:7:5: Error: Expected an identifier, but got '\"\"'.
a.\"\";
- ^";
+ ^^";
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_29941.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29941.dart.strong.expect
index b09dbe3..5c24424 100644
--- a/pkg/front_end/testcases/regress/issue_29941.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29941.dart.strong.expect
@@ -6,6 +6,6 @@
core::String a = "";
invalid-expression "pkg/front_end/testcases/regress/issue_29941.dart:7:5: Error: Expected an identifier, but got '\"\"'.
a.\"\";
- ^";
+ ^^";
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect
index f428fd7..dd9f49e 100644
--- a/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29945.dart.strong.expect
@@ -3,7 +3,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29945.dart:6:3: Error: 's.bool' can't be used as a type because 's' isn't defined.
s.bool x = null;
- ^"]/* from null */;
+ ^^^^^^"]/* from null */;
static method main() → dynamic {
invalid-type x = null;
}
diff --git a/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect
index 57e6d91..d73d7b3 100644
--- a/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29980.dart.strong.expect
@@ -3,7 +3,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29980.dart:6:3: Error: 'x.y' can't be used as a type because 'x' isn't defined.
x.y z;
- ^"]/* from null */;
+ ^^^"]/* from null */;
static method main() → dynamic {
invalid-type z;
}
diff --git a/pkg/front_end/testcases/regress/issue_29983.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29983.dart.strong.expect
index fce02e6..f750a0b 100644
--- a/pkg/front_end/testcases/regress/issue_29983.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29983.dart.strong.expect
@@ -4,9 +4,9 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29983.dart:7:10: Error: Getter not found: 'missing'.
return missing;
- ^", "pkg/front_end/testcases/regress/issue_29983.dart:11:14: Error: Getter not found: 'dummy'.
+ ^^^^^^^", "pkg/front_end/testcases/regress/issue_29983.dart:11:14: Error: Getter not found: 'dummy'.
g() sync* => dummy;
- ^"]/* from null */;
+ ^^^^^"]/* from null */;
static method f() → dynamic sync* {
invalid-expression "pkg/front_end/testcases/regress/issue_29983.dart:7:3: Error: 'sync*' and 'async*' can't return a value.
return missing;
diff --git a/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
index 3dab4b4..a54d2f6 100644
--- a/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
@@ -9,7 +9,7 @@
}
^", "pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: Getter not found: '\u55357\u56603'.
\u55357\u56603
- ^"]/* from null */;
+ ^^"]/* from null */;
static method bad() → dynamic {
throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#🔛, 33, const <core::Type>[], const <dynamic>[], core::Map::unmodifiable<core::Symbol, dynamic>(const <core::Symbol, dynamic>{})));
}
diff --git a/pkg/front_end/testcases/regress/issue_31183.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31183.dart.direct.expect
index 36747ec..3911009 100644
--- a/pkg/front_end/testcases/regress/issue_31183.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31183.dart.direct.expect
@@ -13,9 +13,9 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31183.dart:6:3: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
operator unary- => 0;
- ^", "pkg/front_end/testcases/regress/issue_31183.dart:6:12: Error: Expected ';' before this.
+ ^^^^^^^^", "pkg/front_end/testcases/regress/issue_31183.dart:6:12: Error: Expected ';' before this.
operator unary- => 0;
- ^", "pkg/front_end/testcases/regress/issue_31183.dart:6:17: Error: Operator declarations must be preceeded by the keyword 'operator'.
+ ^^^^^", "pkg/front_end/testcases/regress/issue_31183.dart:6:17: Error: Operator declarations must be preceeded by the keyword 'operator'.
Try adding the keyword 'operator'.
operator unary- => 0;
^", "pkg/front_end/testcases/regress/issue_31183.dart:6:17: Error: A method declaration needs an explicit list of parameters.
diff --git a/pkg/front_end/testcases/regress/issue_31183.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31183.dart.strong.expect
index 36747ec..3911009 100644
--- a/pkg/front_end/testcases/regress/issue_31183.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31183.dart.strong.expect
@@ -13,9 +13,9 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31183.dart:6:3: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
operator unary- => 0;
- ^", "pkg/front_end/testcases/regress/issue_31183.dart:6:12: Error: Expected ';' before this.
+ ^^^^^^^^", "pkg/front_end/testcases/regress/issue_31183.dart:6:12: Error: Expected ';' before this.
operator unary- => 0;
- ^", "pkg/front_end/testcases/regress/issue_31183.dart:6:17: Error: Operator declarations must be preceeded by the keyword 'operator'.
+ ^^^^^", "pkg/front_end/testcases/regress/issue_31183.dart:6:17: Error: Operator declarations must be preceeded by the keyword 'operator'.
Try adding the keyword 'operator'.
operator unary- => 0;
^", "pkg/front_end/testcases/regress/issue_31183.dart:6:17: Error: A method declaration needs an explicit list of parameters.
diff --git a/pkg/front_end/testcases/regress/issue_31186.dart.direct.expect b/pkg/front_end/testcases/regress/issue_31186.dart.direct.expect
index d5b19d5..db52098 100644
--- a/pkg/front_end/testcases/regress/issue_31186.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_31186.dart.direct.expect
@@ -4,6 +4,6 @@
static method bad() → dynamic {
return invalid-expression "pkg/front_end/testcases/regress/issue_31186.dart:6:16: Error: Expected an identifier, but got 'true'.
return null?.true;
- ^";
+ ^^^^";
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_31186.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31186.dart.strong.expect
index d5b19d5..db52098 100644
--- a/pkg/front_end/testcases/regress/issue_31186.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31186.dart.strong.expect
@@ -4,6 +4,6 @@
static method bad() → dynamic {
return invalid-expression "pkg/front_end/testcases/regress/issue_31186.dart:6:16: Error: Expected an identifier, but got 'true'.
return null?.true;
- ^";
+ ^^^^";
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect
index aa56e27..2eacbb9 100644
--- a/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect
@@ -8,7 +8,8 @@
: super core::Object::•()
;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31190.dart: Error: Can't use type arguments with type variable 'T'.", "pkg/front_end/testcases/regress/issue_31190.dart:6:5: Error: 'U' isn't a type.
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_31190.dart: Error: Can't use type arguments with type variable 'T'.
+Try removing the type arguments.", "pkg/front_end/testcases/regress/issue_31190.dart:6:5: Error: 'U' isn't a type.
T<U> v;
^", "pkg/front_end/testcases/regress/issue_31190.dart:6:3: Error: 'T' expects 0 type arguments.
T<U> v;
diff --git a/pkg/front_end/testcases/regress/issue_32196.dart b/pkg/front_end/testcases/regress/issue_32196.dart
new file mode 100644
index 0000000..254d45c
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32196.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class A {
+ final String name;
+ A.get(this.name);
+ A.set(this.name);
+}
+
+main() {
+ new A.get("get");
+ new A.set("set");
+}
diff --git a/pkg/front_end/testcases/regress/issue_32196.dart.direct.expect b/pkg/front_end/testcases/regress/issue_32196.dart.direct.expect
new file mode 100644
index 0000000..bf9d1e2
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32196.dart.direct.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String name;
+ constructor get(core::String name) → void
+ : self::A::name = name, super core::Object::•()
+ ;
+ constructor set(core::String name) → void
+ : self::A::name = name, super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ new self::A::get("get");
+ new self::A::set("set");
+}
diff --git a/pkg/front_end/testcases/regress/issue_32196.dart.outline.expect b/pkg/front_end/testcases/regress/issue_32196.dart.outline.expect
new file mode 100644
index 0000000..383d16c
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32196.dart.outline.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String name;
+ constructor get(core::String name) → void
+ ;
+ constructor set(core::String name) → void
+ ;
+}
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/regress/issue_32196.dart.strong.expect b/pkg/front_end/testcases/regress/issue_32196.dart.strong.expect
new file mode 100644
index 0000000..bf9d1e2
--- /dev/null
+++ b/pkg/front_end/testcases/regress/issue_32196.dart.strong.expect
@@ -0,0 +1,17 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+ final field core::String name;
+ constructor get(core::String name) → void
+ : self::A::name = name, super core::Object::•()
+ ;
+ constructor set(core::String name) → void
+ : self::A::name = name, super core::Object::•()
+ ;
+}
+static method main() → dynamic {
+ new self::A::get("get");
+ new self::A::set("set");
+}
diff --git a/pkg/front_end/testcases/regress/issue_32200.dart.strong.expect b/pkg/front_end/testcases/regress/issue_32200.dart.strong.expect
index cae1a3e..d4cce8e 100644
--- a/pkg/front_end/testcases/regress/issue_32200.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_32200.dart.strong.expect
@@ -10,7 +10,7 @@
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_32200.dart:8:3: Error: 'self.Foo' can't be used as a type because 'self' doesn't refer to an import prefix.
self.Foo self;
- ^"]/* from null */;
+ ^^^^^^^^"]/* from null */;
static method main() → dynamic {
self::Foo instance = new self::Foo::•();
instance.{self::Foo::self} = instance;
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.strong.expect
index c90556c..a7d91b4 100644
--- a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off.dart.strong.expect
@@ -9,5 +9,5 @@
method call() → void {}
}
static method main() → dynamic {
- () → void x = new self::C::•().{self::C::call};
+ () → void x = let final self::C #t1 = new self::C::•() in #t1.==(null) ?{() → void} null : #t1.{self::C::call};
}
diff --git a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.strong.expect
index 6dceb86..6429b52 100644
--- a/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/call_method_implicit_tear_off_future_or.dart.strong.expect
@@ -10,5 +10,5 @@
method call() → void {}
}
static method main() → dynamic {
- asy::FutureOr<() → void> x = new self::C::•().{self::C::call};
+ asy::FutureOr<() → void> x = let final self::C #t1 = new self::C::•() in #t1.==(null) ?{() → void} null : #t1.{self::C::call};
}
diff --git a/pkg/front_end/testing.json b/pkg/front_end/testing.json
index ac2d0fe..8168094 100644
--- a/pkg/front_end/testing.json
+++ b/pkg/front_end/testing.json
@@ -52,8 +52,7 @@
"/testcases/.*_part[0-9]*\\.dart$",
"/testcases/.*_lib[0-9]*\\.dart$",
"/testcases/dartino/",
- "/testcases/shaker/",
- "/testcases/instantiate_to_bound/"
+ "/testcases/shaker/"
]
},
@@ -70,8 +69,7 @@
"/testcases/.*_part[0-9]*\\.dart$",
"/testcases/.*_lib[0-9]*\\.dart$",
"/testcases/dartino/",
- "/testcases/shaker/",
- "/testcases/instantiate_to_bound/"
+ "/testcases/shaker/"
]
},
diff --git a/pkg/front_end/tool/_fasta/generate_messages.dart b/pkg/front_end/tool/_fasta/generate_messages.dart
index 485eaf5..83d821c 100644
--- a/pkg/front_end/tool/_fasta/generate_messages.dart
+++ b/pkg/front_end/tool/_fasta/generate_messages.dart
@@ -16,6 +16,7 @@
'ERROR': 'error',
'ERROR_LEGACY_WARNING': 'errorLegacyWarning',
'INTERNAL_PROBLEM': 'internalProblem',
+ 'CONTEXT': 'context',
};
main(List<String> arguments) async {
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 85e2fbe..a8ae768e 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -349,7 +349,8 @@
FileOffset fileEndOffset;
Byte kind; // Index into the ProcedureKind enum above.
Byte flags (isStatic, isAbstract, isExternal, isConst, isForwardingStub,
- isGenericContravariant, isForwardingSemiStub);
+ isGenericContravariant, isForwardingSemiStub,
+ isRedirectingFactoryConstructor);
Name name;
// An absolute path URI to the .dart file from which the class was created.
UriReference fileUri;
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index dcbffd3..95c0b5f 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1172,7 +1172,7 @@
void set isGenericContravariant(bool value) {
flags2 = value
? (flags2 | Flag2GenericContravariant)
- : (flags & ~Flag2GenericContravariant);
+ : (flags2 & ~Flag2GenericContravariant);
}
/// True if the field is neither final nor const.
@@ -1546,6 +1546,8 @@
static const int FlagForwardingStub = 1 << 4;
static const int FlagGenericContravariant = 1 << 5;
static const int FlagForwardingSemiStub = 1 << 6;
+ // TODO(29841): Remove this flag after the issue is resolved.
+ static const int FlagRedirectingFactoryConstructor = 1 << 7;
bool get isStatic => flags & FlagStatic != 0;
bool get isAbstract => flags & FlagAbstract != 0;
@@ -1577,6 +1579,12 @@
/// stub, it was present in the original source as an abstract method.
bool get isForwardingSemiStub => flags & FlagForwardingSemiStub != 0;
+ // Indicates if this [Procedure] represents a redirecting factory constructor
+ // and doesn't have a runnable body.
+ bool get isRedirectingFactoryConstructor {
+ return flags & FlagRedirectingFactoryConstructor != 0;
+ }
+
/// If set, this flag indicates that this function was not present in the
/// source, and it exists solely for the purpose of type checking arguments
/// and forwarding to [forwardingStubSuperTarget].
@@ -1615,6 +1623,12 @@
: (flags & ~FlagForwardingSemiStub);
}
+ void set isRedirectingFactoryConstructor(bool value) {
+ flags = value
+ ? (flags | FlagRedirectingFactoryConstructor)
+ : (flags & ~FlagRedirectingFactoryConstructor);
+ }
+
bool get isInstanceMember => !isStatic;
bool get isGetter => kind == ProcedureKind.Getter;
bool get isSetter => kind == ProcedureKind.Setter;
diff --git a/pkg/kernel/lib/transformations/mixin_full_resolution.dart b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
index a38f134..59ec97b 100644
--- a/pkg/kernel/lib/transformations/mixin_full_resolution.dart
+++ b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
@@ -152,6 +152,9 @@
// application. They should not be copied.
if (procedure.isForwardingStub) continue;
+ // Factory constructors are not cloned.
+ if (procedure.isFactory) continue;
+
Procedure clone = cloner.clone(procedure);
// Linear search for a forwarding stub with the same name.
for (int i = 0; i < originalLength; ++i) {
@@ -160,6 +163,15 @@
originalProcedure.kind == clone.kind) {
FunctionNode src = originalProcedure.function;
FunctionNode dst = clone.function;
+
+ if (src.positionalParameters.length !=
+ dst.positionalParameters.length ||
+ src.namedParameters.length != dst.namedParameters.length) {
+ // A compile time error has already occured, but don't crash below,
+ // and don't add several procedures with the same name to the class.
+ continue outer;
+ }
+
assert(src.typeParameters.length == dst.typeParameters.length);
for (int j = 0; j < src.typeParameters.length; ++j) {
dst.typeParameters[j].flags = src.typeParameters[i].flags;
@@ -168,6 +180,8 @@
dst.positionalParameters[j].flags =
src.positionalParameters[j].flags;
}
+ // TODO(kernel team): The named parameters are not sorted,
+ // this might not be correct.
for (int j = 0; j < src.namedParameters.length; ++j) {
dst.namedParameters[j].flags = src.namedParameters[j].flags;
}
diff --git a/pkg/kernel/lib/transformations/treeshaker.dart b/pkg/kernel/lib/transformations/treeshaker.dart
index c64205c..6d482b0 100644
--- a/pkg/kernel/lib/transformations/treeshaker.dart
+++ b/pkg/kernel/lib/transformations/treeshaker.dart
@@ -1161,22 +1161,22 @@
}
}
- visitCovariant(DartType type) => type?.accept(this);
+ void visitCovariant(DartType type) => type?.accept(this);
- visitInvariant(DartType type) => shaker._invariantVisitor.visit(type);
+ void visitInvariant(DartType type) => shaker._invariantVisitor.visit(type);
- visitInvalidType(InvalidType node) {}
+ void visitInvalidType(InvalidType node) {}
- visitDynamicType(DynamicType node) {
+ void visitDynamicType(DynamicType node) {
// TODO(asgerf): Find a suitable model for untyped externals, e.g. track
// them to the first type boundary.
}
- visitVoidType(VoidType node) {}
+ void visitVoidType(VoidType node) {}
- visitVectorType(VectorType node) {}
+ void visitVectorType(VectorType node) {}
- visitInterfaceType(InterfaceType node) {
+ void visitInterfaceType(InterfaceType node) {
if (isCovariant) {
shaker._addInstantiatedExternalSubclass(node.classNode);
}
@@ -1197,11 +1197,11 @@
}
}
- visitTypedefType(TypedefType node) {
+ void visitTypedefType(TypedefType node) {
shaker.addUsedTypedef(node.typedefNode);
}
- visitFunctionType(FunctionType node) {
+ void visitFunctionType(FunctionType node) {
visit(node.returnType);
for (int i = 0; i < node.positionalParameters.length; ++i) {
visitContravariant(node.positionalParameters[i]);
@@ -1211,7 +1211,7 @@
}
}
- visitTypeParameterType(TypeParameterType node) {}
+ void visitTypeParameterType(TypeParameterType node) {}
/// Just treat a couple of whitelisted classes as having covariant type
/// parameters.
diff --git a/pkg/testing/lib/src/chain.dart b/pkg/testing/lib/src/chain.dart
index 65bb9f0..15d74ac 100644
--- a/pkg/testing/lib/src/chain.dart
+++ b/pkg/testing/lib/src/chain.dart
@@ -56,7 +56,11 @@
factory Chain.fromJsonMap(Uri base, Map json, String name, String kind) {
Uri source = base.resolve(json["source"]);
- Uri uri = base.resolve(json["path"]);
+ String path = json["path"];
+ if (!path.endsWith("/")) {
+ path += "/";
+ }
+ Uri uri = base.resolve(path);
Uri statusFile = base.resolve(json["status"]);
List<RegExp> pattern =
new List<RegExp>.from(json["pattern"].map((String p) => new RegExp(p)));
diff --git a/pkg/testing/lib/src/log.dart b/pkg/testing/lib/src/log.dart
index 628d139..edd36638 100644
--- a/pkg/testing/lib/src/log.dart
+++ b/pkg/testing/lib/src/log.dart
@@ -4,6 +4,8 @@
library testing.log;
+import 'dart:io' show stdout;
+
import 'chain.dart' show Result, Step;
import 'suite.dart' show Suite;
@@ -14,11 +16,17 @@
/// ANSI escape code for moving cursor one line up.
/// See [CSI codes](https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes).
-const String cursorUp = "\u001b[1A";
+const String cursorUpCodes = "\u001b[1A";
/// ANSI escape code for erasing the entire line.
/// See [CSI codes](https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes).
-const String eraseLine = "\u001b[2K";
+const String eraseLineCodes = "\u001b[2K";
+
+final bool enableAnsiEscapes = stdout.supportsAnsiEscapes;
+
+final String cursorUp = enableAnsiEscapes ? cursorUpCodes : "";
+
+final String eraseLine = enableAnsiEscapes ? eraseLineCodes : "";
final Stopwatch wallclock = new Stopwatch()..start();
diff --git a/pkg/vm/bin/dump_kernel.dart b/pkg/vm/bin/dump_kernel.dart
index fb2ad81..1d0ea77 100644
--- a/pkg/vm/bin/dump_kernel.dart
+++ b/pkg/vm/bin/dump_kernel.dart
@@ -13,6 +13,8 @@
show InferredTypeMetadataRepository;
import 'package:vm/metadata/procedure_attributes.dart'
show ProcedureAttributesMetadataRepository;
+import 'package:vm/metadata/unreachable.dart'
+ show UnreachableNodeMetadataRepository;
final String _usage = '''
Usage: dump_kernel input.dill output.txt
@@ -34,6 +36,7 @@
program.addMetadataRepository(new DirectCallMetadataRepository());
program.addMetadataRepository(new InferredTypeMetadataRepository());
program.addMetadataRepository(new ProcedureAttributesMetadataRepository());
+ program.addMetadataRepository(new UnreachableNodeMetadataRepository());
final List<int> bytes = new File(input).readAsBytesSync();
new BinaryBuilderWithMetadata(bytes).readProgram(program);
diff --git a/pkg/vm/bin/gen_kernel.dart b/pkg/vm/bin/gen_kernel.dart
index be3b85d..c7e6fad 100644
--- a/pkg/vm/bin/gen_kernel.dart
+++ b/pkg/vm/bin/gen_kernel.dart
@@ -30,7 +30,10 @@
..addFlag('sync-async', help: 'Start `async` functions synchronously')
..addFlag('embed-sources',
help: 'Embed source files in the generated kernel program',
- defaultsTo: true);
+ defaultsTo: true)
+ ..addOption('entry-points',
+ help: 'Path to JSON file with the list of entry points',
+ allowMultiple: true);
final String _usage = '''
Usage: dart pkg/vm/bin/gen_kernel.dart --platform vm_platform_strong.dill [options] input.dart
@@ -67,21 +70,32 @@
final bool aot = options['aot'];
final bool syncAsync = options['sync-async'];
+ final List<String> entryPoints = options['entry-points'] ?? <String>[];
+ if (entryPoints.isEmpty) {
+ entryPoints.addAll([
+ 'pkg/vm/lib/transformations/type_flow/entry_points.json',
+ 'pkg/vm/lib/transformations/type_flow/entry_points_extra.json',
+ ]);
+ }
+
ErrorDetector errorDetector = new ErrorDetector();
final CompilerOptions compilerOptions = new CompilerOptions()
..strongMode = strongMode
..target = new VmTarget(
new TargetFlags(strongMode: strongMode, syncAsync: syncAsync))
- ..linkedDependencies = <Uri>[Uri.base.resolve(platformKernel)]
- ..packagesFileUri = packages != null ? Uri.base.resolve(packages) : null
+ ..linkedDependencies = <Uri>[
+ Uri.base.resolveUri(new Uri.file(platformKernel))
+ ]
+ ..packagesFileUri =
+ packages != null ? Uri.base.resolveUri(new Uri.file(packages)) : null
..reportMessages = true
..onError = errorDetector
..embedSourceText = options['embed-sources'];
Program program = await compileToKernel(
- Uri.base.resolve(filename), compilerOptions,
- aot: aot);
+ Uri.base.resolveUri(new Uri.file(filename)), compilerOptions,
+ aot: aot, entryPoints: entryPoints);
if (errorDetector.hasCompilationErrors || (program == null)) {
return _compileTimeErrorExitCode;
diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart
index b53b6bb..7423661 100644
--- a/pkg/vm/bin/kernel_service.dart
+++ b/pkg/vm/bin/kernel_service.dart
@@ -102,6 +102,9 @@
case Severity.warning:
if (!suppressWarnings) stderr.writeln(formatted);
break;
+ case Severity.context:
+ stderr.writeln(formatted);
+ break;
}
};
}
diff --git a/pkg/vm/lib/kernel_front_end.dart b/pkg/vm/lib/kernel_front_end.dart
index 298dae7..73e0ecd 100644
--- a/pkg/vm/lib/kernel_front_end.dart
+++ b/pkg/vm/lib/kernel_front_end.dart
@@ -33,7 +33,7 @@
/// VM-specific replacement of [kernelForProgram].
///
Future<Program> compileToKernel(Uri source, CompilerOptions options,
- {bool aot: false}) async {
+ {bool aot: false, List<String> entryPoints}) async {
// Replace error handler to detect if there are compilation errors.
final errorDetector =
new ErrorDetector(previousErrorHandler: options.onError);
@@ -46,18 +46,19 @@
// Run global transformations only if program is correct.
if (aot && (program != null) && !errorDetector.hasCompilationErrors) {
- _runGlobalTransformations(program, options.strongMode);
+ _runGlobalTransformations(program, options.strongMode, entryPoints);
}
return program;
}
-_runGlobalTransformations(Program program, bool strongMode) {
+_runGlobalTransformations(
+ Program program, bool strongMode, List<String> entryPoints) {
if (strongMode) {
final coreTypes = new CoreTypes(program);
if (kUseGlobalTypeFlow) {
- globalTypeFlow.transformProgram(coreTypes, program);
+ globalTypeFlow.transformProgram(coreTypes, program, entryPoints);
} else {
devirtualization.transformProgram(coreTypes, program);
}
@@ -73,8 +74,7 @@
ErrorDetector({this.previousErrorHandler});
void call(CompilationMessage message) {
- if ((message.severity != Severity.nit) &&
- (message.severity != Severity.warning)) {
+ if (message.severity == Severity.error) {
hasCompilationErrors = true;
}
diff --git a/pkg/vm/lib/metadata/unreachable.dart b/pkg/vm/lib/metadata/unreachable.dart
new file mode 100644
index 0000000..aff77e2
--- /dev/null
+++ b/pkg/vm/lib/metadata/unreachable.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library vm.metadata.unreachable;
+
+import 'package:kernel/ast.dart';
+
+/// Metadata for annotating unreachable nodes. Note that the arguments
+/// of an unreachable node could still be reachable.
+/// Used to annotate calls and functions.
+class UnreachableNode {
+ const UnreachableNode();
+
+ @override
+ String toString() => '';
+}
+
+/// Repository for [UnreachableNode].
+class UnreachableNodeMetadataRepository
+ extends MetadataRepository<UnreachableNode> {
+ @override
+ final String tag = 'vm.unreachable.metadata';
+
+ @override
+ final Map<TreeNode, UnreachableNode> mapping = <TreeNode, UnreachableNode>{};
+
+ @override
+ void writeToBinary(UnreachableNode metadata, BinarySink sink) {}
+
+ @override
+ UnreachableNode readFromBinary(BinarySource source) {
+ return const UnreachableNode();
+ }
+}
diff --git a/pkg/vm/lib/transformations/type_flow/analysis.dart b/pkg/vm/lib/transformations/type_flow/analysis.dart
index 42b78f0..92f7ec2 100644
--- a/pkg/vm/lib/transformations/type_flow/analysis.dart
+++ b/pkg/vm/lib/transformations/type_flow/analysis.dart
@@ -27,7 +27,6 @@
// === Correctness ===
// * Verify incremental re-calculation by fresh analysis starting with known
// allocated classes.
-// * Auto-generate entry_points.json during build.
//
// === Precision ===
// * Handle '==' with null.
@@ -163,7 +162,7 @@
// Call via field.
// TODO(alexmarkov): support function types and use inferred type
// to get more precise return type.
- return new Type.fromStatic(const DynamicType());
+ return new Type.nullableAny();
case CallKind.FieldInitializer:
assertx(args.values.isEmpty);
@@ -197,7 +196,7 @@
// TODO(alexmarkov): capture receiver type
assertx((member is Procedure) && !member.isGetter && !member.isSetter);
typeFlowAnalysis.addRawCall(new DirectSelector(member));
- return new Type.fromStatic(const DynamicType());
+ return new Type.nullableAny();
} else {
// Call via getter.
// TODO(alexmarkov): capture receiver type
@@ -206,7 +205,7 @@
member.isGetter);
typeFlowAnalysis.addRawCall(
new DirectSelector(member, callKind: CallKind.PropertyGet));
- return new Type.fromStatic(const DynamicType());
+ return new Type.nullableAny();
}
}
}
@@ -308,7 +307,7 @@
// TODO(alexmarkov): handle closures more precisely
if ((selector is DynamicSelector) && (selector.name.name == "call")) {
tracePrint("Possible closure call, result is dynamic");
- result = new Type.fromStatic(const DynamicType());
+ result = new Type.nullableAny();
}
return result;
@@ -505,17 +504,17 @@
/// Efficient builder of receiver type.
///
/// Supports the following operations:
-/// 1) Add 1..N concrete types OR add 1 arbitrary type.
+/// 1) Add 1..N concrete types ordered by classId OR add 1 arbitrary type.
/// 2) Make type nullable.
class _ReceiverTypeBuilder {
Type _type;
- Set<ConcreteType> _set;
+ List<ConcreteType> _list;
bool _nullable = false;
/// Appends a ConcreteType. May be called multiple times.
/// Should not be used in conjunction with [addType].
void addConcreteType(ConcreteType type) {
- if (_set == null) {
+ if (_list == null) {
if (_type == null) {
_type = type;
return;
@@ -524,19 +523,20 @@
assertx(_type is ConcreteType);
assertx(_type != type);
- _set = new Set<ConcreteType>();
- _set.add(_type);
+ _list = new List<ConcreteType>();
+ _list.add(_type);
_type = null;
}
- _set.add(type);
+ assertx(_list.last.classId.compareTo(type.classId) < 0);
+ _list.add(type);
}
/// Appends an arbitrary Type. May be called only once.
/// Should not be used in conjunction with [addConcreteType].
void addType(Type type) {
- assertx(_type == null && _set == null);
+ assertx(_type == null && _list == null);
_type = type;
}
@@ -549,13 +549,13 @@
Type toType() {
Type t = _type;
if (t == null) {
- if (_set == null) {
+ if (_list == null) {
t = const EmptyType();
} else {
- t = new SetType(_set);
+ t = new SetType(_list);
}
} else {
- assertx(_set == null);
+ assertx(_list == null);
}
if (_nullable) {
@@ -587,10 +587,11 @@
class _FieldValue extends _DependencyTracker {
final Field field;
+ final Type staticType;
Type value;
_DirectInvocation _initializerInvocation;
- _FieldValue(this.field) {
+ _FieldValue(this.field) : staticType = new Type.fromStatic(field.type) {
if (field.initializer == null && _isDefaultValueOfFieldObservable()) {
value = new Type.nullable(const EmptyType());
} else {
@@ -641,7 +642,9 @@
}
void setValue(Type newValue, TypeFlowAnalysis typeFlowAnalysis) {
- final Type newType = value.union(newValue, typeFlowAnalysis.hierarchyCache);
+ final Type newType = value.union(
+ newValue.intersection(staticType, typeFlowAnalysis.hierarchyCache),
+ typeFlowAnalysis.hierarchyCache);
if (newType != value) {
tracePrint("Set field $field value $newType");
invalidateDependentInvocations(typeFlowAnalysis.workList);
@@ -661,7 +664,8 @@
_DynamicTargetSet(this.selector, this.isObjectMember);
}
-class _ClassData extends _DependencyTracker {
+class _ClassData extends _DependencyTracker implements ClassId<_ClassData> {
+ final int _id;
final Class class_;
final Set<_ClassData> supertypes; // List of super-types including this.
final Set<_ClassData> allocatedSubtypes = new Set<_ClassData>();
@@ -671,10 +675,23 @@
/// Lazy initialized by _ClassHierarchyCache.hasNonTrivialNoSuchMethod().
bool hasNonTrivialNoSuchMethod;
- _ClassData(this.class_, this.supertypes) {
+ _ClassData(this._id, this.class_, this.supertypes) {
supertypes.add(this);
}
+ ConcreteType _concreteType;
+ ConcreteType get concreteType =>
+ _concreteType ??= new ConcreteType(this, class_.rawType);
+
+ @override
+ int get hashCode => _id;
+
+ @override
+ bool operator ==(other) => (other is _ClassData) && (this._id == other._id);
+
+ @override
+ int compareTo(_ClassData other) => this._id.compareTo(other._id);
+
@override
String toString() => "_C $class_";
@@ -697,6 +714,9 @@
/// targets of invocations may appear.
/// It also means that there is no need to add dependencies on classes.
bool _sealed = false;
+
+ int _classIdCounter = 0;
+
final Map<DynamicSelector, _DynamicTargetSet> _dynamicTargets =
<DynamicSelector, _DynamicTargetSet>{};
@@ -716,15 +736,16 @@
for (var sup in c.supers) {
supertypes.addAll(getClassData(sup.classNode).supertypes);
}
- return new _ClassData(c, supertypes);
+ return new _ClassData(++_classIdCounter, c, supertypes);
}
- void addAllocatedClass(Class cl) {
+ ConcreteType addAllocatedClass(Class cl) {
assertx(!cl.isAbstract);
assertx(!_sealed);
+ final _ClassData classData = getClassData(cl);
+
if (allocatedClasses.add(cl)) {
- final _ClassData classData = getClassData(cl);
classData.allocatedSubtypes.add(classData);
classData.invalidateDependentInvocations(_typeFlowAnalysis.workList);
@@ -737,6 +758,8 @@
_addDynamicTarget(cl, targetSet);
}
}
+
+ return classData.concreteType;
}
void seal() {
@@ -829,12 +852,14 @@
if (numSubTypes == 0) {
return new Type.empty();
} else if (numSubTypes == 1) {
- return new Type.concrete(allocatedSubtypes.single.class_.rawType);
+ return allocatedSubtypes.single.concreteType;
} else {
- Set<ConcreteType> types = new Set<ConcreteType>();
+ List<ConcreteType> types = new List<ConcreteType>();
for (var sub in allocatedSubtypes) {
- types.add(new Type.concrete(sub.class_.rawType));
+ types.add(sub.concreteType);
}
+ // TODO(alexmarkov): cache result of specialization or keep allocatedSubtypes sorted
+ types.sort();
return new SetType(types);
}
}
@@ -1089,17 +1114,8 @@
}
@override
- void addAllocatedClass(Class c) {
+ ConcreteType addAllocatedClass(Class c) {
debugPrint("ADD ALLOCATED CLASS: $c");
- hierarchyCache.addAllocatedClass(c);
- }
-
- @override
- void addAllocatedType(InterfaceType type) {
- tracePrint("ADD ALLOCATED TYPE: $type");
-
- // TODO(alexmarkov): take type arguments into account.
-
- hierarchyCache.addAllocatedClass(type.classNode);
+ return hierarchyCache.addAllocatedClass(c);
}
}
diff --git a/pkg/vm/lib/transformations/type_flow/native_code.dart b/pkg/vm/lib/transformations/type_flow/native_code.dart
index bd07402..8dd75bc 100644
--- a/pkg/vm/lib/transformations/type_flow/native_code.dart
+++ b/pkg/vm/lib/transformations/type_flow/native_code.dart
@@ -20,15 +20,12 @@
import 'types.dart';
import 'utils.dart';
-class EntryPointsListener {
+abstract class EntryPointsListener {
/// Add call by the given selector with arbitrary ('raw') arguments.
- void addRawCall(Selector selector) {}
+ void addRawCall(Selector selector);
/// Add instantiation of the given class.
- void addAllocatedClass(Class c) {}
-
- /// Add instantiation of the given type (may be generic).
- void addAllocatedType(InterfaceType type) {}
+ ConcreteType addAllocatedClass(Class c);
}
/// Provides insights into the behavior of native code.
@@ -53,13 +50,13 @@
if (action['action'] == 'return') {
final c = _libraryIndex.getClass(action['library'], action['class']);
- entryPointsListener.addAllocatedClass(c);
+ final concreteClass = entryPointsListener.addAllocatedClass(c);
final nullable = action['nullable'];
if (nullable == false) {
- returnType = new Type.concrete(c.rawType);
+ returnType = concreteClass;
} else if ((nullable == true) || (nullable == null)) {
- returnType = new Type.nullable(new Type.concrete(c.rawType));
+ returnType = new Type.nullable(concreteClass);
} else {
throw 'Bad entry point: unexpected nullable: "$nullable" in $action';
}
diff --git a/pkg/vm/lib/transformations/type_flow/summary_collector.dart b/pkg/vm/lib/transformations/type_flow/summary_collector.dart
index d5c121a..cb96d73 100644
--- a/pkg/vm/lib/transformations/type_flow/summary_collector.dart
+++ b/pkg/vm/lib/transformations/type_flow/summary_collector.dart
@@ -346,8 +346,8 @@
final function = member.function;
assertx(function != null);
- for (var decl in function.positionalParameters) {
- args.add(new Type.fromStatic(decl.type));
+ for (int i = 0; i < function.positionalParameters.length; i++) {
+ args.add(new Type.nullableAny());
}
// TODO(alexmarkov): take named parameters into account
@@ -358,7 +358,7 @@
break;
case CallKind.PropertySet:
- args.add(new Type.fromStatic(member.setterType));
+ args.add(new Type.nullableAny());
break;
case CallKind.FieldInitializer:
@@ -443,9 +443,6 @@
Type _staticType(Expression node) =>
new Type.fromStatic(node.getStaticType(_environment));
- Type _concreteType(DartType t) =>
- (t == _environment.nullType) ? _nullType : new Type.concrete(t);
-
Type _cachedBoolType;
Type get _boolType =>
_cachedBoolType ??= new Type.cone(_environment.boolType);
@@ -522,9 +519,8 @@
@override
TypeExpr visitConstructorInvocation(ConstructorInvocation node) {
- final receiver = _concreteType(node.constructedType);
-
- _entryPointsListener.addAllocatedType(node.constructedType);
+ final receiver =
+ _entryPointsListener.addAllocatedClass(node.constructedType.classNode);
final args = _visitArguments(receiver, node.arguments);
_makeCall(node, new DirectSelector(node.target), args);
@@ -1106,13 +1102,27 @@
visitInvalidInitializer(InvalidInitializer node) {}
}
+class EmptyEntryPointsListener implements EntryPointsListener {
+ final Map<Class, IntClassId> _classIds = <Class, IntClassId>{};
+ int _classIdCounter = 0;
+
+ @override
+ void addRawCall(Selector selector) {}
+
+ @override
+ ConcreteType addAllocatedClass(Class c) {
+ final classId = (_classIds[c] ??= new IntClassId(++_classIdCounter));
+ return new ConcreteType(classId, c.rawType);
+ }
+}
+
class CreateAllSummariesVisitor extends RecursiveVisitor<Null> {
final TypeEnvironment _environment;
final SummaryCollector _summaryColector;
CreateAllSummariesVisitor(this._environment)
: _summaryColector = new SummaryCollector(_environment,
- new EntryPointsListener(), new NativeCodeOracle(null));
+ new EmptyEntryPointsListener(), new NativeCodeOracle(null));
@override
defaultMember(Member m) {
diff --git a/pkg/vm/lib/transformations/type_flow/transformer.dart b/pkg/vm/lib/transformations/type_flow/transformer.dart
index 78e54e4..9bb6c65 100644
--- a/pkg/vm/lib/transformations/type_flow/transformer.dart
+++ b/pkg/vm/lib/transformations/type_flow/transformer.dart
@@ -21,6 +21,7 @@
import '../devirtualization.dart' show Devirtualization;
import '../../metadata/direct_call.dart';
import '../../metadata/inferred_type.dart';
+import '../../metadata/unreachable.dart';
const bool kDumpAllSummaries =
const bool.fromEnvironment('global.type.flow.dump.all.summaries');
@@ -29,12 +30,12 @@
/// Whole-program type flow analysis and transformation.
/// Assumes strong mode and closed world.
-Program transformProgram(CoreTypes coreTypes, Program program,
- // TODO(alexmarkov): Pass entry points descriptors from command line.
- {List<String> entryPointsJSONFiles: const [
- 'pkg/vm/lib/transformations/type_flow/entry_points.json',
- 'pkg/vm/lib/transformations/type_flow/entry_points_extra.json',
- ]}) {
+Program transformProgram(
+ CoreTypes coreTypes, Program program, List<String> entryPoints) {
+ if ((entryPoints == null) || entryPoints.isEmpty) {
+ throw 'Error: unable to perform global type flow analysis without entry points.';
+ }
+
void ignoreAmbiguousSupertypes(Class cls, Supertype a, Supertype b) {}
final hierarchy = new ClassHierarchy(program,
onAmbiguousSupertypes: ignoreAmbiguousSupertypes);
@@ -51,7 +52,7 @@
final analysisStopWatch = new Stopwatch()..start();
final typeFlowAnalysis = new TypeFlowAnalysis(hierarchy, types, libraryIndex,
- entryPointsJSONFiles: entryPointsJSONFiles);
+ entryPointsJSONFiles: entryPoints);
Procedure main = program.mainMethod;
final Selector mainSelector = new DirectSelector(main);
@@ -70,8 +71,7 @@
new TFADevirtualization(program, typeFlowAnalysis).visitProgram(program);
- new AnnotateWithInferredTypes(program, typeFlowAnalysis)
- .visitProgram(program);
+ new AnnotateKernel(program, typeFlowAnalysis).visitProgram(program);
transformsStopWatch.stop();
@@ -132,14 +132,17 @@
}
}
-/// Annotates kernel AST with types inferred by type flow analysis.
-class AnnotateWithInferredTypes extends RecursiveVisitor<Null> {
+/// Annotates kernel AST with metadata using results of type flow analysis.
+class AnnotateKernel extends RecursiveVisitor<Null> {
final TypeFlowAnalysis _typeFlowAnalysis;
- final InferredTypeMetadataRepository _metadata;
+ final InferredTypeMetadataRepository _inferredTypeMetadata;
+ final UnreachableNodeMetadataRepository _unreachableNodeMetadata;
- AnnotateWithInferredTypes(Program program, this._typeFlowAnalysis)
- : _metadata = new InferredTypeMetadataRepository() {
- program.addMetadataRepository(_metadata);
+ AnnotateKernel(Program program, this._typeFlowAnalysis)
+ : _inferredTypeMetadata = new InferredTypeMetadataRepository(),
+ _unreachableNodeMetadata = new UnreachableNodeMetadataRepository() {
+ program.addMetadataRepository(_inferredTypeMetadata);
+ program.addMetadataRepository(_unreachableNodeMetadata);
}
InferredType _convertType(Type type) {
@@ -171,14 +174,24 @@
void _setInferredType(TreeNode node, Type type) {
final inferredType = _convertType(type);
if (inferredType != null) {
- _metadata.mapping[node] = inferredType;
+ _inferredTypeMetadata.mapping[node] = inferredType;
}
}
+ void _setUnreachable(TreeNode node) {
+ _unreachableNodeMetadata.mapping[node] = const UnreachableNode();
+ }
+
void _annotateCallSite(TreeNode node) {
final callSite = _typeFlowAnalysis.callSite(node);
- if ((callSite != null) && callSite.isResultUsed && callSite.isReachable) {
- _setInferredType(node, callSite.resultType);
+ if (callSite != null) {
+ if (callSite.isReachable) {
+ if (callSite.isResultUsed) {
+ _setInferredType(node, callSite.resultType);
+ }
+ } else {
+ _setUnreachable(node);
+ }
}
}
@@ -204,6 +217,8 @@
// TODO(alexmarkov): figure out how to pass receiver type.
// TODO(alexmarkov): support named parameters
}
+ } else if (!member.isAbstract) {
+ _setUnreachable(member);
}
}
diff --git a/pkg/vm/lib/transformations/type_flow/types.dart b/pkg/vm/lib/transformations/type_flow/types.dart
index c8249b0..7b0b6f8 100644
--- a/pkg/vm/lib/transformations/type_flow/types.dart
+++ b/pkg/vm/lib/transformations/type_flow/types.dart
@@ -32,7 +32,14 @@
return const DynamicType();
} else if (type is TypeParameterType) {
// TODO(alexmarkov): instantiate type parameters if possible
- return _normalizeDartType(type.bound);
+ final bound = type.bound;
+ // Protect against infinite recursion in case of cyclic type parameters
+ // like 'T extends T'. As of today, front-end doesn't report errors in such
+ // cases yet.
+ if (bound is TypeParameterType) {
+ return const DynamicType();
+ }
+ return _normalizeDartType(bound);
}
return type;
}
@@ -68,24 +75,18 @@
}
}
- /// Create a type representing instances of a specific class (no subtypes
- /// or `null` object).
- factory Type.concrete(DartType dartType) {
- // Catch certain unexpected types before _normalizeDartType() erases them.
- assertx(dartType is! FunctionType);
- assertx(dartType is! TypeParameterType);
- return new ConcreteType(_normalizeDartType(dartType));
- }
-
/// Create a nullable type - union of [t] and the `null` object.
factory Type.nullable(Type t) => new NullableType(t);
+ /// Create a type representing arbitrary nullable object (`dynamic`).
+ factory Type.nullableAny() => new NullableType(const AnyType());
+
/// Create a Type which corresponds to a set of instances constrained by
/// Dart type annotation [dartType].
factory Type.fromStatic(DartType dartType) {
dartType = _normalizeDartType(dartType);
if ((dartType == const DynamicType()) || (dartType == const VoidType())) {
- return new Type.nullable(const AnyType());
+ return new Type.nullableAny();
} else if (dartType == const BottomType()) {
return new Type.nullable(new Type.empty());
}
@@ -226,11 +227,23 @@
/// SetType is a union of concrete types T1, T2, ..., Tn, where n >= 2.
/// It represents the set of instances which types are in the {T1, T2, ..., Tn}.
class SetType extends Type {
- final Set<ConcreteType> types;
+ /// List of concrete types, sorted by classId.
+ final List<ConcreteType> types;
int _hashCode;
+ /// Creates a new SetType using list of concrete types sorted by classId.
SetType(this.types) {
assertx(types.length >= 2);
+ assertx(_isSorted(types));
+ }
+
+ static bool _isSorted(List<ConcreteType> types) {
+ for (int i = 0; i < types.length - 1; i++) {
+ if (types[i].classId.compareTo(types[i + 1].classId) >= 0) {
+ return false;
+ }
+ }
+ return true;
}
@override
@@ -238,20 +251,24 @@
int _computeHashCode() {
int hash = 1237;
- // Hash code should not depend on the order of types.
for (var t in types) {
- hash = (hash ^ t.hashCode) & kHashMask;
+ hash = (((hash * 31) & kHashMask) + t.classId.hashCode) & kHashMask;
}
return hash;
}
@override
- bool operator ==(other) =>
- (other is SetType) &&
- // TODO(alexmarkov): make it more efficient
- (types.length == other.types.length) &&
- this.types.containsAll(other.types) &&
- other.types.containsAll(this.types);
+ bool operator ==(other) {
+ if ((other is SetType) && (types.length == other.types.length)) {
+ for (int i = 0; i < types.length; i++) {
+ if (types[i].classId != other.types[i].classId) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
@override
String toString() => "_T ${types}";
@@ -259,17 +276,70 @@
@override
int get order => TypeOrder.Set.index;
+ static List<ConcreteType> _unionLists(
+ List<ConcreteType> types1, List<ConcreteType> types2) {
+ int i1 = 0;
+ int i2 = 0;
+ List<ConcreteType> types = <ConcreteType>[];
+ while ((i1 < types1.length) && (i2 < types2.length)) {
+ final t1 = types1[i1];
+ final t2 = types2[i2];
+ final relation = t1.classId.compareTo(t2.classId);
+ if (relation < 0) {
+ types.add(t1);
+ ++i1;
+ } else if (relation > 0) {
+ types.add(t2);
+ ++i2;
+ } else {
+ assertx(t1 == t2);
+ types.add(t1);
+ ++i1;
+ ++i2;
+ }
+ }
+ if (i1 < types1.length) {
+ types.addAll(types1.getRange(i1, types1.length));
+ } else if (i2 < types2.length) {
+ types.addAll(types2.getRange(i2, types2.length));
+ }
+ return types;
+ }
+
+ static List<ConcreteType> _intersectLists(
+ List<ConcreteType> types1, List<ConcreteType> types2) {
+ int i1 = 0;
+ int i2 = 0;
+ List<ConcreteType> types = <ConcreteType>[];
+ while ((i1 < types1.length) && (i2 < types2.length)) {
+ final t1 = types1[i1];
+ final t2 = types2[i2];
+ final relation = t1.classId.compareTo(t2.classId);
+ if (relation < 0) {
+ ++i1;
+ } else if (relation > 0) {
+ ++i2;
+ } else {
+ assertx(t1 == t2);
+ types.add(t1);
+ ++i1;
+ ++i2;
+ }
+ }
+ return types;
+ }
+
@override
Type union(Type other, TypeHierarchy typeHierarchy) {
if (other.order < this.order) {
return other.union(this, typeHierarchy);
}
if (other is SetType) {
- return new SetType(this.types.union(other.types));
+ return new SetType(_unionLists(types, other.types));
} else if (other is ConcreteType) {
return types.contains(other)
? this
- : new SetType(new Set.from(this.types)..add(other));
+ : new SetType(_unionLists(types, <ConcreteType>[other]));
} else if (other is ConeType) {
return typeHierarchy
.specializeTypeCone(other.dartType)
@@ -285,14 +355,14 @@
return other.intersection(this, typeHierarchy);
}
if (other is SetType) {
- Set<ConcreteType> set = this.types.intersection(other.types);
- final size = set.length;
+ List<ConcreteType> list = _intersectLists(types, other.types);
+ final size = list.length;
if (size == 0) {
return const EmptyType();
} else if (size == 1) {
- return set.single;
+ return list.single;
} else {
- return new SetType(set);
+ return new SetType(list);
}
} else if (other is ConcreteType) {
return types.contains(other) ? other : const EmptyType();
@@ -387,29 +457,50 @@
}
}
+/// Abstract unique identifier of a Dart class.
+/// Identifiers are comparable and used to provide ordering on classes.
+abstract class ClassId<E extends ClassId<E>> implements Comparable<E> {
+ const ClassId();
+}
+
+/// Simple implementation of [ClassId] based on int.
+class IntClassId extends ClassId<IntClassId> {
+ final int id;
+
+ const IntClassId(this.id);
+
+ @override
+ int compareTo(IntClassId other) => id.compareTo(other.id);
+}
+
/// Type representing a set of instances of a specific Dart class (no subtypes
/// or `null` object).
-class ConcreteType extends Type {
+class ConcreteType extends Type implements Comparable<ConcreteType> {
+ final ClassId classId;
final DartType dartType;
- ConcreteType(this.dartType) {
- assertx((dartType is FunctionType) ||
- ((dartType is InterfaceType) &&
- !(dartType as InterfaceType).classNode.isAbstract));
+ ConcreteType(this.classId, this.dartType) {
+ // TODO(alexmarkov): support generics & closures
+ assertx(dartType is InterfaceType);
+ assertx(!(dartType as InterfaceType).classNode.isAbstract);
+ assertx((dartType as InterfaceType)
+ .typeArguments
+ .every((t) => t == const DynamicType()));
}
@override
Class getConcreteClass(TypeHierarchy typeHierarchy) =>
- (dartType is InterfaceType)
- ? (dartType as InterfaceType).classNode
- : null;
+ (dartType as InterfaceType).classNode;
@override
- int get hashCode => (dartType.hashCode ^ 0x1234) & kHashMask;
+ int get hashCode => (classId.hashCode ^ 0x1234) & kHashMask;
@override
bool operator ==(other) =>
- (other is ConcreteType) && (this.dartType == other.dartType);
+ (other is ConcreteType) && (this.classId == other.classId);
+
+ @override
+ int compareTo(ConcreteType other) => classId.compareTo(other.classId);
@override
String toString() => "_T (${dartType})";
@@ -426,9 +517,11 @@
if (this == other) {
return this;
} else {
- final Set<ConcreteType> types = new Set<ConcreteType>();
- types.add(this);
- types.add(other);
+ assertx(this.classId != other.classId);
+ final List<ConcreteType> types =
+ (this.classId.compareTo(other.classId) < 0)
+ ? <ConcreteType>[this, other]
+ : <ConcreteType>[other, this];
return new SetType(types);
}
} else {
diff --git a/pkg/vm/test/transformations/type_flow/summary_collector_test.dart b/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
index 78fd141..bdd8af1 100644
--- a/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
+++ b/pkg/vm/test/transformations/type_flow/summary_collector_test.dart
@@ -21,8 +21,8 @@
final StringBuffer _buf = new StringBuffer();
PrintSummaries(TypeEnvironment environment)
- : _summaryColector = new SummaryCollector(
- environment, new EntryPointsListener(), new NativeCodeOracle(null));
+ : _summaryColector = new SummaryCollector(environment,
+ new EmptyEntryPointsListener(), new NativeCodeOracle(null));
String print(TreeNode node) {
visitLibrary(node);
diff --git a/pkg/vm/test/transformations/type_flow/transformer_test.dart b/pkg/vm/test/transformations/type_flow/transformer_test.dart
index 61de1ec..0aa23a6 100644
--- a/pkg/vm/test/transformations/type_flow/transformer_test.dart
+++ b/pkg/vm/test/transformations/type_flow/transformer_test.dart
@@ -25,10 +25,12 @@
final coreTypes = new CoreTypes(program);
- program = transformProgram(coreTypes, program, entryPointsJSONFiles: [
+ final entryPoints = [
pkgVmDir + '/lib/transformations/type_flow/entry_points.json',
pkgVmDir + '/lib/transformations/type_flow/entry_points_extra.json',
- ]);
+ ];
+
+ program = transformProgram(coreTypes, program, entryPoints);
final StringBuffer buffer = new StringBuffer();
new Printer(buffer, showExternal: false, showMetadata: true)
diff --git a/pkg/vm/test/transformations/type_flow/types_test.dart b/pkg/vm/test/transformations/type_flow/types_test.dart
index 83685b7..f00f935 100644
--- a/pkg/vm/test/transformations/type_flow/types_test.dart
+++ b/pkg/vm/test/transformations/type_flow/types_test.dart
@@ -45,19 +45,17 @@
expect(new Type.cone(t2Generic), equals(new ConeType(t2Raw)));
expect(new Type.cone(f1), equals(const AnyType()));
- expect(new Type.concrete(t1), equals(new ConcreteType(t1)));
- expect(new Type.concrete(t2Raw), equals(new ConcreteType(t2Raw)));
- expect(new Type.concrete(t2Generic), equals(new ConcreteType(t2Raw)));
-
expect(new Type.nullable(new Type.empty()),
equals(new NullableType(new EmptyType())));
expect(new Type.nullable(new Type.cone(t1)),
equals(new NullableType(new ConeType(t1))));
- expect(new Type.nullable(new Type.concrete(t1)),
- equals(new NullableType(new ConcreteType(t1))));
+
+ expect(new Type.nullableAny(), equals(new NullableType(new AnyType())));
expect(new Type.fromStatic(const DynamicType()),
equals(new NullableType(new AnyType())));
+ expect(new Type.fromStatic(const DynamicType()),
+ equals(new Type.nullableAny()));
expect(new Type.fromStatic(const BottomType()),
equals(new NullableType(new EmptyType())));
expect(new Type.fromStatic(t1), equals(new NullableType(new ConeType(t1))));
@@ -77,22 +75,22 @@
final empty = new EmptyType();
final any = new AnyType();
- final concreteT1 = new ConcreteType(t1);
- final concreteT2 = new ConcreteType(t2);
- final concreteT3 = new ConcreteType(t3);
- final concreteT4 = new ConcreteType(t4);
+ final concreteT1 = new ConcreteType(const IntClassId(1), t1);
+ final concreteT2 = new ConcreteType(const IntClassId(2), t2);
+ final concreteT3 = new ConcreteType(const IntClassId(3), t3);
+ final concreteT4 = new ConcreteType(const IntClassId(4), t4);
final coneT1 = new ConeType(t1);
final coneT2 = new ConeType(t2);
final coneT3 = new ConeType(t3);
final coneT4 = new ConeType(t4);
- final setT12 = new SetType([concreteT1, concreteT2].toSet());
- final setT14 = new SetType([concreteT1, concreteT4].toSet());
- final setT23 = new SetType([concreteT2, concreteT3].toSet());
- final setT34 = new SetType([concreteT3, concreteT4].toSet());
- final setT123 = new SetType([concreteT1, concreteT2, concreteT3].toSet());
- final setT124 = new SetType([concreteT1, concreteT2, concreteT4].toSet());
+ final setT12 = new SetType([concreteT1, concreteT2]);
+ final setT14 = new SetType([concreteT1, concreteT4]);
+ final setT23 = new SetType([concreteT2, concreteT3]);
+ final setT34 = new SetType([concreteT3, concreteT4]);
+ final setT123 = new SetType([concreteT1, concreteT2, concreteT3]);
+ final setT124 = new SetType([concreteT1, concreteT2, concreteT4]);
final setT1234 =
- new SetType([concreteT1, concreteT2, concreteT3, concreteT4].toSet());
+ new SetType([concreteT1, concreteT2, concreteT3, concreteT4]);
final nullableEmpty = new Type.nullable(empty);
final nullableAny = new Type.nullable(any);
final nullableConcreteT1 = new Type.nullable(concreteT1);
@@ -268,6 +266,10 @@
final f1b = new FunctionType([t1b], const VoidType());
final f2 = new FunctionType([t1a, t1a], const VoidType());
+ final cid1 = const IntClassId(1);
+ final cid2 = const IntClassId(2);
+ final cid3 = const IntClassId(3);
+
void eq(dynamic a, dynamic b) {
expect(a == b, isTrue, reason: "Test case: $a == $b");
expect(a.hashCode == b.hashCode, isTrue,
@@ -290,29 +292,27 @@
eq(new EmptyType(), new EmptyType());
ne(new EmptyType(), new AnyType());
- ne(new EmptyType(), new ConcreteType(t1a));
+ ne(new EmptyType(), new ConcreteType(cid1, t1a));
ne(new EmptyType(), new ConeType(t1a));
ne(new EmptyType(),
- new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()));
+ new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]));
ne(new EmptyType(), new NullableType(new EmptyType()));
eq(new AnyType(), new AnyType());
- ne(new AnyType(), new ConcreteType(t1a));
+ ne(new AnyType(), new ConcreteType(cid1, t1a));
ne(new AnyType(), new ConeType(t1a));
ne(new AnyType(),
- new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()));
+ new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]));
ne(new AnyType(), new NullableType(new EmptyType()));
- eq(new ConcreteType(t1a), new ConcreteType(t1b));
- eq(new ConcreteType(f1a), new ConcreteType(f1b));
- ne(new ConcreteType(t1a), new ConcreteType(t2));
- ne(new ConcreteType(f1a), new ConcreteType(f2));
- ne(new ConcreteType(t1a), new ConcreteType(f1a));
- ne(new ConcreteType(t1a), new ConeType(t1a));
- ne(new ConcreteType(t1a), new ConeType(t2));
- ne(new ConcreteType(t1a),
- new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()));
- ne(new ConcreteType(t1a), new NullableType(new ConcreteType(t1a)));
+ eq(new ConcreteType(cid1, t1a), new ConcreteType(cid1, t1b));
+ ne(new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2));
+ ne(new ConcreteType(cid1, t1a), new ConeType(t1a));
+ ne(new ConcreteType(cid1, t1a), new ConeType(t2));
+ ne(new ConcreteType(cid1, t1a),
+ new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]));
+ ne(new ConcreteType(cid1, t1a),
+ new NullableType(new ConcreteType(cid1, t1a)));
eq(new ConeType(t1a), new ConeType(t1b));
eq(new ConeType(f1a), new ConeType(f1b));
@@ -320,34 +320,34 @@
ne(new ConeType(f1a), new ConeType(f2));
ne(new ConeType(t1a), new ConeType(f1a));
ne(new ConeType(t1a),
- new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()));
+ new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]));
ne(new ConeType(t1a), new NullableType(new ConeType(t1a)));
- eq(new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()),
- new SetType([new ConcreteType(t2), new ConcreteType(t1b)].toSet()));
+ eq(new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]),
+ new SetType([new ConcreteType(cid1, t1b), new ConcreteType(cid2, t2)]));
eq(
new SetType([
- new ConcreteType(t1a),
- new ConcreteType(t2),
- new ConcreteType(t3)
- ].toSet()),
+ new ConcreteType(cid1, t1a),
+ new ConcreteType(cid2, t2),
+ new ConcreteType(cid3, t3)
+ ]),
new SetType([
- new ConcreteType(t2),
- new ConcreteType(t1b),
- new ConcreteType(t3)
- ].toSet()));
+ new ConcreteType(cid1, t1b),
+ new ConcreteType(cid2, t2),
+ new ConcreteType(cid3, t3)
+ ]));
ne(
- new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()),
+ new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]),
new SetType([
- new ConcreteType(t1a),
- new ConcreteType(t2),
- new ConcreteType(t3)
- ].toSet()));
- ne(new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()),
- new SetType([new ConcreteType(t1a), new ConcreteType(t3)].toSet()));
+ new ConcreteType(cid1, t1a),
+ new ConcreteType(cid2, t2),
+ new ConcreteType(cid3, t3)
+ ]));
+ ne(new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]),
+ new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid3, t3)]));
ne(
- new SetType([new ConcreteType(t1a), new ConcreteType(t2)].toSet()),
+ new SetType([new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)]),
new NullableType(new SetType(
- [new ConcreteType(t1a), new ConcreteType(t2)].toSet())));
+ [new ConcreteType(cid1, t1a), new ConcreteType(cid2, t2)])));
});
}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/bench_vector.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/bench_vector.dart.expect
index 82e6549..aa44be5 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/bench_vector.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/bench_vector.dart.expect
@@ -10,13 +10,13 @@
constructor •([@vm.inferred-type.metadata=!] core::int size) → void
: self::_Vector::_offset = 0, self::_Vector::_length = size, self::_Vector::_elements = [@vm.inferred-type.metadata=dart.typed_data::_Float64List] typ::Float64List::•(size), super core::Object::•()
;
- constructor fromVOL(core::List<core::double> values, core::int offset, core::int length) → void
+[@vm.unreachable.metadata=] constructor fromVOL(core::List<core::double> values, core::int offset, core::int length) → void
: self::_Vector::_offset = offset, self::_Vector::_length = length, self::_Vector::_elements = values, super core::Object::•()
throw "TFA Error: #lib::_Vector::fromVOL";
operator [](core::int i) → core::double
return [@vm.direct-call.metadata=dart.typed_data::_Float64List::[]] [@vm.inferred-type.metadata=dart.core::_Double] [@vm.direct-call.metadata=#lib::_Vector::_elements] [@vm.inferred-type.metadata=dart.typed_data::_Float64List] this.{self::_Vector::_elements}.{core::List::[]}(i.{core::num::+}([@vm.direct-call.metadata=#lib::_Vector::_offset] [@vm.inferred-type.metadata=!] this.{self::_Vector::_offset}));
operator []=([@vm.inferred-type.metadata=!] core::int i, core::double value) → void {
- [@vm.direct-call.metadata=#lib::_Vector::_elements] [@vm.inferred-type.metadata=dart.typed_data::_Float64List] this.{self::_Vector::_elements}.{core::List::[]=}(i.{core::num::+}([@vm.direct-call.metadata=#lib::_Vector::_offset] [@vm.inferred-type.metadata=!] this.{self::_Vector::_offset}), value);
+ [@vm.unreachable.metadata=] [@vm.direct-call.metadata=#lib::_Vector::_elements] [@vm.inferred-type.metadata=dart.typed_data::_Float64List] this.{self::_Vector::_elements}.{core::List::[]=}([@vm.unreachable.metadata=] i.{core::num::+}([@vm.direct-call.metadata=#lib::_Vector::_offset] [@vm.inferred-type.metadata=!] this.{self::_Vector::_offset}), value);
}
operator *([@vm.inferred-type.metadata=#lib::_Vector] self::_Vector a) → core::double {
core::double result = 0.0;
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_field_initializer.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_field_initializer.dart.expect
index e4209cf..da1a6e6 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_field_initializer.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_field_initializer.dart.expect
@@ -13,7 +13,7 @@
;
}
abstract class A extends core::Object {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::A::";
abstract method foo() → core::Object;
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class1.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class1.dart.expect
index 6df2428..d0b8b49 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class1.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class1.dart.expect
@@ -8,7 +8,7 @@
;
}
class T2 extends core::Object {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::T2::";
}
@@ -26,10 +26,10 @@
return new self::T1::•();
}
class C extends core::Object implements self::B {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::C::";
- method foo() → dynamic
+[@vm.unreachable.metadata=] method foo() → dynamic
throw "TFA Error: #lib::C::foo";
}
class Intermediate extends core::Object {
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class2.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class2.dart.expect
index 9133d59..a3755e4 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class2.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_new_class2.dart.expect
@@ -26,7 +26,7 @@
return new self::T1::•();
}
abstract class C extends core::Object implements self::B {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::C::";
}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_while_processing.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_while_processing.dart.expect
index 5a3bce0..0a02ddf 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_while_processing.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/invalidation_while_processing.dart.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
abstract class I extends core::Object {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::I::";
abstract method foo() → void;
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect
index e5c53c7..9b51a47 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/no_such_method.dart.expect
@@ -13,7 +13,7 @@
;
}
class T3 extends core::Object {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::T3::";
}
@@ -39,7 +39,7 @@
synthetic constructor •() → void
: super self::A::•()
;
- method noSuchMethod([@vm.inferred-type.metadata=dart.core::_InvocationMirror?] core::Invocation invocation) → dynamic {
+ method noSuchMethod(core::Invocation invocation) → dynamic {
return new self::T1::•();
}
}
@@ -47,7 +47,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method noSuchMethod([@vm.inferred-type.metadata=dart.core::_InvocationMirror?] core::Invocation invocation) → dynamic {
+ method noSuchMethod(core::Invocation invocation) → dynamic {
return new self::T2::•();
}
}
@@ -60,9 +60,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo() → dynamic
+[@vm.unreachable.metadata=] method foo() → dynamic
throw "TFA Error: #lib::E::foo";
- method noSuchMethod([@vm.inferred-type.metadata=dart.core::_InvocationMirror?] core::Invocation invocation) → dynamic {
+ method noSuchMethod(core::Invocation invocation) → dynamic {
return new self::T4::•();
}
}
@@ -70,9 +70,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method twoArg(dynamic a1, dynamic a2) → dynamic
+[@vm.unreachable.metadata=] method twoArg(dynamic a1, dynamic a2) → dynamic
throw "TFA Error: #lib::F::twoArg";
- method noSuchMethod([@vm.inferred-type.metadata=dart.core::_InvocationMirror?] core::Invocation invocation) → dynamic {
+ method noSuchMethod(core::Invocation invocation) → dynamic {
return new self::T2::•();
}
}
@@ -80,7 +80,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method noSuchMethod([@vm.inferred-type.metadata=dart.core::_InvocationMirror?] core::Invocation invocation) → dynamic {
+ method noSuchMethod(core::Invocation invocation) → dynamic {
return new self::T5::•();
}
}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/param_types_before_strong_mode_checks.dart b/pkg/vm/testcases/transformations/type_flow/transformer/param_types_before_strong_mode_checks.dart
new file mode 100644
index 0000000..b60d23b
--- /dev/null
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/param_types_before_strong_mode_checks.dart
@@ -0,0 +1,78 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This test verifies that inferred types of parameters are valid *before*
+// applying strong mode argument type checks.
+
+abstract class T0 {
+ void foo();
+}
+
+class T1 extends T0 {
+ void foo() {}
+}
+
+class T2 extends T0 {
+ void foo() {}
+}
+
+// Called directly with incompatible argument.
+// In such case, CFE inserts implicit cast into the caller and function is
+// invoked with correct argument type, so parameter type is inferred.
+void func1(T0 t0) {
+ t0.foo();
+}
+
+// Tear-off is taken. Arguments could be arbitrary.
+void func2(T0 t0) {
+ t0.foo(); // Devirtualization should still happen.
+}
+
+class A {
+ // Tear-off is taken.
+ void method1(T0 t0) {
+ t0.foo();
+ }
+}
+
+abstract class B {
+ void method2(covariant arg);
+}
+
+class C implements B {
+ // Called through interface with incompatible/unknown argument.
+ void method2(T0 t0) {
+ t0.foo();
+ }
+}
+
+class D {
+ // Potential dynamic call.
+ void method3(T0 t0) {
+ t0.foo();
+ }
+}
+
+Function unknown;
+
+getDynamic() => unknown.call();
+use(x) => unknown.call(x);
+
+main(List<String> args) {
+ func1(getDynamic());
+
+ use(func2);
+
+ use(new A().method1);
+
+ B bb = getDynamic();
+ bb.method2(getDynamic());
+
+ getDynamic().method3(getDynamic());
+
+ new T2();
+ new A();
+ new C();
+ new D();
+}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/param_types_before_strong_mode_checks.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/param_types_before_strong_mode_checks.dart.expect
new file mode 100644
index 0000000..baf82e2
--- /dev/null
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/param_types_before_strong_mode_checks.dart.expect
@@ -0,0 +1,76 @@
+library #lib;
+import self as self;
+import "dart:core" as core;
+
+abstract class T0 extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ abstract method foo() → void;
+}
+class T1 extends self::T0 {
+[@vm.unreachable.metadata=] synthetic constructor •() → void
+ : super self::T0::•()
+ throw "TFA Error: #lib::T1::";
+[@vm.unreachable.metadata=] method foo() → void
+ throw "TFA Error: #lib::T1::foo";
+}
+class T2 extends self::T0 {
+ synthetic constructor •() → void
+ : super self::T0::•()
+ ;
+ method foo() → void {}
+}
+class A extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method method1(self::T0 t0) → void {
+ [@vm.direct-call.metadata=#lib::T2::foo??] t0.{self::T0::foo}();
+ }
+}
+abstract class B extends core::Object {
+[@vm.unreachable.metadata=] synthetic constructor •() → void
+ : super core::Object::•()
+ throw "TFA Error: #lib::B::";
+ abstract method method2(covariant dynamic arg) → void;
+}
+class C extends core::Object implements self::B {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method method2(covariant self::T0 t0) → void {
+ [@vm.direct-call.metadata=#lib::T2::foo??] t0.{self::T0::foo}();
+ }
+}
+class D extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method method3(self::T0 t0) → void {
+ [@vm.direct-call.metadata=#lib::T2::foo??] t0.{self::T0::foo}();
+ }
+}
+[@vm.inferred-type.metadata=dart.core::Null?]static field core::Function unknown;
+static method func1([@vm.inferred-type.metadata=#lib::T2?] self::T0 t0) → void {
+ [@vm.direct-call.metadata=#lib::T2::foo??] t0.{self::T0::foo}();
+}
+static method func2(self::T0 t0) → void {
+ [@vm.direct-call.metadata=#lib::T2::foo??] t0.{self::T0::foo}();
+}
+static method getDynamic() → dynamic
+ return self::unknown.call();
+static method use(dynamic x) → dynamic
+ return self::unknown.call(x);
+static method main(core::List<core::String> args) → dynamic {
+ self::func1(self::getDynamic() as{TypeError} self::T0);
+ self::use(self::func2);
+ self::use(new self::A::•().{self::A::method1});
+ self::B bb = self::getDynamic() as{TypeError} self::B;
+ [@vm.direct-call.metadata=#lib::C::method2??] bb.{self::B::method2}(self::getDynamic());
+ self::getDynamic().method3(self::getDynamic());
+ new self::T2::•();
+ new self::A::•();
+ new self::C::•();
+ new self::D::•();
+}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_dynamic_method.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_dynamic_method.dart.expect
index 186a0a3..0f87c2a 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_dynamic_method.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_dynamic_method.dart.expect
@@ -16,10 +16,10 @@
return 1.{core::num::+}([@vm.inferred-type.metadata=#lib::B] self::knownResult().foo() as{TypeError} core::num) as{TypeError} core::int;
}
class C extends core::Object implements self::A {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::C::";
- method foo() → core::int
+[@vm.unreachable.metadata=] method foo() → core::int
throw "TFA Error: #lib::C::foo";
}
class TearOffDynamicMethod extends core::Object {
@@ -29,7 +29,7 @@
this.{self::TearOffDynamicMethod::bazz}();
}
}
-static field self::A aa = throw "TFA Error: #lib::aa";
+[@vm.unreachable.metadata=]static field self::A aa = throw "TFA Error: #lib::aa";
static method knownResult() → dynamic
return new self::B::•();
static method main(core::List<core::String> args) → dynamic {
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_interface_method.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_interface_method.dart.expect
index 1f42b77..cc9876d 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_interface_method.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_interface_method.dart.expect
@@ -16,10 +16,10 @@
return 1.{core::num::+}([@vm.inferred-type.metadata=#lib::B] self::knownResult().foo() as{TypeError} core::num) as{TypeError} core::int;
}
class C extends core::Object implements self::A {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::C::";
- method foo() → core::int
+[@vm.unreachable.metadata=] method foo() → core::int
throw "TFA Error: #lib::C::foo";
}
class TearOffInterfaceMethod extends core::Object {
@@ -28,7 +28,7 @@
: self::TearOffInterfaceMethod::bazz = arg.{self::A::foo}, super core::Object::•()
;
}
-static field self::A aa = throw "TFA Error: #lib::aa";
+[@vm.unreachable.metadata=]static field self::A aa = throw "TFA Error: #lib::aa";
static method knownResult() → dynamic
return new self::B::•();
static method main(core::List<core::String> args) → dynamic {
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_super_method.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_super_method.dart.expect
index a1b09f0..deb3fa6 100644
--- a/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_super_method.dart.expect
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/tear_off_super_method.dart.expect
@@ -16,10 +16,10 @@
return 1.{core::num::+}([@vm.inferred-type.metadata=#lib::B] self::knownResult().foo() as{TypeError} core::num) as{TypeError} core::int;
}
class C extends core::Object implements self::A {
- synthetic constructor •() → void
+[@vm.unreachable.metadata=] synthetic constructor •() → void
: super core::Object::•()
throw "TFA Error: #lib::C::";
- method foo() → core::int
+[@vm.unreachable.metadata=] method foo() → core::int
throw "TFA Error: #lib::C::foo";
}
class Base extends core::Object {
@@ -35,7 +35,7 @@
synthetic constructor •() → void
: super self::Base::•()
;
- method foo() → core::int
+[@vm.unreachable.metadata=] method foo() → core::int
throw "TFA Error: #lib::TearOffSuperMethod::foo";
method bar() → core::int
return [@vm.direct-call.metadata=#lib::Base::doCall] this.{self::Base::doCall}(super.{self::Base::foo});
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/unreachable.dart b/pkg/vm/testcases/transformations/type_flow/transformer/unreachable.dart
new file mode 100644
index 0000000..3987e39
--- /dev/null
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/unreachable.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+abstract class I {
+ void foo(x);
+}
+
+class A implements I {
+ void foo(x) {
+ print(x);
+ }
+}
+
+class B implements I {
+ void foo(x) {
+ print(x);
+ }
+}
+
+void bar(I i) {
+ if (i is A) {
+ i.foo(42);
+ }
+}
+
+I ii = new B();
+
+main(List<String> args) {
+ bar(ii);
+}
diff --git a/pkg/vm/testcases/transformations/type_flow/transformer/unreachable.dart.expect b/pkg/vm/testcases/transformations/type_flow/transformer/unreachable.dart.expect
new file mode 100644
index 0000000..2170390
--- /dev/null
+++ b/pkg/vm/testcases/transformations/type_flow/transformer/unreachable.dart.expect
@@ -0,0 +1,33 @@
+library #lib;
+import self as self;
+import "dart:core" as core;
+
+abstract class I extends core::Object {
+[@vm.unreachable.metadata=] synthetic constructor •() → void
+ : super core::Object::•()
+ throw "TFA Error: #lib::I::";
+ abstract method foo(dynamic x) → void;
+}
+class A extends core::Object implements self::I {
+[@vm.unreachable.metadata=] synthetic constructor •() → void
+ : super core::Object::•()
+ throw "TFA Error: #lib::A::";
+[@vm.unreachable.metadata=] method foo(dynamic x) → void
+ throw "TFA Error: #lib::A::foo";
+}
+class B extends core::Object implements self::I {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+[@vm.unreachable.metadata=] method foo(dynamic x) → void
+ throw "TFA Error: #lib::B::foo";
+}
+[@vm.inferred-type.metadata=#lib::B]static field self::I ii = new self::B::•();
+static method bar([@vm.inferred-type.metadata=#lib::B] self::I i) → void {
+ if(i is self::A) {
+ [@vm.unreachable.metadata=] i{self::A}.{self::A::foo}(42);
+ }
+}
+static method main(core::List<core::String> args) → dynamic {
+ self::bar([@vm.inferred-type.metadata=#lib::B] self::ii);
+}
diff --git a/pkg/vm/tool/gen_kernel.bat b/pkg/vm/tool/gen_kernel.bat
new file mode 100644
index 0000000..83a99572
--- /dev/null
+++ b/pkg/vm/tool/gen_kernel.bat
@@ -0,0 +1,21 @@
+@echo off
+REM Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+REM for details. All rights reserved. Use of this source code is governed by a
+REM BSD-style license that can be found in the LICENSE file.
+
+REM Script for generating kernel files using Dart 2 pipeline: Fasta with
+REM strong mode enabled.
+
+set SCRIPTPATH=%~dp0
+
+REM Does the path have a trailing slash? If so, remove it.
+if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1%
+
+set SDK_DIR=%SCRIPTPATH%/../../../
+
+REM Enable Dart 2.0 fixed-size integers for gen_kernel
+set DART_VM_OPTIONS=--limit-ints-to-64-bits %DART_VM_OPTIONS%
+
+set DART=%SDK_DIR%/tools/sdks/win/dart-sdk/bin/dart.exe
+
+"%DART%" %DART_VM_OPTIONS% "%SDK_DIR%/pkg/vm/bin/gen_kernel.dart" %*
diff --git a/pkg/vm/tool/precompiler2 b/pkg/vm/tool/precompiler2
index 69062fe..d0776cb 100755
--- a/pkg/vm/tool/precompiler2
+++ b/pkg/vm/tool/precompiler2
@@ -70,6 +70,9 @@
export DART_CONFIGURATION=${DART_CONFIGURATION:-ReleaseX64}
BIN_DIR="$OUT_DIR/$DART_CONFIGURATION"
+ENTRY_POINTS="--entry-points ${BIN_DIR}/gen/runtime/bin/precompiler_entry_points.json \
+ --entry-points ${SDK_DIR}/pkg/vm/lib/transformations/type_flow/entry_points_extra.json"
+
# Step 1: Generate Kernel binary from the input Dart source.
"$BIN_DIR"/dart \
--limit-ints-to-64-bits \
@@ -78,6 +81,7 @@
--aot \
$SYNC_ASYNC \
$PACKAGES \
+ $ENTRY_POINTS \
-o "$SNAPSHOT_FILE.dill" \
"$SOURCE_FILE"
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 27c5806..410bde7 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -1205,3 +1205,30 @@
ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
}
}
+
+compiled_action("precompiler_entry_points_json") {
+ # Printing precompiler entry points is folded into precompilation, so dart_bootstrap is invoked
+ # with correct arguments to generate app-aot snapshot.
+
+ # Dart script to precompile (any valid script would suffice).
+ input = "../vm/snapshot_test.dart"
+
+ # Output snapshot for precompilation.
+ snapshot = "$target_gen_dir/dummy.snapshot"
+
+ output = "$target_gen_dir/precompiler_entry_points.json"
+ tool = ":dart_bootstrap"
+ inputs = [
+ input,
+ ]
+ outputs = [
+ output,
+ ]
+ args = [
+ "--print-precompiler-entry-points=" + rebase_path(output),
+ "--snapshot=" + rebase_path(snapshot),
+ "--snapshot-kind=app-aot",
+ "--use-blobs",
+ rebase_path(input),
+ ]
+}
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 462c1a2..63c0c87 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -1377,6 +1377,14 @@
Dart_IsolateFlags isolate_flags;
Dart_IsolateFlagsInitialize(&isolate_flags);
+
+ Dart_QualifiedFunctionName* entry_points = NULL;
+ if (IsSnapshottingForPrecompilation()) {
+ entry_points = ParseEntryPointsManifestIfPresent();
+ isolate_flags.obfuscate = obfuscate;
+ isolate_flags.entry_points = entry_points;
+ }
+
// We need to capture the vmservice library in the core snapshot, so load it
// in the main isolate as well.
isolate_flags.load_vmservice_library = true;
@@ -1413,9 +1421,6 @@
return kErrorExitCode;
}
- Dart_QualifiedFunctionName* entry_points =
- ParseEntryPointsManifestIfPresent();
-
CreateAndWritePrecompiledSnapshot(entry_points);
CreateAndWriteDependenciesFile();
diff --git a/runtime/bin/snapshot_utils.cc b/runtime/bin/snapshot_utils.cc
index 73ca52e..00fc580 100644
--- a/runtime/bin/snapshot_utils.cc
+++ b/runtime/bin/snapshot_utils.cc
@@ -339,7 +339,7 @@
}
void Snapshot::GenerateAppJIT(const char* snapshot_filename) {
-#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_DBC)
+#if defined(TARGET_ARCH_IA32)
// Snapshots with code are not supported on IA32 or DBC.
uint8_t* isolate_buffer = NULL;
intptr_t isolate_size = 0;
diff --git a/runtime/lib/bigint.dart b/runtime/lib/bigint.dart
index f08c19d..03a4b70 100644
--- a/runtime/lib/bigint.dart
+++ b/runtime/lib/bigint.dart
@@ -1925,6 +1925,7 @@
// y == 1/x mod _DIGIT_BASE
y = -y; // We really want the negative inverse.
args[_RHO] = y & _Bigint._DIGIT_MASK;
+ assert(((x * y) & _Bigint._DIGIT_MASK) == _Bigint._DIGIT_MASK);
}
// Calculates -1/x % _DIGIT_BASE^2, x is a pair of 32-bit digits.
@@ -1938,6 +1939,7 @@
y = (y * (2 - (((xl & 0xffff) * y) & 0xffff))) &
0xffff; // y == 1/x mod 2^16
y = (y * (2 - ((xl * y) & 0xffffffff))) & 0xffffffff; // y == 1/x mod 2^32
+ // Warning: The following expressions involve bigint arithmetic.
var x = (args[_X_HI] << _Bigint._DIGIT_BITS) | xl;
y = (y * (2 - ((x * y) & _Bigint._TWO_DIGITS_MASK))) &
_Bigint._TWO_DIGITS_MASK;
@@ -1945,6 +1947,7 @@
y = -y; // We really want the negative inverse.
args[_RHO] = y & _Bigint._DIGIT_MASK;
args[_RHO_HI] = (y >> _Bigint._DIGIT_BITS) & _Bigint._DIGIT_MASK;
+ assert(((x * y) & _Bigint._TWO_DIGITS_MASK) == _Bigint._TWO_DIGITS_MASK);
}
// Operation:
@@ -1972,6 +1975,7 @@
int _convert(_Bigint x, Uint32List r_digits) {
// Montgomery reduction only works if abs(x) < _m.
assert(x._abs() < _m);
+ assert(_digits_per_step == 1 || _m._used.isEven);
var r = x._abs()._dlShift(_m._used)._rem(_m);
if (x._neg && !r._neg && r._used > 0) {
r = _m._sub(r);
diff --git a/runtime/observatory/tests/service/get_source_report_test.dart b/runtime/observatory/tests/service/get_source_report_test.dart
index 75f1e06..d11c722 100644
--- a/runtime/observatory/tests/service/get_source_report_test.dart
+++ b/runtime/observatory/tests/service/get_source_report_test.dart
@@ -119,6 +119,16 @@
expect(coverage['ranges'].length, greaterThan(1));
expect(coverage['scripts'].length, greaterThan(1));
+ // Full isolate
+ params = {
+ 'reports': ['Coverage'],
+ 'forceCompile': true
+ };
+ coverage = await isolate.invokeRpcNoUpgrade('getSourceReport', params);
+ expect(coverage['type'], equals('SourceReport'));
+ expect(coverage['ranges'].length, greaterThan(1));
+ expect(coverage['scripts'].length, greaterThan(1));
+
// Multiple reports (make sure enum list parameter parsing works).
params = {
'reports': ['_CallSites', 'Coverage', 'PossibleBreakpoints'],
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index c0a5c01..a3d1244 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -16,7 +16,6 @@
evaluate_activation_test/instance: RuntimeError
evaluate_activation_test/scope: RuntimeError
evaluate_in_sync_star_activation_test: RuntimeError
-library_dependency_test: CompileTimeError # Deferred loading kernel issue 28335.
pause_on_unhandled_async_exceptions2_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056
pause_on_unhandled_async_exceptions_test: RuntimeError # --pause-isolates-on-unhandled-exceptions doesn't currently work. Issue #29056
step_through_arithmetic_test: RuntimeError # probably constant evaluator pre-evaluating e.g. 1+2
@@ -128,7 +127,6 @@
coverage_optimized_function_test: RuntimeError # Please triage.
get_object_rpc_test: RuntimeError # Please triage.
get_source_report_test: RuntimeError # Please triage.
-library_dependency_test: RuntimeError # Please triage.
positive_token_pos_test: Pass, RuntimeError
reload_sources_test: Skip # Times out.
rewind_test: Pass, RuntimeError
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index ad2aa9f..6d78dea 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -15,6 +15,7 @@
cc/IsolateReload_PendingStaticCall_NSMToDefined: SkipSlow # Issue 28198
cc/IsolateReload_PendingUnqualifiedCall_InstanceToStatic: SkipSlow # Issue 28198
cc/IsolateReload_PendingUnqualifiedCall_StaticToInstance: SkipSlow # Issue 28198
+cc/IsolateReload_RunNewFieldInitializersWithGenerics: Fail # Issue 32299
cc/Profiler_InliningIntervalBoundry: Skip # Differences in ia32, debug, release
cc/SNPrint_BadArgs: Crash, Fail # These tests are expected to crash on all platforms.
cc/Sleep: Skip # Flaky # Flaky on buildbot. Issue 5133 and 10409.
@@ -24,7 +25,6 @@
cc/CodeImmutability: Fail, OK # Address Sanitizer turns a crash into a failure.
cc/IsolateReload_DanglingGetter_Class: Fail # Issue 28349
cc/IsolateReload_DanglingGetter_Instance: Fail # Issue 28349
-cc/IsolateReload_DanglingSetter_Instance: Fail # Issue 28349
cc/IsolateReload_LiveStack: Fail # Issue 28349
cc/IsolateReload_PendingSuperCall: Fail # Issue 28349
cc/IsolateReload_SmiFastPathStubs: Fail # Issue 28349
@@ -62,10 +62,10 @@
dart/wrap_around_in_range_analysis_test: SkipByDesign # The test requires int64.
[ $compiler == dartk ]
-cc/DartAPI_New: Crash
+cc/DartAPI_New: Fail
cc/DartAPI_TypeGetParameterizedTypes: Crash
-dart/redirection_type_shuffling_test/00: Crash
-dart/redirection_type_shuffling_test/none: Crash
+dart/redirection_type_shuffling_test/00: RuntimeError
+dart/redirection_type_shuffling_test/none: RuntimeError
[ $compiler != dartk ]
cc/IsolateReload_KernelIncrementalCompile: Skip
@@ -164,8 +164,6 @@
[ $compiler == dartk && $runtime == vm ]
cc/CanonicalizationInScriptSnapshots: Fail
cc/Class_ComputeEndTokenPos: Crash
-cc/CorelibCompileAll: Crash
-cc/CorelibCompilerStats: Crash
cc/DartAPI_CurrentStackTraceInfo: Fail
cc/DartAPI_InjectNativeFields1: Skip
cc/DartAPI_InvokeNoSuchMethod: Fail
@@ -199,21 +197,11 @@
cc/Debugger_SetBreakpointInPartOfLibrary: Crash
cc/FunctionSourceFingerprint: Fail
cc/GenerateSource: Skip # Cannot generate source from a kernel binary.
-cc/IsolateReload_DanglingSetter_Instance: Fail
cc/IsolateReload_EnumDelete: Fail
cc/IsolateReload_EnumReorderIdentical: Fail
cc/IsolateReload_EnumToNotEnum: Skip
-cc/IsolateReload_LiveStack: Fail
cc/IsolateReload_NotEnumToEnum: Skip
cc/IsolateReload_NotTypedefToTypedef: Fail
-cc/IsolateReload_PendingSuperCall: Fail
-cc/IsolateReload_RunNewFieldInitialiazersSuperClass: Skip
-cc/IsolateReload_RunNewFieldInitializers: Skip
-cc/IsolateReload_RunNewFieldInitializersMutateStaticField: Skip
-cc/IsolateReload_RunNewFieldInitializersReferenceStaticField: Skip
-cc/IsolateReload_RunNewFieldInitializersThrows: Skip
-cc/IsolateReload_RunNewFieldInitializersWithConsts: Skip
-cc/IsolateReload_SmiFastPathStubs: Fail
cc/IsolateReload_TypedefToNotTypedef: Fail
cc/Parser_AllocateVariables_CaptureLoopVar: Fail
cc/Parser_AllocateVariables_CapturedVar: Fail
@@ -244,7 +232,7 @@
cc/SourceReport_CallSites_PolymorphicCall: Fail
cc/SourceReport_CallSites_SimpleCall: Fail
cc/SourceReport_Coverage_AllFunctions: Fail
-cc/SourceReport_Coverage_AllFunctions_ForceCompile: Crash
+cc/SourceReport_Coverage_AllFunctions_ForceCompile: Fail
cc/SourceReport_Coverage_ForceCompile: Fail
cc/SourceReport_Coverage_NestedFunctions: Fail
cc/SourceReport_Coverage_NoCalls: Fail
@@ -261,20 +249,11 @@
dart/spawn_shutdown_test: SkipSlow
[ $compiler == dartk && $runtime == vm && $system == macos ]
-cc/IsolateReload_DanglingGetter_Class: Crash
-cc/IsolateReload_DanglingGetter_Instance: Crash
-cc/IsolateReload_DanglingSetter_Instance: Crash
cc/IsolateReload_EnumDelete: Crash
cc/IsolateReload_LibraryLookup: Fail, Crash
-cc/IsolateReload_TearOff_AddArguments: Crash
-cc/IsolateReload_TearOff_AddArguments2: Crash
-cc/IsolateReload_TearOff_Class_Identity: Crash
-cc/IsolateReload_TearOff_Instance_Equality: Crash
-cc/IsolateReload_TearOff_Library_Identity: Crash
-cc/IsolateReload_TearOff_List_Set: Crash
-cc/IsolateReload_TypeIdentity: Crash
-cc/IsolateReload_TypeIdentityGeneric: Crash
-cc/IsolateReload_TypeIdentityParameter: Crash
+cc/IsolateReload_TearOff_AddArguments: Fail
+cc/IsolateReload_TearOff_Instance_Equality: Fail
+cc/IsolateReload_TearOff_List_Set: Fail
cc/Parser_AllocateVariables_CaptureLoopVar: Crash
cc/Parser_AllocateVariables_Issue7681: Crash
cc/Parser_AllocateVariables_MiddleChain: Crash
@@ -286,34 +265,16 @@
cc/IsolateReload_LibraryShow: Crash
[ $compiler == dartk && $system == linux ]
-cc/IsolateReload_DanglingGetter_Class: Fail
-cc/IsolateReload_DanglingGetter_Instance: Fail
cc/IsolateReload_LibraryLookup: Crash
cc/IsolateReload_TearOff_AddArguments: Fail
-cc/IsolateReload_TearOff_AddArguments2: Fail
-cc/IsolateReload_TearOff_Class_Identity: Fail
cc/IsolateReload_TearOff_Instance_Equality: Fail
-cc/IsolateReload_TearOff_Library_Identity: Fail
cc/IsolateReload_TearOff_List_Set: Fail
-cc/IsolateReload_TypeIdentity: Fail
-cc/IsolateReload_TypeIdentityGeneric: Fail
-cc/IsolateReload_TypeIdentityParameter: Fail
[ $compiler == dartk && $system == windows ]
-cc/IsolateReload_DanglingGetter_Class: Crash
-cc/IsolateReload_DanglingGetter_Instance: Crash
cc/IsolateReload_LibraryLookup: Crash
-cc/IsolateReload_TearOff_AddArguments: Crash
-cc/IsolateReload_TearOff_AddArguments2: Crash
-cc/IsolateReload_TearOff_Class_Identity: Crash
-cc/IsolateReload_TearOff_Instance_Equality: Crash
-cc/IsolateReload_TearOff_Library_Identity: Crash
-cc/IsolateReload_TearOff_List_Set: Crash
-cc/IsolateReload_TypeIdentity: Crash
-cc/IsolateReload_TypeIdentityGeneric: Crash
-cc/IsolateReload_TypeIdentityParameter: Crash
-cc/Profiler_BasicSourcePosition: Fail, Pass
-cc/Profiler_CodeTicks: Fail, Pass
+cc/IsolateReload_TearOff_AddArguments: Fail
+cc/IsolateReload_TearOff_Instance_Equality: Fail
+cc/IsolateReload_TearOff_List_Set: Fail
cc/Profiler_ContextAllocation: Fail, Pass # Flaky on Windows --- sometimes give "profiler_test.cc: 1107: error: expected: !walker.Down()"
cc/Profiler_FunctionTicks: Fail, Pass
cc/Profiler_ToggleRecordAllocation: Fail, Pass
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index e57816e..fecad3a 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -1926,11 +1926,9 @@
s->Write<intptr_t>(entry.raw_value_);
break;
}
- case ObjectPool::kNativeEntry: {
-// Write nothing. Will initialize with the lazy link entry.
-#if defined(TARGET_ARCH_DBC)
- UNREACHABLE(); // DBC does not support lazy native call linking.
-#endif
+ case ObjectPool::kNativeFunction:
+ case ObjectPool::kNativeFunctionWrapper: {
+ // Write nothing. Will initialize with the lazy link entry.
break;
}
default:
@@ -1982,16 +1980,20 @@
case ObjectPool::kImmediate:
entry.raw_value_ = d->Read<intptr_t>();
break;
- case ObjectPool::kNativeEntry: {
-#if !defined(TARGET_ARCH_DBC)
+ case ObjectPool::kNativeFunction: {
// Read nothing. Initialize with the lazy link entry.
uword new_entry = NativeEntry::LinkNativeCallEntry();
entry.raw_value_ = static_cast<intptr_t>(new_entry);
-#else
- UNREACHABLE(); // DBC does not support lazy native call linking.
-#endif
break;
}
+#if defined(TARGET_ARCH_DBC)
+ case ObjectPool::kNativeFunctionWrapper: {
+ // Read nothing. Initialize with the lazy link entry.
+ uword new_entry = NativeEntry::BootstrapNativeCallWrapperEntry();
+ entry.raw_value_ = static_cast<intptr_t>(new_entry);
+ break;
+ }
+#endif
default:
UNREACHABLE();
}
@@ -5528,12 +5530,8 @@
isolate->heap()->Verify();
#endif
- {
- NOT_IN_PRODUCT(TimelineDurationScope tds(
- thread(), Timeline::GetIsolateStream(), "PostLoad"));
- for (intptr_t i = 0; i < num_clusters_; i++) {
- clusters_[i]->PostLoad(refs, kind_, zone_);
- }
+ for (intptr_t i = 0; i < num_clusters_; i++) {
+ clusters_[i]->PostLoad(refs, kind_, zone_);
}
// Setup native resolver for bootstrap impl.
diff --git a/runtime/vm/code_patcher.h b/runtime/vm/code_patcher.h
index 379dbb3..8518a74 100644
--- a/runtime/vm/code_patcher.h
+++ b/runtime/vm/code_patcher.h
@@ -81,14 +81,27 @@
static RawCode* GetSwitchableCallTargetAt(uword return_address,
const Code& caller_code);
+#if defined(TARGET_ARCH_DBC)
+ static NativeFunctionWrapper GetNativeCallAt(uword return_address,
+ const Code& code,
+ NativeFunction* target);
+#else
static RawCode* GetNativeCallAt(uword return_address,
const Code& code,
NativeFunction* target);
+#endif
+#if defined(TARGET_ARCH_DBC)
+ static void PatchNativeCallAt(uword return_address,
+ const Code& code,
+ NativeFunction target,
+ NativeFunctionWrapper trampoline);
+#else
static void PatchNativeCallAt(uword return_address,
const Code& code,
NativeFunction target,
const Code& trampoline);
+#endif
};
} // namespace dart
diff --git a/runtime/vm/code_patcher_dbc.cc b/runtime/vm/code_patcher_dbc.cc
index 2ab9ae4..30159b1 100644
--- a/runtime/vm/code_patcher_dbc.cc
+++ b/runtime/vm/code_patcher_dbc.cc
@@ -88,16 +88,16 @@
void CodePatcher::PatchNativeCallAt(uword return_address,
const Code& code,
NativeFunction target,
- const Code& trampoline) {
+ NativeFunctionWrapper trampoline) {
ASSERT(code.ContainsInstructionAt(return_address));
NativeCallPattern call(return_address, code);
call.set_target(trampoline);
call.set_native_function(target);
}
-RawCode* CodePatcher::GetNativeCallAt(uword return_address,
- const Code& code,
- NativeFunction* target) {
+NativeFunctionWrapper CodePatcher::GetNativeCallAt(uword return_address,
+ const Code& code,
+ NativeFunction* target) {
ASSERT(code.ContainsInstructionAt(return_address));
NativeCallPattern call(return_address, code);
*target = call.native_function();
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index b08c085..bf90c32 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -691,7 +691,27 @@
writer.CloseObject(); // top-level
- THR_Print("%s\n", writer.ToCString());
+ const char* contents = writer.ToCString();
+
+ Dart_FileOpenCallback file_open = Dart::file_open_callback();
+ Dart_FileWriteCallback file_write = Dart::file_write_callback();
+ Dart_FileCloseCallback file_close = Dart::file_close_callback();
+ if ((file_open == NULL) || (file_write == NULL) || (file_close == NULL)) {
+ FATAL(
+ "Unable to print precompiler entry points:"
+ " file callbacks are not provided by embedder");
+ }
+
+ void* out_stream =
+ file_open(FLAG_print_precompiler_entry_points, /* write = */ true);
+ if (out_stream == NULL) {
+ FATAL1(
+ "Unable to print precompiler entry points:"
+ " failed to open file \"%s\" for writing",
+ FLAG_print_precompiler_entry_points);
+ }
+ file_write(contents, strlen(contents), out_stream);
+ file_close(out_stream);
}
void PrecompilerEntryPointsPrinter::DescribeClass(JSONWriter* writer,
@@ -3367,6 +3387,10 @@
PreventRenaming("library");
PreventRenaming("io");
PreventRenaming("html");
+
+ // Looked up by name via "DartUtils::GetDartType".
+ PreventRenaming("_RandomAccessFileOpsImpl");
+ PreventRenaming("_NamespaceImpl");
}
RawString* Obfuscator::ObfuscationState::RenameImpl(const String& name,
diff --git a/runtime/vm/compiler/assembler/assembler.cc b/runtime/vm/compiler/assembler/assembler.cc
index 04b9fb1..c19a0d2 100644
--- a/runtime/vm/compiler/assembler/assembler.cc
+++ b/runtime/vm/compiler/assembler/assembler.cc
@@ -281,13 +281,21 @@
kNotPatchable);
}
-intptr_t ObjectPoolWrapper::FindNativeEntry(const ExternalLabel* label,
- Patchability patchable) {
+intptr_t ObjectPoolWrapper::FindNativeFunction(const ExternalLabel* label,
+ Patchability patchable) {
return FindObject(
- ObjectPoolWrapperEntry(label->address(), ObjectPool::kNativeEntry),
+ ObjectPoolWrapperEntry(label->address(), ObjectPool::kNativeFunction),
patchable);
}
+intptr_t ObjectPoolWrapper::FindNativeFunctionWrapper(
+ const ExternalLabel* label,
+ Patchability patchable) {
+ return FindObject(ObjectPoolWrapperEntry(label->address(),
+ ObjectPool::kNativeFunctionWrapper),
+ patchable);
+}
+
RawObjectPool* ObjectPoolWrapper::MakeObjectPool() {
intptr_t len = object_pool_.length();
if (len == 0) {
diff --git a/runtime/vm/compiler/assembler/assembler.h b/runtime/vm/compiler/assembler/assembler.h
index daa31a5..bc16cba 100644
--- a/runtime/vm/compiler/assembler/assembler.h
+++ b/runtime/vm/compiler/assembler/assembler.h
@@ -372,7 +372,10 @@
Patchability patchable = kNotPatchable);
intptr_t FindObject(const Object& obj, const Object& equivalence);
intptr_t FindImmediate(uword imm);
- intptr_t FindNativeEntry(const ExternalLabel* label, Patchability patchable);
+ intptr_t FindNativeFunction(const ExternalLabel* label,
+ Patchability patchable);
+ intptr_t FindNativeFunctionWrapper(const ExternalLabel* label,
+ Patchability patchable);
RawObjectPool* MakeObjectPool();
diff --git a/runtime/vm/compiler/assembler/assembler_arm.cc b/runtime/vm/compiler/assembler/assembler_arm.cc
index 139069e..14b68c0 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm.cc
@@ -1509,7 +1509,7 @@
Patchability patchable,
Condition cond) {
const int32_t offset = ObjectPool::element_offset(
- object_pool_wrapper_.FindNativeEntry(label, patchable));
+ object_pool_wrapper_.FindNativeFunction(label, patchable));
LoadWordFromPoolOffset(rd, offset - kHeapObjectTag, PP, cond);
}
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc
index a85c3bc..6d5c531 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64.cc
@@ -436,7 +436,7 @@
void Assembler::LoadNativeEntry(Register dst, const ExternalLabel* label) {
const int32_t offset = ObjectPool::element_offset(
- object_pool_wrapper_.FindNativeEntry(label, kNotPatchable));
+ object_pool_wrapper_.FindNativeFunction(label, kNotPatchable));
LoadWordFromPoolOffset(dst, offset);
}
diff --git a/runtime/vm/compiler/assembler/assembler_x64.cc b/runtime/vm/compiler/assembler/assembler_x64.cc
index 123ce31..e9451d0 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.cc
+++ b/runtime/vm/compiler/assembler/assembler_x64.cc
@@ -47,7 +47,7 @@
const ExternalLabel* label,
Patchability patchable) {
const int32_t offset = ObjectPool::element_offset(
- object_pool_wrapper_.FindNativeEntry(label, patchable));
+ object_pool_wrapper_.FindNativeFunction(label, patchable));
LoadWordFromPoolOffset(dst, offset - kHeapObjectTag);
}
diff --git a/runtime/vm/compiler/backend/il_dbc.cc b/runtime/vm/compiler/backend/il_dbc.cc
index bb75c7c..9565d80 100644
--- a/runtime/vm/compiler/backend/il_dbc.cc
+++ b/runtime/vm/compiler/backend/il_dbc.cc
@@ -954,21 +954,32 @@
const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
- ASSERT(!link_lazily());
- const ExternalLabel label(reinterpret_cast<uword>(native_c_function()));
+ NativeFunctionWrapper trampoline;
+ NativeFunction function;
+ if (link_lazily()) {
+ trampoline = &NativeEntry::BootstrapNativeCallWrapper;
+ function = reinterpret_cast<NativeFunction>(&NativeEntry::LinkNativeCall);
+ } else {
+ if (is_bootstrap_native()) {
+ trampoline = &NativeEntry::BootstrapNativeCallWrapper;
+ } else if (is_auto_scope()) {
+ trampoline = &NativeEntry::AutoScopeNativeCallWrapper;
+ } else {
+ trampoline = &NativeEntry::NoScopeNativeCallWrapper;
+ }
+ function = native_c_function();
+ }
+
+ const ExternalLabel trampoline_label(reinterpret_cast<uword>(trampoline));
+ const intptr_t trampoline_kidx =
+ __ object_pool_wrapper().FindNativeFunctionWrapper(&trampoline_label,
+ kPatchable);
+ const ExternalLabel label(reinterpret_cast<uword>(function));
const intptr_t target_kidx =
- __ object_pool_wrapper().FindNativeEntry(&label, kNotPatchable);
+ __ object_pool_wrapper().FindNativeFunction(&label, kPatchable);
const intptr_t argc_tag_kidx =
__ object_pool_wrapper().FindImmediate(static_cast<uword>(argc_tag));
- __ PushConstant(target_kidx);
- __ PushConstant(argc_tag_kidx);
- if (is_bootstrap_native()) {
- __ NativeBootstrapCall();
- } else if (is_auto_scope()) {
- __ NativeAutoScopeCall();
- } else {
- __ NativeNoScopeCall();
- }
+ __ NativeCall(trampoline_kidx, target_kidx, argc_tag_kidx);
compiler->RecordSafepoint(locs());
compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, Thread::kNoDeoptId,
token_pos());
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 449e737..aa504d3 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
+#include "vm/compiler/aot/precompiler.h"
#include "vm/compiler/frontend/prologue_builder.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/longjump.h"
@@ -18,7 +19,7 @@
#define T (type_translator_)
#define I Isolate::Current()
-static bool IsStaticInitializer(const Function& function, Zone* zone) {
+static bool IsFieldInitializer(const Function& function, Zone* zone) {
return (function.kind() == RawFunction::kImplicitStaticFinalGetter) &&
String::Handle(zone, function.name())
.StartsWith(Symbols::InitPrefix());
@@ -1003,7 +1004,7 @@
case RawFunction::kImplicitStaticFinalGetter:
case RawFunction::kImplicitSetter: {
ASSERT(builder_->PeekTag() == kField);
- if (IsStaticInitializer(function, Z)) {
+ if (IsFieldInitializer(function, Z)) {
VisitNode();
break;
}
@@ -1541,6 +1542,10 @@
}
return;
}
+ case kLoadLibrary:
+ case kCheckLibraryIsLoaded:
+ builder_->ReadUInt(); // library index
+ break;
default:
H.ReportError("Unsupported tag at this point: %d.", tag);
UNREACHABLE();
@@ -1711,7 +1716,7 @@
case kReturnStatement: {
if ((depth_.function_ == 0) && (depth_.finally_ > 0) &&
(result_->finally_return_variable == NULL)) {
- const String& name = H.DartSymbol(":try_finally_return_value");
+ const String& name = Symbols::TryFinallyReturnValue();
LocalVariable* variable =
MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
name, AbstractType::dynamic_type());
@@ -1849,7 +1854,7 @@
// `declaration->SetConstantValue()`.
const String& name = (H.StringSize(helper.name_index_) == 0)
? GenerateName(":var", name_index_++)
- : H.DartSymbol(helper.name_index_);
+ : H.DartSymbolObfuscate(helper.name_index_);
Tag tag = builder_->ReadTag(); // read (first part of) initializer.
if (tag == kSomething) {
@@ -2077,7 +2082,7 @@
builder_->inferred_type_metadata_helper_.GetInferredType(kernel_offset);
VariableDeclarationHelper helper(builder_);
helper.ReadUntilExcluding(VariableDeclarationHelper::kType);
- String& name = H.DartSymbol(helper.name_index_);
+ String& name = H.DartSymbolObfuscate(helper.name_index_);
AbstractType& type = BuildAndVisitVariableType(); // read type.
helper.SetJustRead(VariableDeclarationHelper::kType);
helper.ReadUntilExcluding(VariableDeclarationHelper::kInitializer);
@@ -2238,7 +2243,7 @@
declaration_binary_offset - builder_->data_program_offset_,
parsed_function_->function());
- const String& name = H.DartSymbol(var_name);
+ const String& name = H.DartSymbolObfuscate(var_name);
variable = current_function_scope_->parent()->LookupVariable(name, true);
ASSERT(variable != NULL);
result_->locals.Insert(declaration_binary_offset, variable);
@@ -2267,7 +2272,7 @@
intptr_t suffix) {
char name[64];
OS::SNPrint(name, 64, "%s%" Pd "", prefix, suffix);
- return H.DartSymbol(name);
+ return H.DartSymbolObfuscate(name);
}
void StreamingScopeBuilder::HandleSpecialLoad(LocalVariable** variable,
@@ -2469,7 +2474,7 @@
intptr_t pos = 0;
parameter_types.SetAt(pos, AbstractType::dynamic_type());
- parameter_names.SetAt(pos, H.DartSymbol("_receiver_"));
+ parameter_names.SetAt(pos, H.DartSymbolPlain("_receiver_"));
++pos;
for (intptr_t i = 0; i < positional_count; ++i, ++pos) {
BuildTypeInternal(); // read ith positional parameter.
@@ -2477,7 +2482,7 @@
result_ = AbstractType::dynamic_type().raw();
}
parameter_types.SetAt(pos, result_);
- parameter_names.SetAt(pos, H.DartSymbol("noname"));
+ parameter_names.SetAt(pos, H.DartSymbolPlain("noname"));
}
// The additional first parameter is the receiver type (set to dynamic).
@@ -2490,7 +2495,7 @@
builder_->ReadListLength(); // read named_parameters list length.
for (intptr_t i = 0; i < named_count; ++i, ++pos) {
// read string reference (i.e. named_parameters[i].name).
- String& name = H.DartSymbol(builder_->ReadStringReference());
+ String& name = H.DartSymbolObfuscate(builder_->ReadStringReference());
BuildTypeInternal(); // read named_parameters[i].type.
if (result_.IsMalformed()) {
result_ = AbstractType::dynamic_type().raw();
@@ -2607,7 +2612,10 @@
return;
}
- H.ReportError("Unexpected input. Please report this at dartbug.com.");
+ H.ReportError(
+ builder_->script(), TokenPosition::kNoSource,
+ "Unbound type parameter found in %s. Please report this at dartbug.com.",
+ active_class_->ToCString());
}
const TypeArguments& StreamingDartTypeTranslator::BuildTypeArguments(
@@ -2770,6 +2778,9 @@
case kLet:
EvaluateLet();
break;
+ case kInstantiation:
+ EvaluatePartialTearoffInstantiation();
+ break;
case kBigIntLiteral:
EvaluateBigIntLiteral();
break;
@@ -3179,11 +3190,15 @@
if (constructor.IsFactory()) {
// Factories return the new object.
result_ ^= result.raw();
- result_ = H.Canonicalize(result_);
} else {
ASSERT(!receiver->IsNull());
- result_ = H.Canonicalize(*receiver);
+ result_ ^= (*receiver).raw();
}
+ if (I->obfuscate() &&
+ (result_.clazz() == I->object_store()->symbol_class())) {
+ Obfuscator::ObfuscateSymbolInstance(H.thread(), result_);
+ }
+ result_ = H.Canonicalize(result_);
}
void StreamingConstantEvaluator::EvaluateNot() {
@@ -3293,7 +3308,8 @@
}
void StreamingConstantEvaluator::EvaluateSymbolLiteral() {
- const String& symbol_value = H.DartSymbol(
+ // The symbol value is read plain and obfuscated later.
+ const String& symbol_value = H.DartSymbolPlain(
builder_->ReadStringReference()); // read index into string table.
const Class& symbol_class =
@@ -3356,8 +3372,9 @@
ASSERT(!map_class.IsNull());
ASSERT(map_class.NumTypeArguments() == 2);
- const Field& field = Field::Handle(
- Z, map_class.LookupInstanceFieldAllowPrivate(H.DartSymbol("_kvPairs")));
+ const Field& field =
+ Field::Handle(Z, map_class.LookupInstanceFieldAllowPrivate(
+ H.DartSymbolObfuscate("_kvPairs")));
ASSERT(!field.IsNull());
// NOTE: This needs to be kept in sync with `runtime/lib/immutable_map.dart`!
@@ -3387,6 +3404,41 @@
EvaluateExpression(builder_->ReaderOffset(), false); // read body
}
+void StreamingConstantEvaluator::EvaluatePartialTearoffInstantiation() {
+ // This method call wasn't cached, so receiver et al. isn't cached either.
+ const Instance& receiver =
+ EvaluateExpression(builder_->ReaderOffset(), false); // read receiver.
+ if (!receiver.IsClosure()) {
+ H.ReportError(script_, TokenPosition::kNoSource, "Expected closure.");
+ }
+ const Closure& old_closure = Closure::Cast(receiver);
+
+ // read type arguments.
+ intptr_t num_type_args = builder_->ReadListLength();
+ const TypeArguments* type_args = &T.BuildTypeArguments(num_type_args);
+ // Even if all dynamic types are passed in, we need to put a vector in here to
+ // distinguish this partially applied tearoff from a normal tearoff. This is
+ // necessary because the tearoff wrapper (BuildGraphOfImplicitClosureFunction)
+ // needs to throw NSM if type arguments are passed to a partially applied
+ // tearoff.
+ if (type_args->IsNull()) {
+ type_args =
+ &TypeArguments::ZoneHandle(Z, TypeArguments::New(num_type_args));
+ for (intptr_t i = 0; i < num_type_args; ++i) {
+ type_args->SetTypeAt(i, Type::ZoneHandle(Z, Type::DynamicType()));
+ }
+ }
+
+ // Create new closure with the type arguments inserted, and other things
+ // copied over.
+ Closure& new_closure = Closure::Handle(
+ Z, Closure::New(TypeArguments::Handle(
+ Z, old_closure.instantiator_type_arguments()),
+ *type_args, Function::Handle(Z, old_closure.function()),
+ Context::Handle(Z, old_closure.context()), Heap::kOld));
+ result_ = H.Canonicalize(new_closure);
+}
+
void StreamingConstantEvaluator::EvaluateBigIntLiteral() {
const String& value =
H.DartString(builder_->ReadStringReference()); // read string reference.
@@ -3399,7 +3451,7 @@
}
void StreamingConstantEvaluator::EvaluateStringLiteral() {
- result_ = H.DartSymbol(builder_->ReadStringReference())
+ result_ = H.DartSymbolPlain(builder_->ReadStringReference())
.raw(); // read string reference.
}
@@ -3469,8 +3521,8 @@
const Array& names =
Array::ZoneHandle(Z, Array::New(list_length, H.allocation_space()));
for (intptr_t i = 0; i < list_length; ++i) {
- String& name =
- H.DartSymbol(builder_->ReadStringReference()); // read ith name index.
+ String& name = H.DartSymbolObfuscate(
+ builder_->ReadStringReference()); // read ith name index.
names.SetAt(i, name);
EvaluateExpression(builder_->ReaderOffset(),
false); // read ith expression.
@@ -3547,6 +3599,10 @@
// The factory method returns the allocated object.
instance ^= result.raw();
}
+ if (I->obfuscate() &&
+ (instance.clazz() == I->object_store()->symbol_class())) {
+ Obfuscator::ObfuscateSymbolInstance(H.thread(), instance);
+ }
return H.Canonicalize(instance);
}
@@ -3692,10 +3748,9 @@
return flow_graph_builder_->optimizing_;
}
-FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfStaticFieldInitializer() {
+FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfFieldInitializer() {
FieldHelper field_helper(this);
field_helper.ReadUntilExcluding(FieldHelper::kInitializer);
- ASSERT(field_helper.IsStatic());
Tag initializer_tag = ReadTag(); // read first part of initializer.
if (initializer_tag != kSomething) {
@@ -4201,7 +4256,7 @@
VariableDeclarationHelper helper(this);
helper.ReadUntilExcluding(VariableDeclarationHelper::kEnd);
- argument_names.SetAt(i, H.DartSymbol(helper.name_index_));
+ argument_names.SetAt(i, H.DartSymbolObfuscate(helper.name_index_));
}
}
@@ -4251,7 +4306,7 @@
for (intptr_t i = 0; i < num_type_params; ++i) {
ReadFlags(); // skip flags
SkipListOfExpressions(); // skip annotations
- String& name = H.DartSymbol(ReadStringReference()); // read name
+ String& name = H.DartSymbolObfuscate(ReadStringReference()); // read name
AbstractType& bound = T.BuildType(); // read bound
if (forwarding_target != NULL) {
@@ -4710,8 +4765,8 @@
case RawFunction::kImplicitGetter:
case RawFunction::kImplicitStaticFinalGetter:
case RawFunction::kImplicitSetter: {
- return IsStaticInitializer(function, Z)
- ? BuildGraphOfStaticFieldInitializer()
+ return IsFieldInitializer(function, Z)
+ ? BuildGraphOfFieldInitializer()
: BuildGraphOfFieldAccessor(scopes()->setter_value);
}
case RawFunction::kMethodExtractor:
@@ -4843,6 +4898,10 @@
return BuildConstantExpression(position);
case kInstantiation:
return BuildPartialTearoffInstantiation(position);
+ case kLoadLibrary:
+ case kCheckLibraryIsLoaded:
+ ReadUInt(); // skip library index
+ return BuildFutureNullValue(position);
default:
H.ReportError("Unsupported tag at this point: %d.", tag);
UNREACHABLE();
@@ -5395,6 +5454,10 @@
case kConstantExpression:
SkipConstantReference();
return;
+ case kLoadLibrary:
+ case kCheckLibraryIsLoaded:
+ ReadUInt(); // skip library index
+ return;
default:
H.ReportError("Unsupported tag at this point: %d.", tag);
UNREACHABLE();
@@ -6206,7 +6269,8 @@
*argument_names ^= Array::New(list_length, Heap::kOld);
}
for (intptr_t i = 0; i < list_length; ++i) {
- String& name = H.DartSymbol(ReadStringReference()); // read ith name index.
+ String& name =
+ H.DartSymbolObfuscate(ReadStringReference()); // read ith name index.
instructions += BuildExpression(); // read ith expression.
if (!skip_push_arguments) instructions += PushArgument();
if (do_drop) instructions += Drop();
@@ -7082,7 +7146,7 @@
intptr_t named_list_length = ReadListLength();
argument_names ^= Array::New(named_list_length, H.allocation_space());
for (intptr_t i = 0; i < named_list_length; i++) {
- const String& arg_name = H.DartSymbol(ReadStringReference());
+ const String& arg_name = H.DartSymbolObfuscate(ReadStringReference());
argument_names.SetAt(i, arg_name);
SkipExpression();
}
@@ -7855,8 +7919,8 @@
TokenPosition* position) {
if (position != NULL) *position = TokenPosition::kNoSource;
- return Constant(
- H.DartSymbol(ReadStringReference())); // read index into string table.
+ return Constant(H.DartSymbolPlain(
+ ReadStringReference())); // read index into string table.
}
Fragment StreamingFlowGraphBuilder::BuildIntLiteral(uint8_t payload,
@@ -7899,6 +7963,23 @@
return Constant(Instance::ZoneHandle(Z, Instance::null()));
}
+Fragment StreamingFlowGraphBuilder::BuildFutureNullValue(
+ TokenPosition* position) {
+ if (position != NULL) *position = TokenPosition::kNoSource;
+ const Class& future = Class::Handle(Z, I->object_store()->future_class());
+ ASSERT(!future.IsNull());
+ const Function& constructor =
+ Function::ZoneHandle(Z, future.LookupFunction(Symbols::FutureValue()));
+ ASSERT(!constructor.IsNull());
+
+ Fragment instructions;
+ instructions += BuildNullLiteral(position);
+ instructions += PushArgument();
+ instructions += StaticCall(TokenPosition::kNoSource, constructor,
+ /* argument_count = */ 1, ICData::kStatic);
+ return instructions;
+}
+
Fragment StreamingFlowGraphBuilder::BuildVectorCreation(
TokenPosition* position) {
if (position != NULL) *position = TokenPosition::kNoSource;
@@ -8453,9 +8534,15 @@
const Class& klass = Class::ZoneHandle(
Z, Library::LookupCoreClass(Symbols::FallThroughError()));
ASSERT(!klass.IsNull());
+
+ GrowableHandlePtrArray<const String> pieces(Z, 3);
+ pieces.Add(Symbols::FallThroughError());
+ pieces.Add(Symbols::Dot());
+ pieces.Add(H.DartSymbolObfuscate("_create"));
+
const Function& constructor = Function::ZoneHandle(
- Z, klass.LookupConstructorAllowPrivate(
- H.DartSymbol("FallThroughError._create")));
+ Z, klass.LookupConstructorAllowPrivate(String::ZoneHandle(
+ Z, Symbols::FromConcatAll(H.thread(), pieces))));
ASSERT(!constructor.IsNull());
const String& url = H.DartString(
parsed_function()->function().ToLibNamePrefixedQualifiedCString(),
@@ -8989,7 +9076,7 @@
VariableDeclarationHelper helper(this);
helper.ReadUntilExcluding(VariableDeclarationHelper::kType);
- String& name = H.DartSymbol(helper.name_index_);
+ String& name = H.DartSymbolObfuscate(helper.name_index_);
AbstractType& type = T.BuildType(); // read type.
Tag tag = ReadTag(); // read (first part of) initializer.
@@ -9072,7 +9159,7 @@
const String* name;
if (declaration) {
- name = &H.DartSymbol(name_index);
+ name = &H.DartSymbolObfuscate(name_index);
} else {
name = &Symbols::AnonymousClosure();
}
@@ -9195,7 +9282,7 @@
parameter = TypeParameter::New(
set_on_class ? *active_class->klass : Class::Handle(Z),
parameterized_function, i,
- H.DartSymbol(ReadStringReference()), // read ith name index.
+ H.DartSymbolObfuscate(ReadStringReference()), // read ith name index.
null_bound, TokenPosition::kNoSource);
type_parameters.SetTypeAt(i, parameter);
SkipDartType(); // read guard.
@@ -9312,7 +9399,7 @@
function.SetParameterTypeAt(
pos, type.IsMalformed() ? Type::dynamic_type() : type);
- function.SetParameterNameAt(pos, H.DartSymbol(helper.name_index_));
+ function.SetParameterNameAt(pos, H.DartSymbolObfuscate(helper.name_index_));
}
intptr_t named_parameter_count_check = ReadListLength(); // read list length.
@@ -9329,7 +9416,7 @@
function.SetParameterTypeAt(
pos, type.IsMalformed() ? Type::dynamic_type() : type);
- function.SetParameterNameAt(pos, H.DartSymbol(helper.name_index_));
+ function.SetParameterNameAt(pos, H.DartSymbolObfuscate(helper.name_index_));
}
function_node_helper->SetJustRead(FunctionNodeHelper::kNamedParameters);
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index b4dca31..80da18a 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -271,6 +271,9 @@
kExternal = 1 << 2,
kConst = 1 << 3, // Only for external const factories.
kForwardingStub = 1 << 4,
+
+ // TODO(29841): Remove this line after the issue is resolved.
+ kRedirectingFactoryConstructor = 1 << 7,
};
explicit ProcedureHelper(StreamingFlowGraphBuilder* builder) {
@@ -292,6 +295,9 @@
bool IsExternal() { return (flags_ & kExternal) != 0; }
bool IsConst() { return (flags_ & kConst) != 0; }
bool IsForwardingStub() { return (flags_ & kForwardingStub) != 0; }
+ bool IsRedirectingFactoryConstructor() {
+ return (flags_ & kRedirectingFactoryConstructor) != 0;
+ }
NameIndex canonical_name_;
TokenPosition position_;
@@ -872,6 +878,7 @@
void EvaluateListLiteralInternal();
void EvaluateMapLiteralInternal();
void EvaluateLet();
+ void EvaluatePartialTearoffInstantiation();
void EvaluateBigIntLiteral();
void EvaluateStringLiteral();
void EvaluateIntLiteral(uint8_t payload);
@@ -1033,7 +1040,7 @@
bool optimizing();
- FlowGraph* BuildGraphOfStaticFieldInitializer();
+ FlowGraph* BuildGraphOfFieldInitializer();
FlowGraph* BuildGraphOfFieldAccessor(LocalVariable* setter_value);
void SetupDefaultParameterValues();
Fragment BuildFieldInitializer(NameIndex canonical_name);
@@ -1304,6 +1311,7 @@
Fragment BuildDoubleLiteral(TokenPosition* position);
Fragment BuildBoolLiteral(bool value, TokenPosition* position);
Fragment BuildNullLiteral(TokenPosition* position);
+ Fragment BuildFutureNullValue(TokenPosition* position);
Fragment BuildVectorCreation(TokenPosition* position);
Fragment BuildVectorGet(TokenPosition* position);
Fragment BuildVectorSet(TokenPosition* position);
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index 1c75fa7..e8b7c6b 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -4,6 +4,7 @@
#include <set>
+#include "vm/compiler/aot/precompiler.h"
#include "vm/compiler/frontend/kernel_to_il.h"
#include "vm/compiler/backend/il.h"
@@ -435,23 +436,46 @@
return String::ZoneHandle(Z, String::FromUTF8(utf8_array, len, space));
}
-const String& TranslationHelper::DartSymbol(const char* content) const {
+const String& TranslationHelper::DartSymbolPlain(const char* content) const {
return String::ZoneHandle(Z, Symbols::New(thread_, content));
}
-String& TranslationHelper::DartSymbol(StringIndex string_index) const {
+String& TranslationHelper::DartSymbolPlain(StringIndex string_index) const {
intptr_t length = StringSize(string_index);
uint8_t* buffer = Z->Alloc<uint8_t>(length);
{
NoSafepointScope no_safepoint;
memmove(buffer, StringBuffer(string_index), length);
}
- return String::ZoneHandle(Z, Symbols::FromUTF8(thread_, buffer, length));
+ String& result =
+ String::ZoneHandle(Z, Symbols::FromUTF8(thread_, buffer, length));
+ return result;
}
-String& TranslationHelper::DartSymbol(const uint8_t* utf8_array,
- intptr_t len) const {
- return String::ZoneHandle(Z, Symbols::FromUTF8(thread_, utf8_array, len));
+const String& TranslationHelper::DartSymbolObfuscate(
+ const char* content) const {
+ String& result = String::ZoneHandle(Z, Symbols::New(thread_, content));
+ if (I->obfuscate()) {
+ Obfuscator obfuscator(thread_, String::Handle(Z));
+ result = obfuscator.Rename(result, true);
+ }
+ return result;
+}
+
+String& TranslationHelper::DartSymbolObfuscate(StringIndex string_index) const {
+ intptr_t length = StringSize(string_index);
+ uint8_t* buffer = Z->Alloc<uint8_t>(length);
+ {
+ NoSafepointScope no_safepoint;
+ memmove(buffer, StringBuffer(string_index), length);
+ }
+ String& result =
+ String::ZoneHandle(Z, Symbols::FromUTF8(thread_, buffer, length));
+ if (I->obfuscate()) {
+ Obfuscator obfuscator(thread_, String::Handle(Z));
+ result = obfuscator.Rename(result, true);
+ }
+ return result;
}
const String& TranslationHelper::DartClassName(NameIndex kernel_class) {
@@ -505,7 +529,7 @@
}
String& name =
String::ZoneHandle(Z, String::FromUTF8(buffer, size, allocation_space_));
- ManglePrivateName(parent, &name, false);
+ ManglePrivateName(parent, &name);
name = Field::SetterSymbol(name);
return name;
}
@@ -518,7 +542,7 @@
const String& TranslationHelper::DartGetterName(NameIndex parent,
StringIndex getter) {
String& name = DartString(getter);
- ManglePrivateName(parent, &name, false);
+ ManglePrivateName(parent, &name);
name = Field::GetterSymbol(name);
return name;
}
@@ -556,7 +580,8 @@
// This ASSERT is just a sanity check.
ASSERT(IsLibrary(kernel_library) ||
IsAdministrative(CanonicalNameParent(kernel_library)));
- const String& library_name = DartSymbol(CanonicalNameString(kernel_library));
+ const String& library_name =
+ DartSymbolPlain(CanonicalNameString(kernel_library));
ASSERT(!library_name.IsNull());
RawLibrary* library = Library::LookupLibrary(thread_, library_name);
ASSERT(library != Object::null());
@@ -589,7 +614,7 @@
klass = LookupClassByKernelClass(enclosing);
}
RawField* field = klass.LookupFieldAllowPrivate(
- DartSymbol(CanonicalNameString(kernel_field)));
+ DartSymbolObfuscate(CanonicalNameString(kernel_field)));
ASSERT(field != Object::null());
return field;
}
@@ -726,27 +751,50 @@
String& TranslationHelper::ManglePrivateName(NameIndex parent,
String* name_to_modify,
- bool symbolize) {
+ bool symbolize,
+ bool obfuscate) {
if (name_to_modify->Length() >= 1 && name_to_modify->CharAt(0) == '_') {
const Library& library =
Library::Handle(Z, LookupLibraryByKernelLibrary(parent));
*name_to_modify = library.PrivateName(*name_to_modify);
+ if (obfuscate && I->obfuscate()) {
+ const String& library_key = String::Handle(library.private_key());
+ Obfuscator obfuscator(thread_, library_key);
+ *name_to_modify = obfuscator.Rename(*name_to_modify);
+ }
} else if (symbolize) {
*name_to_modify = Symbols::New(thread_, *name_to_modify);
+ if (obfuscate && I->obfuscate()) {
+ const String& library_key = String::Handle();
+ Obfuscator obfuscator(thread_, library_key);
+ *name_to_modify = obfuscator.Rename(*name_to_modify);
+ }
}
return *name_to_modify;
}
String& TranslationHelper::ManglePrivateName(const Library& library,
String* name_to_modify,
- bool symbolize) {
+ bool symbolize,
+ bool obfuscate) {
if (name_to_modify->Length() >= 1 && name_to_modify->CharAt(0) == '_') {
*name_to_modify = library.PrivateName(*name_to_modify);
+ if (obfuscate && I->obfuscate()) {
+ const String& library_key = String::Handle(library.private_key());
+ Obfuscator obfuscator(thread_, library_key);
+ *name_to_modify = obfuscator.Rename(*name_to_modify);
+ }
} else if (symbolize) {
*name_to_modify = Symbols::New(thread_, *name_to_modify);
+ if (obfuscate && I->obfuscate()) {
+ const String& library_key = String::Handle();
+ Obfuscator obfuscator(thread_, library_key);
+ *name_to_modify = obfuscator.Rename(*name_to_modify);
+ }
}
return *name_to_modify;
}
+
FlowGraphBuilder::FlowGraphBuilder(
intptr_t kernel_offset,
ParsedFunction* parsed_function,
@@ -1692,9 +1740,14 @@
const Class& klass =
Class::ZoneHandle(Z, Library::LookupCoreClass(Symbols::TypeError()));
ASSERT(!klass.IsNull());
+ GrowableHandlePtrArray<const String> pieces(Z, 3);
+ pieces.Add(Symbols::TypeError());
+ pieces.Add(Symbols::Dot());
+ pieces.Add(H.DartSymbolObfuscate("_create"));
+
const Function& constructor = Function::ZoneHandle(
- Z,
- klass.LookupConstructorAllowPrivate(H.DartSymbol("_TypeError._create")));
+ Z, klass.LookupConstructorAllowPrivate(
+ String::ZoneHandle(Z, Symbols::FromConcatAll(thread_, pieces))));
ASSERT(!constructor.IsNull());
const String& url = H.DartString(
@@ -1720,7 +1773,7 @@
instructions += IntConstant(0);
instructions += PushArgument(); // column
- instructions += Constant(H.DartSymbol("Malformed type."));
+ instructions += Constant(H.DartSymbolPlain("Malformed type."));
instructions += PushArgument(); // message
instructions += StaticCall(TokenPosition::kNoSource, constructor,
@@ -2162,9 +2215,8 @@
const Class& klass =
Class::ZoneHandle(Z, Library::LookupCoreClass(Symbols::AssertionError()));
ASSERT(!klass.IsNull());
- const Function& target =
- Function::ZoneHandle(Z, klass.LookupStaticFunctionAllowPrivate(
- H.DartSymbol("_evaluateAssertion")));
+ const Function& target = Function::ZoneHandle(
+ Z, klass.LookupStaticFunctionAllowPrivate(Symbols::EvaluateAssertion()));
ASSERT(!target.IsNull());
return StaticCall(TokenPosition::kNoSource, target, /* argument_count = */ 1,
ICData::kStatic);
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.h b/runtime/vm/compiler/frontend/kernel_to_il.h
index 79254c6..cd5ffd4 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.h
+++ b/runtime/vm/compiler/frontend/kernel_to_il.h
@@ -221,6 +221,10 @@
return klass->NumTypeArguments();
}
+ const char* ToCString() {
+ return member != NULL ? member->ToCString() : klass->ToCString();
+ }
+
// The current enclosing class (or the library top-level class).
const Class* klass;
@@ -375,9 +379,10 @@
intptr_t len,
Heap::Space space);
- const String& DartSymbol(const char* content) const;
- String& DartSymbol(StringIndex string_index) const;
- String& DartSymbol(const uint8_t* utf8_array, intptr_t len) const;
+ const String& DartSymbolPlain(const char* content) const;
+ String& DartSymbolPlain(StringIndex string_index) const;
+ const String& DartSymbolObfuscate(const char* content) const;
+ String& DartSymbolObfuscate(StringIndex string_index) const;
const String& DartClassName(NameIndex kernel_class);
@@ -434,10 +439,12 @@
// to get the import URI of the library where the name is visible.
String& ManglePrivateName(NameIndex parent,
String* name_to_modify,
- bool symbolize = true);
+ bool symbolize = true,
+ bool obfuscate = true);
String& ManglePrivateName(const Library& library,
String* name_to_modify,
- bool symbolize = true);
+ bool symbolize = true,
+ bool obfuscate = true);
Thread* thread_;
Zone* zone_;
diff --git a/runtime/vm/compiler/intrinsifier_arm.cc b/runtime/vm/compiler/intrinsifier_arm.cc
index 589f84d..1fa171f 100644
--- a/runtime/vm/compiler/intrinsifier_arm.cc
+++ b/runtime/vm/compiler/intrinsifier_arm.cc
@@ -750,7 +750,7 @@
// R6 = &r_digits[1]
__ add(R6, R2,
Operand(TypedData::data_offset() - kHeapObjectTag +
- Bigint::kBytesPerDigit));
+ kBytesPerBigIntDigit));
// R6 = &r_digits[x_used + n ~/ _DIGIT_BITS + 1]
__ add(R4, R4, Operand(R0, ASR, 1));
__ add(R6, R6, Operand(R4, LSL, 2));
@@ -761,13 +761,13 @@
__ mov(R9, Operand(0));
Label loop;
__ Bind(&loop);
- __ ldr(R4, Address(NOTFP, -Bigint::kBytesPerDigit, Address::PreIndex));
+ __ ldr(R4, Address(NOTFP, -kBytesPerBigIntDigit, Address::PreIndex));
__ orr(R9, R9, Operand(R4, LSR, R0));
- __ str(R9, Address(R6, -Bigint::kBytesPerDigit, Address::PreIndex));
+ __ str(R9, Address(R6, -kBytesPerBigIntDigit, Address::PreIndex));
__ mov(R9, Operand(R4, LSL, R1));
__ teq(NOTFP, Operand(R8));
__ b(&loop, NE);
- __ str(R9, Address(R6, -Bigint::kBytesPerDigit, Address::PreIndex));
+ __ str(R9, Address(R6, -kBytesPerBigIntDigit, Address::PreIndex));
// Returning Object::null() is not required, since this method is private.
__ Ret();
}
@@ -797,15 +797,15 @@
// R0 = 32 - R1
__ rsb(R0, R1, Operand(32));
// R9 = x_digits[n ~/ _DIGIT_BITS] >> (n % _DIGIT_BITS)
- __ ldr(R9, Address(NOTFP, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R9, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
__ mov(R9, Operand(R9, LSR, R1));
Label loop_entry;
__ b(&loop_entry);
Label loop;
__ Bind(&loop);
- __ ldr(R4, Address(NOTFP, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R4, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
__ orr(R9, R9, Operand(R4, LSL, R0));
- __ str(R9, Address(R6, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R9, Address(R6, kBytesPerBigIntDigit, Address::PostIndex));
__ mov(R9, Operand(R4, LSR, R1));
__ Bind(&loop_entry);
__ teq(R6, Operand(R8));
@@ -845,11 +845,11 @@
Label add_loop;
__ Bind(&add_loop);
// Loop a_used times, a_used > 0.
- __ ldr(R4, Address(R1, Bigint::kBytesPerDigit, Address::PostIndex));
- __ ldr(R9, Address(R3, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R4, Address(R1, kBytesPerBigIntDigit, Address::PostIndex));
+ __ ldr(R9, Address(R3, kBytesPerBigIntDigit, Address::PostIndex));
__ adcs(R4, R4, Operand(R9));
__ teq(R1, Operand(NOTFP)); // Does not affect carry flag.
- __ str(R4, Address(R8, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R4, Address(R8, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&add_loop, NE);
Label last_carry;
@@ -859,10 +859,10 @@
Label carry_loop;
__ Bind(&carry_loop);
// Loop used - a_used times, used - a_used > 0.
- __ ldr(R4, Address(R1, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R4, Address(R1, kBytesPerBigIntDigit, Address::PostIndex));
__ adcs(R4, R4, Operand(0));
__ teq(R1, Operand(R6)); // Does not affect carry flag.
- __ str(R4, Address(R8, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R4, Address(R8, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&carry_loop, NE);
__ Bind(&last_carry);
@@ -904,11 +904,11 @@
Label sub_loop;
__ Bind(&sub_loop);
// Loop a_used times, a_used > 0.
- __ ldr(R4, Address(R1, Bigint::kBytesPerDigit, Address::PostIndex));
- __ ldr(R9, Address(R3, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R4, Address(R1, kBytesPerBigIntDigit, Address::PostIndex));
+ __ ldr(R9, Address(R3, kBytesPerBigIntDigit, Address::PostIndex));
__ sbcs(R4, R4, Operand(R9));
__ teq(R1, Operand(NOTFP)); // Does not affect carry flag.
- __ str(R4, Address(R8, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R4, Address(R8, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&sub_loop, NE);
Label done;
@@ -918,10 +918,10 @@
Label carry_loop;
__ Bind(&carry_loop);
// Loop used - a_used times, used - a_used > 0.
- __ ldr(R4, Address(R1, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R4, Address(R1, kBytesPerBigIntDigit, Address::PostIndex));
__ sbcs(R4, R4, Operand(0));
__ teq(R1, Operand(R6)); // Does not affect carry flag.
- __ str(R4, Address(R8, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R4, Address(R8, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&carry_loop, NE);
__ Bind(&done);
@@ -992,7 +992,7 @@
// n: R8
// uint32_t mi = *mip++
- __ ldr(R2, Address(R4, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R2, Address(R4, kBytesPerBigIntDigit, Address::PostIndex));
// uint32_t aj = *ajp
__ ldr(R0, Address(R9, 0));
@@ -1001,7 +1001,7 @@
__ umaal(R0, R1, R2, R3); // R1:R0 = R2*R3 + R1 + R0.
// *ajp++ = low32(t) = R0
- __ str(R0, Address(R9, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R9, kBytesPerBigIntDigit, Address::PostIndex));
// c = high32(t) = R1
@@ -1015,14 +1015,14 @@
// *ajp++ += c
__ ldr(R0, Address(R9, 0));
__ adds(R0, R0, Operand(R1));
- __ str(R0, Address(R9, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R9, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&done, CC);
Label propagate_carry_loop;
__ Bind(&propagate_carry_loop);
__ ldr(R0, Address(R9, 0));
__ adds(R0, R0, Operand(1));
- __ str(R0, Address(R9, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R9, kBytesPerBigIntDigit, Address::PostIndex));
__ b(&propagate_carry_loop, CS);
__ Bind(&done);
@@ -1064,7 +1064,7 @@
// R3 = x = *xip++, return if x == 0
Label x_zero;
- __ ldr(R3, Address(R4, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R3, Address(R4, kBytesPerBigIntDigit, Address::PostIndex));
__ tst(R3, Operand(R3));
__ b(&x_zero, EQ);
@@ -1079,7 +1079,7 @@
__ umaal(R0, R8, R3, R3); // R8:R0 = R3*R3 + R8 + R0.
// *ajp++ = low32(t) = R0
- __ str(R0, Address(NOTFP, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
// R8 = low32(c) = high32(t)
// R9 = high32(c) = 0
@@ -1103,7 +1103,7 @@
// n: R6
// uint32_t xi = *xip++
- __ ldr(R2, Address(R4, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R2, Address(R4, kBytesPerBigIntDigit, Address::PostIndex));
// uint96_t t = R9:R8:R0 = 2*x*xi + aj + c
__ umull(R0, R1, R2, R3); // R1:R0 = R2*R3.
@@ -1120,7 +1120,7 @@
__ adc(R9, R2, Operand(0)); // R9:R8:R0 = 2*x*xi + c + aj.
// *ajp++ = low32(t) = R0
- __ str(R0, Address(NOTFP, Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(NOTFP, kBytesPerBigIntDigit, Address::PostIndex));
// while (--n >= 0)
__ subs(R6, R6, Operand(1)); // --n
@@ -1161,8 +1161,8 @@
__ ldr(R4, Address(SP, 2 * kWordSize)); // args
// R3 = rho = args[2]
- __ ldr(R3, FieldAddress(
- R4, TypedData::data_offset() + 2 * Bigint::kBytesPerDigit));
+ __ ldr(R3,
+ FieldAddress(R4, TypedData::data_offset() + 2 * kBytesPerBigIntDigit));
// R2 = digits[i >> 1]
__ ldrd(R0, R1, SP, 0 * kWordSize); // R0 = i as Smi, R1 = digits
@@ -1173,8 +1173,8 @@
__ umull(R0, R1, R2, R3);
// args[4] = t mod DIGIT_BASE = low32(t)
- __ str(R0, FieldAddress(
- R4, TypedData::data_offset() + 4 * Bigint::kBytesPerDigit));
+ __ str(R0,
+ FieldAddress(R4, TypedData::data_offset() + 4 * kBytesPerBigIntDigit));
__ mov(R0, Operand(Smi::RawValue(1))); // One digit processed.
__ Ret();
diff --git a/runtime/vm/compiler/intrinsifier_arm64.cc b/runtime/vm/compiler/intrinsifier_arm64.cc
index c8aaf0a..4da90f0 100644
--- a/runtime/vm/compiler/intrinsifier_arm64.cc
+++ b/runtime/vm/compiler/intrinsifier_arm64.cc
@@ -649,7 +649,7 @@
// R8 = &r_digits[2*1]
__ add(R8, R4,
Operand(TypedData::data_offset() - kHeapObjectTag +
- 2 * Bigint::kBytesPerDigit));
+ 2 * kBytesPerBigIntDigit));
// R8 = &r_digits[2*(R2 + n ~/ (2*_DIGIT_BITS) + 1)]
__ add(R0, R0, Operand(R2));
__ add(R8, R8, Operand(R0, LSL, 3));
@@ -661,14 +661,14 @@
__ mov(R1, ZR);
Label loop;
__ Bind(&loop);
- __ ldr(R0, Address(R7, -2 * Bigint::kBytesPerDigit, Address::PreIndex));
+ __ ldr(R0, Address(R7, -2 * kBytesPerBigIntDigit, Address::PreIndex));
__ lsrv(R4, R0, R2);
__ orr(R1, R1, Operand(R4));
- __ str(R1, Address(R8, -2 * Bigint::kBytesPerDigit, Address::PreIndex));
+ __ str(R1, Address(R8, -2 * kBytesPerBigIntDigit, Address::PreIndex));
__ lslv(R1, R0, R3);
__ cmp(R7, Operand(R6));
__ b(&loop, NE);
- __ str(R1, Address(R8, -2 * Bigint::kBytesPerDigit, Address::PreIndex));
+ __ str(R1, Address(R8, -2 * kBytesPerBigIntDigit, Address::PreIndex));
// Returning Object::null() is not required, since this method is private.
__ ret();
}
@@ -701,16 +701,16 @@
__ LoadImmediate(R2, 64);
__ sub(R2, R2, Operand(R3));
// R1 = x_digits[n ~/ (2*_DIGIT_BITS)] >> (n % (2*_DIGIT_BITS))
- __ ldr(R1, Address(R7, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R1, Address(R7, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ lsrv(R1, R1, R3);
Label loop_entry;
__ b(&loop_entry);
Label loop;
__ Bind(&loop);
- __ ldr(R0, Address(R7, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R0, Address(R7, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ lslv(R4, R0, R2);
__ orr(R1, R1, Operand(R4));
- __ str(R1, Address(R8, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R1, Address(R8, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ lsrv(R1, R0, R3);
__ Bind(&loop_entry);
__ cmp(R8, Operand(R6));
@@ -754,11 +754,11 @@
Label add_loop;
__ Bind(&add_loop);
// Loop (a_used+1)/2 times, a_used > 0.
- __ ldr(R0, Address(R3, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
- __ ldr(R1, Address(R5, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R0, Address(R3, 2 * kBytesPerBigIntDigit, Address::PostIndex));
+ __ ldr(R1, Address(R5, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ adcs(R0, R0, R1);
__ sub(R9, R3, Operand(R7)); // Does not affect carry flag.
- __ str(R0, Address(R6, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R6, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ cbnz(&add_loop, R9); // Does not affect carry flag.
Label last_carry;
@@ -768,10 +768,10 @@
Label carry_loop;
__ Bind(&carry_loop);
// Loop (used+1)/2 - (a_used+1)/2 times, used - a_used > 0.
- __ ldr(R0, Address(R3, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R0, Address(R3, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ adcs(R0, R0, ZR);
__ sub(R9, R3, Operand(R8)); // Does not affect carry flag.
- __ str(R0, Address(R6, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R6, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ cbnz(&carry_loop, R9);
__ Bind(&last_carry);
@@ -819,11 +819,11 @@
Label sub_loop;
__ Bind(&sub_loop);
// Loop (a_used+1)/2 times, a_used > 0.
- __ ldr(R0, Address(R3, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
- __ ldr(R1, Address(R5, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R0, Address(R3, 2 * kBytesPerBigIntDigit, Address::PostIndex));
+ __ ldr(R1, Address(R5, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ sbcs(R0, R0, R1);
__ sub(R9, R3, Operand(R7)); // Does not affect carry flag.
- __ str(R0, Address(R6, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R6, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ cbnz(&sub_loop, R9); // Does not affect carry flag.
Label done;
@@ -833,10 +833,10 @@
Label carry_loop;
__ Bind(&carry_loop);
// Loop (used+1)/2 - (a_used+1)/2 times, used - a_used > 0.
- __ ldr(R0, Address(R3, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R0, Address(R3, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ sbcs(R0, R0, ZR);
__ sub(R9, R3, Operand(R8)); // Does not affect carry flag.
- __ str(R0, Address(R6, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R6, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ cbnz(&carry_loop, R9);
__ Bind(&done);
@@ -913,7 +913,7 @@
// t: R7:R8 (not live at loop entry)
// uint64_t mi = *mip++
- __ ldr(R2, Address(R4, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R2, Address(R4, 2 * kBytesPerBigIntDigit, Address::PostIndex));
// uint64_t aj = *ajp
__ ldr(R0, Address(R5, 0));
@@ -927,7 +927,7 @@
__ adc(R1, R8, ZR); // c = R1 = high64(t).
// *ajp++ = low64(t) = R0
- __ str(R0, Address(R5, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R5, 2 * kBytesPerBigIntDigit, Address::PostIndex));
// while (--n > 0)
__ subs(R6, R6, Operand(1)); // --n
@@ -939,14 +939,14 @@
// *ajp++ += c
__ ldr(R0, Address(R5, 0));
__ adds(R0, R0, Operand(R1));
- __ str(R0, Address(R5, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R5, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ b(&done, CC);
Label propagate_carry_loop;
__ Bind(&propagate_carry_loop);
__ ldr(R0, Address(R5, 0));
__ adds(R0, R0, Operand(1));
- __ str(R0, Address(R5, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R5, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ b(&propagate_carry_loop, CS);
__ Bind(&done);
@@ -989,7 +989,7 @@
// R3 = x = *xip++, return if x == 0
Label x_zero;
- __ ldr(R3, Address(R4, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R3, Address(R4, 2 * kBytesPerBigIntDigit, Address::PostIndex));
__ tst(R3, Operand(R3));
__ b(&x_zero, EQ);
@@ -1007,7 +1007,7 @@
__ mov(R7, ZR); // R7 = high64(c) = 0.
// *ajp++ = low64(t) = R1
- __ str(R1, Address(R5, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R1, Address(R5, 2 * kBytesPerBigIntDigit, Address::PostIndex));
// int n = (used - i + 1)/2 - 1
__ ldr(R0, Address(SP, 0 * kWordSize)); // used is Smi
@@ -1028,7 +1028,7 @@
// n: R8
// uint64_t xi = *xip++
- __ ldr(R2, Address(R4, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ ldr(R2, Address(R4, 2 * kBytesPerBigIntDigit, Address::PostIndex));
// uint192_t t = R2:R1:R0 = 2*x*xi + aj + c
__ mul(R0, R2, R3); // R0 = low64(R2*R3) = low64(x*xi).
@@ -1045,7 +1045,7 @@
__ adc(R7, R2, ZR); // R7:R6:R0 = 2*x*xi + aj + c.
// *ajp++ = low64(t) = R0
- __ str(R0, Address(R5, 2 * Bigint::kBytesPerDigit, Address::PostIndex));
+ __ str(R0, Address(R5, 2 * kBytesPerBigIntDigit, Address::PostIndex));
// while (--n >= 0)
__ subs(R8, R8, Operand(1)); // --n
@@ -1123,8 +1123,7 @@
// R0 = i as Smi, R1 = digits
__ ldp(R0, R1, Address(SP, 0 * kWordSize, Address::PairOffset));
__ add(R1, R1, Operand(R0, LSL, 1));
- __ ldr(R2,
- FieldAddress(R1, TypedData::data_offset() - Bigint::kBytesPerDigit));
+ __ ldr(R2, FieldAddress(R1, TypedData::data_offset() - kBytesPerBigIntDigit));
// R0 = qd = (DIGIT_MASK << 32) | DIGIT_MASK = -1
__ movn(R0, Immediate(0), 0);
@@ -1135,8 +1134,8 @@
__ b(&return_qd, EQ);
// R1 = dl = digits[(i >> 1) - 3 .. (i >> 1) - 2]
- __ ldr(R1, FieldAddress(
- R1, TypedData::data_offset() - 3 * Bigint::kBytesPerDigit));
+ __ ldr(R1,
+ FieldAddress(R1, TypedData::data_offset() - 3 * kBytesPerBigIntDigit));
// R5 = yth = yt >> 32
__ orr(R5, ZR, Operand(R3, LSR, 32));
@@ -1234,8 +1233,8 @@
__ Bind(&return_qd);
// args[2..3] = qd
- __ str(R0, FieldAddress(
- R4, TypedData::data_offset() + 2 * Bigint::kBytesPerDigit));
+ __ str(R0,
+ FieldAddress(R4, TypedData::data_offset() + 2 * kBytesPerBigIntDigit));
__ LoadImmediate(R0, Smi::RawValue(2)); // Two digits processed.
__ ret();
@@ -1255,8 +1254,8 @@
__ ldr(R4, Address(SP, 2 * kWordSize)); // args
// R3 = rho = args[2..3]
- __ ldr(R3, FieldAddress(
- R4, TypedData::data_offset() + 2 * Bigint::kBytesPerDigit));
+ __ ldr(R3,
+ FieldAddress(R4, TypedData::data_offset() + 2 * kBytesPerBigIntDigit));
// R2 = digits[i >> 1 .. (i >> 1) + 1]
// R0 = i as Smi, R1 = digits
@@ -1268,8 +1267,8 @@
__ mul(R0, R2, R3); // R0 = low64(R2*R3).
// args[4 .. 5] = R0
- __ str(R0, FieldAddress(
- R4, TypedData::data_offset() + 4 * Bigint::kBytesPerDigit));
+ __ str(R0,
+ FieldAddress(R4, TypedData::data_offset() + 4 * kBytesPerBigIntDigit));
__ LoadImmediate(R0, Smi::RawValue(2)); // Two digits processed.
__ ret();
diff --git a/runtime/vm/compiler/intrinsifier_ia32.cc b/runtime/vm/compiler/intrinsifier_ia32.cc
index fe8b123..7727717 100644
--- a/runtime/vm/compiler/intrinsifier_ia32.cc
+++ b/runtime/vm/compiler/intrinsifier_ia32.cc
@@ -755,7 +755,7 @@
__ xorl(EAX, EAX); // EAX = 0.
__ movl(EDX, FieldAddress(EDI, ESI, TIMES_4, TypedData::data_offset()));
__ shldl(EAX, EDX, ECX);
- __ movl(Address(EBX, ESI, TIMES_4, Bigint::kBytesPerDigit), EAX);
+ __ movl(Address(EBX, ESI, TIMES_4, kBytesPerBigIntDigit), EAX);
Label last;
__ cmpl(ESI, Immediate(0));
__ j(EQUAL, &last, Assembler::kNearJump);
@@ -763,7 +763,7 @@
__ Bind(&loop);
__ movl(EAX, EDX);
__ movl(EDX, FieldAddress(EDI, ESI, TIMES_4,
- TypedData::data_offset() - Bigint::kBytesPerDigit));
+ TypedData::data_offset() - kBytesPerBigIntDigit));
__ shldl(EAX, EDX, ECX);
__ movl(Address(EBX, ESI, TIMES_4, 0), EAX);
__ decl(ESI);
@@ -808,7 +808,7 @@
Label loop;
__ Bind(&loop);
__ movl(EAX, EDX);
- __ movl(EDX, Address(EDI, ESI, TIMES_4, Bigint::kBytesPerDigit));
+ __ movl(EDX, Address(EDI, ESI, TIMES_4, kBytesPerBigIntDigit));
__ shrdl(EAX, EDX, ECX);
__ movl(Address(EBX, ESI, TIMES_4, 0), EAX);
__ incl(ESI);
@@ -1010,7 +1010,7 @@
// uint32_t mi = *mip++
__ movl(EAX, Address(EDI, 0));
- __ addl(EDI, Immediate(Bigint::kBytesPerDigit));
+ __ addl(EDI, Immediate(kBytesPerBigIntDigit));
// uint64_t t = x*mi
__ mull(EBX); // t = EDX:EAX = EAX * EBX
@@ -1023,7 +1023,7 @@
// *ajp++ = low32(t)
__ movl(Address(ESI, 0), EAX);
- __ addl(ESI, Immediate(Bigint::kBytesPerDigit));
+ __ addl(ESI, Immediate(kBytesPerBigIntDigit));
// c = high32(t)
__ movl(ECX, EDX);
@@ -1042,7 +1042,7 @@
Label propagate_carry_loop;
__ Bind(&propagate_carry_loop);
- __ addl(ESI, Immediate(Bigint::kBytesPerDigit));
+ __ addl(ESI, Immediate(kBytesPerBigIntDigit));
__ incl(Address(ESI, 0)); // c == 0 or 1
__ j(CARRY, &propagate_carry_loop, Assembler::kNearJump);
@@ -1093,7 +1093,7 @@
__ movl(EBX, Address(EDI, 0));
__ cmpl(EBX, Immediate(0));
__ j(EQUAL, &x_zero, Assembler::kNearJump);
- __ addl(EDI, Immediate(Bigint::kBytesPerDigit));
+ __ addl(EDI, Immediate(kBytesPerBigIntDigit));
// Preserve THR to free ESI.
__ pushl(THR);
@@ -1111,7 +1111,7 @@
// *ajp++ = low32(t)
__ movl(Address(ESI, 0), EAX);
- __ addl(ESI, Immediate(Bigint::kBytesPerDigit));
+ __ addl(ESI, Immediate(kBytesPerBigIntDigit));
// int n = used - i - 1
__ movl(EAX, Address(ESP, 2 * kWordSize)); // used is Smi
@@ -1143,7 +1143,7 @@
// uint32_t xi = *xip++
__ movl(EAX, Address(EDI, 0));
- __ addl(EDI, Immediate(Bigint::kBytesPerDigit));
+ __ addl(EDI, Immediate(kBytesPerBigIntDigit));
// uint96_t t = ECX:EDX:EAX = 2*x*xi + aj + c
__ mull(EBX); // EDX:EAX = EAX * EBX
@@ -1160,7 +1160,7 @@
// *ajp++ = low32(t)
__ movl(Address(ESI, 0), EAX);
- __ addl(ESI, Immediate(Bigint::kBytesPerDigit));
+ __ addl(ESI, Immediate(kBytesPerBigIntDigit));
// c = high64(t)
__ movl(cl_addr, EDX);
@@ -1178,7 +1178,7 @@
// *ajp++ = low32(t)
// *ajp = high32(t)
__ movl(Address(ESI, 0), EAX);
- __ movl(Address(ESI, Bigint::kBytesPerDigit), EDX);
+ __ movl(Address(ESI, kBytesPerBigIntDigit), EDX);
// Restore THR and return.
__ Drop(3);
@@ -1210,7 +1210,7 @@
// ECX = yt = args[1]
__ movl(ECX,
- FieldAddress(EDI, TypedData::data_offset() + Bigint::kBytesPerDigit));
+ FieldAddress(EDI, TypedData::data_offset() + kBytesPerBigIntDigit));
// EBX = dp = &digits[i >> 1]
__ movl(EBX, Address(ESP, 2 * kWordSize)); // digits
@@ -1229,7 +1229,7 @@
__ j(EQUAL, &return_qd, Assembler::kNearJump);
// EAX = dl = dp[-1]
- __ movl(EAX, Address(EBX, -Bigint::kBytesPerDigit));
+ __ movl(EAX, Address(EBX, -kBytesPerBigIntDigit));
// EAX = qd = dh:dl / yt = EDX:EAX / ECX
__ divl(ECX);
@@ -1237,7 +1237,7 @@
__ Bind(&return_qd);
// args[2] = qd
__ movl(
- FieldAddress(EDI, TypedData::data_offset() + 2 * Bigint::kBytesPerDigit),
+ FieldAddress(EDI, TypedData::data_offset() + 2 * kBytesPerBigIntDigit),
EAX);
__ movl(EAX, Immediate(Smi::RawValue(1))); // One digit processed.
@@ -1259,7 +1259,7 @@
// ECX = rho = args[2]
__ movl(ECX, FieldAddress(
- EDI, TypedData::data_offset() + 2 * Bigint::kBytesPerDigit));
+ EDI, TypedData::data_offset() + 2 * kBytesPerBigIntDigit));
// EAX = digits[i >> 1]
__ movl(EBX, Address(ESP, 2 * kWordSize)); // digits
@@ -1271,7 +1271,7 @@
// args[4] = t mod DIGIT_BASE = low32(t)
__ movl(
- FieldAddress(EDI, TypedData::data_offset() + 4 * Bigint::kBytesPerDigit),
+ FieldAddress(EDI, TypedData::data_offset() + 4 * kBytesPerBigIntDigit),
EAX);
__ movl(EAX, Immediate(Smi::RawValue(1))); // One digit processed.
diff --git a/runtime/vm/compiler/intrinsifier_x64.cc b/runtime/vm/compiler/intrinsifier_x64.cc
index 636b71c..1e2574c 100644
--- a/runtime/vm/compiler/intrinsifier_x64.cc
+++ b/runtime/vm/compiler/intrinsifier_x64.cc
@@ -717,7 +717,7 @@
__ xorq(RAX, RAX); // RAX = 0.
__ movq(RDX, FieldAddress(RDI, R8, TIMES_8, TypedData::data_offset()));
__ shldq(RAX, RDX, RCX);
- __ movq(Address(RBX, R8, TIMES_8, 2 * Bigint::kBytesPerDigit), RAX);
+ __ movq(Address(RBX, R8, TIMES_8, 2 * kBytesPerBigIntDigit), RAX);
Label last;
__ cmpq(R8, Immediate(0));
__ j(EQUAL, &last, Assembler::kNearJump);
@@ -726,7 +726,7 @@
__ movq(RAX, RDX);
__ movq(RDX,
FieldAddress(RDI, R8, TIMES_8,
- TypedData::data_offset() - 2 * Bigint::kBytesPerDigit));
+ TypedData::data_offset() - 2 * kBytesPerBigIntDigit));
__ shldq(RAX, RDX, RCX);
__ movq(Address(RBX, R8, TIMES_8, 0), RAX);
__ decq(R8);
@@ -762,7 +762,7 @@
Label loop;
__ Bind(&loop);
__ movq(RAX, RDX);
- __ movq(RDX, Address(RDI, RSI, TIMES_8, 2 * Bigint::kBytesPerDigit));
+ __ movq(RDX, Address(RDI, RSI, TIMES_8, 2 * kBytesPerBigIntDigit));
__ shrdq(RAX, RDX, RCX);
__ movq(Address(RBX, RSI, TIMES_8, 0), RAX);
__ incq(RSI);
@@ -945,7 +945,7 @@
// uint64_t mi = *mip++
__ movq(RAX, Address(RDI, 0));
- __ addq(RDI, Immediate(2 * Bigint::kBytesPerDigit));
+ __ addq(RDI, Immediate(2 * kBytesPerBigIntDigit));
// uint128_t t = x*mi
__ mulq(RBX); // t = RDX:RAX = RAX * RBX, 64-bit * 64-bit -> 64-bit
@@ -958,7 +958,7 @@
// *ajp++ = low64(t)
__ movq(Address(RSI, 0), RAX);
- __ addq(RSI, Immediate(2 * Bigint::kBytesPerDigit));
+ __ addq(RSI, Immediate(2 * kBytesPerBigIntDigit));
// c = high64(t)
__ movq(RCX, RDX);
@@ -976,7 +976,7 @@
Label propagate_carry_loop;
__ Bind(&propagate_carry_loop);
- __ addq(RSI, Immediate(2 * Bigint::kBytesPerDigit));
+ __ addq(RSI, Immediate(2 * kBytesPerBigIntDigit));
__ incq(Address(RSI, 0)); // c == 0 or 1
__ j(CARRY, &propagate_carry_loop, Assembler::kNearJump);
@@ -1022,7 +1022,7 @@
__ movq(RBX, Address(RDI, 0));
__ cmpq(RBX, Immediate(0));
__ j(EQUAL, &x_zero);
- __ addq(RDI, Immediate(2 * Bigint::kBytesPerDigit));
+ __ addq(RDI, Immediate(2 * kBytesPerBigIntDigit));
// RSI = ajp = &a_digits[i]
__ movq(RSI, Address(RSP, 2 * kWordSize)); // a_digits
@@ -1036,7 +1036,7 @@
// *ajp++ = low64(t)
__ movq(Address(RSI, 0), RAX);
- __ addq(RSI, Immediate(2 * Bigint::kBytesPerDigit));
+ __ addq(RSI, Immediate(2 * kBytesPerBigIntDigit));
// int n = (used - i + 1)/2 - 1
__ movq(R8, Address(RSP, 1 * kWordSize)); // used is Smi
@@ -1064,7 +1064,7 @@
// uint64_t xi = *xip++
__ movq(RAX, Address(RDI, 0));
- __ addq(RDI, Immediate(2 * Bigint::kBytesPerDigit));
+ __ addq(RDI, Immediate(2 * kBytesPerBigIntDigit));
// uint192_t t = RCX:RDX:RAX = 2*x*xi + aj + c
__ mulq(RBX); // RDX:RAX = RAX * RBX
@@ -1081,7 +1081,7 @@
// *ajp++ = low64(t)
__ movq(Address(RSI, 0), RAX);
- __ addq(RSI, Immediate(2 * Bigint::kBytesPerDigit));
+ __ addq(RSI, Immediate(2 * kBytesPerBigIntDigit));
// c = high128(t)
__ movq(R12, RDX);
@@ -1097,7 +1097,7 @@
// *ajp++ = low64(t)
// *ajp = high64(t)
__ movq(Address(RSI, 0), R12);
- __ movq(Address(RSI, 2 * Bigint::kBytesPerDigit), R13);
+ __ movq(Address(RSI, 2 * kBytesPerBigIntDigit), R13);
__ Bind(&x_zero);
__ movq(RAX, Immediate(Smi::RawValue(2))); // Two digits processed.
@@ -1131,7 +1131,7 @@
__ movq(RBX, Address(RSP, 2 * kWordSize)); // digits
__ movq(RAX, Address(RSP, 1 * kWordSize)); // i is Smi and odd.
__ leaq(RBX, FieldAddress(RBX, RAX, TIMES_2,
- TypedData::data_offset() - Bigint::kBytesPerDigit));
+ TypedData::data_offset() - kBytesPerBigIntDigit));
// RDX = dh = dp[0]
__ movq(RDX, Address(RBX, 0));
@@ -1145,7 +1145,7 @@
__ j(EQUAL, &return_qd, Assembler::kNearJump);
// RAX = dl = dp[-1]
- __ movq(RAX, Address(RBX, -2 * Bigint::kBytesPerDigit));
+ __ movq(RAX, Address(RBX, -2 * kBytesPerBigIntDigit));
// RAX = qd = dh:dl / yt = RDX:RAX / RCX
__ divq(RCX);
@@ -1153,7 +1153,7 @@
__ Bind(&return_qd);
// args[2..3] = qd
__ movq(
- FieldAddress(RDI, TypedData::data_offset() + 2 * Bigint::kBytesPerDigit),
+ FieldAddress(RDI, TypedData::data_offset() + 2 * kBytesPerBigIntDigit),
RAX);
__ movq(RAX, Immediate(Smi::RawValue(2))); // Two digits processed.
@@ -1175,7 +1175,7 @@
// RCX = rho = args[2 .. 3]
__ movq(RCX, FieldAddress(
- RDI, TypedData::data_offset() + 2 * Bigint::kBytesPerDigit));
+ RDI, TypedData::data_offset() + 2 * kBytesPerBigIntDigit));
// RAX = digits[i >> 1 .. (i >> 1) + 1]
__ movq(RBX, Address(RSP, 2 * kWordSize)); // digits
@@ -1187,7 +1187,7 @@
// args[4 .. 5] = t mod DIGIT_BASE^2 = low64(t)
__ movq(
- FieldAddress(RDI, TypedData::data_offset() + 4 * Bigint::kBytesPerDigit),
+ FieldAddress(RDI, TypedData::data_offset() + 4 * kBytesPerBigIntDigit),
RAX);
__ movq(RAX, Immediate(Smi::RawValue(2))); // Two digits processed.
diff --git a/runtime/vm/compiler/jit/compiler.cc b/runtime/vm/compiler/jit/compiler.cc
index 0e61225..c77b602 100644
--- a/runtime/vm/compiler/jit/compiler.cc
+++ b/runtime/vm/compiler/jit/compiler.cc
@@ -1712,8 +1712,6 @@
return Error::Cast(result).raw();
}
ASSERT(!result.IsNull());
- func.ClearICDataArray();
- func.ClearCode();
}
}
return Error::null();
diff --git a/runtime/vm/constants_dbc.h b/runtime/vm/constants_dbc.h
index 97ee072..b86780e 100644
--- a/runtime/vm/constants_dbc.h
+++ b/runtime/vm/constants_dbc.h
@@ -165,9 +165,10 @@
// with arguments SP[-(1+ArgC)], ..., SP[-1].
// The ICData indicates whether the first argument is a type argument vector.
//
-// - NativeBootstrapCall, NativeNoScopeCall, NativeAutoScopeCall
+// - NativeCall ArgA, ArgB, ArgC
//
-// Invoke native function SP[-1] with argc_tag SP[0].
+// Invoke native function at pool[ArgB] with argc_tag at pool[ArgC] using
+// wrapper at pool[ArgA].
//
// - PushPolymorphicInstanceCall ArgC, D
//
@@ -767,9 +768,7 @@
V(InstanceCall2Opt, A_D, num, num, ___) \
V(PushPolymorphicInstanceCall, A_D, num, num, ___) \
V(PushPolymorphicInstanceCallByRange, A_D, num, num, ___) \
- V(NativeBootstrapCall, 0, ___, ___, ___) \
- V(NativeNoScopeCall, 0, ___, ___, ___) \
- V(NativeAutoScopeCall, 0, ___, ___, ___) \
+ V(NativeCall, A_B_C, num, num, num) \
V(OneByteStringFromCharCode, A_X, reg, xeg, ___) \
V(StringToCharCode, A_X, reg, xeg, ___) \
V(AddTOS, 0, ___, ___, ___) \
@@ -1001,6 +1000,10 @@
return (bc >> kAShift) & kAMask;
}
+ DART_FORCE_INLINE static uint8_t DecodeB(Instr bc) {
+ return (bc >> kBShift) & kBMask;
+ }
+
DART_FORCE_INLINE static uint16_t DecodeD(Instr bc) {
return (bc >> kDShift) & kDMask;
}
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 5b607f4..faa46ac 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -48,7 +48,6 @@
#include "vm/symbols.h"
#include "vm/tags.h"
#include "vm/thread_registry.h"
-#include "vm/timeline.h"
#include "vm/timer.h"
#include "vm/unicode.h"
#include "vm/uri.h"
@@ -87,34 +86,6 @@
}
}
-#ifndef PRODUCT
-#define API_TIMELINE_DURATION \
- TimelineDurationScope tds(Thread::Current(), Timeline::GetAPIStream(), \
- CURRENT_FUNC)
-#define API_TIMELINE_DURATION_BASIC \
- API_TIMELINE_DURATION; \
- tds.SetNumArguments(1); \
- tds.CopyArgument(0, "mode", "basic");
-
-#define API_TIMELINE_BEGIN_END \
- TimelineBeginEndScope tbes(Thread::Current(), Timeline::GetAPIStream(), \
- CURRENT_FUNC)
-
-#define API_TIMELINE_BEGIN_END_BASIC \
- API_TIMELINE_BEGIN_END; \
- tbes.SetNumArguments(1); \
- tbes.CopyArgument(0, "mode", "basic");
-#else
-#define API_TIMELINE_DURATION \
- do { \
- } while (false)
-#define API_TIMELINE_DURATION_BASIC API_TIMELINE_DURATION
-#define API_TIMELINE_BEGIN_END \
- do { \
- } while (false)
-#define API_TIMELINE_BEGIN_END_BASIC API_TIMELINE_BEGIN_END
-#endif // !PRODUCT
-
#if defined(DEBUG)
// An object visitor which will iterate over all the function objects in the
// heap and check if the result type and parameter types are canonicalized
@@ -783,8 +754,8 @@
}
DART_EXPORT const char* Dart_GetError(Dart_Handle handle) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
return GetErrorString(T, obj);
}
@@ -1442,13 +1413,13 @@
DART_EXPORT void Dart_NotifyIdle(int64_t deadline) {
Thread* T = Thread::Current();
CHECK_ISOLATE(T->isolate());
- API_TIMELINE_BEGIN_END;
+ API_TIMELINE_BEGIN_END(T);
TransitionNativeToVM transition(T);
T->isolate()->NotifyIdle(deadline);
}
DART_EXPORT void Dart_NotifyLowMemory() {
- API_TIMELINE_BEGIN_END;
+ API_TIMELINE_BEGIN_END(Thread::Current());
Isolate::NotifyLowMemory();
}
@@ -1479,7 +1450,7 @@
uint8_t** isolate_snapshot_data_buffer,
intptr_t* isolate_snapshot_data_size) {
DARTSCOPE(Thread::Current());
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
if (!FLAG_load_deferred_eagerly) {
return Api::NewError(
@@ -1523,8 +1494,8 @@
DART_EXPORT Dart_Handle
Dart_CreateScriptSnapshot(uint8_t** script_snapshot_buffer,
intptr_t* script_snapshot_size) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
CHECK_NULL(script_snapshot_buffer);
CHECK_NULL(script_snapshot_size);
@@ -1600,7 +1571,7 @@
DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) {
CHECK_NO_ISOLATE(Isolate::Current());
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(Thread::Current());
if (isolate == NULL) {
FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
}
@@ -1651,7 +1622,7 @@
CHECK_API_SCOPE(T);
CHECK_CALLBACK_STATE(T);
}
- API_TIMELINE_BEGIN_END;
+ API_TIMELINE_BEGIN_END(Thread::Current());
// The message handler run loop does not expect to have a current isolate
// so we exit the isolate here and enter it again after the runloop is done.
::Dart_ExitIsolate();
@@ -1685,7 +1656,7 @@
Isolate* I = T->isolate();
CHECK_API_SCOPE(T);
CHECK_CALLBACK_STATE(T);
- API_TIMELINE_BEGIN_END_BASIC;
+ API_TIMELINE_BEGIN_END_BASIC(T);
TransitionNativeToVM transition(T);
if (I->message_handler()->HandleNextMessage() != MessageHandler::kOK) {
Dart_Handle error = Api::NewHandle(T, T->sticky_error());
@@ -1700,7 +1671,7 @@
Isolate* I = T->isolate();
CHECK_API_SCOPE(T);
CHECK_CALLBACK_STATE(T);
- API_TIMELINE_BEGIN_END_BASIC;
+ API_TIMELINE_BEGIN_END_BASIC(T);
TransitionNativeToVM transition(T);
if (I->message_handler()->HandleAllMessages() != MessageHandler::kOK) {
Dart_Handle error = Api::NewHandle(T, T->sticky_error());
@@ -1715,7 +1686,7 @@
Isolate* I = T->isolate();
CHECK_API_SCOPE(T);
CHECK_CALLBACK_STATE(T);
- API_TIMELINE_BEGIN_END_BASIC;
+ API_TIMELINE_BEGIN_END_BASIC(T);
TransitionNativeToVM transition(T);
if (I->message_notify_callback() != NULL) {
return Api::NewError("waitForEventSync is not supported by this embedder");
@@ -1769,7 +1740,7 @@
Isolate* I = T->isolate();
CHECK_API_SCOPE(T);
CHECK_CALLBACK_STATE(T);
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(T);
TransitionNativeToVM transition(T);
ASSERT(I->GetAndClearResumeRequest() == false);
MessageHandler::MessageStatus status =
@@ -1799,7 +1770,7 @@
DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) {
DARTSCOPE(Thread::Current());
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(T);
NoSafepointScope no_safepoint_scope;
if (port_id == ILLEGAL_PORT) {
return false;
@@ -1832,7 +1803,7 @@
Dart_Port* port_id) {
DARTSCOPE(Thread::Current());
CHECK_CALLBACK_STATE(T);
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(T);
const SendPort& send_port = Api::UnwrapSendPortHandle(Z, port);
if (send_port.IsNull()) {
RETURN_TYPE_ERROR(Z, port, SendPort);
@@ -2061,8 +2032,8 @@
}
DART_EXPORT bool Dart_IsFuture(Dart_Handle handle) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
if (obj.IsInstance()) {
@@ -2083,8 +2054,8 @@
// --- Instances ----
DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
const Object& obj = Object::Handle(Z, Api::UnwrapHandle(instance));
if (obj.IsNull()) {
@@ -2102,9 +2073,9 @@
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer,
bool* fits) {
- API_TIMELINE_DURATION;
// Fast path for Smis and Mints.
Thread* thread = Thread::Current();
+ API_TIMELINE_DURATION(thread);
Isolate* isolate = thread->isolate();
CHECK_ISOLATE(isolate);
intptr_t class_id = Api::ClassId(integer);
@@ -2129,7 +2100,7 @@
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
CHECK_ISOLATE(isolate);
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(thread);
if (Api::IsSmi(integer)) {
*fits = (Api::SmiValue(integer) >= 0);
return Api::Success();
@@ -2155,7 +2126,7 @@
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
CHECK_ISOLATE(isolate);
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(thread);
if (Smi::IsValid(value)) {
NOHANDLESCOPE(thread);
return Api::NewHandle(thread, Smi::New(static_cast<intptr_t>(value)));
@@ -2169,7 +2140,7 @@
DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value) {
DARTSCOPE(Thread::Current());
CHECK_CALLBACK_STATE(T);
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(T);
if (Integer::IsValueInRange(value)) {
return Api::NewHandle(T, Integer::NewFromUint64(value));
}
@@ -2180,7 +2151,7 @@
DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char* str) {
DARTSCOPE(Thread::Current());
CHECK_CALLBACK_STATE(T);
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(T);
const String& str_obj = String::Handle(Z, String::New(str));
RawInteger* integer = Integer::New(str_obj);
if (integer == Integer::null()) {
@@ -2262,8 +2233,8 @@
DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer,
const char** value) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer);
if (int_obj.IsNull()) {
RETURN_TYPE_ERROR(Z, integer, Integer);
@@ -2348,8 +2319,8 @@
}
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char* str) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
if (str == NULL) {
RETURN_NULL_ERROR(str);
}
@@ -2359,8 +2330,8 @@
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t* utf8_array,
intptr_t length) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
if (utf8_array == NULL && length != 0) {
RETURN_NULL_ERROR(utf8_array);
}
@@ -2386,8 +2357,8 @@
DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t* utf32_array,
intptr_t length) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
if (utf32_array == NULL && length != 0) {
RETURN_NULL_ERROR(utf32_array);
}
@@ -2401,8 +2372,8 @@
intptr_t length,
void* peer,
Dart_PeerFinalizer cback) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
if (latin1_array == NULL && length != 0) {
RETURN_NULL_ERROR(latin1_array);
}
@@ -2430,8 +2401,8 @@
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object,
const char** cstr) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
if (cstr == NULL) {
RETURN_NULL_ERROR(cstr);
}
@@ -2454,8 +2425,8 @@
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str,
uint8_t** utf8_array,
intptr_t* length) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
if (utf8_array == NULL) {
RETURN_NULL_ERROR(utf8_array);
}
@@ -2479,8 +2450,8 @@
DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str,
uint8_t* latin1_array,
intptr_t* length) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
if (latin1_array == NULL) {
RETURN_NULL_ERROR(latin1_array);
}
@@ -2506,8 +2477,8 @@
DART_EXPORT Dart_Handle Dart_StringToUTF16(Dart_Handle str,
uint16_t* utf16_array,
intptr_t* length) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
const String& str_obj = Api::UnwrapStringHandle(Z, str);
if (str_obj.IsNull()) {
RETURN_TYPE_ERROR(Z, str, String);
@@ -3233,7 +3204,7 @@
}
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object) {
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(Thread::Current());
intptr_t class_id = Api::ClassId(object);
if (RawObject::IsTypedDataClassId(class_id) ||
RawObject::IsTypedDataViewClassId(class_id)) {
@@ -3244,7 +3215,7 @@
DART_EXPORT Dart_TypedData_Type
Dart_GetTypeOfExternalTypedData(Dart_Handle object) {
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(Thread::Current());
intptr_t class_id = Api::ClassId(object);
if (RawObject::IsExternalTypedDataClassId(class_id)) {
return GetType(class_id);
@@ -3959,8 +3930,8 @@
Dart_Handle name,
int number_of_arguments,
Dart_Handle* arguments) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
CHECK_CALLBACK_STATE(T);
if (number_of_arguments < 0) {
@@ -4035,8 +4006,8 @@
Dart_Handle name,
int number_of_arguments,
Dart_Handle* arguments) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
CHECK_CALLBACK_STATE(T);
const String& function_name = Api::UnwrapStringHandle(Z, name);
@@ -4178,8 +4149,8 @@
DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure,
int number_of_arguments,
Dart_Handle* arguments) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
CHECK_CALLBACK_STATE(T);
const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure);
if (closure_obj.IsNull() || !closure_obj.IsCallable(NULL)) {
@@ -4207,8 +4178,8 @@
}
DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
CHECK_CALLBACK_STATE(T);
const String& field_name = Api::UnwrapStringHandle(Z, name);
@@ -4354,8 +4325,8 @@
DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container,
Dart_Handle name,
Dart_Handle value) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
CHECK_CALLBACK_STATE(T);
const String& field_name = Api::UnwrapStringHandle(Z, name);
@@ -5073,8 +5044,8 @@
DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle base_url,
Dart_Handle url) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
CHECK_CALLBACK_STATE(T);
const String& base_uri = Api::UnwrapStringHandle(Z, base_url);
@@ -5140,8 +5111,8 @@
#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
const String& url_str = Api::UnwrapStringHandle(Z, url);
if (url_str.IsNull()) {
@@ -5221,8 +5192,8 @@
#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
StackZone zone(T);
if (buffer == NULL) {
@@ -5299,8 +5270,8 @@
#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
StackZone zone(T);
Isolate* I = T->isolate();
@@ -5528,8 +5499,8 @@
#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
const String& url_str = Api::UnwrapStringHandle(Z, url);
@@ -5691,8 +5662,8 @@
#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
const Library& lib = Api::UnwrapLibraryHandle(Z, library);
if (lib.IsNull()) {
@@ -5742,8 +5713,8 @@
#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
const Library& lib = Api::UnwrapLibraryHandle(Z, library);
if (lib.IsNull()) {
@@ -5773,8 +5744,8 @@
// Finalizes classes and invokes Dart core library function that completes
// futures of loadLibrary calls (deferred library loading).
DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures) {
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
CHECK_CALLBACK_STATE(T);
@@ -6423,8 +6394,8 @@
#if defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
- API_TIMELINE_DURATION;
Thread* thread = Thread::Current();
+ API_TIMELINE_DURATION(thread);
DARTSCOPE(thread);
CHECK_NULL(buffer);
CHECK_NULL(buffer_length);
@@ -6441,7 +6412,7 @@
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
Thread* thread = Thread::Current();
- API_TIMELINE_DURATION;
+ API_TIMELINE_DURATION(thread);
DARTSCOPE(thread);
CHECK_NULL(buffer);
CompilationTraceLoader loader(thread);
@@ -6480,8 +6451,8 @@
return Api::NewError(
"This VM was built without support for AOT compilation.");
#else
- API_TIMELINE_BEGIN_END;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_BEGIN_END(T);
if (!FLAG_precompiled_mode) {
return Api::NewError("Flag --precompilation was not specified.");
}
@@ -6509,8 +6480,8 @@
return Api::NewError(
"This VM was built without support for AOT compilation.");
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
if (I->compilation_allowed()) {
return Api::NewError(
@@ -6550,8 +6521,8 @@
return Api::NewError(
"This VM was built without support for AOT compilation.");
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
CHECK_NULL(assembly_buffer);
CHECK_NULL(assembly_size);
@@ -6590,8 +6561,8 @@
return Api::NewError(
"AOT as blobs is not supported on Fuchsia; use dylibs instead.");
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
if (I->compilation_allowed()) {
return Api::NewError(
@@ -6641,13 +6612,11 @@
intptr_t* isolate_snapshot_instructions_size) {
#if defined(TARGET_ARCH_IA32)
return Api::NewError("Snapshots with code are not supported on IA32.");
-#elif defined(TARGET_ARCH_DBC)
- return Api::NewError("Snapshots with code are not supported on DBC.");
#elif defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("JIT app snapshots cannot be taken from an AOT runtime");
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
if (!FLAG_load_deferred_eagerly) {
return Api::NewError(
@@ -6700,13 +6669,11 @@
intptr_t* isolate_snapshot_instructions_size) {
#if defined(TARGET_ARCH_IA32)
return Api::NewError("Snapshots with code are not supported on IA32.");
-#elif defined(TARGET_ARCH_DBC)
- return Api::NewError("Snapshots with code are not supported on DBC.");
#elif defined(DART_PRECOMPILED_RUNTIME)
return Api::NewError("JIT app snapshots cannot be taken from an AOT runtime");
#else
- API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Isolate* I = T->isolate();
if (!FLAG_load_deferred_eagerly) {
return Api::NewError(
diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h
index c1d3a5d..2541e0a 100644
--- a/runtime/vm/dart_api_impl.h
+++ b/runtime/vm/dart_api_impl.h
@@ -10,6 +10,7 @@
#include "vm/object.h"
#include "vm/safepoint.h"
#include "vm/thread_registry.h"
+#include "vm/timeline.h"
namespace dart {
@@ -101,6 +102,32 @@
} \
} while (0)
+#ifndef PRODUCT
+#define API_TIMELINE_DURATION(thread) \
+ TimelineDurationScope tds(thread, Timeline::GetAPIStream(), CURRENT_FUNC)
+#define API_TIMELINE_DURATION_BASIC(thread) \
+ API_TIMELINE_DURATION(thread); \
+ tds.SetNumArguments(1); \
+ tds.CopyArgument(0, "mode", "basic");
+
+#define API_TIMELINE_BEGIN_END(thread) \
+ TimelineBeginEndScope tbes(thread, Timeline::GetAPIStream(), CURRENT_FUNC)
+
+#define API_TIMELINE_BEGIN_END_BASIC(thread) \
+ API_TIMELINE_BEGIN_END(thread); \
+ tbes.SetNumArguments(1); \
+ tbes.CopyArgument(0, "mode", "basic");
+#else
+#define API_TIMELINE_DURATION(thread) \
+ do { \
+ } while (false)
+#define API_TIMELINE_DURATION_BASIC(thread) API_TIMELINE_DURATION(thread)
+#define API_TIMELINE_BEGIN_END(thread) \
+ do { \
+ } while (false)
+#define API_TIMELINE_BEGIN_END_BASIC(thread) API_TIMELINE_BEGIN_END(thread)
+#endif // !PRODUCT
+
class Api : AllStatic {
public:
// Create on the stack to provide a new throw-safe api scope.
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index c8467ab..08c2c06 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -133,7 +133,7 @@
P(polymorphic_with_deopt, bool, true, \
"Polymorphic calls with deoptimization / megamorphic call") \
P(precompiled_mode, bool, false, "Precompilation compiler mode") \
- P(print_precompiler_entry_points, bool, false, \
+ P(print_precompiler_entry_points, charp, NULL, \
"Print entry points and info about recognized methods used by " \
"precompiler.") \
P(print_snapshot_sizes, bool, false, "Print sizes of generated snapshots.") \
diff --git a/runtime/vm/globals.h b/runtime/vm/globals.h
index 36525e7..4fa43f2 100644
--- a/runtime/vm/globals.h
+++ b/runtime/vm/globals.h
@@ -32,6 +32,9 @@
const intptr_t kSmiMax32 = (static_cast<intptr_t>(1) << kSmiBits32) - 1;
const intptr_t kSmiMin32 = -(static_cast<intptr_t>(1) << kSmiBits32);
+// Number of bytes per BigInt digit.
+const intptr_t kBytesPerBigIntDigit = 4;
+
// The default old gen heap size in MB, where 0 == unlimited.
const intptr_t kDefaultMaxOldGenHeapSize = (kWordSize <= 4) ? 1536 : 0;
diff --git a/runtime/vm/instructions_dbc.cc b/runtime/vm/instructions_dbc.cc
index 40877c7..697cba5 100644
--- a/runtime/vm/instructions_dbc.cc
+++ b/runtime/vm/instructions_dbc.cc
@@ -69,17 +69,23 @@
: object_pool_(ObjectPool::Handle(code.GetObjectPool())),
end_(pc),
native_function_pool_index_(-1),
- target_code_pool_index_(-1) {
- UNIMPLEMENTED();
+ trampoline_pool_index_(-1) {
+ ASSERT(code.ContainsInstructionAt(end_));
+ const uword call_pc = end_ - sizeof(Instr);
+ Instr call_instr = Bytecode::At(call_pc);
+ ASSERT(Bytecode::DecodeOpcode(call_instr) == Bytecode::kNativeCall);
+ native_function_pool_index_ = Bytecode::DecodeB(call_instr);
+ trampoline_pool_index_ = Bytecode::DecodeA(call_instr);
}
-RawCode* NativeCallPattern::target() const {
- return reinterpret_cast<RawCode*>(
- object_pool_.ObjectAt(target_code_pool_index_));
+NativeFunctionWrapper NativeCallPattern::target() const {
+ return reinterpret_cast<NativeFunctionWrapper>(
+ object_pool_.ObjectAt(trampoline_pool_index_));
}
-void NativeCallPattern::set_target(const Code& new_target) const {
- object_pool_.SetObjectAt(target_code_pool_index_, new_target);
+void NativeCallPattern::set_target(NativeFunctionWrapper new_target) const {
+ object_pool_.SetRawValueAt(trampoline_pool_index_,
+ reinterpret_cast<uword>(new_target));
// No need to flush the instruction cache, since the code is not modified.
}
diff --git a/runtime/vm/instructions_dbc.h b/runtime/vm/instructions_dbc.h
index 301c14b..15ac846 100644
--- a/runtime/vm/instructions_dbc.h
+++ b/runtime/vm/instructions_dbc.h
@@ -74,8 +74,8 @@
public:
NativeCallPattern(uword pc, const Code& code);
- RawCode* target() const;
- void set_target(const Code& target) const;
+ NativeFunctionWrapper target() const;
+ void set_target(NativeFunctionWrapper target) const;
NativeFunction native_function() const;
void set_native_function(NativeFunction target) const;
@@ -85,7 +85,7 @@
uword end_;
intptr_t native_function_pool_index_;
- intptr_t target_code_pool_index_;
+ intptr_t trampoline_pool_index_;
DISALLOW_COPY_AND_ASSIGN(NativeCallPattern);
};
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 6db3341..338409f 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -157,22 +157,29 @@
}
TIR_Print("Running new field initializers for class: %s\n", to_.ToCString());
- String& initializing_expression = String::Handle();
- Function& eval_func = Function::Handle();
- Object& result = Object::Handle();
- Class& owning_class = Class::Handle();
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ String& initializing_expression = String::Handle(zone);
+ Function& eval_func = Function::Handle(zone);
+ Object& result = Object::Handle(zone);
+ Class& owning_class = Class::Handle(zone);
// For each new field.
for (intptr_t i = 0; i < new_fields_->length(); i++) {
// Create a function that returns the expression.
const Field* field = new_fields_->At(i);
- owning_class ^= field->Owner();
- ASSERT(!owning_class.IsNull());
- // Extract the initializing expression.
- initializing_expression = field->InitializingExpression();
- TIR_Print("New `%s` has initializing expression `%s`\n", field->ToCString(),
- initializing_expression.ToCString());
- eval_func ^= Function::EvaluateHelper(owning_class, initializing_expression,
- Array::empty_array(), true);
+ if (field->kernel_offset() > 0) {
+ eval_func ^= kernel::CreateFieldInitializerFunction(thread, zone, *field);
+ } else {
+ owning_class ^= field->Owner();
+ ASSERT(!owning_class.IsNull());
+ // Extract the initializing expression.
+ initializing_expression = field->InitializingExpression();
+ TIR_Print("New `%s` has initializing expression `%s`\n",
+ field->ToCString(), initializing_expression.ToCString());
+ eval_func ^= Function::EvaluateHelper(
+ owning_class, initializing_expression, Array::empty_array(), true);
+ }
+
for (intptr_t j = 0; j < after_->length(); j++) {
const Instance* instance = after_->At(j);
TIR_Print("Initializing instance %" Pd " / %" Pd "\n", j + 1,
diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc
index 8ec1d7f..f2a44d1 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.cc
@@ -720,7 +720,7 @@
TEST_CASE(IsolateReload_TypeIdentity) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class T { }\n"
"getType() => T;\n"
"main() {\n"
@@ -734,7 +734,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class T extends Stopwatch { }\n"
"getType() => T;\n"
"main() {\n"
@@ -751,7 +751,7 @@
TEST_CASE(IsolateReload_TypeIdentityGeneric) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class T<G> { }\n"
"getType() => new T<int>().runtimeType;\n"
"main() {\n"
@@ -765,7 +765,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class T<G> extends Stopwatch { }\n"
"getType() => new T<int>().runtimeType;\n"
"main() {\n"
@@ -783,7 +783,7 @@
TEST_CASE(IsolateReload_TypeIdentityParameter) {
const char* kScript =
"import 'dart:mirrors';\n"
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class T<G> { }\n"
"getTypeVar() => reflectType(T).typeVariables[0];\n"
"main() {\n"
@@ -798,7 +798,7 @@
const char* kReloadScript =
"import 'dart:mirrors';\n"
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class T<G> extends Stopwatch { }\n"
"getTypeVar() => reflectType(T).typeVariables[0];\n"
"main() {\n"
@@ -946,7 +946,7 @@
TEST_CASE(IsolateReload_LiveStack) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"helper() => 7;\n"
"alpha() { var x = helper(); reloadTest(); return x + helper(); }\n"
"foo() => alpha();\n"
@@ -959,7 +959,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"helper() => 100;\n"
"alpha() => 5 + helper();\n"
"foo() => alpha();\n"
@@ -972,8 +972,8 @@
EXPECT_EQ(107, SimpleInvoke(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
EXPECT_EQ(105, SimpleInvoke(lib, "main"));
}
@@ -1100,7 +1100,7 @@
TestCase::AddTestLib("test:lib1", kImportScript);
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"import 'test:lib1' show importedIntFunc;\n"
"main() {\n"
" var x = importedIntFunc();\n"
@@ -1183,7 +1183,7 @@
TEST_CASE(IsolateReload_PendingUnqualifiedCall_StaticToInstance) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo() => 'static';\n"
" test() {\n"
@@ -1199,7 +1199,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo() => 'instance';\n"
" test() {\n"
@@ -1215,14 +1215,14 @@
EXPECT_STREQ("instance", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
EXPECT_STREQ("instance", SimpleInvokeStr(lib, "main"));
}
TEST_CASE(IsolateReload_PendingUnqualifiedCall_InstanceToStatic) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo() => 'instance';\n"
" test() {\n"
@@ -1238,7 +1238,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo() => 'static';\n"
" test() {\n"
@@ -1254,14 +1254,14 @@
EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
}
TEST_CASE(IsolateReload_PendingConstructorCall_AbstractToConcrete) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"abstract class Foo {}\n"
"class C {\n"
" test() {\n"
@@ -1282,7 +1282,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class Foo {}\n"
"class C {\n"
" test() {\n"
@@ -1303,14 +1303,14 @@
EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
}
TEST_CASE(IsolateReload_PendingConstructorCall_ConcreteToAbstract) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class Foo {}\n"
"class C {\n"
" test() {\n"
@@ -1331,7 +1331,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"abstract class Foo {}\n"
"class C {\n"
" test() {\n"
@@ -1352,14 +1352,14 @@
EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
}
TEST_CASE(IsolateReload_PendingStaticCall_DefinedToNSM) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo() => 'static'\n"
" test() {\n"
@@ -1379,7 +1379,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" test() {\n"
" reloadTest();\n"
@@ -1398,14 +1398,14 @@
EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
}
TEST_CASE(IsolateReload_PendingStaticCall_NSMToDefined) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" test() {\n"
" reloadTest();\n"
@@ -1424,7 +1424,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo() => 'static'\n"
" test() {\n"
@@ -1444,14 +1444,14 @@
EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
}
TEST_CASE(IsolateReload_PendingSuperCall) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class S {\n"
" foo() => 1;\n"
"}\n"
@@ -1471,7 +1471,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class S {\n"
" foo() => 10;\n"
"}\n"
@@ -1494,7 +1494,7 @@
TEST_CASE(IsolateReload_TearOff_Instance_Equality) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo() => 'old';\n"
"}\n"
@@ -1510,7 +1510,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo() => 'new';\n"
"}\n"
@@ -1526,13 +1526,13 @@
EXPECT_STREQ("new new true false", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
}
TEST_CASE(IsolateReload_TearOff_Class_Identity) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo() => 'old';\n"
"}\n"
@@ -1548,7 +1548,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo() => 'new';\n"
"}\n"
@@ -1564,13 +1564,13 @@
EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
}
TEST_CASE(IsolateReload_TearOff_Library_Identity) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"foo() => 'old';\n"
"getFoo() => foo;\n"
"main() {\n"
@@ -1584,7 +1584,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"foo() => 'new';\n"
"getFoo() => foo;\n"
"main() {\n"
@@ -1598,13 +1598,13 @@
EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
}
TEST_CASE(IsolateReload_TearOff_List_Set) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo() => 'old';\n"
"}\n"
@@ -1632,7 +1632,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo() => 'new';\n"
"}\n"
@@ -1661,13 +1661,16 @@
EXPECT_STREQ("new new true true true new true true true",
SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
}
+// TODO(bkonyi): This test has been modified since it was written and no longer
+// tests functionality that it did originally. It needs to be either re-written
+// or removed.
TEST_CASE(IsolateReload_DanglingGetter_Instance) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" var x = 3;\n"
" var y = 4;\n"
@@ -1692,7 +1695,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" var x = 3;\n"
"}\n"
@@ -1719,13 +1722,20 @@
"NoSuchMethodError: Class 'int' has no instance method 'call'.",
SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ if (TestCase::UsingDartFrontend() && TestCase::UsingStrongMode()) {
+ EXPECT_NULL(lib);
+ } else {
+ EXPECT_NON_NULL(lib);
+ }
}
+// TODO(bkonyi): This test has been modified since it was written and no longer
+// tests functionality that it did originally. It needs to be either re-written
+// or removed.
TEST_CASE(IsolateReload_DanglingGetter_Class) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static var x;\n"
" static var y;\n"
@@ -1751,7 +1761,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static var x;\n"
"}\n"
@@ -1779,13 +1789,17 @@
"NoSuchMethodError: Class 'int' has no instance method 'call'.",
SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ if (TestCase::UsingDartFrontend() && TestCase::UsingStrongMode()) {
+ EXPECT_NULL(lib);
+ } else {
+ EXPECT_NON_NULL(lib);
+ }
}
TEST_CASE(IsolateReload_TearOff_AddArguments) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo(x) => x;\n"
"}\n"
@@ -1809,7 +1823,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" foo(x, y, z) => x + y + z;\n"
"}\n"
@@ -1836,13 +1850,13 @@
"'foo' with matching arguments.",
SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
}
TEST_CASE(IsolateReload_TearOff_AddArguments2) {
const char* kScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo(x) => x;\n"
"}\n"
@@ -1865,7 +1879,7 @@
EXPECT_VALID(lib);
const char* kReloadScript =
- "import 'test:isolate_reload_helper';\n"
+ "import 'file:///test:isolate_reload_helper';\n"
"class C {\n"
" static foo(x, y, z) => x + y + z;\n"
"}\n"
@@ -1891,8 +1905,8 @@
"function 'C.foo'",
SimpleInvokeStr(lib, "main"));
- lib = TestCase::GetReloadErrorOrRootLibrary();
- EXPECT_VALID(lib);
+ lib = TestCase::GetReloadLibrary();
+ EXPECT_NON_NULL(lib);
}
TEST_CASE(IsolateReload_EnumEquality) {
@@ -3375,6 +3389,46 @@
EXPECT_STREQ("true true true true", SimpleInvokeStr(lib, "main"));
}
+TEST_CASE(IsolateReload_RunNewFieldInitializersWithGenerics) {
+ const char* kScript =
+ "class Foo<T> {\n"
+ " T x;\n"
+ "}\n"
+ "Foo value1;\n"
+ "Foo value2;\n"
+ "main() {\n"
+ " value1 = new Foo<String>();\n"
+ " value2 = new Foo<int>();\n"
+ " return 'Okay';\n"
+ "}\n";
+
+ Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
+ EXPECT_VALID(lib);
+ EXPECT_STREQ("Okay", SimpleInvokeStr(lib, "main"));
+
+ const char* kReloadScript =
+ "class Foo<T> {\n"
+ " T x;\n"
+ " List<T> y = new List<T>();"
+ " dynamic z = <T,T>{};"
+ "}\n"
+ "Foo value1;\n"
+ "Foo value2;\n"
+ "main() {\n"
+ " return '${value1.y.runtimeType} ${value1.z.runtimeType}'"
+ " ' ${value2.y.runtimeType} ${value2.z.runtimeType}';\n"
+ "}\n";
+
+ lib = TestCase::ReloadTestScript(kReloadScript);
+ EXPECT_VALID(lib);
+ // Verify that we ran field initializers on existing instances and
+ // correct type arguments were used.
+ EXPECT_STREQ(
+ "List<String> _InternalLinkedHashMap<String, String> List<int> "
+ "_InternalLinkedHashMap<int, int>",
+ SimpleInvokeStr(lib, "main"));
+}
+
TEST_CASE(IsolateReload_TypedefToNotTypedef) {
const char* kScript =
"typedef bool Predicate(dynamic x);\n"
diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h
index 366277f..579a186 100644
--- a/runtime/vm/kernel.h
+++ b/runtime/vm/kernel.h
@@ -184,6 +184,10 @@
DISALLOW_COPY_AND_ASSIGN(KernelLineStartsReader);
};
+RawFunction* CreateFieldInitializerFunction(Thread* thread,
+ Zone* zone,
+ const Field& field);
+
ParsedFunction* ParseStaticFieldInitializer(Zone* zone, const Field& field);
bool FieldHasFunctionLiteralInitializer(const Field& field,
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index 4819fd2..d514487 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -40,6 +40,8 @@
kLocalInitializer = 11,
kAssertInitializer = 12,
+ kCheckLibraryIsLoaded = 13,
+ kLoadLibrary = 14,
kDirectPropertyGet = 15,
kDirectPropertySet = 16,
kDirectMethodInvocation = 17,
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index f3362e4..6b2e819 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -14,6 +14,7 @@
#include "vm/longjump.h"
#include "vm/object_store.h"
#include "vm/parser.h"
+#include "vm/reusable_handles.h"
#include "vm/service_isolate.h"
#include "vm/symbols.h"
@@ -56,7 +57,7 @@
return true;
}
case kStringLiteral:
- simple_value_ = &H.DartSymbol(
+ simple_value_ = &H.DartSymbolPlain(
builder_->ReadStringReference()); // read index into string table.
return true;
case kSpecialIntLiteral:
@@ -466,7 +467,7 @@
Tag tag = builder_.ReadTag();
ASSERT(tag == kStringLiteral);
- String& result = H.DartSymbol(
+ String& result = H.DartSymbolPlain(
builder_.ReadStringReference()); // read index into string table.
// List of named.
@@ -733,7 +734,7 @@
intptr_t procedure_count = library_index.procedure_count();
library_helper.ReadUntilIncluding(LibraryHelper::kName);
- library.SetName(H.DartSymbol(library_helper.name_index_));
+ library.SetName(H.DartSymbolObfuscate(library_helper.name_index_));
// The bootstrapper will take care of creating the native wrapper classes, but
// we will add the synthetic constructors to them here.
@@ -877,7 +878,8 @@
uint8_t flags = builder_.ReadFlags();
intptr_t name_count = builder_.ReadListLength();
for (intptr_t n = 0; n < name_count; ++n) {
- String& show_hide_name = H.DartSymbol(builder_.ReadStringReference());
+ String& show_hide_name =
+ H.DartSymbolObfuscate(builder_.ReadStringReference());
if (flags & LibraryDependencyHelper::Show) {
show_list.Add(show_hide_name, Heap::kOld);
} else {
@@ -904,7 +906,7 @@
target_library.url() == Symbols::DartMirrors().raw()) {
H.ReportError("import of dart:mirrors with --enable-mirrors=false");
}
- String& prefix = H.DartSymbol(dependency_helper.name_index_);
+ String& prefix = H.DartSymbolPlain(dependency_helper.name_index_);
ns = Namespace::New(target_library, show_names, hide_names);
if (dependency_helper.flags_ & LibraryDependencyHelper::Export) {
library->AddExport(ns);
@@ -967,6 +969,41 @@
if (class_helper->is_abstract_) klass->set_is_abstract();
}
+// Workaround for http://dartbug.com/32087: currently Kernel front-end
+// embeds absolute build-time paths to core library sources into Kernel
+// binaries this introduces discrepancy between how stack traces were
+// looked like in legacy pipeline and how they look in Dart 2 pipeline and
+// breaks users' code that attempts to pattern match and filter various
+// irrelevant frames (e.g. frames from dart:async).
+// This also breaks debugging experience in external debuggers because
+// debugger attempts to open files that don't exist in the local file
+// system.
+// To work around this issue we reformat urls of scripts belonging to
+// dart:-scheme libraries to look like they looked like in legacy pipeline:
+//
+// dart:libname/filename.dart
+//
+void KernelLoader::FixCoreLibraryScriptUri(const Library& library,
+ const Script& script) {
+ if (library.is_dart_scheme()) {
+ String& url = String::Handle(zone_, script.url());
+ if (!url.StartsWith(Symbols::DartScheme())) {
+ // Search backwards until '/' is found. That gives us the filename.
+ // Note: can't use reusable handle in the code below because
+ // concat also needs it.
+ intptr_t pos = url.Length() - 1;
+ while (pos >= 0 && url.CharAt(pos) != '/') {
+ pos--;
+ }
+
+ url = String::SubString(url, pos + 1);
+ url = String::Concat(Symbols::Slash(), url);
+ url = String::Concat(String::Handle(zone_, library.url()), url);
+ script.set_url(url);
+ }
+ }
+}
+
Class& KernelLoader::LoadClass(const Library& library,
const Class& toplevel_class,
intptr_t class_end) {
@@ -987,6 +1024,7 @@
const Script& script =
Script::Handle(Z, ScriptAt(class_helper.source_uri_index_));
klass.set_script(script);
+ FixCoreLibraryScriptUri(library, script);
}
if (klass.token_pos() == TokenPosition::kNoSource) {
class_helper.ReadUntilIncluding(ClassHelper::kPosition);
@@ -1190,6 +1228,10 @@
ProcedureHelper procedure_helper(&builder_);
procedure_helper.ReadUntilExcluding(ProcedureHelper::kAnnotations);
+ if (procedure_helper.IsRedirectingFactoryConstructor()) {
+ builder_.SetOffset(procedure_end);
+ return;
+ }
const String& name = H.DartProcedureName(procedure_helper.canonical_name_);
bool is_method = in_class && !procedure_helper.IsStatic();
bool is_abstract = procedure_helper.IsAbstract();
@@ -1345,6 +1387,7 @@
patch_class ^= patch_classes_.At(source_uri_index);
if (patch_class.IsNull() || patch_class.origin_class() != klass.raw()) {
ASSERT(!library_kernel_data_.IsNull());
+ FixCoreLibraryScriptUri(Library::Handle(klass.library()), correct_script);
patch_class = PatchClass::New(klass, correct_script);
patch_class.set_library_kernel_data(library_kernel_data_);
patch_class.set_library_kernel_offset(library_kernel_offset_);
@@ -1496,7 +1539,7 @@
Library& KernelLoader::LookupLibrary(NameIndex library) {
Library* handle = NULL;
if (!libraries_.Lookup(library, &handle)) {
- const String& url = H.DartSymbol(H.CanonicalNameString(library));
+ const String& url = H.DartString(H.CanonicalNameString(library));
handle = &Library::Handle(Z, Library::LookupLibrary(thread_, url));
if (handle->IsNull()) {
*handle = Library::New(url);
@@ -1541,16 +1584,19 @@
return static_cast<RawFunction::Kind>(lookuptable[kind]);
}
-ParsedFunction* ParseStaticFieldInitializer(Zone* zone, const Field& field) {
- Thread* thread = Thread::Current();
-
+RawFunction* CreateFieldInitializerFunction(Thread* thread,
+ Zone* zone,
+ const Field& field) {
String& init_name = String::Handle(zone, field.name());
init_name = Symbols::FromConcat(thread, Symbols::InitPrefix(), init_name);
// Create a static initializer.
const Object& owner = Object::Handle(field.RawOwner());
- const Function& initializer_fun = Function::ZoneHandle(
- zone, Function::New(init_name, RawFunction::kImplicitStaticFinalGetter,
+ const Function& initializer_fun = Function::Handle(
+ zone, Function::New(init_name,
+ // TODO(alexmarkov): Consider creating a separate
+ // function kind for field initializers.
+ RawFunction::kImplicitStaticFinalGetter,
true, // is_static
false, // is_const
false, // is_abstract
@@ -1562,6 +1608,15 @@
initializer_fun.set_is_debuggable(false);
initializer_fun.set_is_reflectable(false);
initializer_fun.set_is_inlinable(false);
+ return initializer_fun.raw();
+}
+
+ParsedFunction* ParseStaticFieldInitializer(Zone* zone, const Field& field) {
+ Thread* thread = Thread::Current();
+
+ const Function& initializer_fun = Function::ZoneHandle(
+ zone, CreateFieldInitializerFunction(thread, zone, field));
+
return new (zone) ParsedFunction(thread, initializer_fun);
}
diff --git a/runtime/vm/kernel_loader.h b/runtime/vm/kernel_loader.h
index 8a5f60f..c66d499 100644
--- a/runtime/vm/kernel_loader.h
+++ b/runtime/vm/kernel_loader.h
@@ -145,12 +145,15 @@
void AnnotateNativeProcedures(const Array& constant_table);
void LoadNativeExtensionLibraries(const Array& constant_table);
- const String& DartSymbol(StringIndex index) {
- return translation_helper_.DartSymbol(index);
+ const String& DartSymbolPlain(StringIndex index) {
+ return translation_helper_.DartSymbolPlain(index);
+ }
+ const String& DartSymbolObfuscate(StringIndex index) {
+ return translation_helper_.DartSymbolObfuscate(index);
}
const String& LibraryUri(intptr_t library_index) {
- return translation_helper_.DartSymbol(
+ return translation_helper_.DartSymbolPlain(
translation_helper_.CanonicalNameString(
library_canonical_name(library_index)));
}
@@ -192,6 +195,8 @@
void CheckForInitializer(const Field& field);
+ void FixCoreLibraryScriptUri(const Library& library, const Script& script);
+
Class& LoadClass(const Library& library,
const Class& toplevel_class,
intptr_t class_end);
diff --git a/runtime/vm/native_api_impl.cc b/runtime/vm/native_api_impl.cc
index 2f52f30..c8510f6 100644
--- a/runtime/vm/native_api_impl.cc
+++ b/runtime/vm/native_api_impl.cc
@@ -102,6 +102,7 @@
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
if (::Dart_IsError(result)) {
return result;
@@ -120,6 +121,7 @@
return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
#else
DARTSCOPE(Thread::Current());
+ API_TIMELINE_DURATION(T);
Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
if (::Dart_IsError(result)) {
return result;
diff --git a/runtime/vm/native_entry.cc b/runtime/vm/native_entry.cc
index 57405db..d993921 100644
--- a/runtime/vm/native_entry.cc
+++ b/runtime/vm/native_entry.cc
@@ -102,6 +102,19 @@
UNREACHABLE();
}
+#if defined(TARGET_ARCH_DBC)
+uword NativeEntry::BootstrapNativeCallWrapperEntry() {
+ uword entry =
+ reinterpret_cast<uword>(NativeEntry::BootstrapNativeCallWrapper);
+ return entry;
+}
+
+void NativeEntry::BootstrapNativeCallWrapper(Dart_NativeArguments args,
+ Dart_NativeFunction func) {
+ func(args);
+}
+#endif
+
uword NativeEntry::NoScopeNativeCallWrapperEntry() {
uword entry = reinterpret_cast<uword>(NativeEntry::NoScopeNativeCallWrapper);
#if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC)
@@ -202,8 +215,6 @@
VERIFY_ON_TRANSITION;
}
-// DBC does not support lazy native call linking.
-#if !defined(TARGET_ARCH_DBC)
static NativeFunction ResolveNativeFunction(Zone* zone,
const Function& func,
bool* is_bootstrap_native,
@@ -229,7 +240,8 @@
uword NativeEntry::LinkNativeCallEntry() {
uword entry = reinterpret_cast<uword>(NativeEntry::LinkNativeCall);
-#if defined(USING_SIMULATOR)
+#if defined(USING_SIMULATOR) && !defined(TARGET_ARCH_DBC)
+ // DBC does not use redirections unlike other simulators.
entry = Simulator::RedirectExternalReference(
entry, Simulator::kBootstrapNativeCall, NativeEntry::kNumArguments);
#endif
@@ -269,7 +281,7 @@
&is_bootstrap_native, &is_auto_scope);
ASSERT(target_function != NULL);
-#if defined(DEBUG)
+#if defined(DEBUG) && !defined(TARGET_ARCH_DBC)
{
NativeFunction current_function = NULL;
const Code& current_trampoline =
@@ -291,6 +303,16 @@
#endif
NativeFunction patch_target_function = target_function;
+#if defined(TARGET_ARCH_DBC)
+ NativeFunctionWrapper trampoline;
+ if (is_bootstrap_native) {
+ trampoline = &BootstrapNativeCallWrapper;
+ } else if (is_auto_scope) {
+ trampoline = &AutoScopeNativeCallWrapper;
+ } else {
+ trampoline = &NoScopeNativeCallWrapper;
+ }
+#else
Code& trampoline = Code::Handle(zone);
if (is_bootstrap_native) {
trampoline = StubCode::CallBootstrapNative_entry()->code();
@@ -305,6 +327,7 @@
} else {
trampoline = StubCode::CallNoScopeNative_entry()->code();
}
+#endif
CodePatcher::PatchNativeCallAt(caller_frame->pc(), code,
patch_target_function, trampoline);
@@ -331,6 +354,5 @@
args, reinterpret_cast<Dart_NativeFunction>(target_function));
}
}
-#endif // !defined(TARGET_ARCH_DBC)
} // namespace dart
diff --git a/runtime/vm/native_entry.h b/runtime/vm/native_entry.h
index 1fda0b5..048c12e 100644
--- a/runtime/vm/native_entry.h
+++ b/runtime/vm/native_entry.h
@@ -36,6 +36,8 @@
// scope.
typedef void (*NativeFunction)(NativeArguments* arguments);
+typedef void (*NativeFunctionWrapper)(Dart_NativeArguments args,
+ Dart_NativeFunction func);
#ifndef PRODUCT
#define TRACE_NATIVE_CALL(format, name) \
@@ -127,6 +129,12 @@
uword pc);
static const uint8_t* ResolveSymbol(uword pc);
+#if defined(TARGET_ARCH_DBC)
+ static uword BootstrapNativeCallWrapperEntry();
+ static void BootstrapNativeCallWrapper(Dart_NativeArguments args,
+ Dart_NativeFunction func);
+#endif
+
static uword NoScopeNativeCallWrapperEntry();
static void NoScopeNativeCallWrapper(Dart_NativeArguments args,
Dart_NativeFunction func);
@@ -135,11 +143,8 @@
static void AutoScopeNativeCallWrapper(Dart_NativeArguments args,
Dart_NativeFunction func);
-// DBC does not support lazy native call linking.
-#if !defined(TARGET_ARCH_DBC)
static uword LinkNativeCallEntry();
static void LinkNativeCall(Dart_NativeArguments args);
-#endif
private:
static void NoScopeNativeCallWrapperNoStackCheck(Dart_NativeArguments args,
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index a2d7cfe..3a928b4 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12264,8 +12264,6 @@
if (result.IsError()) {
return Error::Cast(result).raw();
}
- func.ClearICDataArray();
- func.ClearCode();
}
}
return Error::null();
@@ -12547,8 +12545,10 @@
RawObject* obj = ObjectAt(i);
THR_Print("0x%" Px " %s (obj)\n", reinterpret_cast<uword>(obj),
Object::Handle(obj).ToCString());
- } else if (TypeAt(i) == kNativeEntry) {
- THR_Print("0x%" Px " (native entry)\n", RawValueAt(i));
+ } else if (TypeAt(i) == kNativeFunction) {
+ THR_Print("0x%" Px " (native function)\n", RawValueAt(i));
+ } else if (TypeAt(i) == kNativeFunctionWrapper) {
+ THR_Print("0x%" Px " (native function wrapper)\n", RawValueAt(i));
} else {
THR_Print("0x%" Px " (raw)\n", RawValueAt(i));
}
@@ -22658,35 +22658,7 @@
}
}
- // Workaround for http://dartbug.com/32087: currently Kernel front-end
- // embeds absolute build-time paths to core library sources into Kernel
- // binaries this introduces discrepancy between how stack traces were
- // looked like in legacy pipeline and how they look in Dart 2 pipeline and
- // breaks users' code that attempts to pattern match and filter various
- // irrelevant frames (e.g. frames from dart:async).
- // To work around this issue we reformat urls of scripts belonging to
- // dart:-scheme libraries to look like they looked like in legacy pipeline:
- //
- // dart:libname/filename.dart
- //
const char* url_string = url.ToCString();
- if (script.kernel_program_info() != KernelProgramInfo::null()) {
- const Class& owner = Class::Handle(function.Owner());
- const Library& lib = Library::Handle(owner.library());
- if (lib.is_dart_scheme()) {
- // Search backwards until '/' is found. That gives us the filename.
- intptr_t pos = strlen(url_string) - 1;
- while (pos >= 0 && url_string[pos] != '/') {
- pos--;
- }
- const char* filename = url_string + (pos + 1);
-
- // Glue together canonic library url (e.g. dart:async) and filename.
- url_string = zone->PrintToString(
- "%s/%s", String::Handle(lib.url()).ToCString(), filename);
- }
- }
-
if (column >= 0) {
buffer->Printf("#%-6" Pd " %s (%s:%" Pd ":%" Pd ")\n", frame_index,
function_name.ToCString(), url_string, line, column);
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index ec35e6e..a03522c 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3076,7 +3076,7 @@
intptr_t kernel_offset() const {
#if defined(DART_PRECOMPILED_RUNTIME)
- return NULL;
+ return 0;
#else
return raw_ptr()->kernel_offset_;
#endif
@@ -4051,7 +4051,8 @@
enum EntryType {
kTaggedObject,
kImmediate,
- kNativeEntry,
+ kNativeFunction,
+ kNativeFunctionWrapper,
};
struct Entry {
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index a8efe0c..aa21aa8 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -657,9 +657,14 @@
jsentry.AddProperty("kind", "Immediate");
jsentry.AddProperty64("value", imm);
break;
- case ObjectPool::kNativeEntry:
+ case ObjectPool::kNativeFunction:
imm = RawValueAt(i);
- jsentry.AddProperty("kind", "NativeEntry");
+ jsentry.AddProperty("kind", "NativeFunction");
+ jsentry.AddProperty64("value", imm);
+ break;
+ case ObjectPool::kNativeFunctionWrapper:
+ imm = RawValueAt(i);
+ jsentry.AddProperty("kind", "NativeFunctionWrapper");
jsentry.AddProperty64("value", imm);
break;
default:
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index 624c883..abdae63 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -66,7 +66,7 @@
const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) {
time_service::TimeServiceSyncPtr time_svc;
if (GetTimeServicePtr(&time_svc) == ZX_OK) {
- fidl::String res;
+ f1dl::String res;
time_svc->GetTimezoneId(&res);
char* tz_name = Thread::Current()->zone()->Alloc<char>(res.size() + 1);
memmove(tz_name, res.get().c_str(), res.size());
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index 876f645..bd7be22 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -620,10 +620,6 @@
// Calls to leaf float Dart runtime functions are based on this interface.
typedef double (*SimulatorLeafFloatRuntimeCall)(double d0, double d1);
-// Calls to native Dart functions are based on this interface.
-typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments);
-typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target);
-
void Simulator::Exit(Thread* thread,
RawObject** base,
RawObject** frame,
@@ -970,48 +966,15 @@
}
}
-static DART_NOINLINE bool InvokeBootstrapNative(Thread* thread,
- Simulator* sim,
- SimulatorBootstrapNativeCall f,
- NativeArguments* args) {
+static DART_NOINLINE bool InvokeNative(Thread* thread,
+ Simulator* sim,
+ NativeFunctionWrapper wrapper,
+ Dart_NativeFunction function,
+ Dart_NativeArguments args) {
SimulatorSetjmpBuffer buffer(sim);
if (!setjmp(buffer.buffer_)) {
- thread->set_vm_tag(reinterpret_cast<uword>(f));
- f(args);
- thread->set_vm_tag(VMTag::kDartTagId);
- thread->set_top_exit_frame_info(0);
- return true;
- } else {
- return false;
- }
-}
-
-static DART_NOINLINE bool InvokeNativeNoScopeWrapper(Thread* thread,
- Simulator* sim,
- Dart_NativeFunction f,
- NativeArguments* args) {
- SimulatorSetjmpBuffer buffer(sim);
- if (!setjmp(buffer.buffer_)) {
- thread->set_vm_tag(reinterpret_cast<uword>(f));
- NativeEntry::NoScopeNativeCallWrapper(
- reinterpret_cast<Dart_NativeArguments>(args), f);
- thread->set_vm_tag(VMTag::kDartTagId);
- thread->set_top_exit_frame_info(0);
- return true;
- } else {
- return false;
- }
-}
-
-static DART_NOINLINE bool InvokeNativeAutoScopeWrapper(Thread* thread,
- Simulator* sim,
- Dart_NativeFunction f,
- NativeArguments* args) {
- SimulatorSetjmpBuffer buffer(sim);
- if (!setjmp(buffer.buffer_)) {
- thread->set_vm_tag(reinterpret_cast<uword>(f));
- NativeEntry::AutoScopeNativeCallWrapper(
- reinterpret_cast<Dart_NativeArguments>(args), f);
+ thread->set_vm_tag(reinterpret_cast<uword>(function));
+ wrapper(args, function);
thread->set_vm_tag(VMTag::kDartTagId);
thread->set_top_exit_frame_info(0);
return true;
@@ -1174,22 +1137,8 @@
HANDLE_RETURN; \
}
-#define INVOKE_BOOTSTRAP_NATIVE(Func, Args) \
- if (!InvokeBootstrapNative(thread, this, Func, &Args)) { \
- HANDLE_EXCEPTION; \
- } else { \
- HANDLE_RETURN; \
- }
-
-#define INVOKE_NATIVE_NO_SCOPE(Func, Args) \
- if (!InvokeNativeNoScopeWrapper(thread, this, Func, &Args)) { \
- HANDLE_EXCEPTION; \
- } else { \
- HANDLE_RETURN; \
- }
-
-#define INVOKE_NATIVE_AUTO_SCOPE(Func, Args) \
- if (!InvokeNativeAutoScopeWrapper(thread, this, Func, &Args)) { \
+#define INVOKE_NATIVE(Wrapper, Func, Args) \
+ if (!InvokeNative(thread, this, Wrapper, Func, Args)) { \
HANDLE_EXCEPTION; \
} else { \
HANDLE_RETURN; \
@@ -1854,60 +1803,25 @@
}
{
- BYTECODE(NativeBootstrapCall, 0);
- intptr_t argc_tag = reinterpret_cast<intptr_t>(SP[-0]);
+ BYTECODE(NativeCall, A_B_C);
+ NativeFunctionWrapper trampoline =
+ reinterpret_cast<NativeFunctionWrapper>(LOAD_CONSTANT(rA));
+ Dart_NativeFunction function =
+ reinterpret_cast<Dart_NativeFunction>(LOAD_CONSTANT(rB));
+ intptr_t argc_tag = reinterpret_cast<intptr_t>(LOAD_CONSTANT(rC));
const intptr_t num_arguments = NativeArguments::ArgcBits::decode(argc_tag);
- RawObject** incoming_args = SP - 1 - num_arguments;
- RawObject** return_slot = SP - 1;
- SimulatorBootstrapNativeCall native_target =
- reinterpret_cast<SimulatorBootstrapNativeCall>(SP[-1]);
- SP[-0] = 0; // Note: argc_tag is not smi-tagged.
- SP[-1] = null_value;
- Exit(thread, FP, SP + 1, pc);
+ *++SP = null_value; // Result slot.
+
+ RawObject** incoming_args = SP - num_arguments;
+ RawObject** return_slot = SP;
+ Exit(thread, FP, SP, pc);
NativeArguments args(thread, argc_tag, incoming_args, return_slot);
- INVOKE_BOOTSTRAP_NATIVE(native_target, args);
+ INVOKE_NATIVE(trampoline, function,
+ reinterpret_cast<Dart_NativeArguments>(&args));
- *(SP - 1 - num_arguments) = *return_slot;
- SP -= 1 + num_arguments;
- DISPATCH();
- }
-
- {
- BYTECODE(NativeNoScopeCall, 0);
- intptr_t argc_tag = reinterpret_cast<intptr_t>(SP[-0]);
- const intptr_t num_arguments = NativeArguments::ArgcBits::decode(argc_tag);
-
- RawObject** incoming_args = SP - 1 - num_arguments;
- RawObject** return_slot = SP - 1;
- Dart_NativeFunction native_target =
- reinterpret_cast<Dart_NativeFunction>(SP[-1]);
- SP[-0] = 0; // argc_tag is not smi tagged!
- SP[-1] = null_value;
- Exit(thread, FP, SP + 1, pc);
- NativeArguments args(thread, argc_tag, incoming_args, return_slot);
- INVOKE_NATIVE_NO_SCOPE(native_target, args);
- *(SP - 1 - num_arguments) = *return_slot;
- SP -= 1 + num_arguments;
- DISPATCH();
- }
-
- {
- BYTECODE(NativeAutoScopeCall, 0);
- intptr_t argc_tag = reinterpret_cast<intptr_t>(SP[-0]);
- const intptr_t num_arguments = NativeArguments::ArgcBits::decode(argc_tag);
-
- RawObject** incoming_args = SP - 1 - num_arguments;
- RawObject** return_slot = SP - 1;
- Dart_NativeFunction native_target =
- reinterpret_cast<Dart_NativeFunction>(SP[-1]);
- SP[-0] = 0; // argc_tag is not smi tagged!
- SP[-1] = null_value;
- Exit(thread, FP, SP + 1, pc);
- NativeArguments args(thread, argc_tag, incoming_args, return_slot);
- INVOKE_NATIVE_AUTO_SCOPE(native_target, args);
- *(SP - 1 - num_arguments) = *return_slot;
- SP -= 1 + num_arguments;
+ *(SP - num_arguments) = *return_slot;
+ SP -= num_arguments;
DISPATCH();
}
diff --git a/runtime/vm/source_report.cc b/runtime/vm/source_report.cc
index e6e8ac7..33afde7 100644
--- a/runtime/vm/source_report.cc
+++ b/runtime/vm/source_report.cc
@@ -65,6 +65,13 @@
}
bool SourceReport::ShouldSkipFunction(const Function& func) {
+ // TODO(32315): Verify that the check is still needed after the issue is
+ // resolved.
+ if (!func.token_pos().IsReal() || !func.end_token_pos().IsReal()) {
+ // At least one of the token positions is not known.
+ return true;
+ }
+
if (script_ != NULL && !script_->IsNull()) {
if (func.script() != script_->raw()) {
// The function is from the wrong script.
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 276657a..4af3163 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -95,6 +95,7 @@
V(ArgDescVar, ":arg_desc") \
V(CurrentContextVar, ":current_context_var") \
V(SavedTryContextVar, ":saved_try_context_var") \
+ V(TryFinallyReturnValue, ":try_finally_return_value") \
V(ExceptionParameter, ":exception") \
V(StackTraceParameter, ":stack_trace") \
V(ExceptionVar, ":exception_var") \
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index 1d80516..a8fcbc1 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -175,17 +175,24 @@
}
#ifndef PRODUCT
+static const char* kIsolateReloadTestLibSource =
+ "void reloadTest() native 'Reload_Test';\n";
+
+static const char* IsolateReloadTestLibUri() {
+ return FLAG_use_dart_frontend ? "test:isolate_reload_helper"
+ : "file:///test:isolate_reload_helper";
+}
+
static bool IsIsolateReloadTestLib(const char* url_name) {
- const char* kIsolateReloadTestLibUri = "test:isolate_reload_helper";
static const intptr_t kIsolateReloadTestLibUriLen =
- strlen(kIsolateReloadTestLibUri);
- return (strncmp(url_name, kIsolateReloadTestLibUri,
+ strlen(IsolateReloadTestLibUri());
+ return (strncmp(url_name, IsolateReloadTestLibUri(),
kIsolateReloadTestLibUriLen) == 0);
}
static Dart_Handle IsolateReloadTestLibSource() {
// Special library with one function.
- return DartUtils::NewString("void reloadTest() native 'Reload_Test';\n");
+ return DartUtils::NewString(kIsolateReloadTestLibSource);
}
static void ReloadTest(Dart_NativeArguments native_args) {
@@ -198,6 +205,12 @@
bool* auto_setup_scope) {
return ReloadTest;
}
+
+static Dart_Handle LoadIsolateReloadTestLib() {
+ return TestCase::LoadTestLibrary(IsolateReloadTestLibUri(),
+ kIsolateReloadTestLibSource,
+ IsolateReloadTestNativeResolver);
+}
#endif // !PRODUCT
static Dart_Handle ResolvePackageUri(const char* uri_chars) {
@@ -215,6 +228,10 @@
return FLAG_use_dart_frontend;
}
+bool TestCase::UsingStrongMode() {
+ return FLAG_strong;
+}
+
char* TestCase::CompileTestScriptWithDFE(const char* url,
const char* source,
void** kernel_pgm,
@@ -408,6 +425,12 @@
const char* lib_url,
bool finalize_classes) {
if (FLAG_use_dart_frontend) {
+#ifndef PRODUCT
+ if (strstr(script, IsolateReloadTestLibUri()) != NULL) {
+ Dart_Handle result = LoadIsolateReloadTestLib();
+ EXPECT_VALID(result);
+ }
+#endif // ifndef PRODUCT
Dart_SourceFile* sourcefiles = NULL;
intptr_t num_sources = BuildSourceFilesArray(&sourcefiles, script);
Dart_Handle result = LoadTestScriptWithDFE(num_sources, sourcefiles,
@@ -420,23 +443,26 @@
}
}
-Dart_Handle TestCase::LoadTestLibrary(const char* lib_uri, const char* script) {
+Dart_Handle TestCase::LoadTestLibrary(const char* lib_uri,
+ const char* script,
+ Dart_NativeEntryResolver resolver) {
if (FLAG_use_dart_frontend) {
const char* prefixed_lib_uri =
OS::SCreate(Thread::Current()->zone(), "file:///%s", lib_uri);
Dart_SourceFile sourcefiles[] = {{prefixed_lib_uri, script}};
- Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler);
- EXPECT_VALID(result);
void* kernel_pgm = NULL;
int sourcefiles_count = sizeof(sourcefiles) / sizeof(Dart_SourceFile);
char* error = TestCase::CompileTestScriptWithDFE(
- sourcefiles[0].uri, sourcefiles_count, sourcefiles, &kernel_pgm, false);
+ sourcefiles[0].uri, sourcefiles_count, sourcefiles, &kernel_pgm, true);
if (error != NULL) {
return Dart_NewApiError(error);
}
Dart_Handle url = NewString(prefixed_lib_uri);
- return Dart_LoadLibrary(url, Dart_Null(),
- reinterpret_cast<Dart_Handle>(kernel_pgm), 0, 0);
+ Dart_Handle lib = Dart_LoadLibrary(
+ url, Dart_Null(), reinterpret_cast<Dart_Handle>(kernel_pgm), 0, 0);
+ EXPECT_VALID(lib);
+ Dart_SetNativeResolver(lib, resolver, NULL);
+ return lib;
} else {
Dart_Handle url = NewString(lib_uri);
Dart_Handle source = NewString(script);
@@ -475,13 +501,20 @@
#ifndef PRODUCT
void TestCase::SetReloadTestScript(const char* script) {
- if (script_reload_key == kUnsetThreadLocalKey) {
- script_reload_key = OSThread::CreateThreadLocal();
+ if (FLAG_use_dart_frontend) {
+ Dart_SourceFile* sourcefiles = NULL;
+ intptr_t num_files = BuildSourceFilesArray(&sourcefiles, script);
+ KernelIsolate::UpdateInMemorySources(num_files, sourcefiles);
+ } else {
+ if (script_reload_key == kUnsetThreadLocalKey) {
+ script_reload_key = OSThread::CreateThreadLocal();
+ }
+ ASSERT(script_reload_key != kUnsetThreadLocalKey);
+ ASSERT(OSThread::GetThreadLocal(script_reload_key) == 0);
+ // Store the new script in TLS.
+ OSThread::SetThreadLocal(script_reload_key,
+ reinterpret_cast<uword>(script));
}
- ASSERT(script_reload_key != kUnsetThreadLocalKey);
- ASSERT(OSThread::GetThreadLocal(script_reload_key) == 0);
- // Store the new script in TLS.
- OSThread::SetThreadLocal(script_reload_key, reinterpret_cast<uword>(script));
}
Dart_Handle TestCase::TriggerReload() {
@@ -504,6 +537,16 @@
}
}
+Dart_Handle TestCase::GetReloadLibrary() {
+ Isolate* isolate = Isolate::Current();
+
+ if (isolate->reload_context() != NULL &&
+ isolate->reload_context()->reload_aborted()) {
+ return Dart_Null();
+ }
+ return Dart_RootLibrary();
+}
+
Dart_Handle TestCase::GetReloadErrorOrRootLibrary() {
Isolate* isolate = Isolate::Current();
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index 2e6221d..e8b1fc7 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -312,6 +312,7 @@
TestCase(RunEntry* run, const char* name) : TestCaseBase(name), run_(run) {}
static bool UsingDartFrontend();
+ static bool UsingStrongMode();
static char* CompileTestScriptWithDFE(const char* url,
const char* source,
@@ -326,7 +327,9 @@
Dart_NativeEntryResolver resolver,
const char* lib_uri = USER_TEST_URI,
bool finalize = true);
- static Dart_Handle LoadTestLibrary(const char* lib_uri, const char* script);
+ static Dart_Handle LoadTestLibrary(const char* lib_uri,
+ const char* script,
+ Dart_NativeEntryResolver resolver = NULL);
static Dart_Handle LoadTestScriptWithDFE(
int sourcefiles_count,
Dart_SourceFile sourcefiles[],
@@ -335,6 +338,7 @@
bool incrementally = true);
static Dart_Handle LoadCoreTestScript(const char* script,
Dart_NativeEntryResolver resolver);
+
static Dart_Handle lib();
static const char* url();
static Dart_Isolate CreateTestIsolateFromSnapshot(uint8_t* buffer,
@@ -355,8 +359,10 @@
// Initiates the reload.
static Dart_Handle TriggerReload();
- // Gets the result of a reload.
- static Dart_Handle GetReloadErrorOrRootLibrary();
+
+ // Returns the root library if the last reload was successful, otherwise
+ // returns Dart_Null().
+ static Dart_Handle GetReloadLibrary();
// Helper function which reloads the current isolate using |script|.
static Dart_Handle ReloadTestScript(const char* script);
@@ -377,6 +383,11 @@
const char* name,
void* data = NULL);
+ // Gets the result of a reload. This touches state in IsolateReloadContext
+ // that is zone allocated and should not be used if a reload is triggered
+ // using reloadTest() from package:isolate_reload_helper.
+ static Dart_Handle GetReloadErrorOrRootLibrary();
+
RunEntry* const run_;
};
@@ -658,6 +669,24 @@
} \
} while (0)
+#define EXPECT_NULL(handle) \
+ do { \
+ Dart_Handle tmp_handle = (handle); \
+ if (!Dart_IsNull(tmp_handle)) { \
+ dart::Expect(__FILE__, __LINE__) \
+ .Fail("expected '%s' to be a null handle.\n", #handle); \
+ } \
+ } while (0)
+
+#define EXPECT_NON_NULL(handle) \
+ do { \
+ Dart_Handle tmp_handle = (handle); \
+ if (Dart_IsNull(tmp_handle)) { \
+ dart::Expect(__FILE__, __LINE__) \
+ .Fail("expected '%s' to be a non-null handle.\n", #handle); \
+ } \
+ } while (0)
+
// Elide a substring which starts with some prefix and ends with a ".
//
// This is used to remove non-deterministic or fragile substrings from
diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart
index ed91dd4..f2a025e 100644
--- a/sdk/lib/_http/http_impl.dart
+++ b/sdk/lib/_http/http_impl.dart
@@ -376,7 +376,7 @@
_httpRequest._httpClientConnection.destroy();
return new Stream<List<int>>.empty().listen(null, onDone: onDone);
}
- var stream = _incoming;
+ Stream<List<int>> stream = _incoming;
if (_httpClient.autoUncompress &&
headers.value(HttpHeaders.CONTENT_ENCODING) == "gzip") {
stream = stream.transform(GZIP.decoder);
diff --git a/sdk/lib/_internal/js_runtime/lib/js_number.dart b/sdk/lib/_internal/js_runtime/lib/js_number.dart
index e1b1e07..c0867be 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_number.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_number.dart
@@ -55,6 +55,7 @@
return JS('num', r'# % #', this, b);
}
+ @NoInline() // Use invoke_dynamic_specializer instead of inlining.
JSNumber abs() => JS(
'returns:num;effects:none;depends:none;throws:never;gvn:true',
r'Math.abs(#)',
@@ -413,21 +414,26 @@
/**
* The interceptor class for [int]s.
*
- * This class implements double since in JavaScript all numbers are doubles, so
- * while we want to treat `2.0` as an integer for some operations, its
- * interceptor should answer `true` to `is double`.
+ * This class implements double (indirectly through JSNumber) since in
+ * JavaScript all numbers are doubles, so while we want to treat `2.0` as an
+ * integer for some operations, its interceptor should answer `true` to `is
+ * double`.
*/
class JSInt extends JSNumber implements int {
const JSInt();
@override
- JSInt abs() => super.abs();
+ @NoInline() // Use invoke_dynamic_specializer instead of inlining.
+ JSInt abs() => JS(
+ 'returns:int;effects:none;depends:none;throws:never;gvn:true',
+ r'Math.abs(#)',
+ this);
@override
- JSInt get sign => super.sign;
+ JSInt get sign => this > 0 ? 1 : this < 0 ? -1 : this;
@override
- JSInt operator -() => -super;
+ JSInt operator -() => JS('int', r'-#', this);
bool get isEven => (this & 1) == 0;
diff --git a/sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart b/sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart
new file mode 100644
index 0000000..6f8018a
--- /dev/null
+++ b/sdk/lib/_internal/js_runtime/lib/mirrors_patch_cfe.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Patch library for dart:mirrors.
+
+import 'dart:_js_helper' show patch;
+import 'dart:mirrors';
+
+const String _message = 'dart:mirrors is no longer supported for web apps';
+
+@patch
+MirrorSystem currentMirrorSystem() => throw new UnsupportedError(_message);
+
+@patch
+InstanceMirror reflect(Object reflectee) =>
+ throw new UnsupportedError(_message);
+
+@patch
+ClassMirror reflectClass(Type key) => throw new UnsupportedError(_message);
+
+@patch
+TypeMirror reflectType(Type key, [List<Type> typeArguments]) =>
+ throw new UnsupportedError(_message);
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index f6b6b26..bdc5a41 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -138,8 +138,8 @@
return result;
}
- void addEntries(Iterable<MapEntry<K, V>> entries) {
- for (var entry in entries) {
+ void addEntries(Iterable<MapEntry<K, V>> newEntries) {
+ for (var entry in newEntries) {
this[entry.key] = entry.value;
}
}
diff --git a/sdk/lib/core/annotations.dart b/sdk/lib/core/annotations.dart
index ff32c8d..3071723 100644
--- a/sdk/lib/core/annotations.dart
+++ b/sdk/lib/core/annotations.dart
@@ -166,6 +166,16 @@
}
/**
+ * This annotation is deprecated and will be removed in Dart 2.
+ *
+ * Dart 2 has a more restrictive type system than Dart 1, and it requires
+ * method access to be either through a known interface or by using
+ * dynamic invocations. The original intent of `@proxy` (to implement a class
+ * that isn't known statically, as documented at the end of this text),
+ * is not supported by Dart 2.
+ * To continue to perform dynamic invocations on an object,
+ * it should be accessed through a reference of type `dynamic`.
+ *
* The annotation `@proxy` marks a class as implementing members dynamically
* through `noSuchMethod`.
*
@@ -173,8 +183,7 @@
* superclass and interfaces.
*
* If a class is annotated with `@proxy`, or it implements any class that is
- * annotated, then the class is considered to implement any member with regard
- * to static type analysis.
+ * annotated, then all member accesses are allowed on an object of that type.
* As such, it is not a static type warning to access any member of the object
* which is not implemented by the class, or to call a method with a different
* number of parameters than it is declared with.
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index fe9ee96..77e40e0 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -172,6 +172,68 @@
static List<T> castFrom<S, T>(List<S> source) => new CastList<S, T>(source);
/**
+ * Copy a range of one list into another list.
+ *
+ * This is a utility function that can be used to implement methods like
+ * [setRange].
+ *
+ * The range from [start] to [end] must be a valid range of [source],
+ * and there must be room for `end - start` elements from position [at].
+ * If [start] is omitted, it defaults to zero.
+ * If [end] is omitted, it defaults to [source.length].
+ *
+ * If [source] and [target] is the same list, overlapping source and target
+ * ranges are respected so that the target range ends up containing the
+ * initial content of the source range.
+ * Otherwise the order of element copying is not guaranteed.
+ */
+ static void copyRange<T>(List<T> target, int at, List<T> source,
+ [int start, int end]) {
+ start ??= 0;
+ end = RangeError.checkValidRange(start, end, source.length);
+ int length = end - start;
+ if (target.length < at + length) {
+ throw new ArgumentError.value(target, "target",
+ "Not big enough to hold $length elements at position $at");
+ }
+ if (!identical(source, target) || start >= at) {
+ for (int i = 0; i < length; i++) {
+ target[at + i] = source[start + i];
+ }
+ } else {
+ for (int i = length; --i >= 0;) {
+ target[at + i] = source[start + i];
+ }
+ }
+ }
+
+ /**
+ * Write the elements of an iterable into a list.
+ *
+ * This is a utility function that can be used to implement methods like
+ * [setAll].
+ *
+ * The elements of [source] are written into [target] from position [at].
+ * The [source] must not contain more elements after writing the last
+ * position of [target].
+ *
+ * If the source is a list, the [copyRange] function is likely to be more
+ * efficient.
+ */
+ static void writeIterable<T>(List<T> target, int at, Iterable<T> source) {
+ RangeError.checkValueInInterval(at, 0, target.length, "at");
+ int index = at;
+ int targetLength = target.length;
+ for (var element in source) {
+ if (index == targetLength) {
+ throw new IndexError(targetLength, target);
+ }
+ target[index] = element;
+ index++;
+ }
+ }
+
+ /**
* Returns a view of this list as a list of [R] instances, if necessary.
*
* If this list is already a `List<R>`, it is returned unchanged.
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index 0cae297..9e9741a 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -248,7 +248,7 @@
/**
* Adds all key/value pairs of [newEntries] to this map.
*
- * If a key of [other] is already in this map,
+ * If a key of [newEntries] is already in this map,
* the corresponding value is overwritten.
*
* The operation is equivalent to doing `this[entry.key] = entry.value`
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index aa24f6d..b3d29f9 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -25422,6 +25422,65 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+@DocsEditable()
+@DomName('MutationEvent')
+// http://www.w3.org/TR/DOM-Level-3-Events/#events-mutationevents
+@deprecated
+@Native("MutationEvent")
+class MutationEvent extends Event {
+ // To suppress missing implicit constructor warnings.
+ factory MutationEvent._() {
+ throw new UnsupportedError("Not supported");
+ }
+
+ @DomName('MutationEvent.ADDITION')
+ @DocsEditable()
+ static const int ADDITION = 2;
+
+ @DomName('MutationEvent.MODIFICATION')
+ @DocsEditable()
+ static const int MODIFICATION = 1;
+
+ @DomName('MutationEvent.REMOVAL')
+ @DocsEditable()
+ static const int REMOVAL = 3;
+
+ @DomName('MutationEvent.attrChange')
+ @DocsEditable()
+ final int attrChange;
+
+ @DomName('MutationEvent.attrName')
+ @DocsEditable()
+ final String attrName;
+
+ @DomName('MutationEvent.newValue')
+ @DocsEditable()
+ final String newValue;
+
+ @DomName('MutationEvent.prevValue')
+ @DocsEditable()
+ final String prevValue;
+
+ @DomName('MutationEvent.relatedNode')
+ @DocsEditable()
+ final Node relatedNode;
+
+ @DomName('MutationEvent.initMutationEvent')
+ @DocsEditable()
+ void initMutationEvent(
+ String type,
+ bool bubbles,
+ bool cancelable,
+ Node relatedNode,
+ String prevValue,
+ String newValue,
+ String attrName,
+ int attrChange) native;
+}
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
@DomName('MutationObserver')
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
diff --git a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
index 466366f..715037b 100644
--- a/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
+++ b/sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart
@@ -534,8 +534,8 @@
@DomName('IDBFactory.open')
Future<Database> open(String name,
{int version,
- void onUpgradeNeeded(VersionChangeEvent),
- void onBlocked(Event)}) {
+ void onUpgradeNeeded(VersionChangeEvent event),
+ void onBlocked(Event event)}) {
if ((version == null) != (onUpgradeNeeded == null)) {
return new Future.error(new ArgumentError(
'version and onUpgradeNeeded must be specified together'));
@@ -1447,11 +1447,10 @@
@DocsEditable()
Stream<Event> get onError => errorEvent.forTarget(this);
}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-@DocsEditable()
@DomName('IDBVersionChangeEvent')
@Unstable()
@Native("IDBVersionChangeEvent")
@@ -1499,4 +1498,9 @@
@Creates('int|String|Null')
@Returns('int|String|Null')
final int oldVersion;
+
+ @JSName('target')
+ @DomName('IDBVersionChangeEvent.target')
+ @DocsEditable()
+ final OpenDBRequest target;
}
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index e1a1a6e..c2b21b0 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -152,7 +152,7 @@
"uri": "async/async.dart"
},
"mirrors": {
- "patches": "_internal/js_runtime/lib/mirrors_patch.dart",
+ "patches": "_internal/js_runtime/lib/mirrors_patch_cfe.dart",
"uri": "mirrors/mirrors.dart"
},
"_interceptors": {
@@ -259,4 +259,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/sdk/lib/mirrors/mirrors.dart b/sdk/lib/mirrors/mirrors.dart
index 5f6aca9..6b455c6 100644
--- a/sdk/lib/mirrors/mirrors.dart
+++ b/sdk/lib/mirrors/mirrors.dart
@@ -173,7 +173,7 @@
*
* Optionally takes a list of [typeArguments] for generic classes. If the list
* is provided, then the [key] must be a generic class type, and the number of
- * the provided type arguments must be equal to the number of type variables
+ * the provided type arguments must be equal to the number of type variables
* declared by the class.
*
* Note that since one cannot obtain a [Type] object from another isolate, this
@@ -452,7 +452,7 @@
InstanceMirror setField(Symbol fieldName, Object value);
/**
- * Performs [invocation] on [reflectee].
+ * Performs [invocation] on the reflectee of this [ObjectMirror].
*
* Equivalent to
*
@@ -460,7 +460,7 @@
* return this.getField(invocation.memberName).reflectee;
* } else if (invocation.isSetter) {
* return this.setField(invocation.memberName,
- * invocation.positionArguments[0]).reflectee;
+ * invocation.positionalArguments[0]).reflectee;
* } else {
* return this.invoke(invocation.memberName,
* invocation.positionalArguments,
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index dffed23..a526bd4 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -5994,7 +5994,6 @@
LayoutTests/fast/dom/Range/mutation_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/Range/range-comparePoint_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/Range/range-constructor_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/dom/Range/range-created-during-remove-children_t01: RuntimeError
LayoutTests/fast/dom/Range/range-detached-exceptions_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/Range/range-exceptions_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/Range/range-expand_t01: RuntimeError # Please triage this failure
@@ -6002,7 +6001,6 @@
LayoutTests/fast/dom/Range/range-insertNode-splittext_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/Range/range-isPointInRange_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/Range/range-on-detached-node_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/dom/Range/remove-twice-crash_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/Range/surroundContents-for-detached-node_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/SelectorAPI/dumpNodeList-2_t01: RuntimeError # Please triage this failure
LayoutTests/fast/dom/SelectorAPI/dumpNodeList_t01: RuntimeError # Please triage this failure
@@ -6161,7 +6159,6 @@
LayoutTests/fast/events/mutation-during-replace-child-2_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/mutation-during-replace-child_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/overflowchanged-event-raf-timing_t01: Skip # Times out. Please triage this failure
-LayoutTests/fast/events/scoped/editing-commands_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/scroll-event-does-not-bubble_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/tabindex-removal-from-focused-element_t01: RuntimeError # Please triage this failure
LayoutTests/fast/exclusions/parsing/parsing-wrap-flow_t01: RuntimeError # Please triage this failure
@@ -6271,8 +6268,6 @@
LayoutTests/fast/forms/plaintext-mode-1_t01: RuntimeError # Please triage this failure
LayoutTests/fast/forms/search-popup-crasher_t01: Pass, RuntimeError # Fails on 7.1. Please triage this failure
LayoutTests/fast/forms/select-max-length_t01: Pass, RuntimeError # Issue 29634
-LayoutTests/fast/forms/select-set-length-with-mutation-remove_t01: RuntimeError
-LayoutTests/fast/forms/select-set-length-with-mutation-reparent_t01: RuntimeError
LayoutTests/fast/forms/selection-wrongtype_t01: RuntimeError # Please triage this failure
LayoutTests/fast/forms/setrangetext_t01: RuntimeError # Please triage this failure
LayoutTests/fast/forms/textarea-maxlength_t01: RuntimeError # Please triage this failure
@@ -6991,9 +6986,6 @@
LibTest/core/Uri/Uri_A06_t03: Slow, Pass # Please triage this failure
LibTest/math/Point/operator_mult_A02_t01: RuntimeError # Issue 1533
-[ $compiler == dart2js && $checked && $fast_startup ]
-Language/Statements/Break/async_loops_t02: RuntimeError
-
[ $compiler == dart2js && !$checked && $enable_asserts ]
Language/Statements/Assert/execution_t01: SkipByDesign # Unspec'd feature.
Language/Statements/Assert/execution_t02: SkipByDesign # Unspec'd feature.
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index d3b5419..e4570b3 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -73,13 +73,10 @@
Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t03: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t05: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/superclass_constructor_t06: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t05: MissingCompileTimeError
Language/Classes/Instance_Variables/constant_t01: MissingCompileTimeError
Language/Classes/Static_Methods/declaration_t01: MissingCompileTimeError
Language/Classes/Superclasses/wrong_superclass_t08: MissingCompileTimeError
Language/Classes/Superinterfaces/wrong_type_t05: MissingCompileTimeError
-Language/Classes/declarations_t33: MissingCompileTimeError
Language/Classes/same_name_type_variable_t04: MissingCompileTimeError
Language/Classes/same_name_type_variable_t07: MissingCompileTimeError
Language/Expressions/Constants/bitwise_operators_t02: MissingCompileTimeError
@@ -238,6 +235,9 @@
[ $compiler == dartkp && $mode == debug ]
Language/Functions/External_Functions/not_connected_to_a_body_t01: Crash
+[ $compiler == dartkp && $minified ]
+Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/no_such_method_t01: RuntimeError # Compares new Symbol with noSuchMethod actual name.
+
[ $compiler == dartkp && $strong ]
*: SkipByDesign
@@ -272,12 +272,10 @@
Language/Expressions/Constants/depending_on_itself_t03: Crash
Language/Expressions/Constants/math_operators_t04: Crash
Language/Expressions/Constants/math_operators_t05: Crash
-Language/Expressions/Instance_Creation/New/evaluation_t19: CompileTimeError # Issue 31938
-Language/Expressions/Instance_Creation/New/evaluation_t20: CompileTimeError # Issue 31938
+Language/Expressions/Instance_Creation/New/evaluation_t19: RuntimeError # Issue 31938
+Language/Expressions/Instance_Creation/New/evaluation_t20: RuntimeError # Issue 31938
Language/Functions/External_Functions/not_connected_to_a_body_t01: RuntimeError # Dartk Issue 28565
-Language/Libraries_and_Scripts/Imports/deferred_import_t01: CompileTimeError # Deferred loading kernel issue 28335.
-Language/Libraries_and_Scripts/Imports/deferred_import_t02: CompileTimeError # Deferred loading kernel issue 28335.
-Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t03: CompileTimeError
+Language/Libraries_and_Scripts/Imports/deferred_import_t01: RuntimeError # Deferred loading kernel issue 28335.
Language/Libraries_and_Scripts/Imports/same_name_t10: RuntimeError
Language/Libraries_and_Scripts/Imports/static_type_t01: Skip # No support for deferred libraries.
Language/Metadata/before_export_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
@@ -294,7 +292,6 @@
Language/Metadata/before_param_t09: RuntimeError # Issue 28434: Kernel IR misses these annotations.
Language/Metadata/before_typedef_t01: RuntimeError # Issue 28434: Kernel IR misses these annotations.
Language/Mixins/Mixin_Application/syntax_t16: CompileTimeError # Issue 25765
-Language/Types/Dynamic_Type_System/deferred_type_error_t01: CompileTimeError
Language/Types/Type_Void/syntax_t01: Pass # Issue 30470
LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: Skip # No support for deferred libraries.
LibTest/isolate/Isolate/spawnUri_A01_t06: Skip
diff --git a/tests/co19_2/co19_2-kernel.status b/tests/co19_2/co19_2-kernel.status
index 4632eb0..5eb6348 100644
--- a/tests/co19_2/co19_2-kernel.status
+++ b/tests/co19_2/co19_2-kernel.status
@@ -45,8 +45,6 @@
Language/Classes/Constructors/Generative_Constructors/redirection_t07: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/redirection_t08: MissingCompileTimeError
Language/Classes/Constructors/Generative_Constructors/static_type_t01: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t04: MissingCompileTimeError
-Language/Classes/Constructors/Generative_Constructors/syntax_t05: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t01: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t02: MissingCompileTimeError
Language/Classes/Getters/instance_getter_t03: MissingCompileTimeError
@@ -91,7 +89,6 @@
Language/Classes/Superinterfaces/wrong_type_t05: MissingCompileTimeError
Language/Classes/declarations_t06: MissingCompileTimeError
Language/Classes/declarations_t08: MissingCompileTimeError
-Language/Classes/declarations_t33: MissingCompileTimeError
Language/Classes/definition_t23: CompileTimeError
Language/Classes/method_definition_t03: MissingCompileTimeError
Language/Classes/method_definition_t04: MissingCompileTimeError
diff --git a/tests/compiler/dart2js/constant_expression_evaluate_test.dart b/tests/compiler/dart2js/constant_expression_evaluate_test.dart
index 08a7251..c281b3f 100644
--- a/tests/compiler/dart2js/constant_expression_evaluate_test.dart
+++ b/tests/compiler/dart2js/constant_expression_evaluate_test.dart
@@ -480,9 +480,19 @@
class B {
const B() : assert(true, "Message");
}
+ class C {
+ final a;
+ const C(this.a);
+ }
+ class D extends C {
+ final b;
+ const D(c) : super(c + 1), b = c + 2;
+ }
''', const [
const ConstantData(r'const A()', 'ConstructedConstant(A())'),
const ConstantData(r'const B()', 'ConstructedConstant(B())'),
+ const ConstantData(r'const D(0)',
+ 'ConstructedConstant(D(a=IntConstant(1),b=IntConstant(2)))'),
]),
];
diff --git a/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart b/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
index 62d2eb1..6fa2be5 100644
--- a/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
+++ b/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
@@ -31,6 +31,10 @@
factory C3.fact() => C3.gen();
C3.gen();
}
+ void F9<U extends V, V>(U u, V v) {}
+ F10() {
+ void local<A extends B, B>(A a, B b) {}
+ }
"""), compileMode: CompileMode.kernel, options: [Flags.strongMode]);
testToString(FunctionType type, String expectedToString) {
@@ -83,6 +87,21 @@
FunctionType F6 = env.getFieldType('F6');
FunctionType F7 = env.getFieldType('F7');
FunctionType F8 = env.getFieldType('F8');
+ FunctionType F9 = env.getMemberType('F9');
+ FunctionType F10 = env.getClosureType('F10');
+
+ List<FunctionType> all = <FunctionType>[
+ F1,
+ F2,
+ F3,
+ F4,
+ F5,
+ F6,
+ F7,
+ F8,
+ F9,
+ F10,
+ ];
testToString(F1, 'void Function<#A>(#A)');
testToString(F2, 'void Function<#A>(#A)');
@@ -92,6 +111,8 @@
testToString(F6, 'void Function<#A extends int>(#A)');
testToString(F7, 'void Function<#A extends num>(#A,[int])');
testToString(F8, '#A Function<#A extends num>(#A)');
+ testToString(F9, 'void Function<#A extends #B,#B>(#A,#B)');
+ testToString(F10, 'void Function<#A extends #B,#B>(#A,#B)');
testBounds(F1, [Object_]);
testBounds(F2, [Object_]);
@@ -101,6 +122,8 @@
testBounds(F6, [int_]);
testBounds(F7, [num_]);
testBounds(F8, [num_]);
+ testBounds(F9, [F9.typeVariables.last, Object_]);
+ testBounds(F10, [F10.typeVariables.last, Object_]);
testInstantiate(F1, [C1], 'void Function(C1)');
testInstantiate(F2, [C2], 'void Function(C2)');
@@ -110,78 +133,31 @@
testInstantiate(F6, [int_], 'void Function(int)');
testInstantiate(F7, [int_], 'void Function(int,[int])');
testInstantiate(F8, [int_], 'int Function(int)');
+ testInstantiate(F9, [int_, num_], 'void Function(int,num)');
+ testInstantiate(F10, [int_, num_], 'void Function(int,num)');
- testRelations(F1, F1, areEqual: true);
- testRelations(F1, F2, areEqual: true);
- testRelations(F1, F3);
- testRelations(F1, F4);
- testRelations(F1, F5);
- testRelations(F1, F6);
- testRelations(F1, F7);
- testRelations(F1, F8);
+ Map<FunctionType, List<FunctionType>> expectedEquals =
+ <FunctionType, List<FunctionType>>{
+ F1: [F2],
+ F2: [F1],
+ F9: [F10],
+ F10: [F9],
+ };
- testRelations(F2, F1, areEqual: true);
- testRelations(F2, F2, areEqual: true);
- testRelations(F2, F3);
- testRelations(F2, F4);
- testRelations(F2, F5);
- testRelations(F2, F6);
- testRelations(F2, F7);
- testRelations(F2, F8);
+ Map<FunctionType, List<FunctionType>> expectedSubtype =
+ <FunctionType, List<FunctionType>>{
+ F7: [F5],
+ F8: [F5],
+ };
- testRelations(F3, F1);
- testRelations(F3, F2);
- testRelations(F3, F3, areEqual: true);
- testRelations(F3, F4);
- testRelations(F3, F5);
- testRelations(F3, F6);
- testRelations(F3, F7);
- testRelations(F3, F8);
-
- testRelations(F4, F1);
- testRelations(F4, F2);
- testRelations(F4, F3);
- testRelations(F4, F4, areEqual: true);
- testRelations(F4, F5);
- testRelations(F4, F6);
- testRelations(F4, F7);
- testRelations(F4, F8);
-
- testRelations(F5, F1);
- testRelations(F5, F2);
- testRelations(F5, F3);
- testRelations(F5, F4);
- testRelations(F5, F5, areEqual: true);
- testRelations(F5, F6);
- testRelations(F5, F7);
- testRelations(F5, F8);
-
- testRelations(F6, F1);
- testRelations(F6, F2);
- testRelations(F6, F3);
- testRelations(F6, F4);
- testRelations(F6, F5);
- testRelations(F6, F6, areEqual: true);
- testRelations(F6, F7);
- testRelations(F6, F8);
-
- testRelations(F7, F1);
- testRelations(F7, F2);
- testRelations(F7, F3);
- testRelations(F7, F4);
- testRelations(F7, F5, isSubtype: true);
- testRelations(F7, F6);
- testRelations(F7, F7, areEqual: true);
- testRelations(F7, F8);
-
- testRelations(F8, F1);
- testRelations(F8, F2);
- testRelations(F8, F3);
- testRelations(F8, F4);
- testRelations(F8, F5, isSubtype: true);
- testRelations(F8, F6);
- testRelations(F8, F7);
- testRelations(F8, F8, areEqual: true);
+ for (FunctionType f1 in all) {
+ for (FunctionType f2 in all) {
+ testRelations(f1, f2,
+ areEqual: identical(f1, f2) ||
+ (expectedEquals[f1]?.contains(f2) ?? false),
+ isSubtype: expectedSubtype[f1]?.contains(f2) ?? false);
+ }
+ }
testRelations(F1.typeVariables.first, F1.typeVariables.first,
areEqual: true);
diff --git a/tests/compiler/dart2js/generic_methods/generic_method_test.dart b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
index 4065293..668e99c 100644
--- a/tests/compiler/dart2js/generic_methods/generic_method_test.dart
+++ b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
@@ -92,6 +92,12 @@
}
}
+// Nested generic local function.
+outside<T>() {
+ nested<T>(T t) => '';
+ return nested;
+}
+
main(args) {
method1<int>(0);
method2<String, double>(0.5, 'foo');
@@ -109,6 +115,7 @@
print('noSuchMethod: Class2.method6<int>');
print('');
}
+ outside();
}
''';
@@ -162,7 +169,7 @@
}, options: [
Flags.useKernel,
Flags.strongMode,
- Flags.disableRtiOptimization
+ Flags.disableRtiOptimization,
], expectedOutput: OUTPUT, printJs: args.contains('-v'));
ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
diff --git a/tests/compiler/dart2js/old_frontend/type_variable_occurrence_test.dart b/tests/compiler/dart2js/old_frontend/type_variable_occurrence_test.dart
index a85c307..ac88d12 100644
--- a/tests/compiler/dart2js/old_frontend/type_variable_occurrence_test.dart
+++ b/tests/compiler/dart2js/old_frontend/type_variable_occurrence_test.dart
@@ -58,7 +58,7 @@
ClassElement A = env.getElement('A');
expect(bool expectResult, String memberName) {
- ResolutionDartType memberType = env.getMemberType(A, memberName);
+ ResolutionDartType memberType = env.getMemberType(memberName, A);
ResolutionTypeVariableType typeVariable =
memberType.typeVariableOccurrence;
if (expectResult) {
diff --git a/tests/compiler/dart2js/rti/emission/arguments.dart b/tests/compiler/dart2js/rti/emission/arguments.dart
index 328e684..30b4f2e 100644
--- a/tests/compiler/dart2js/rti/emission/arguments.dart
+++ b/tests/compiler/dart2js/rti/emission/arguments.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
class A {}
-/*class: B:checks=[]*/
+/*class: B:checks=[],typeArgument*/
class B {}
-/*class: C:checks=[]*/
+/*class: C:checkedInstance,checks=[],instance*/
class C<T> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/call.dart b/tests/compiler/dart2js/rti/emission/call.dart
index d603eab..41faae4 100644
--- a/tests/compiler/dart2js/rti/emission/call.dart
+++ b/tests/compiler/dart2js/rti/emission/call.dart
@@ -5,7 +5,7 @@
import 'package:expect/expect.dart';
import 'package:meta/dart2js.dart';
-/*class: A:checks=[$isFunction]*/
+/*class: A:checks=[$isFunction],instance*/
class A {
call() {}
}
diff --git a/tests/compiler/dart2js/rti/emission/closure_function.dart b/tests/compiler/dart2js/rti/emission/closure_function.dart
index 82d8712..9604fba 100644
--- a/tests/compiler/dart2js/rti/emission/closure_function.dart
+++ b/tests/compiler/dart2js/rti/emission/closure_function.dart
@@ -8,6 +8,6 @@
test(o) => o is Function;
main() {
- test(/*checks=[]*/ () {});
+ test(/*checks=[],instance*/ () {});
test(null);
}
diff --git a/tests/compiler/dart2js/rti/emission/closure_function_type.dart b/tests/compiler/dart2js/rti/emission/closure_function_type.dart
index 0c7e05b..f8560ed 100644
--- a/tests/compiler/dart2js/rti/emission/closure_function_type.dart
+++ b/tests/compiler/dart2js/rti/emission/closure_function_type.dart
@@ -8,6 +8,6 @@
test(o) => o is Function();
main() {
- test(/*checks=[]*/ () {});
- test(/*checks=[]*/ (a) {});
+ test(/*checks=[],instance*/ () {});
+ test(/*checks=[],instance*/ (a) {});
}
diff --git a/tests/compiler/dart2js/rti/emission/generic_instanceof4.dart b/tests/compiler/dart2js/rti/emission/generic_instanceof4.dart
index 45ab17f..46cc720 100644
--- a/tests/compiler/dart2js/rti/emission/generic_instanceof4.dart
+++ b/tests/compiler/dart2js/rti/emission/generic_instanceof4.dart
@@ -4,7 +4,7 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checks=[],instance*/
class A<T> {
@noInline
foo(x) {
@@ -12,10 +12,10 @@
}
}
-/*class: BB:checks=[]*/
+/*class: BB:checkedInstance,checks=[],typeArgument*/
class BB {}
-/*class: B:checks=[$isBB]*/
+/*class: B:checks=[$isBB],instance*/
class B<T> implements BB {
@noInline
foo() {
diff --git a/tests/compiler/dart2js/rti/emission/inherited_is.dart b/tests/compiler/dart2js/rti/emission/inherited_is.dart
index 618b16f..6e071e9 100644
--- a/tests/compiler/dart2js/rti/emission/inherited_is.dart
+++ b/tests/compiler/dart2js/rti/emission/inherited_is.dart
@@ -5,6 +5,7 @@
import 'package:expect/expect.dart';
import 'package:meta/dart2js.dart';
+/*class: A:checkedInstance*/
class A {}
/*class: B:checks=[]*/
@@ -13,7 +14,7 @@
/*class: C:checks=[$isA]*/
class C = Object with B;
-/*class: D:checks=[]*/
+/*class: D:checks=[],instance*/
class D extends C {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/inherited_is2.dart b/tests/compiler/dart2js/rti/emission/inherited_is2.dart
index a703a2b..13739e1 100644
--- a/tests/compiler/dart2js/rti/emission/inherited_is2.dart
+++ b/tests/compiler/dart2js/rti/emission/inherited_is2.dart
@@ -5,6 +5,7 @@
import 'package:expect/expect.dart';
import 'package:meta/dart2js.dart';
+/*class: A:checkedInstance*/
class A {}
/*class: B:checks=[$isA]*/
@@ -13,7 +14,7 @@
/*class: C:checks=[]*/
class C extends B {}
-/*class: D:checks=[]*/
+/*class: D:checks=[],instance*/
class D extends C {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/list.dart b/tests/compiler/dart2js/rti/emission/list.dart
index b5d777c..bfcd830 100644
--- a/tests/compiler/dart2js/rti/emission/list.dart
+++ b/tests/compiler/dart2js/rti/emission/list.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: global#JSArray:checks=[$isIterable]*/
-/*class: global#Iterable:*/
+/*class: global#JSArray:checkedInstance,checks=[$isIterable],instance*/
+/*class: global#Iterable:checkedInstance*/
-/*class: A:checks=[]*/
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
class A {}
-/*class: B:checks=[]*/
+/*class: B:checks=[],typeArgument*/
class B {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/map_literal.dart b/tests/compiler/dart2js/rti/emission/map_literal.dart
index 1b86df4..d666180 100644
--- a/tests/compiler/dart2js/rti/emission/map_literal.dart
+++ b/tests/compiler/dart2js/rti/emission/map_literal.dart
@@ -2,11 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*class: global#Map:*/
+/*class: global#Map:instance*/
/*class: global#LinkedHashMap:*/
-/*class: global#JsLinkedHashMap:checks=[]*/
-/*class: global#double:checks=[]*/
-/*class: global#JSDouble:checks=[]*/
+/*class: global#JsLinkedHashMap:checks=[],instance*/
+/*class: global#double:checks=[],instance,typeArgument*/
+/*class: global#JSDouble:checks=[],instance*/
main() {
<int, double>{}[0] = 0.5;
diff --git a/tests/compiler/dart2js/rti/emission/map_literal_checked.dart b/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
index c074638..2f51833 100644
--- a/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
+++ b/tests/compiler/dart2js/rti/emission/map_literal_checked.dart
@@ -2,12 +2,12 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*class: global#Map:checks=[]*/
-/*class: global#LinkedHashMap:*/
-/*class: global#JsLinkedHashMap:checks=[$isLinkedHashMap]*/
-/*class: global#double:checks=[]*/
-/*class: global#JSNumber:checks=[$isdouble,$isnum]*/
-/*class: global#JSDouble:checks=[]*/
+/*class: global#Map:checkedInstance,checks=[],instance*/
+/*class: global#LinkedHashMap:checkedInstance*/
+/*class: global#JsLinkedHashMap:checkedInstance,checks=[$isLinkedHashMap],instance*/
+/*class: global#double:checkedInstance,checks=[],instance,typeArgument*/
+/*class: global#JSNumber:checks=[$isdouble,$isnum],instance*/
+/*class: global#JSDouble:checks=[],instance*/
main() {
<int, double>{}[0] = 0.5;
diff --git a/tests/compiler/dart2js/rti/emission/mixin_mixin2.dart b/tests/compiler/dart2js/rti/emission/mixin_mixin2.dart
index 747c430..5c1ed6a 100644
--- a/tests/compiler/dart2js/rti/emission/mixin_mixin2.dart
+++ b/tests/compiler/dart2js/rti/emission/mixin_mixin2.dart
@@ -23,16 +23,16 @@
/*class: D:checks=[$asM]*/
class D<V> = Object with C<Set<V>>;
-/*class: E:checks=[$asM]*/
+/*class: E:checks=[$asM],instance*/
class E extends A<num> {}
-/*class: F:checks=[$asM]*/
+/*class: F:checks=[$asM],instance*/
class F extends B<String> {}
-/*class: G:checks=[]*/
+/*class: G:checks=[],instance*/
class G<T> extends C<T> {}
-/*class: H:checks=[$asM]*/
+/*class: H:checks=[$asM],instance*/
class H<T> extends D<Map<String, T>> {}
main() {
diff --git a/tests/compiler/dart2js/rti/emission/mixin_mixin4.dart b/tests/compiler/dart2js/rti/emission/mixin_mixin4.dart
index 7d42422..8a1e159 100644
--- a/tests/compiler/dart2js/rti/emission/mixin_mixin4.dart
+++ b/tests/compiler/dart2js/rti/emission/mixin_mixin4.dart
@@ -4,23 +4,26 @@
import "package:expect/expect.dart";
+/*class: I:checkedInstance*/
class I<T> {}
+/*class: J:checkedInstance*/
class J<T> {}
-/*class: S:checks=[]*/
+/*class: S:checkedInstance,checks=[]*/
class S<T> {}
-/*class: M:checks=[]*/
+/*class: M:checkedInstance,checks=[]*/
class M<T> {
t() {
return T;
}
}
+/*class: A:checkedInstance*/
class A<U, V> = Object with M<Map<U, V>> implements I<V>;
-/*class: C:checks=[$asA,$asI,$asJ,$asM,$asS,$isA,$isI,$isJ]*/
+/*class: C:checks=[$asA,$asI,$asJ,$asM,$asS,$isA,$isI,$isJ],instance*/
class C<T, K> = S<T> with A<T, List<K>> implements J<K>;
@NoInline()
diff --git a/tests/compiler/dart2js/rti/emission/mixin_type_arguments.dart b/tests/compiler/dart2js/rti/emission/mixin_type_arguments.dart
index 6067cef..cc6f668 100644
--- a/tests/compiler/dart2js/rti/emission/mixin_type_arguments.dart
+++ b/tests/compiler/dart2js/rti/emission/mixin_type_arguments.dart
@@ -19,7 +19,7 @@
/*class: E:checks=[]*/
class E {}
-/*class: F:checks=[]*/
+/*class: F:checks=[],typeArgument*/
class F {}
/*class: M1:checks=[]*/
@@ -47,35 +47,35 @@
m5() => "M5<$Tm5>";
}
-/*class: C1:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: C1:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class C1 = Object with M1, M2<A>, M3, M4<B>, M5<C>;
-/*class: C2:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: C2:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class C2 = Object with M1<A>, M2<B>, M3<C>, M4<D>, M5<E>;
-/*class: C3:checks=[$asM1,$asM3,$asM4,$asM5]*/
+/*class: C3:checks=[$asM1,$asM3,$asM4,$asM5],instance*/
class C3<T> = Object with M1<A>, M2<T>, M3, M4, M5<B>;
-/*class: C4:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: C4:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class C4 extends Object with M1, M2<A>, M3, M4<B>, M5<C> {}
-/*class: C5:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: C5:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class C5 extends Object with M1<A>, M2<B>, M3<C>, M4<D>, M5<E> {}
-/*class: C6:checks=[$asM1,$asM3,$asM4,$asM5]*/
+/*class: C6:checks=[$asM1,$asM3,$asM4,$asM5],instance*/
class C6<T> extends Object with M1<A>, M2<T>, M3, M4, M5<B> {}
-/*class: C7:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: C7:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class C7 = Object with M1<A>, M2<A>, M3<A>, M4<A>, M5<A>;
-/*class: C8:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: C8:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class C8 extends Object with M1<A>, M2<A>, M3<A>, M4<A>, M5<A> {}
-/*class: C9:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: C9:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class C9 = Object
with M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>;
-/*class: CA:checks=[$asM1,$asM2,$asM3,$asM4,$asM5]*/
+/*class: CA:checks=[$asM1,$asM2,$asM3,$asM4,$asM5],instance*/
class CA extends Object
with M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>> {}
diff --git a/tests/compiler/dart2js/rti/emission/native.dart b/tests/compiler/dart2js/rti/emission/native.dart
index c7bfb9f..edcf75a 100644
--- a/tests/compiler/dart2js/rti/emission/native.dart
+++ b/tests/compiler/dart2js/rti/emission/native.dart
@@ -8,10 +8,11 @@
// ignore: import_internal_library
import 'dart:_foreign_helper' show JS;
-/*class: Purple:checks=[$isPurple]*/
+/*class: Purple:checkedInstance,checks=[$isPurple],instance*/
@Native('PPPP')
class Purple {}
+/*class: Q:instance*/
@Native('QQQQ')
class Q {}
diff --git a/tests/compiler/dart2js/rti/emission/regress_18713.dart b/tests/compiler/dart2js/rti/emission/regress_18713.dart
index 8d0ff99..b923d1d 100644
--- a/tests/compiler/dart2js/rti/emission/regress_18713.dart
+++ b/tests/compiler/dart2js/rti/emission/regress_18713.dart
@@ -16,7 +16,7 @@
Type get getSType => Y;
}
-/*class: TS:checks=[$asS0,$asT]*/
+/*class: TS:checks=[$asS0,$asT],instance*/
class TS<A, B> = T<A> with S<B>;
@NoInline()
diff --git a/tests/compiler/dart2js/rti/emission/runtime_type.dart b/tests/compiler/dart2js/rti/emission/runtime_type.dart
index c9973eb..8e7fd19 100644
--- a/tests/compiler/dart2js/rti/emission/runtime_type.dart
+++ b/tests/compiler/dart2js/rti/emission/runtime_type.dart
@@ -2,10 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*class: A:checks=[]*/
+/*class: A:checks=[],instance*/
class A<T> {}
-/*class: B:checks=[]*/
+/*class: B:checks=[],typeArgument*/
class B<T> {}
main() {
diff --git a/tests/compiler/dart2js/rti/emission/self.dart b/tests/compiler/dart2js/rti/emission/self.dart
index 76c29c4..a6aa4a6 100644
--- a/tests/compiler/dart2js/rti/emission/self.dart
+++ b/tests/compiler/dart2js/rti/emission/self.dart
@@ -4,7 +4,7 @@
import 'package:meta/dart2js.dart';
-/*class: C:checks=[]*/
+/*class: C:checkedInstance,checks=[],instance*/
class C {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/self_generic.dart b/tests/compiler/dart2js/rti/emission/self_generic.dart
index 793f276..ca5bc11 100644
--- a/tests/compiler/dart2js/rti/emission/self_generic.dart
+++ b/tests/compiler/dart2js/rti/emission/self_generic.dart
@@ -4,7 +4,7 @@
import 'package:meta/dart2js.dart';
-/*class: C:checks=[]*/
+/*class: C:checkedInstance,checks=[],instance*/
class C<T> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/subtype_named_args.dart b/tests/compiler/dart2js/rti/emission/subtype_named_args.dart
index b2b1cc7..3291f16 100644
--- a/tests/compiler/dart2js/rti/emission/subtype_named_args.dart
+++ b/tests/compiler/dart2js/rti/emission/subtype_named_args.dart
@@ -6,25 +6,25 @@
import 'package:expect/expect.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
class A {}
-/*class: A1:checks=[]*/
+/*class: A1:checkedTypeArgument,checks=[],typeArgument*/
class A1 {}
-/*class: A2:checks=[]*/
+/*class: A2:checkedTypeArgument,checks=[],typeArgument*/
class A2 {}
-/*class: B:checks=[$isA,$isA1,$isA2]*/
+/*class: B:checkedTypeArgument,checks=[$isA,$isA1,$isA2],typeArgument*/
class B implements A, A1, A2 {}
-/*class: C:checks=[$isA,$isA1,$isA2,$isB]*/
+/*class: C:checkedTypeArgument,checks=[$isA,$isA1,$isA2,$isB],typeArgument*/
class C implements B {}
-/*class: D:checks=[$isA,$isA1,$isA2,$isB,$isC]*/
+/*class: D:checkedTypeArgument,checks=[$isA,$isA1,$isA2,$isB,$isC],typeArgument*/
class D implements C {}
-/*class: G:checks=[]*/
+/*class: G:checkedTypeArgument,checks=[],typeArgument*/
class G<T, S, U, W> {}
typedef classesFunc({A a, B b, C c, D d});
@@ -45,35 +45,46 @@
typedef okWithDynamicFunc_2({int x, bool y, List<Map> z, classesFunc v});
main() {
- Expect.isTrue(/*checks=[]*/ ({D a, B b, C c, A d}) {} is classesFunc);
- Expect.isTrue(/*checks=[]*/ ({A a, A b, A c, A d}) {} is classesFunc);
- Expect.isTrue(/*checks=[]*/ ({D a, A1 b, A1 c, A1 d}) {} is classesFunc);
- Expect.isTrue(/*checks=[]*/ ({D a, A2 b, A2 c, A2 d}) {} is classesFunc);
- Expect.isTrue(/*checks=[]*/ ({D a, D b, D c, D d}) {} is classesFunc);
- Expect.isTrue(/*checks=[]*/ ({var a, var b, var c, var d}) {} is classesFunc);
- Expect.isTrue(/*checks=[]*/ ({Object a, Object b, Object c, Object d}) {}
- is classesFunc);
+ Expect
+ .isTrue(/*checks=[],instance*/ ({D a, B b, C c, A d}) {} is classesFunc);
+ Expect
+ .isTrue(/*checks=[],instance*/ ({A a, A b, A c, A d}) {} is classesFunc);
+ Expect.isTrue(
+ /*checks=[],instance*/ ({D a, A1 b, A1 c, A1 d}) {} is classesFunc);
+ Expect.isTrue(
+ /*checks=[],instance*/ ({D a, A2 b, A2 c, A2 d}) {} is classesFunc);
+ Expect
+ .isTrue(/*checks=[],instance*/ ({D a, D b, D c, D d}) {} is classesFunc);
+ Expect.isTrue(
+ /*checks=[],instance*/ ({var a, var b, var c, var d}) {} is classesFunc);
+ Expect.isTrue(/*checks=[],instance*/ (
+ {Object a, Object b, Object c, Object d}) {} is classesFunc);
- Expect.isTrue(/*checks=[]*/ (
+ Expect.isTrue(/*checks=[],instance*/ (
{Map<num, num> m,
List<List<A1>> l,
G<A, A1, A1, A1> g}) {} is genericsFunc);
Expect.isTrue(
- /*checks=[]*/ ({Map<int, int> m, List<List<D>> l, G<D, D, D, D> g}) {}
- is genericsFunc);
- Expect.isTrue(/*checks=[]*/ ({var m, var l, var g}) {} is genericsFunc);
+ /*checks=[],instance*/ (
+ {Map<int, int> m,
+ List<List<D>> l,
+ G<D, D, D, D> g}) {} is genericsFunc);
Expect.isTrue(
- /*checks=[]*/ ({Object m, Object l, Object g}) {} is genericsFunc);
+ /*checks=[],instance*/ ({var m, var l, var g}) {} is genericsFunc);
+ Expect.isTrue(
+ /*checks=[],instance*/ ({Object m, Object l, Object g}) {}
+ is genericsFunc);
- Expect.isTrue(/*checks=[]*/ ({A x, G y, mixFunc z, var v}) {} is dynamicFunc);
- Expect.isTrue(/*checks=[]*/ ({int x, bool y, List<Map> z, classesFunc v}) {}
- is dynamicFunc);
+ Expect.isTrue(
+ /*checks=[],instance*/ ({A x, G y, mixFunc z, var v}) {} is dynamicFunc);
+ Expect.isTrue(/*checks=[],instance*/ (
+ {int x, bool y, List<Map> z, classesFunc v}) {} is dynamicFunc);
- Expect.isTrue(/*checks=[]*/ (
+ Expect.isTrue(/*checks=[],instance*/ (
{okWithClassesFunc_1 f1,
okWithGenericsFunc_1 f2,
okWithDynamicFunc_1 f3}) {} is funcFunc);
- Expect.isTrue(/*checks=[]*/ (
+ Expect.isTrue(/*checks=[],instance*/ (
{okWithClassesFunc_2 f1,
okWithGenericsFunc_2 f2,
okWithDynamicFunc_2 f3}) {} is funcFunc);
diff --git a/tests/compiler/dart2js/rti/emission/superclass.dart b/tests/compiler/dart2js/rti/emission/superclass.dart
index 4270537..e0427de 100644
--- a/tests/compiler/dart2js/rti/emission/superclass.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass.dart
@@ -4,10 +4,10 @@
import 'package:meta/dart2js.dart';
-/*class: B:checks=[]*/
+/*class: B:checkedInstance,checks=[],instance*/
class B {}
-/*class: C:checks=[]*/
+/*class: C:checks=[],instance*/
class C extends B {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_as.dart b/tests/compiler/dart2js/rti/emission/superclass_as.dart
index e780a0e..0bcd138 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_as.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_as.dart
@@ -5,7 +5,7 @@
import 'package:expect/expect.dart';
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedInstance,checks=[],instance*/
class A<T> {}
/*class: B:checks=[]*/
@@ -14,7 +14,7 @@
method() => new A<S>();
}
-/*class: C:checks=[$asB]*/
+/*class: C:checks=[$asB],instance*/
class C<T> extends B<T, T> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_complex.dart b/tests/compiler/dart2js/rti/emission/superclass_complex.dart
index d2f9bb5..1d4fe7f 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_complex.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_complex.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
class A<T> {}
-/*class: B:checks=[]*/
+/*class: B:checkedInstance,checks=[]*/
class B<T> {}
-/*class: C:checks=[$asB]*/
+/*class: C:checks=[$asB],instance*/
class C<T> extends B<A<T>> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_fixed.dart b/tests/compiler/dart2js/rti/emission/superclass_fixed.dart
index 5c86698..7beb498 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_fixed.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_fixed.dart
@@ -4,10 +4,10 @@
import 'package:meta/dart2js.dart';
-/*class: B:checks=[]*/
+/*class: B:checkedInstance,checks=[]*/
class B<T> {}
-/*class: C:checks=[$asB]*/
+/*class: C:checks=[$asB],instance*/
class C extends B<String> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype.dart b/tests/compiler/dart2js/rti/emission/superclass_supertype.dart
index fa9bad0..5f38aa3 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_supertype.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_supertype.dart
@@ -7,10 +7,10 @@
/*class: A:checks=[]*/
class A {}
-/*class: B:*/
+/*class: B:checkedInstance*/
class B {}
-/*class: C:checks=[$isB]*/
+/*class: C:checks=[$isB],instance*/
class C extends A implements B {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype_complex.dart b/tests/compiler/dart2js/rti/emission/superclass_supertype_complex.dart
index 29bcaa7..c87c3f3 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_supertype_complex.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_supertype_complex.dart
@@ -4,16 +4,16 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
class A<T> {}
-/*class: B:*/
+/*class: B:checkedInstance*/
class B<T> {}
/*class: C:checks=[]*/
class C<T> {}
-/*class: D:checks=[$asB,$isB]*/
+/*class: D:checks=[$asB,$isB],instance*/
class D<T> extends C<T> implements B<A<T>> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype_fixed.dart b/tests/compiler/dart2js/rti/emission/superclass_supertype_fixed.dart
index 3c5a8d0..6db1e5e 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_supertype_fixed.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_supertype_fixed.dart
@@ -7,10 +7,10 @@
/*class: A:checks=[]*/
class A {}
-/*class: B:*/
+/*class: B:checkedInstance*/
class B<T> {}
-/*class: C:checks=[$asB,$isB]*/
+/*class: C:checks=[$asB,$isB],instance*/
class C extends A implements B<String> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype_trivial.dart b/tests/compiler/dart2js/rti/emission/superclass_supertype_trivial.dart
index 73f6b8b..d5c5878 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_supertype_trivial.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_supertype_trivial.dart
@@ -7,10 +7,10 @@
/*class: A:checks=[]*/
class A<T> {}
-/*class: B:*/
+/*class: B:checkedInstance*/
class B<T> {}
-/*class: C:checks=[$isB]*/
+/*class: C:checks=[$isB],instance*/
class C<T> extends A<T> implements B<T> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclass_trivial.dart b/tests/compiler/dart2js/rti/emission/superclass_trivial.dart
index b9d8ac1..52b3c6f 100644
--- a/tests/compiler/dart2js/rti/emission/superclass_trivial.dart
+++ b/tests/compiler/dart2js/rti/emission/superclass_trivial.dart
@@ -4,10 +4,10 @@
import 'package:meta/dart2js.dart';
-/*class: B:checks=[]*/
+/*class: B:checkedInstance,checks=[]*/
class B<T> {}
-/*class: C:checks=[]*/
+/*class: C:checks=[],instance*/
class C<T> extends B<T> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclasses_non_trivial.dart b/tests/compiler/dart2js/rti/emission/superclasses_non_trivial.dart
index c3ff5dd..bbaac15 100644
--- a/tests/compiler/dart2js/rti/emission/superclasses_non_trivial.dart
+++ b/tests/compiler/dart2js/rti/emission/superclasses_non_trivial.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedInstance,checks=[]*/
class A<T> {}
-/*class: B:checks=[$asA]*/
+/*class: B:checks=[$asA],instance*/
class B<S, T> extends A<T> {} // Non-trivial substitution of A.
-/*class: C:checks=[]*/
+/*class: C:checks=[],instance*/
class C<S, T> extends B<S, T> {} // Non-trivial substitution of A
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/superclasses_trivial.dart b/tests/compiler/dart2js/rti/emission/superclasses_trivial.dart
index a552926..5067b79 100644
--- a/tests/compiler/dart2js/rti/emission/superclasses_trivial.dart
+++ b/tests/compiler/dart2js/rti/emission/superclasses_trivial.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedInstance,checks=[]*/
class A<T> {}
-/*class: B:checks=[$asA]*/
+/*class: B:checks=[$asA],instance*/
class B<S, T> extends A<T> {} // Non-trivial substitution of A.
-/*class: C:checks=[$asA,$asB]*/
+/*class: C:checks=[$asA,$asB],instance*/
class C<T> extends B<T, T> {} // Trivial substitution of A
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertype.dart b/tests/compiler/dart2js/rti/emission/supertype.dart
index 763d175..92bae3f 100644
--- a/tests/compiler/dart2js/rti/emission/supertype.dart
+++ b/tests/compiler/dart2js/rti/emission/supertype.dart
@@ -4,10 +4,10 @@
import 'package:meta/dart2js.dart';
-/*class: B:*/
+/*class: B:checkedInstance*/
class B {}
-/*class: C:checks=[$isB]*/
+/*class: C:checks=[$isB],instance*/
class C implements B {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertype_complex.dart b/tests/compiler/dart2js/rti/emission/supertype_complex.dart
index 8a70382..5ca3b0f 100644
--- a/tests/compiler/dart2js/rti/emission/supertype_complex.dart
+++ b/tests/compiler/dart2js/rti/emission/supertype_complex.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
class A<T> {}
-/*class: B:*/
+/*class: B:checkedInstance*/
class B<T> {}
-/*class: C:checks=[$asB,$isB]*/
+/*class: C:checks=[$asB,$isB],instance*/
class C<T> implements B<A<T>> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertype_fixed.dart b/tests/compiler/dart2js/rti/emission/supertype_fixed.dart
index ce5d6d7..2b14e4c 100644
--- a/tests/compiler/dart2js/rti/emission/supertype_fixed.dart
+++ b/tests/compiler/dart2js/rti/emission/supertype_fixed.dart
@@ -4,10 +4,10 @@
import 'package:meta/dart2js.dart';
-/*class: B:*/
+/*class: B:checkedInstance*/
class B<T> {}
-/*class: C:checks=[$asB,$isB]*/
+/*class: C:checks=[$asB,$isB],instance*/
class C implements B<String> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertype_trivial.dart b/tests/compiler/dart2js/rti/emission/supertype_trivial.dart
index 4cc95f5..40f9e29 100644
--- a/tests/compiler/dart2js/rti/emission/supertype_trivial.dart
+++ b/tests/compiler/dart2js/rti/emission/supertype_trivial.dart
@@ -4,10 +4,10 @@
import 'package:meta/dart2js.dart';
-/*class: B:*/
+/*class: B:checkedInstance*/
class B<T> {}
-/*class: C:checks=[$isB]*/
+/*class: C:checks=[$isB],instance*/
class C<T> implements B<T> {}
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_extends.dart b/tests/compiler/dart2js/rti/emission/supertypes_extends.dart
index ab679a8..f9ab4fa 100644
--- a/tests/compiler/dart2js/rti/emission/supertypes_extends.dart
+++ b/tests/compiler/dart2js/rti/emission/supertypes_extends.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:*/
+/*class: A:checkedInstance*/
class A {}
/*class: B:checks=[$isA]*/
class B implements A {}
-/*class: C:checks=[]*/
+/*class: C:checks=[],instance*/
class C extends B {} // Implements A through `extends B`.
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_extends2.dart b/tests/compiler/dart2js/rti/emission/supertypes_extends2.dart
index 772ef53..dc3de4e 100644
--- a/tests/compiler/dart2js/rti/emission/supertypes_extends2.dart
+++ b/tests/compiler/dart2js/rti/emission/supertypes_extends2.dart
@@ -4,12 +4,13 @@
import 'package:meta/dart2js.dart';
+/*class: A:checkedInstance*/
class A {}
-/*class: B:checks=[$isA]*/
+/*class: B:checks=[$isA],instance*/
class B implements A {}
-/*class: C:checks=[]*/
+/*class: C:checks=[],instance*/
class C extends B {} // Implements A through `extends B`.
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_extends3.dart b/tests/compiler/dart2js/rti/emission/supertypes_extends3.dart
index 894e130..eee47b1 100644
--- a/tests/compiler/dart2js/rti/emission/supertypes_extends3.dart
+++ b/tests/compiler/dart2js/rti/emission/supertypes_extends3.dart
@@ -4,7 +4,7 @@
import 'package:meta/dart2js.dart';
-/*class: A:*/
+/*class: A:checkedInstance*/
class A {}
/*class: B:checks=[$isA]*/
@@ -13,7 +13,7 @@
/*class: C:checks=[]*/
class C extends B {} // Implements A through `extends B`.
-/*class: D:checks=[]*/
+/*class: D:checks=[],instance*/
class D extends C {} // Implements A through `extends C`.
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_implements.dart b/tests/compiler/dart2js/rti/emission/supertypes_implements.dart
index ac984b7..c5a92b4 100644
--- a/tests/compiler/dart2js/rti/emission/supertypes_implements.dart
+++ b/tests/compiler/dart2js/rti/emission/supertypes_implements.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:*/
+/*class: A:checkedInstance*/
class A {}
/*class: B:*/
class B extends A {}
-/*class: C:checks=[$isA]*/
+/*class: C:checks=[$isA],instance*/
class C implements B {} // Implements A through `implements B`.
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_non_trivial.dart b/tests/compiler/dart2js/rti/emission/supertypes_non_trivial.dart
index 27fd588..0dedcb3 100644
--- a/tests/compiler/dart2js/rti/emission/supertypes_non_trivial.dart
+++ b/tests/compiler/dart2js/rti/emission/supertypes_non_trivial.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedInstance,checks=[]*/
class A<T> {}
-/*class: B:checks=[$asA]*/
+/*class: B:checks=[$asA],instance*/
class B<S, T> extends A<T> {} // Non-trivial substitution of A.
-/*class: C:checks=[$asA,$isA]*/
+/*class: C:checks=[$asA,$isA],instance*/
class C<S, T> implements B<S, T> {} // Non-trivial substitution of A
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_trivial.dart b/tests/compiler/dart2js/rti/emission/supertypes_trivial.dart
index 340c2f4..f1a15cd 100644
--- a/tests/compiler/dart2js/rti/emission/supertypes_trivial.dart
+++ b/tests/compiler/dart2js/rti/emission/supertypes_trivial.dart
@@ -4,13 +4,13 @@
import 'package:meta/dart2js.dart';
-/*class: A:checks=[]*/
+/*class: A:checkedInstance,checks=[]*/
class A<T> {}
-/*class: B:checks=[$asA]*/
+/*class: B:checks=[$asA],instance*/
class B<S, T> extends A<T> {} // Non-trivial substitution of A.
-/*class: C:checks=[$isA]*/
+/*class: C:checks=[$isA],instance*/
class C<T> implements B<T, T> {} // Trivial substitution of A
@noInline
diff --git a/tests/compiler/dart2js/rti/emission/type_argument_dynamic_strong.dart b/tests/compiler/dart2js/rti/emission/type_argument_dynamic_strong.dart
new file mode 100644
index 0000000..a3d12e2
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/type_argument_dynamic_strong.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
+class A {}
+
+/*class: B:checks=[$isA],typeArgument*/
+class B implements A {}
+
+/*class: C:checkedInstance,checks=[],instance*/
+class C<T> {}
+
+/*class: D:checks=[],typeArgument*/
+class D {}
+
+/*class: E:checks=[],instance*/
+class E {
+ @noInline
+ m<T>() => new C<T>();
+}
+
+/*class: F:checks=[],instance*/
+class F {
+ @noInline
+ m<T>() => false;
+}
+
+@noInline
+test(o) => o is C<A>;
+
+main() {
+ dynamic o =
+ new DateTime.now().millisecondsSinceEpoch == 0 ? new F() : new E();
+ Expect.isTrue(test(o.m<B>()));
+ Expect.isFalse(test(o.m<D>()));
+}
diff --git a/tests/compiler/dart2js/rti/emission/type_argument_static_strong.dart b/tests/compiler/dart2js/rti/emission/type_argument_static_strong.dart
new file mode 100644
index 0000000..05ba49e
--- /dev/null
+++ b/tests/compiler/dart2js/rti/emission/type_argument_static_strong.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:meta/dart2js.dart';
+
+/*class: A:checkedTypeArgument,checks=[],typeArgument*/
+class A {}
+
+/*class: B:checks=[$isA],typeArgument*/
+class B implements A {}
+
+/*class: C:checkedInstance,checks=[],instance*/
+class C<T> {}
+
+/*class: D:checks=[],typeArgument*/
+class D {}
+
+@noInline
+m<T>() => new C<T>();
+
+@noInline
+test(o) => o is C<A>;
+
+main() {
+ Expect.isTrue(test(m<B>()));
+ Expect.isFalse(test(m<D>()));
+}
diff --git a/tests/compiler/dart2js/rti/rti_emission_test.dart b/tests/compiler/dart2js/rti/rti_emission_test.dart
index 2dcdc43..cb3a0a4 100644
--- a/tests/compiler/dart2js/rti/rti_emission_test.dart
+++ b/tests/compiler/dart2js/rti/rti_emission_test.dart
@@ -11,6 +11,7 @@
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
+import 'package:compiler/src/js_backend/runtime_types.dart';
import 'package:compiler/src/js_emitter/model.dart';
import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:compiler/src/kernel/element_map.dart';
@@ -23,6 +24,7 @@
main(List<String> args) {
asyncTest(() async {
+ cacheRtiDataForTesting = true;
Directory dataDir =
new Directory.fromUri(Platform.script.resolve('emission'));
await checkTests(
@@ -43,6 +45,10 @@
class Tags {
static const String isChecks = 'checks';
+ static const String instance = 'instance';
+ static const String checkedInstance = 'checkedInstance';
+ static const String typeArgument = 'typeArgument';
+ static const String checkedTypeArgument = 'checkedTypeArgument';
}
void computeAstRtiMemberEmission(
@@ -67,6 +73,9 @@
Compiler get compiler;
ProgramLookup lookup;
+ RuntimeTypesImpl get checksBuilder =>
+ compiler.backend.rtiChecksBuilderForTesting;
+
String getClassValue(ClassEntity element) {
lookup ??= new ProgramLookup(compiler);
Class cls = lookup.getClass(element);
@@ -77,6 +86,21 @@
features.addElement(Tags.isChecks, stub.name.key);
}
}
+ ClassUse classUse = checksBuilder.classUseMapForTesting[element];
+ if (classUse != null) {
+ if (classUse.instance) {
+ features.add(Tags.instance);
+ }
+ if (classUse.checkedInstance) {
+ features.add(Tags.checkedInstance);
+ }
+ if (classUse.typeArgument) {
+ features.add(Tags.typeArgument);
+ }
+ if (classUse.checkedTypeArgument) {
+ features.add(Tags.checkedTypeArgument);
+ }
+ }
return features.getText();
}
diff --git a/tests/compiler/dart2js/subtype_test.dart b/tests/compiler/dart2js/subtype_test.dart
index 719a484..7d938fc 100644
--- a/tests/compiler/dart2js/subtype_test.dart
+++ b/tests/compiler/dart2js/subtype_test.dart
@@ -315,12 +315,12 @@
ClassEntity classA = env.getClass('A');
DartType A = env.elementEnvironment.getRawType(classA);
DartType function = env['Function'];
- DartType call = env.getMemberType(classA, 'call');
- DartType m1 = env.getMemberType(classA, 'm1');
- DartType m2 = env.getMemberType(classA, 'm2');
- DartType m3 = env.getMemberType(classA, 'm3');
- DartType m4 = env.getMemberType(classA, 'm4');
- DartType m5 = env.getMemberType(classA, 'm5');
+ DartType call = env.getMemberType('call', classA);
+ DartType m1 = env.getMemberType('m1', classA);
+ DartType m2 = env.getMemberType('m2', classA);
+ DartType m3 = env.getMemberType('m3', classA);
+ DartType m4 = env.getMemberType('m4', classA);
+ DartType m5 = env.getMemberType('m5', classA);
expect(true, A, function);
expect(true, A, call);
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index 7a064ab..e4f6b26 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -215,8 +215,17 @@
return getElementType(name);
}
- DartType getMemberType(ClassEntity cls, String name) {
- MemberEntity member = elementEnvironment.lookupLocalClassMember(cls, name);
+ MemberEntity _getMember(String name, [ClassEntity cls]) {
+ if (cls != null) {
+ return elementEnvironment.lookupLocalClassMember(cls, name);
+ } else {
+ LibraryEntity mainLibrary = elementEnvironment.mainLibrary;
+ return elementEnvironment.lookupLibraryMember(mainLibrary, name);
+ }
+ }
+
+ DartType getMemberType(String name, [ClassEntity cls]) {
+ MemberEntity member = _getMember(name, cls);
if (member is FieldEntity) {
return elementEnvironment.getFieldType(member);
} else if (member is FunctionEntity) {
@@ -225,6 +234,22 @@
throw 'Unexpected member: $member';
}
+ DartType getClosureType(String name, [ClassEntity cls]) {
+ if (testBackendWorld) {
+ throw new UnsupportedError(
+ "getClosureType not supported for backend testing.");
+ }
+ MemberEntity member = _getMember(name, cls);
+ DartType type;
+ compiler.resolutionWorldBuilder
+ .forEachLocalFunction((MemberEntity m, Local local) {
+ if (member == m) {
+ type ??= elementEnvironment.getLocalFunctionType(local);
+ }
+ });
+ return type;
+ }
+
DartType getFieldType(String name) {
LibraryEntity mainLibrary = elementEnvironment.mainLibrary;
FieldEntity field =
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index c6a7753..ffe01f1 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -27,6 +27,11 @@
dummy_compiler_test: Skip # Issue 28649
recursive_import_test: Skip # Issue 28649
+[ $compiler == dart2js && !$strong ]
+generic_method_dynamic_is_test: RuntimeError # Test against function type variables is only supported in strong mode.
+generic_method_static_is_test: RuntimeError # Test against function type variables is only supported in strong mode.
+local_signature_test: RuntimeError # Test against function type variables is only supported in strong mode.
+
[ $compiler == dart2js && $mode == debug ]
operator_test: Skip
string_interpolation_test: Skip
@@ -136,96 +141,94 @@
unconditional_dartio_import_test: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
-21666_test: CompileTimeError
-23056_test: CompileTimeError
+21666_test: RuntimeError
23264_test: RuntimeError
closure_capture2_test: RuntimeError
-closure_type_reflection2_test: CompileTimeError
-closure_type_reflection_test: CompileTimeError
+closure_type_reflection2_test: RuntimeError
+closure_type_reflection_test: RuntimeError
constant_javascript_semantics_test/01: MissingCompileTimeError
-deferred/deferred_mirrors1_test: CompileTimeError
-deferred/deferred_mirrors2_test: CompileTimeError
-deferred/reflect_multiple_annotations_test: CompileTimeError
-deferred/reflect_multiple_default_arg_test: CompileTimeError
+deferred/deferred_mirrors1_test: RuntimeError
+deferred/deferred_mirrors2_test: RuntimeError
+deferred/reflect_multiple_annotations_test: RuntimeError
+deferred/reflect_multiple_default_arg_test: RuntimeError
deferred_fail_and_retry_test: RuntimeError
deferred_fail_and_retry_worker_test: Fail
-inference_nsm_mirrors_test: CompileTimeError
-invalid_annotation2_test/none: CompileTimeError
-mirror_enqueuer_regression_test: CompileTimeError
-mirror_invalid_field_access2_test: CompileTimeError
-mirror_invalid_field_access3_test: CompileTimeError
-mirror_invalid_field_access4_test: CompileTimeError
-mirror_invalid_field_access_test: CompileTimeError
-mirror_invalid_invoke2_test: CompileTimeError
-mirror_invalid_invoke3_test: CompileTimeError
-mirror_invalid_invoke_test: CompileTimeError
-mirror_printer_test/01: CompileTimeError
-mirror_printer_test/none: CompileTimeError
-mirror_test: CompileTimeError
-mirror_type_inference_field2_test: CompileTimeError
-mirror_type_inference_field_test: CompileTimeError
-mirror_type_inference_function_test: CompileTimeError
-mirrors_declarations_filtering_test: CompileTimeError
-mirrors_used_metatargets_test: CompileTimeError
-mirrors_used_native_test: CompileTimeError
-mirrors_used_warning2_test: CompileTimeError
-mirrors_used_warning_test/minif: CompileTimeError
-mirrors_used_warning_test/none: CompileTimeError
-no_such_method_mirrors_test: CompileTimeError
+inference_nsm_mirrors_test: RuntimeError
+invalid_annotation2_test/none: RuntimeError
+mirror_invalid_field_access2_test: RuntimeError
+mirror_invalid_field_access3_test: RuntimeError
+mirror_invalid_field_access4_test: RuntimeError
+mirror_invalid_field_access_test: RuntimeError
+mirror_invalid_invoke2_test: RuntimeError
+mirror_invalid_invoke3_test: RuntimeError
+mirror_invalid_invoke_test: RuntimeError
+mirror_printer_test/01: RuntimeError
+mirror_printer_test/none: RuntimeError
+mirror_test: RuntimeError
+mirror_type_inference_field2_test: RuntimeError
+mirror_type_inference_field_test: RuntimeError
+mirror_type_inference_function_test: RuntimeError
+mirrors_declarations_filtering_test: RuntimeError
+mirrors_used_closure_test: SkipByDesign
+mirrors_used_metatargets_test: RuntimeError
+mirrors_used_native_test: RuntimeError
+mirrors_used_warning2_test: RuntimeError
+mirrors_used_warning_test/minif: RuntimeError
+mirrors_used_warning_test/none: RuntimeError
+no_such_method_mirrors_test: RuntimeError
private_symbol_literal_test/01: MissingCompileTimeError
private_symbol_literal_test/02: MissingCompileTimeError
private_symbol_literal_test/03: MissingCompileTimeError
private_symbol_literal_test/04: MissingCompileTimeError
private_symbol_literal_test/05: MissingCompileTimeError
private_symbol_literal_test/06: MissingCompileTimeError
-reflect_native_types_test: CompileTimeError
+reflect_native_types_test: RuntimeError
regress/4562_test/none: CompileTimeError
type_constant_switch_test/01: MissingCompileTimeError
unconditional_dartio_import_test: RuntimeError # Issue 30902
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]
-21666_test: CompileTimeError
-23056_test: CompileTimeError
+21666_test: RuntimeError
23264_test: RuntimeError
-closure_type_reflection2_test: CompileTimeError
-closure_type_reflection_test: CompileTimeError
+closure_type_reflection2_test: RuntimeError
+closure_type_reflection_test: RuntimeError
constant_javascript_semantics_test/01: MissingCompileTimeError
-deferred/deferred_mirrors1_test: CompileTimeError
-deferred/deferred_mirrors2_test: CompileTimeError
+deferred/deferred_mirrors1_test: RuntimeError
+deferred/deferred_mirrors2_test: RuntimeError
deferred/reflect_multiple_annotations_test: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
deferred/reflect_multiple_default_arg_test: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
deferred_fail_and_retry_test: RuntimeError
deferred_fail_and_retry_worker_test: Fail
dummy_compiler_test: CompileTimeError
-inference_nsm_mirrors_test: CompileTimeError
-invalid_annotation2_test/none: CompileTimeError
-mirror_enqueuer_regression_test: CompileTimeError
-mirror_invalid_field_access2_test: CompileTimeError
-mirror_invalid_field_access3_test: CompileTimeError
-mirror_invalid_field_access4_test: CompileTimeError
-mirror_invalid_field_access_test: CompileTimeError
-mirror_invalid_invoke2_test: CompileTimeError
-mirror_invalid_invoke3_test: CompileTimeError
-mirror_invalid_invoke_test: CompileTimeError
-mirror_printer_test/01: CompileTimeError
-mirror_printer_test/none: CompileTimeError
-mirror_test: CompileTimeError
-mirror_type_inference_field2_test: CompileTimeError
-mirror_type_inference_field_test: CompileTimeError
-mirror_type_inference_function_test: CompileTimeError
-mirrors_declarations_filtering_test: CompileTimeError
-mirrors_used_metatargets_test: CompileTimeError
-mirrors_used_native_test: CompileTimeError
-mirrors_used_warning2_test: CompileTimeError
-mirrors_used_warning_test/none: CompileTimeError
-no_such_method_mirrors_test: CompileTimeError
+inference_nsm_mirrors_test: RuntimeError
+invalid_annotation2_test/none: RuntimeError
+mirror_invalid_field_access2_test: RuntimeError
+mirror_invalid_field_access3_test: RuntimeError
+mirror_invalid_field_access4_test: RuntimeError
+mirror_invalid_field_access_test: RuntimeError
+mirror_invalid_invoke2_test: RuntimeError
+mirror_invalid_invoke3_test: RuntimeError
+mirror_invalid_invoke_test: RuntimeError
+mirror_printer_test/01: RuntimeError
+mirror_printer_test/none: RuntimeError
+mirror_test: RuntimeError
+mirror_type_inference_field2_test: RuntimeError
+mirror_type_inference_field_test: RuntimeError
+mirror_type_inference_function_test: RuntimeError
+mirrors_declarations_filtering_test: RuntimeError
+mirrors_used_closure_test: SkipByDesign
+mirrors_used_metatargets_test: RuntimeError
+mirrors_used_native_test: RuntimeError
+mirrors_used_warning2_test: RuntimeError
+mirrors_used_warning_test/none: RuntimeError
+no_such_method_mirrors_test: RuntimeError
private_symbol_literal_test/01: MissingCompileTimeError
private_symbol_literal_test/02: MissingCompileTimeError
private_symbol_literal_test/03: MissingCompileTimeError
private_symbol_literal_test/04: MissingCompileTimeError
private_symbol_literal_test/05: MissingCompileTimeError
private_symbol_literal_test/06: MissingCompileTimeError
-reflect_native_types_test: CompileTimeError
+reflect_native_types_test: RuntimeError
regress/4562_test/none: CompileTimeError
type_constant_switch_test/01: MissingCompileTimeError
unconditional_dartio_import_test: RuntimeError # Issue 30902
@@ -265,7 +268,7 @@
mirror_type_inference_field_test: Fail # mirrors not supported
mirror_type_inference_function_test: Fail # mirrors not supported
mirrors_declarations_filtering_test: Fail # mirrors not supported
-mirrors_used_closure_test: Fail # mirrors not supported
+mirrors_used_closure_test: SkipByDesign
mirrors_used_metatargets_test: Fail # mirrors not supported
mirrors_used_native_test: Fail # mirrors not supported
mirrors_used_warning2_test: Fail # mirrors not supported
diff --git a/tests/compiler/dart2js_extra/generic_method_dynamic_is_test.dart b/tests/compiler/dart2js_extra/generic_method_dynamic_is_test.dart
new file mode 100644
index 0000000..4f3a720
--- /dev/null
+++ b/tests/compiler/dart2js_extra/generic_method_dynamic_is_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B implements A {}
+
+class C<T> {}
+
+class D {}
+
+class E {
+ @NoInline()
+ m<T>() => new C<T>();
+}
+
+class F {
+ @NoInline()
+ m<T>() => false;
+}
+
+@NoInline()
+test(o) => o is C<A>;
+
+main() {
+ dynamic o =
+ new DateTime.now().millisecondsSinceEpoch == 0 ? new F() : new E();
+ Expect.isTrue(test(o.m<B>()));
+ Expect.isFalse(test(o.m<D>()));
+}
diff --git a/tests/compiler/dart2js_extra/generic_method_static_is_test.dart b/tests/compiler/dart2js_extra/generic_method_static_is_test.dart
new file mode 100644
index 0000000..946fa1c
--- /dev/null
+++ b/tests/compiler/dart2js_extra/generic_method_static_is_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class B implements A {}
+
+class C<T> {}
+
+class D {}
+
+@NoInline()
+m<T>() => new C<T>();
+
+@NoInline()
+test(o) => o is C<A>;
+
+main() {
+ Expect.isTrue(test(m<B>()));
+ Expect.isFalse(test(m<D>()));
+}
diff --git a/tests/compiler/dart2js_extra/local_signature_test.dart b/tests/compiler/dart2js_extra/local_signature_test.dart
new file mode 100644
index 0000000..8d39233
--- /dev/null
+++ b/tests/compiler/dart2js_extra/local_signature_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+@NoInline()
+test1(o) => o is Function(int);
+
+@NoInline()
+test2(o) => o is Function<T>(T);
+
+class C<S> {
+ @NoInline()
+ test(bool expected) {
+ local1(int i) {}
+ local2<T>(T t) {}
+ local3(S s) {}
+
+ Expect.isTrue(test1(local1));
+ Expect.isFalse(test2(local1));
+
+ Expect.isFalse(test1(local2));
+ Expect.isTrue(test2(local2));
+
+ Expect.equals(expected, test1(local3));
+ Expect.isFalse(test2(local3));
+ }
+}
+
+main() {
+ new C<int>().test(true);
+ new C<double>().test(false);
+}
diff --git a/tests/compiler/dart2js_extra/named_mixin_runtime_type_test.dart b/tests/compiler/dart2js_extra/named_mixin_runtime_type_test.dart
new file mode 100644
index 0000000..ec4adf2
--- /dev/null
+++ b/tests/compiler/dart2js_extra/named_mixin_runtime_type_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+abstract class A {}
+
+abstract class B {}
+
+class C = B with A;
+
+@NoInline()
+test(o) => o.runtimeType;
+
+main() {
+ Expect.equals(C, test(new C()));
+}
diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/compiler/dart2js_native/dart2js_native.status
index 29cb393..d3fcb95 100644
--- a/tests/compiler/dart2js_native/dart2js_native.status
+++ b/tests/compiler/dart2js_native/dart2js_native.status
@@ -40,12 +40,12 @@
bound_closure_super_test: RuntimeError
compute_this_script_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/types.dart': Failed assertion: line 63 pos 12: '!result.isEmpty': is not true.
fake_thing_test: RuntimeError
-mirror_intercepted_field_test: CompileTimeError
+mirror_intercepted_field_test: RuntimeError
native_library_same_name_used_frog_test: CompileTimeError
-native_mirror_test: CompileTimeError
-native_no_such_method_exception3_frog_test: CompileTimeError
-native_no_such_method_exception4_frog_test: CompileTimeError
-native_no_such_method_exception5_frog_test: CompileTimeError
+native_mirror_test: RuntimeError
+native_no_such_method_exception3_frog_test: RuntimeError
+native_no_such_method_exception4_frog_test: RuntimeError
+native_no_such_method_exception5_frog_test: RuntimeError
subclassing_constructor_1_test: RuntimeError
subclassing_super_call_test: RuntimeError
subclassing_super_field_1_test: RuntimeError
@@ -54,12 +54,12 @@
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]
bound_closure_super_test: RuntimeError
fake_thing_test: RuntimeError
-mirror_intercepted_field_test: CompileTimeError
+mirror_intercepted_field_test: RuntimeError
native_library_same_name_used_frog_test: CompileTimeError
-native_mirror_test: CompileTimeError
-native_no_such_method_exception3_frog_test: CompileTimeError
-native_no_such_method_exception4_frog_test: CompileTimeError
-native_no_such_method_exception5_frog_test: CompileTimeError
+native_mirror_test: RuntimeError
+native_no_such_method_exception3_frog_test: RuntimeError
+native_no_such_method_exception4_frog_test: RuntimeError
+native_no_such_method_exception5_frog_test: RuntimeError
optimization_hints_test: RuntimeError
subclassing_constructor_1_test: RuntimeError
subclassing_super_call_test: RuntimeError
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index edd0cde..3996278 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -177,7 +177,7 @@
symbol_reserved_word_test/03: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
-apply3_test: CompileTimeError
+apply3_test: RuntimeError
big_integer_parsed_arith_vm_test: RuntimeError
big_integer_parsed_div_rem_vm_test: RuntimeError
big_integer_parsed_mul_div_vm_test: RuntimeError
@@ -194,7 +194,7 @@
symbol_reserved_word_test/03: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]
-apply3_test: CompileTimeError
+apply3_test: RuntimeError
big_integer_parsed_arith_vm_test: RuntimeError
big_integer_parsed_div_rem_vm_test: RuntimeError
big_integer_parsed_mul_div_vm_test: RuntimeError
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 5e4efa2..e0bcaf1 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -210,10 +210,10 @@
uri_base_test: Crash # RangeError (index): Invalid value: Valid value range is empty: 0
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked && $strong ]
-apply3_test: CompileTimeError
+apply3_test: RuntimeError
cast_test: RuntimeError
collection_removes_test: RuntimeError
-dynamic_nosuchmethod_test: CompileTimeError
+dynamic_nosuchmethod_test: RuntimeError
error_stack_trace1_test: RuntimeError # Issue 12399
growable_list_test: RuntimeError
int_parse_radix_test/01: RuntimeError
@@ -244,10 +244,10 @@
uri_base_test: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $minified && $strong ]
-apply3_test: CompileTimeError
+apply3_test: RuntimeError
cast_test: RuntimeError
collection_removes_test: RuntimeError
-dynamic_nosuchmethod_test: CompileTimeError
+dynamic_nosuchmethod_test: RuntimeError
error_stack_trace1_test: RuntimeError
growable_list_test: RuntimeError
hash_set_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(_CustomHashSet.#x), local(_CustomHashSet.#)) for j:closure_call(_CustomHashSet__CustomHashSet_closure.call).
diff --git a/tests/corelib_2/list_copy_range_test.dart b/tests/corelib_2/list_copy_range_test.dart
new file mode 100644
index 0000000..009f445
--- /dev/null
+++ b/tests/corelib_2/list_copy_range_test.dart
@@ -0,0 +1,115 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:typed_data";
+import "package:expect/expect.dart";
+
+// Tests of List.copyRange.
+
+void main() {
+ var list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+
+ List.copyRange(list, 3, [10, 11, 12, 13], 0, 4);
+
+ Expect.listEquals([0, 1, 2, 10, 11, 12, 13, 7, 8, 9], list);
+
+ List.copyRange(list, 6, [20, 21, 22, 23], 1, 3);
+
+ Expect.listEquals([0, 1, 2, 10, 11, 12, 21, 22, 8, 9], list);
+
+ // Empty ranges won't change anything.
+ List.copyRange(list, 7, [30, 31, 32, 33], 3, 3);
+ List.copyRange(list, list.length, [30, 31, 32, 33], 3, 3);
+
+ Expect.listEquals([0, 1, 2, 10, 11, 12, 21, 22, 8, 9], list);
+
+ List.copyRange(list, 0, [40, 41, 42, 43], 0, 2);
+
+ Expect.listEquals([40, 41, 2, 10, 11, 12, 21, 22, 8, 9], list);
+
+ // Overlapping self-ranges
+
+ List.copyRange(list, 2, list, 0, 4);
+
+ Expect.listEquals([40, 41, 40, 41, 2, 10, 21, 22, 8, 9], list);
+
+ List.copyRange(list, 4, list, 6, 10);
+
+ Expect.listEquals([40, 41, 40, 41, 21, 22, 8, 9, 8, 9], list);
+
+ // Invalid source ranges.
+
+ Expect.throwsArgumentError(() {
+ List.copyRange(list, 0, [0, 0, 0], -1, 1);
+ });
+
+ Expect.throwsArgumentError(() {
+ List.copyRange(list, 0, [0, 0, 0], 0, 4);
+ });
+
+ Expect.throwsArgumentError(() {
+ List.copyRange(list, 0, [0, 0, 0], 2, 1);
+ });
+
+ Expect.throwsArgumentError(() {
+ List.copyRange(list, 0, [], 1, 1);
+ });
+
+ // Invalid target range.
+ Expect.throwsArgumentError(() {
+ List.copyRange(list, list.length - 3, [0, 0, 0, 0], 0, 4);
+ });
+
+ // Invalid target range.
+ Expect.throwsArgumentError(() {
+ List.copyRange(list, list.length + 1, [0, 0, 0, 0], 0, 0);
+ });
+
+ // Argument errors throw before changing anything, so list is unchanged.
+ Expect.listEquals([40, 41, 40, 41, 21, 22, 8, 9, 8, 9], list);
+
+ // Omitting start/end (or passing null).
+ List.copyRange(list, 2, [1, 2, 3]);
+
+ Expect.listEquals([40, 41, 1, 2, 3, 22, 8, 9, 8, 9], list);
+
+ List.copyRange(list, 5, [1, 2, 3], 1);
+
+ Expect.listEquals([40, 41, 1, 2, 3, 2, 3, 9, 8, 9], list);
+
+ // Other kinds of lists.
+ var listu8 = new Uint8List.fromList([1, 2, 3, 4]);
+ var list16 = new Int16List.fromList([11, 12, -13, -14]);
+ List.copyRange(listu8, 2, list16, 1, 3);
+ Expect.listEquals([1, 2, 12, 256 - 13], listu8);
+
+ var clist = const <int>[1, 2, 3, 4];
+ var flist = new List<int>(4)..setAll(0, [10, 11, 12, 13]);
+ List.copyRange(flist, 1, clist, 1, 3);
+ Expect.listEquals([10, 2, 3, 13], flist);
+
+ // Invoking with a type parameter that is a supertype of the list types
+ // is valid and useful.
+ List<int> ilist = <int>[1, 2, 3, 4];
+ List<num> nlist = <num>[11, 12, 13, 14];
+
+ List.copyRange<num>(ilist, 1, nlist, 1, 3);
+ Expect.listEquals([1, 12, 13, 4], ilist);
+ List.copyRange<Object>(ilist, 1, nlist, 0, 2);
+ Expect.listEquals([1, 11, 12, 4], ilist);
+ List.copyRange<dynamic>(ilist, 1, nlist, 2, 4);
+ Expect.listEquals([1, 13, 14, 4], ilist);
+
+ var d = new D();
+ List<B> bdlist = <B>[d];
+ List<C> cdlist = <C>[null];
+ List.copyRange<Object>(cdlist, 0, bdlist, 0, 1);
+ Expect.identical(d, cdlist[0]);
+}
+
+class B {}
+
+class C {}
+
+class D implements B, C {}
diff --git a/tests/corelib_2/list_write_elements_test.dart b/tests/corelib_2/list_write_elements_test.dart
new file mode 100644
index 0000000..3f382ce
--- /dev/null
+++ b/tests/corelib_2/list_write_elements_test.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:typed_data";
+import "package:expect/expect.dart";
+
+void main() {
+ test([1, 2, 3, 4], [5, 6], 2, [1, 2, 5, 6]);
+ test([1, 2, 3, 4], [5, 6], 0, [5, 6, 3, 4]);
+ test([1, 2, 3, 4], [5, 6], 1, [1, 5, 6, 4]);
+ test([1, 2, 3, 4], [], 2, [1, 2, 3, 4]);
+ test([1, 2, 3, 4], [5, 6], 2, [1, 2, 5, 6]);
+ test([1, 2, 3, 4], [5, 6], 2, [1, 2, 5, 6]);
+ test([1, 2, 3, 4], [5, 6], 2, [1, 2, 5, 6]);
+ test([], [], 0, []);
+ test([1], [2], 0, [2]);
+
+ // Other (non-list) iterables.
+ test([1, 2, 3, 4], new Iterable.generate(2, (x) => x + 7), 1, [1, 7, 8, 4]);
+ test([1, 2, 3, 4], [9, 9, 5, 6].skip(2), 1, [1, 5, 6, 4]);
+ test([1, 2, 3, 4], [5, 6, 9, 9].take(2), 1, [1, 5, 6, 4]);
+ test([1, 2, 3, 4], [9, 5, 9, 6, 9, 9].where((x) => x != 9), 1, [1, 5, 6, 4]);
+ test([1, 2, 3, 4], new Set.from([5, 6]), 1, [1, 5, 6, 4]);
+
+ // Other types of lists.
+ test(new Uint8List(4), [5, 6], 1, [0, 5, 6, 0]);
+ test(new Uint8List(4), [-5, 6], 1, [0, 256 - 5, 6, 0]);
+
+ // Over-long iterables. Updates until end, then throws.
+ testThrows([], [1], 0);
+ testThrows([2], [1], 1);
+ testThrows([2], [1], 1);
+ testThrows([1, 2, 3, 4], [5, 6, 7, 8], 2, [1, 2, 5, 6]);
+
+ // Throwing iterable.
+ Expect.throws(() {
+ Iterable<int> throwingIterable() sync* {
+ yield 1;
+ throw "2";
+ }
+
+ List.writeIterable([1, 2, 3], 1, throwingIterable());
+ }, (e) => e == "2");
+
+ // Bad start index.
+ testThrows([1, 2], [1], -1);
+ testThrows([1, 2], [1], 2);
+
+ // Working at a supertype is practical and useful.
+ test<Object>(<int>[1, 2, 3, 4], <num>[5, 6], 1, [1, 5, 6, 4]);
+
+ var d = new D();
+ test<Object>(<B>[null], <C>[d], 0, [d]);
+}
+
+testThrows<T>(list, iterable, start, [expect]) {
+ Expect.throws(() {
+ List.writeIterable<T>(list, start, iterable);
+ });
+ if (expect != null) {
+ Expect.listEquals(expect, list);
+ }
+}
+
+test<T>(List<T> list, Iterable<T> iterable, int start, List expect) {
+ List.writeIterable<T>(list, start, iterable);
+ Expect.listEquals(expect, list);
+}
+
+class B {}
+
+class C {}
+
+class D implements B, C {}
diff --git a/tests/html/html.status b/tests/html/html.status
index 6a3157d..cfa3a87 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -40,11 +40,6 @@
indexeddb_4_test: Pass, Timeout # Roll 50 failure
indexeddb_5_test: Pass, Timeout # Roll 50 failure
input_element_test/attributes: Fail # Issue 21555
-js_interop_constructor_name_test/HTMLDivElement-types-erroneous1: Fail # Issue 26838
-js_interop_constructor_name_test/HTMLDivElement-types-erroneous2: Fail # Issue 26838
-js_type_test/dynamic-String-not-Foo: Fail # Issue 26838
-js_type_test/dynamic-String-not-dynamic-Foo: Fail # Issue 26838
-js_type_test/dynamic-null-not-Foo: Fail # Issue 26838
js_typed_interop_default_arg_test/default_value: MissingCompileTimeError # Issue #25759
js_typed_interop_side_cast_exp_test: Pass, RuntimeError # Roll 50 failure
mirrors_js_typed_interop_test: Pass, Slow
diff --git a/tests/html/js_interop_constructor_name_test.dart b/tests/html/js_interop_constructor_name_test.dart
index e82422f..6ed93e4 100644
--- a/tests/html/js_interop_constructor_name_test.dart
+++ b/tests/html/js_interop_constructor_name_test.dart
@@ -23,7 +23,7 @@
@NoInline()
@AssumeDynamic()
-confuse(x) => x;
+dynamic confuse(dynamic x) => x;
main() {
useHtmlIndividualConfiguration();
@@ -43,27 +43,15 @@
var e = confuse(makeDiv('hello'));
expect(e is HTMLDivElement, isTrue);
});
- });
-
- group('HTMLDivElement-types-erroneous1', () {
test('dom-is-js', () {
var e = confuse(new html.DivElement());
- // TODO(26838): When Issue 26838 is fixed and this test passes, move this
- // test into group `HTMLDivElement-types`.
-
// Currently, HTML types are not [JavaScriptObject]s. We could change that
// by having HTML types extend JavaScriptObject, in which case we would
// change this expectation.
expect(e is HTMLDivElement, isFalse);
});
- });
-
- group('HTMLDivElement-types-erroneous2', () {
test('String-is-not-js', () {
var e = confuse('kombucha');
- // TODO(26838): When Issue 26838 is fixed and this test passes, move this
- // test into group `HTMLDivElement-types`.
-
// A String should not be a JS interop type. The type test flags are added
// to Interceptor, but should be added to the class that implements all
// the JS-interop methods.
diff --git a/tests/language/bad_constructor_test.dart b/tests/language/bad_constructor_test.dart
index 747ebc6..968f789 100644
--- a/tests/language/bad_constructor_test.dart
+++ b/tests/language/bad_constructor_test.dart
@@ -23,6 +23,12 @@
int foo(int a, int b) => a + b * m;
}
+class B {
+ // Constructor may not be static.
+ static B(){} // //# 07: compile-time error
+}
+
main() {
new A();
+ new B();
}
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 5ced098..271a2ed 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -121,7 +121,6 @@
const_error_multiply_initialized_test/02: MissingCompileTimeError
const_error_multiply_initialized_test/04: MissingCompileTimeError
const_evaluation_test/01: RuntimeError
-const_factory_with_body_test/01: MissingCompileTimeError
const_init2_test/02: MissingCompileTimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
@@ -490,7 +489,6 @@
const_error_multiply_initialized_test/02: MissingCompileTimeError
const_error_multiply_initialized_test/04: MissingCompileTimeError
const_evaluation_test/01: RuntimeError
-const_factory_with_body_test/01: MissingCompileTimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
const_map3_test/00: MissingCompileTimeError
@@ -784,7 +782,6 @@
call_nonexistent_constructor_test/01: RuntimeError
call_type_literal_test/01: RuntimeError
canonical_const2_test: RuntimeError
-canonical_const3_test: CompileTimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
class_cycle_test/03: MissingCompileTimeError
@@ -797,9 +794,7 @@
config_import_test: RuntimeError
const_error_multiply_initialized_test/02: MissingCompileTimeError
const_error_multiply_initialized_test/04: MissingCompileTimeError
-const_evaluation_test/01: CompileTimeError
-const_evaluation_test/none: CompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
+const_evaluation_test/01: RuntimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
const_map3_test/00: MissingCompileTimeError
@@ -817,8 +812,8 @@
constructor_redirect2_negative_test: Crash # Issue 30856
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
cyclic_constructor_test/01: Crash # Issue 30856
-deferred_constraints_constants_test/none: CompileTimeError
-deferred_constraints_constants_test/reference_after_load: CompileTimeError
+deferred_constraints_constants_test/none: RuntimeError
+deferred_constraints_constants_test/reference_after_load: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
@@ -833,7 +828,7 @@
duplicate_implements_test/04: MissingCompileTimeError
dynamic_prefix_core_test/01: RuntimeError
dynamic_prefix_core_test/none: RuntimeError
-enum_mirror_test: CompileTimeError
+enum_mirror_test: RuntimeError
example_constructor_test: RuntimeError
expect_test: RuntimeError
external_test/10: MissingRuntimeError
@@ -842,7 +837,7 @@
factory_redirection_test/07: MissingCompileTimeError
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
-field_increment_bailout_test: CompileTimeError
+field_increment_bailout_test: RuntimeError
field_initialization_order_test: RuntimeError
field_override3_test/00: MissingCompileTimeError
field_override3_test/01: MissingCompileTimeError
@@ -867,23 +862,23 @@
identical_closure2_test: RuntimeError
if_null_assignment_behavior_test/14: RuntimeError
infinity_test: RuntimeError
-instance_creation_in_function_annotation_test: CompileTimeError
+instance_creation_in_function_annotation_test: RuntimeError
integer_division_by_zero_test: RuntimeError
internal_library_test/02: Crash # type 'DillLibraryBuilder' is not a subtype of type 'SourceLibraryBuilder<KernelTypeBuilder, Library>' of 'value' where
-invocation_mirror2_test: CompileTimeError
+invocation_mirror2_test: RuntimeError
invocation_mirror_empty_arguments_test: RuntimeError
-invocation_mirror_invoke_on2_test: CompileTimeError
-invocation_mirror_invoke_on_test: CompileTimeError
+invocation_mirror_invoke_on2_test: RuntimeError
+invocation_mirror_invoke_on_test: RuntimeError
invocation_mirror_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/builder_kernel.dart': Failed assertion: line 2521 pos 14: 'arguments.named.isEmpty': is not true.
issue13474_test: RuntimeError
-issue21079_test: CompileTimeError
+issue21079_test: RuntimeError
left_shift_test: RuntimeError
library_env_test/has_mirror_support: RuntimeError
library_env_test/has_no_html_support: RuntimeError
library_env_test/has_no_io_support: RuntimeError
list_literal4_test: RuntimeError
main_not_a_function_test/01: CompileTimeError
-many_overridden_no_such_method_test: CompileTimeError
+many_overridden_no_such_method_test: RuntimeError
map_literal4_test: RuntimeError
method_override5_test: RuntimeError
method_override7_test/00: MissingCompileTimeError
@@ -1005,12 +1000,13 @@
named_parameters_type_test/03: MissingRuntimeError
nan_identical_test: RuntimeError
no_main_test/01: CompileTimeError
-no_such_method_test: CompileTimeError
-null_test/none: CompileTimeError
+no_such_method_test: RuntimeError
+null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError
+operator2_negative_test: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
operator_test: Crash # 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart': Failed assertion: line 441 pos 16: 'identical(combiner.arguments.positional[0], rhs)': is not true.
-overridden_no_such_method_test: CompileTimeError
+overridden_no_such_method_test: RuntimeError
override_field_method1_negative_test: Fail
override_field_method2_negative_test: Fail
override_field_method4_negative_test: Fail
@@ -1028,21 +1024,20 @@
redirecting_constructor_initializer_test: RuntimeError
redirecting_factory_default_values_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_long_test: RuntimeError
-redirecting_factory_reflection_test: CompileTimeError
-regress_13462_0_test: CompileTimeError
-regress_13462_1_test: CompileTimeError
+redirecting_factory_reflection_test: RuntimeError
+regress_13462_1_test: RuntimeError
regress_13494_test: RuntimeError
regress_17382_test: RuntimeError
-regress_18535_test: CompileTimeError
+regress_18535_test: RuntimeError
regress_20394_test/01: MissingCompileTimeError
regress_22936_test/01: RuntimeError
+regress_23408_test: RuntimeError
regress_24283_test: RuntimeError
regress_27572_test: RuntimeError
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
regress_28217_test/01: MissingCompileTimeError
regress_28217_test/none: MissingCompileTimeError
-regress_28255_test: CompileTimeError
+regress_28255_test: RuntimeError
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
@@ -1053,8 +1048,8 @@
static_getter_no_setter1_test/01: RuntimeError
static_getter_no_setter2_test/01: RuntimeError
static_getter_no_setter3_test/01: RuntimeError
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
+super_call4_test: RuntimeError
+super_getter_setter_test: RuntimeError
super_test: RuntimeError
switch_bad_case_test/01: MissingCompileTimeError
switch_bad_case_test/02: MissingCompileTimeError
@@ -1063,6 +1058,28 @@
switch_case_test/02: MissingCompileTimeError
sync_generator2_test/41: Crash # 'file:*/pkg/compiler/lib/src/kernel/element_map_impl.dart': Failed assertion: line 939 pos 18: 'asyncMarker == AsyncMarker.SYNC': is not true.
sync_generator2_test/52: Crash # 'file:*/pkg/compiler/lib/src/kernel/element_map_impl.dart': Failed assertion: line 939 pos 18: 'asyncMarker == AsyncMarker.SYNC': is not true.
+syntax_test/04: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/05: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/06: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/07: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/08: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/09: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/10: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/11: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/13: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/14: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/15: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/16: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/17: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/18: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/19: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/20: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/21: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/22: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/23: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/24: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/25: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
+syntax_test/26: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
syntax_test/none: CompileTimeError
top_level_getter_no_setter1_test/01: RuntimeError
top_level_getter_no_setter2_test/01: RuntimeError
@@ -1089,7 +1106,6 @@
call_nonexistent_constructor_test/01: RuntimeError
call_type_literal_test/01: RuntimeError
canonical_const2_test: RuntimeError
-canonical_const3_test: CompileTimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
class_cycle_test/03: MissingCompileTimeError
@@ -1101,9 +1117,7 @@
config_import_test: RuntimeError
const_error_multiply_initialized_test/02: MissingCompileTimeError
const_error_multiply_initialized_test/04: MissingCompileTimeError
-const_evaluation_test/01: CompileTimeError
-const_evaluation_test/none: CompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
+const_evaluation_test/01: RuntimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
const_map3_test/00: MissingCompileTimeError
@@ -1121,8 +1135,8 @@
constructor_redirect2_negative_test: Crash # Issue 30856
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
cyclic_constructor_test/01: Crash # Issue 30856
-deferred_constraints_constants_test/none: CompileTimeError
-deferred_constraints_constants_test/reference_after_load: CompileTimeError
+deferred_constraints_constants_test/none: RuntimeError
+deferred_constraints_constants_test/reference_after_load: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
@@ -1139,7 +1153,7 @@
duplicate_implements_test/04: MissingCompileTimeError
dynamic_prefix_core_test/01: RuntimeError
dynamic_prefix_core_test/none: RuntimeError
-enum_mirror_test: CompileTimeError
+enum_mirror_test: RuntimeError
example_constructor_test: RuntimeError
expect_test: RuntimeError
external_test/10: MissingRuntimeError
@@ -1149,7 +1163,7 @@
factory_redirection_test/07: MissingCompileTimeError
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
-field_increment_bailout_test: CompileTimeError
+field_increment_bailout_test: RuntimeError
field_initialization_order_test: RuntimeError
field_override3_test/00: MissingCompileTimeError
field_override3_test/01: MissingCompileTimeError
@@ -1173,23 +1187,23 @@
identical_closure2_test: RuntimeError
if_null_assignment_behavior_test/14: RuntimeError
infinity_test: RuntimeError
-instance_creation_in_function_annotation_test: CompileTimeError
+instance_creation_in_function_annotation_test: RuntimeError
integer_division_by_zero_test: RuntimeError
internal_library_test/02: Crash # NoSuchMethodError: Class 'DillLibraryBuilder' has no instance getter 'mixinApplicationClasses'.
-invocation_mirror2_test: CompileTimeError
+invocation_mirror2_test: RuntimeError
invocation_mirror_empty_arguments_test: RuntimeError
-invocation_mirror_invoke_on2_test: CompileTimeError
-invocation_mirror_invoke_on_test: CompileTimeError
+invocation_mirror_invoke_on2_test: RuntimeError
+invocation_mirror_invoke_on_test: RuntimeError
invocation_mirror_test: RuntimeError
issue13474_test: RuntimeError
-issue21079_test: CompileTimeError
+issue21079_test: RuntimeError
left_shift_test: RuntimeError
library_env_test/has_mirror_support: RuntimeError
library_env_test/has_no_html_support: RuntimeError
library_env_test/has_no_io_support: RuntimeError
list_literal4_test: RuntimeError
main_not_a_function_test/01: CompileTimeError
-many_overridden_no_such_method_test: CompileTimeError
+many_overridden_no_such_method_test: RuntimeError
map_literal4_test: RuntimeError
method_override5_test: RuntimeError
method_override7_test/00: MissingCompileTimeError
@@ -1311,11 +1325,11 @@
named_parameters_type_test/03: MissingRuntimeError
nan_identical_test: RuntimeError
no_main_test/01: CompileTimeError
-no_such_method_test: CompileTimeError
-null_test/none: CompileTimeError
+no_such_method_test: RuntimeError
+null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError
-overridden_no_such_method_test: CompileTimeError
+overridden_no_such_method_test: RuntimeError
override_field_method1_negative_test: Fail
override_field_method2_negative_test: Fail
override_field_method4_negative_test: Fail
@@ -1332,12 +1346,11 @@
redirecting_constructor_initializer_test: RuntimeError
redirecting_factory_default_values_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_reflection_test: CompileTimeError
-regress_13462_0_test: CompileTimeError
-regress_13462_1_test: CompileTimeError
+redirecting_factory_reflection_test: RuntimeError
+regress_13462_1_test: RuntimeError
regress_13494_test: RuntimeError
regress_17382_test: RuntimeError
-regress_18535_test: CompileTimeError
+regress_18535_test: RuntimeError
regress_20394_test/01: MissingCompileTimeError
regress_22936_test/01: RuntimeError
regress_23408_test: RuntimeError
@@ -1346,7 +1359,7 @@
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
regress_28217_test/01: MissingCompileTimeError
regress_28217_test/none: MissingCompileTimeError
-regress_28255_test: CompileTimeError
+regress_28255_test: RuntimeError
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
@@ -1357,8 +1370,8 @@
static_getter_no_setter1_test/01: RuntimeError
static_getter_no_setter2_test/01: RuntimeError
static_getter_no_setter3_test/01: RuntimeError
-super_call4_test: CompileTimeError
-super_getter_setter_test: CompileTimeError
+super_call4_test: RuntimeError
+super_getter_setter_test: RuntimeError
super_test: RuntimeError
switch_bad_case_test/01: MissingCompileTimeError
switch_bad_case_test/02: MissingCompileTimeError
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index 7f1bb06..a7c5a89 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -20,7 +20,6 @@
config_import_test: Crash
const_error_multiply_initialized_test/02: MissingCompileTimeError
const_error_multiply_initialized_test/04: MissingCompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
const_map3_test/00: MissingCompileTimeError
diff --git a/tests/language_2/bad_constructor_test.dart b/tests/language_2/bad_constructor_test.dart
index 6bc4f12..429da88 100644
--- a/tests/language_2/bad_constructor_test.dart
+++ b/tests/language_2/bad_constructor_test.dart
@@ -38,10 +38,17 @@
E.setter();
}
+// A constructor can't be static.
+class F {
+ static //# 07: compile-time error
+ F(){}
+}
+
main() {
new A();
new B();
new C.good();
new D.good();
new E.setter();
+ new F();
}
diff --git a/tests/language_2/call_method_implicit_tear_off_nullable_test.dart b/tests/language_2/call_method_implicit_tear_off_nullable_test.dart
new file mode 100644
index 0000000..2b1050d
--- /dev/null
+++ b/tests/language_2/call_method_implicit_tear_off_nullable_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test program to test arithmetic operations.
+
+import "package:expect/expect.dart";
+
+class B {}
+
+class C {
+ B call(B b) => b;
+}
+
+typedef B BToB(B x);
+
+C c = null;
+
+void check(BToB f) {
+ Expect.isNull(f);
+}
+
+main() {
+ // The implicit tear-off of `.call` should be tolerant of `null`.
+ check(c); // Equivalent to `check(c?.call);`
+}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_named_test.dart b/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_named_test.dart
index d3f7601..468077d 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_named_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_named_test.dart
@@ -47,6 +47,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C.named(C<int>.named(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_test.dart b/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_test.dart
index aeb663b..ffeb1fe 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_constructor_generic_test.dart
@@ -49,6 +49,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C(C<int>(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_constructor_named_test.dart b/tests/language_2/implicit_creation/implicit_const_context_constructor_named_test.dart
index e523ca4..16345ab 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_constructor_named_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_constructor_named_test.dart
@@ -49,6 +49,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C.named(C.named(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_constructor_test.dart b/tests/language_2/implicit_creation/implicit_const_context_constructor_test.dart
index 6d24997..fec39c2 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_constructor_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_constructor_test.dart
@@ -49,6 +49,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C(C(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_list_test.dart b/tests/language_2/implicit_creation/implicit_const_context_list_test.dart
index 442cf74..c089d35 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_list_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_list_test.dart
@@ -58,6 +58,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C(<int>[42])
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_map_test.dart b/tests/language_2/implicit_creation/implicit_const_context_map_test.dart
index 1ed8fe5..231bfc3 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_map_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_map_test.dart
@@ -58,6 +58,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C(<int, int>{37: 87})
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_named_test.dart b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_named_test.dart
index 4ab25f6..0455aa7 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_named_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_named_test.dart
@@ -50,6 +50,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C.named(prefix.C<int>.named(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_test.dart b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_test.dart
index 2933b77..e86289f 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_generic_test.dart
@@ -51,6 +51,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C(prefix.C<int>(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_named_test.dart b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_named_test.dart
index a865f0f..4ab1603 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_named_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_named_test.dart
@@ -51,6 +51,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C.named(prefix.C.named(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_test.dart b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_test.dart
index 95edd04..cfd8fd1 100644
--- a/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_test.dart
+++ b/tests/language_2/implicit_creation/implicit_const_context_prefix_constructor_test.dart
@@ -51,6 +51,6 @@
// Annotation argument.
// (Cannot check that it's const, just that it's accepted).
@C(prefix.C(42))
- void foo() {}
- foo(); // avoid "unused" hints.
+ var foo = null;
+ foo; // avoid "unused" hints.
}
diff --git a/tests/language_2/invalid_override_in_mixin_test.dart b/tests/language_2/invalid_override_in_mixin_test.dart
new file mode 100644
index 0000000..426dac0
--- /dev/null
+++ b/tests/language_2/invalid_override_in_mixin_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+class A {
+ noSuchMethod() {} // //# 01: compile-time error
+}
+
+class C extends Object with A {
+ test() {
+ print("Hello from test");
+ }
+}
+
+main() {
+ C c = new C();
+ c.test();
+ dynamic cc = c;
+ Expect.throwsNoSuchMethodError(() => cc.doesntExist());
+}
diff --git a/tests/language_2/invalid_type_argument_count_test.dart b/tests/language_2/invalid_type_argument_count_test.dart
new file mode 100644
index 0000000..7e9c351
--- /dev/null
+++ b/tests/language_2/invalid_type_argument_count_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test top level field.
+dynamic // Formatter shouldn't join this line.
+ <int> // //# 01: compile-time error
+ x1 = 42;
+
+class Foo {
+ // Test class member.
+ dynamic // Formatter shouldn't join this line.
+ <int> // //# 02: compile-time error
+ x2 = 42;
+
+ Foo() {
+ print(x2);
+ }
+}
+
+main() {
+ print(x1);
+
+ new Foo();
+
+ // Test local variable.
+ dynamic // Formatter shouldn't join this line.
+ <int> // //# 03: compile-time error
+ x3 = 42;
+ print(x3);
+
+ foo(42);
+}
+
+// Test parameter.
+void foo(
+ dynamic // Formatter shouldn't join this line.
+ <int> // //# 04: compile-time error
+ x4) {
+ print(x4);
+}
diff --git a/tests/language_2/issue_25671a_test.dart b/tests/language_2/issue_25671a_test.dart
deleted file mode 100644
index 17c7a1e..0000000
--- a/tests/language_2/issue_25671a_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:expect/expect.dart';
-
-class A {
- noSuchMethod() { // //# 01: static type warning
- throw new Exception( // //# 01: continued
- "Wrong noSuchMethod() should not be called"); //# 01: continued
- } // //# 01: continued
-}
-
-class C extends A {
- test() {
- super.v = 1; //# 01: continued
- }
-}
-
-main() {
- C c = new C();
- Expect.throwsNoSuchMethodError(() => c.test()); //# 01: continued
-}
diff --git a/tests/language_2/issue_25671b_test.dart b/tests/language_2/issue_25671b_test.dart
deleted file mode 100644
index 5fc62f4..0000000
--- a/tests/language_2/issue_25671b_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:expect/expect.dart';
-
-class A {
- noSuchMethod() { // //# 01: static type warning
- throw new Exception( // //# 01: continued
- "Wrong noSuchMethod() should not be called"); //# 01: continued
- } // //# 01: continued
-}
-
-class C extends Object with A {
- test() {
- super.v = 1; //# 01: continued
- }
-}
-
-main() {
- C c = new C();
- Expect.throwsNoSuchMethodError(() => c.test()); //# 01: continued
-}
diff --git a/tests/language_2/language_2.status b/tests/language_2/language_2.status
index 06cff1c..9828cc6 100644
--- a/tests/language_2/language_2.status
+++ b/tests/language_2/language_2.status
@@ -5,6 +5,29 @@
[ $compiler == app_jit ]
deferred_inheritance_constraints_test/redirecting_constructor: Crash
+[ $compiler == dart2analyzer ]
+implicit_creation/implicit_const_context_constructor_generic_named_test: CompileTimeError
+implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError
+implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError
+implicit_creation/implicit_const_context_constructor_test: CompileTimeError
+implicit_creation/implicit_const_context_list_test: CompileTimeError
+implicit_creation/implicit_const_context_map_test: CompileTimeError
+implicit_creation/implicit_const_context_prefix_constructor_generic_named_test: CompileTimeError
+implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError
+implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError
+implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError
+implicit_creation/implicit_new_constructor_generic_named_test: CompileTimeError
+implicit_creation/implicit_new_constructor_generic_test: CompileTimeError
+implicit_creation/implicit_new_constructor_named_test: CompileTimeError
+implicit_creation/implicit_new_constructor_test: CompileTimeError
+implicit_creation/implicit_new_or_const_composite_test: CompileTimeError
+implicit_creation/implicit_new_or_const_generic_test: CompileTimeError
+implicit_creation/implicit_new_or_const_test: CompileTimeError
+implicit_creation/implicit_new_prefix_constructor_generic_named_test: CompileTimeError
+implicit_creation/implicit_new_prefix_constructor_generic_test: CompileTimeError
+implicit_creation/implicit_new_prefix_constructor_named_test: CompileTimeError
+implicit_creation/implicit_new_prefix_constructor_test: CompileTimeError
+
[ $compiler != dart2analyzer ]
switch_case_warn_test: Skip # Analyzer only, see language_analyzer2.status
@@ -52,8 +75,6 @@
compile_time_constant_static5_test/16: CompileTimeError # Issue 30546
compile_time_constant_static5_test/21: CompileTimeError # Issue 30546
compile_time_constant_static5_test/23: CompileTimeError # Issue 30546
-issue_25671a_test/01: CompileTimeError
-issue_25671b_test/01: CompileTimeError
type_promotion_more_specific_test/04: CompileTimeError # Issue 30906.
[ $compiler != dart2js && !$fasta && !$strong ]
@@ -99,29 +120,6 @@
[ $compiler != dartdevc && !$checked ]
function_type/*: Skip # Needs checked mode.
-[ $compiler != dartdevc && !$fasta && $strong ]
-implicit_creation/implicit_const_context_constructor_generic_named_test: CompileTimeError
-implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError
-implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError
-implicit_creation/implicit_const_context_constructor_test: CompileTimeError
-implicit_creation/implicit_const_context_list_test: CompileTimeError
-implicit_creation/implicit_const_context_map_test: CompileTimeError
-implicit_creation/implicit_const_context_prefix_constructor_generic_named_test: CompileTimeError
-implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError
-implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError
-implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError
-implicit_creation/implicit_new_constructor_generic_named_test: CompileTimeError
-implicit_creation/implicit_new_constructor_generic_test: CompileTimeError
-implicit_creation/implicit_new_constructor_named_test: CompileTimeError
-implicit_creation/implicit_new_constructor_test: CompileTimeError
-implicit_creation/implicit_new_or_const_composite_test: CompileTimeError
-implicit_creation/implicit_new_or_const_generic_test: CompileTimeError
-implicit_creation/implicit_new_or_const_test: CompileTimeError
-implicit_creation/implicit_new_prefix_constructor_generic_named_test: CompileTimeError
-implicit_creation/implicit_new_prefix_constructor_generic_test: CompileTimeError
-implicit_creation/implicit_new_prefix_constructor_named_test: CompileTimeError
-implicit_creation/implicit_new_prefix_constructor_test: CompileTimeError
-
[ $compiler != dartk && $compiler != dartkp && $mode == debug && $runtime == vm ]
built_in_identifier_type_annotation_test/15: Crash # Not supported by legacy VM front-end.
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 31ebcc6..bf6f7d9 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -56,6 +56,10 @@
interface_static_method_negative_test: CompileTimeError
interface_static_non_final_fields_negative_test: Fail # Issue 11594
interface_test/00: MissingCompileTimeError
+invalid_type_argument_count_test/01: MissingCompileTimeError
+invalid_type_argument_count_test/02: MissingCompileTimeError
+invalid_type_argument_count_test/03: MissingCompileTimeError
+invalid_type_argument_count_test/04: MissingCompileTimeError
is_not_class1_negative_test: CompileTimeError
is_not_class4_negative_test: CompileTimeError
issue1578_negative_test: CompileTimeError
@@ -1434,6 +1438,7 @@
invalid_cast_test/09: MissingCompileTimeError
invalid_cast_test/10: MissingCompileTimeError
invalid_cast_test/11: MissingCompileTimeError
+invalid_override_in_mixin_test/01: MissingCompileTimeError
invocation_mirror_test: StaticWarning
issue13179_test: StaticWarning
issue15606_test/none: StaticWarning # invalid use of void for dart 2, see also #32100
@@ -1583,6 +1588,12 @@
object_has_no_call_method_test/05: MissingCompileTimeError
object_has_no_call_method_test/08: MissingCompileTimeError
override_inheritance_no_such_method_test/05: MissingCompileTimeError
+partial_tearoff_instantiation_test/01: MissingCompileTimeError
+partial_tearoff_instantiation_test/03: MissingCompileTimeError
+partial_tearoff_instantiation_test/05: MissingCompileTimeError
+partial_tearoff_instantiation_test/06: MissingCompileTimeError
+partial_tearoff_instantiation_test/07: MissingCompileTimeError
+partial_tearoff_instantiation_test/08: MissingCompileTimeError
positional_parameters_type_test/01: MissingCompileTimeError
positional_parameters_type_test/02: MissingCompileTimeError
prefix13_negative_test: CompileTimeError, OK
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index f257594..18de4de 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -499,7 +499,6 @@
const_error_multiply_initialized_test/02: MissingCompileTimeError
const_error_multiply_initialized_test/04: MissingCompileTimeError
const_evaluation_test/01: RuntimeError
-const_factory_with_body_test/01: MissingCompileTimeError
const_init2_test/02: MissingCompileTimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
@@ -910,23 +909,6 @@
[ $compiler == dart2js && $dart2js_with_kernel ]
async_error_timing_test: Crash
bug31436_test: RuntimeError
-built_in_identifier_type_annotation_test/22: Crash # Issue 28815
-built_in_identifier_type_annotation_test/52: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/53: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/54: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/55: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/57: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/58: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/59: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/60: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/61: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/62: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/63: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/64: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/65: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/66: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/67: MissingCompileTimeError # Issue 28815
-built_in_identifier_type_annotation_test/68: MissingCompileTimeError # Issue 28815
call_method_as_cast_test/01: RuntimeError
call_method_as_cast_test/02: RuntimeError
call_method_as_cast_test/03: RuntimeError
@@ -981,6 +963,13 @@
mixin_type_parameter_inference_test/13: CompileTimeError
mixin_type_parameter_inference_test/16: CompileTimeError
mixin_type_parameter_inference_test/none: CompileTimeError
+partial_tearoff_instantiation_test/02: CompileTimeError
+partial_tearoff_instantiation_test/04: CompileTimeError
+partial_tearoff_instantiation_test/05: Pass # for the wrong reason.
+partial_tearoff_instantiation_test/06: Pass # for the wrong reason.
+partial_tearoff_instantiation_test/07: Pass # for the wrong reason.
+partial_tearoff_instantiation_test/08: Pass # for the wrong reason.
+partial_tearoff_instantiation_test/none: CompileTimeError
[ $compiler == dart2js && $dart2js_with_kernel && $fast_startup && $strong ]
assertion_initializer_const_error2_test/none: CompileTimeError
@@ -1062,7 +1051,6 @@
const_error_multiply_initialized_test/02: MissingCompileTimeError
const_error_multiply_initialized_test/04: MissingCompileTimeError
const_evaluation_test/01: RuntimeError
-const_factory_with_body_test/01: MissingCompileTimeError
const_init2_test/02: MissingCompileTimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
@@ -1397,11 +1385,9 @@
abstract_getter_test/01: MissingCompileTimeError
abstract_override_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError
-abstract_override_adds_optional_args_supercall_test: MissingCompileTimeError
abstract_syntax_test/00: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError
-additional_interface_adds_optional_args_supercall_test: MissingCompileTimeError
argument_assignability_function_typed_test/03: RuntimeError
argument_assignability_function_typed_test/04: RuntimeError
argument_assignability_function_typed_test/05: RuntimeError
@@ -1458,12 +1444,6 @@
await_for_use_local_test: RuntimeError
await_not_started_immediately_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
await_test: RuntimeError
-bad_named_parameters2_test/01: MissingCompileTimeError
-bad_named_parameters_test/01: MissingCompileTimeError
-bad_named_parameters_test/02: MissingCompileTimeError
-bad_named_parameters_test/03: MissingCompileTimeError
-bad_named_parameters_test/04: MissingCompileTimeError
-bad_named_parameters_test/05: MissingCompileTimeError
bad_override_test/01: MissingCompileTimeError
bad_override_test/02: MissingCompileTimeError
bad_override_test/03: MissingCompileTimeError
@@ -1509,14 +1489,9 @@
config_import_test: RuntimeError
const_constructor2_test/11: CompileTimeError
const_constructor2_test/12: CompileTimeError
-const_constructor2_test/20: MissingCompileTimeError
-const_constructor2_test/22: MissingCompileTimeError
-const_constructor2_test/24: MissingCompileTimeError
const_constructor3_test/03: CompileTimeError
const_dynamic_type_literal_test/02: MissingCompileTimeError
-const_evaluation_test/01: CompileTimeError
-const_evaluation_test/none: CompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
+const_evaluation_test/01: RuntimeError
const_instance_field_test/01: MissingCompileTimeError
const_list_test: RuntimeError
const_map2_test/00: MissingCompileTimeError
@@ -1557,8 +1532,8 @@
cyclic_typedef_test/11: Crash # Stack Overflow
default_factory2_test/01: MissingCompileTimeError
default_factory_test/01: MissingCompileTimeError
-deferred_constraints_constants_test/none: CompileTimeError
-deferred_constraints_constants_test/reference_after_load: CompileTimeError
+deferred_constraints_constants_test/none: RuntimeError
+deferred_constraints_constants_test/reference_after_load: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
@@ -1574,7 +1549,7 @@
duplicate_implements_test/02: MissingCompileTimeError
dynamic_prefix_core_test/none: CompileTimeError
emit_const_fields_test: CompileTimeError
-enum_mirror_test: CompileTimeError
+enum_mirror_test: RuntimeError
example_constructor_test: RuntimeError
expect_test: RuntimeError
external_test/10: MissingRuntimeError
@@ -1590,10 +1565,9 @@
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
field3_test/01: MissingCompileTimeError
-field_increment_bailout_test: CompileTimeError
+field_increment_bailout_test: RuntimeError
field_initialization_order_test/01: MissingCompileTimeError
field_initialization_order_test/none: RuntimeError
-field_method4_test: MissingCompileTimeError
field_override2_test: MissingCompileTimeError
field_override3_test/00: MissingCompileTimeError
field_override3_test/01: MissingCompileTimeError
@@ -1620,7 +1594,6 @@
function_subtype_bound_closure7_test: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
-function_subtype_cast0_test: RuntimeError
function_subtype_cast1_test: RuntimeError
function_subtype_checked0_test: RuntimeError
function_subtype_closure0_test: RuntimeError
@@ -1637,7 +1610,7 @@
function_subtype_setter0_test: RuntimeError
function_subtype_simple2_test: RuntimeError
function_subtype_typearg5_test: RuntimeError
-function_type2_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(B.T) in (local(B.#)) for j:signature(B_closure.$signature).
+function_type2_test: RuntimeError
function_type_alias2_test: RuntimeError
function_type_alias4_test: RuntimeError
function_type_alias_test: RuntimeError
@@ -1647,7 +1620,7 @@
generic_closure_test/01: RuntimeError
generic_closure_test/none: RuntimeError
generic_field_mixin6_test/none: RuntimeError
-generic_function_bounds_test: Crash # Unsupported operation: Unsupported type parameter type node U.
+generic_function_bounds_test: RuntimeError
generic_function_dcall_test: Crash # Unsupported operation: Unsupported type parameter type node T.
generic_function_type_as_type_argument_test/01: MissingCompileTimeError
generic_function_type_as_type_argument_test/02: MissingCompileTimeError
@@ -1699,7 +1672,7 @@
infinity_test: RuntimeError
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
-instance_creation_in_function_annotation_test: CompileTimeError
+instance_creation_in_function_annotation_test: RuntimeError
instantiate_tearoff_after_contravariance_check_test: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
instantiate_tearoff_of_call_test: CompileTimeError
instantiate_tearoff_test: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
@@ -1715,19 +1688,16 @@
int64_literal_test/none: RuntimeError
integer_division_by_zero_test: RuntimeError
internal_library_test/02: Crash # type 'DillLibraryBuilder' is not a subtype of type 'SourceLibraryBuilder<KernelTypeBuilder, Library>' of 'value' where
-invocation_mirror2_test: CompileTimeError
-invocation_mirror_invoke_on2_test: CompileTimeError
-invocation_mirror_invoke_on_test: CompileTimeError
-invocation_mirror_test: CompileTimeError
+invocation_mirror2_test: RuntimeError
+invocation_mirror_invoke_on2_test: RuntimeError
+invocation_mirror_invoke_on_test: RuntimeError
issue18628_2_test/01: MissingCompileTimeError
-issue21079_test: CompileTimeError
+issue21079_test: RuntimeError
issue23244_test: RuntimeError
issue31596_override_test/07: MissingCompileTimeError
issue31596_override_test/08: MissingCompileTimeError
issue31596_super_test/01: CompileTimeError
issue31596_super_test/03: CompileTimeError
-issue_25671a_test/01: CompileTimeError
-issue_25671b_test/01: CompileTimeError
known_identifier_usage_error_test/none: RuntimeError
left_shift_test: RuntimeError
library_env_test/has_mirror_support: RuntimeError
@@ -1736,8 +1706,6 @@
library_prefixes_test: CompileTimeError
local_function2_test/none: RuntimeError
local_function3_test/none: RuntimeError
-local_function_test/01: MissingCompileTimeError
-local_function_test/02: MissingCompileTimeError
local_function_test/none: RuntimeError
main_test/03: RuntimeError
main_test/20: RuntimeError
@@ -1760,7 +1728,7 @@
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
many_generic_instanceof_test: RuntimeError
-many_overridden_no_such_method_test: CompileTimeError
+many_overridden_no_such_method_test: RuntimeError
map_literal11_test/none: MissingRuntimeError
map_literal3_test/01: MissingCompileTimeError
map_literal3_test/02: MissingCompileTimeError
@@ -1882,31 +1850,22 @@
named_constructor_test/01: MissingCompileTimeError
named_parameters_default_eq_test/02: MissingCompileTimeError
named_parameters_default_eq_test/none: RuntimeError
-named_parameters_test/02: MissingCompileTimeError
-named_parameters_test/04: MissingCompileTimeError
-named_parameters_test/06: MissingCompileTimeError
-named_parameters_test/08: MissingCompileTimeError
-named_parameters_test/10: MissingCompileTimeError
nan_identical_test: RuntimeError
nested_generic_closure_test: RuntimeError
no_main_test/01: CompileTimeError
no_such_method_mock_test: RuntimeError
-no_such_method_test: CompileTimeError
+no_such_method_test: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
null_no_such_method_test: CompileTimeError
-null_test/mirrors: CompileTimeError
-null_test/none: CompileTimeError
+null_test/mirrors: RuntimeError
+null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError
operator2_negative_test: Crash # 'file:*/pkg/compiler/lib/src/kernel/env.dart': Failed assertion: line 322 pos 16: '!name.contains('#')': is not true.
operator4_test: RuntimeError
operator_test: Crash # 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart': Failed assertion: line 441 pos 16: 'identical(combiner.arguments.positional[0], rhs)': is not true.
-optional_named_parameters_test/02: MissingCompileTimeError
-optional_named_parameters_test/04: MissingCompileTimeError
-optional_named_parameters_test/06: MissingCompileTimeError
-optional_named_parameters_test/08: MissingCompileTimeError
-overridden_no_such_method_test: CompileTimeError
+overridden_no_such_method_test: RuntimeError
override_field_method1_negative_test: Fail
override_field_method2_negative_test: Fail
override_field_method4_negative_test: Fail
@@ -1943,8 +1902,6 @@
override_inheritance_field_test/53: MissingCompileTimeError
override_inheritance_field_test/54: MissingCompileTimeError
override_inheritance_generic_test/02: CompileTimeError
-override_inheritance_method_test/17: CompileTimeError
-override_inheritance_method_test/18: CompileTimeError
override_inheritance_method_test/28: CompileTimeError
override_inheritance_method_test/29: CompileTimeError
override_inheritance_mixed_test/01: MissingCompileTimeError
@@ -1965,16 +1922,21 @@
override_inheritance_no_such_method_test/13: MissingCompileTimeError
override_method_with_field_test/01: MissingCompileTimeError
parser_quirks_test: CompileTimeError
+partial_tearoff_instantiation_test/02: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
+partial_tearoff_instantiation_test/04: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
+partial_tearoff_instantiation_test/05: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
+partial_tearoff_instantiation_test/06: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
+partial_tearoff_instantiation_test/07: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
+partial_tearoff_instantiation_test/08: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
+partial_tearoff_instantiation_test/none: Crash # Assertion failure: kind=special,memberName=instantiate,callStructure:CallStructure(arity=0, types=1)
prefix5_negative_test: Crash # 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart': Failed assertion: line 441 pos 16: 'identical(combiner.arguments.positional[0], rhs)': is not true.
redirecting_factory_default_values_test/01: MissingCompileTimeError
redirecting_factory_default_values_test/02: MissingCompileTimeError
-redirecting_factory_default_values_test/03: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
-redirecting_factory_reflection_test: CompileTimeError
-regress_13462_0_test: CompileTimeError
-regress_13462_1_test: CompileTimeError
-regress_18535_test: CompileTimeError
+redirecting_factory_reflection_test: RuntimeError
+regress_13462_1_test: RuntimeError
+regress_18535_test: RuntimeError
regress_23089_test: Crash # Stack Overflow
regress_23408_test: CompileTimeError
regress_23996_test: RuntimeError
@@ -1982,14 +1944,13 @@
regress_24935_test/none: RuntimeError
regress_26175_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
-regress_28255_test: CompileTimeError
+regress_28255_test: RuntimeError
regress_29025_test: CompileTimeError
regress_29405_test: CompileTimeError
regress_29784_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in () for j:constructor(A.ok).
regress_29784_test/02: MissingCompileTimeError # Issue 29784
regress_30339_test: CompileTimeError
regress_31591_test: RuntimeError
-regress_32012_test: Crash # Unsupported operation: Unsupported type parameter type node B.
runtime_type_function_test: RuntimeError
setter4_test: MissingCompileTimeError
setter_no_getter_test/01: CompileTimeError
@@ -2100,7 +2061,7 @@
vm/optimization_test: RuntimeError
vm/optimized_guarded_field_isolates_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
vm/optimized_list_constructor_test: RuntimeError
-vm/reflect_core_vm_test: CompileTimeError
+vm/reflect_core_vm_test: RuntimeError
vm/regress_22480_test: RuntimeError
vm/regress_23238_test: RuntimeError
vm/regress_27201_test: CompileTimeError
@@ -2265,9 +2226,7 @@
const_constructor2_test/12: CompileTimeError
const_constructor3_test/03: CompileTimeError
const_dynamic_type_literal_test/02: MissingCompileTimeError
-const_evaluation_test/01: CompileTimeError
-const_evaluation_test/none: CompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
+const_evaluation_test/01: RuntimeError
const_instance_field_test/01: MissingCompileTimeError
const_list_test: RuntimeError
const_map2_test/00: MissingCompileTimeError
@@ -2308,8 +2267,8 @@
cyclic_typedef_test/11: Crash # Stack Overflow
default_factory2_test/01: MissingCompileTimeError
default_factory_test/01: MissingCompileTimeError
-deferred_constraints_constants_test/none: CompileTimeError
-deferred_constraints_constants_test/reference_after_load: CompileTimeError
+deferred_constraints_constants_test/none: RuntimeError
+deferred_constraints_constants_test/reference_after_load: RuntimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError
deferred_inheritance_constraints_test/implements: MissingCompileTimeError
deferred_inheritance_constraints_test/mixin: MissingCompileTimeError
@@ -2325,7 +2284,7 @@
duplicate_implements_test/02: MissingCompileTimeError
dynamic_prefix_core_test/none: CompileTimeError
emit_const_fields_test: CompileTimeError
-enum_mirror_test: CompileTimeError
+enum_mirror_test: RuntimeError
example_constructor_test: RuntimeError
expect_test: RuntimeError
external_test/10: MissingRuntimeError
@@ -2342,7 +2301,7 @@
fauxverride_test/03: MissingCompileTimeError
fauxverride_test/05: MissingCompileTimeError
field3_test/01: MissingCompileTimeError
-field_increment_bailout_test: CompileTimeError
+field_increment_bailout_test: RuntimeError
field_initialization_order_test/01: MissingCompileTimeError
field_initialization_order_test/none: RuntimeError
field_override2_test: MissingCompileTimeError
@@ -2387,7 +2346,7 @@
function_subtype_setter0_test: RuntimeError
function_subtype_simple2_test: RuntimeError
function_subtype_typearg5_test: RuntimeError
-function_type2_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(B.T) in (local(B.#)) for j:signature(B_closure.$signature).
+function_type2_test: RuntimeError
function_type_alias2_test: RuntimeError
function_type_alias4_test: RuntimeError
function_type_alias_test: RuntimeError
@@ -2395,7 +2354,7 @@
function_type_test: RuntimeError
generic_async_star_test: RuntimeError
generic_field_mixin6_test/none: RuntimeError
-generic_function_bounds_test: Crash # Unsupported operation: Unsupported type parameter type node U.
+generic_function_bounds_test: RuntimeError
generic_function_dcall_test: RuntimeError
generic_function_type_as_type_argument_test/01: MissingCompileTimeError
generic_function_type_as_type_argument_test/02: MissingCompileTimeError
@@ -2446,7 +2405,7 @@
infinity_test: RuntimeError
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
-instance_creation_in_function_annotation_test: CompileTimeError
+instance_creation_in_function_annotation_test: RuntimeError
instantiate_tearoff_of_call_test: CompileTimeError
int64_literal_test/01: RuntimeError
int64_literal_test/02: RuntimeError
@@ -2460,19 +2419,17 @@
int64_literal_test/none: RuntimeError
integer_division_by_zero_test: RuntimeError
internal_library_test/02: Crash # NoSuchMethodError: Class 'DillLibraryBuilder' has no instance getter 'mixinApplicationClasses'.
-invocation_mirror2_test: CompileTimeError
-invocation_mirror_invoke_on2_test: CompileTimeError
-invocation_mirror_invoke_on_test: CompileTimeError
+invocation_mirror2_test: RuntimeError
+invocation_mirror_invoke_on2_test: RuntimeError
+invocation_mirror_invoke_on_test: RuntimeError
invocation_mirror_test: RuntimeError
issue18628_2_test/01: MissingCompileTimeError
-issue21079_test: CompileTimeError
+issue21079_test: RuntimeError
issue23244_test: RuntimeError
issue31596_override_test/07: MissingCompileTimeError
issue31596_override_test/08: MissingCompileTimeError
issue31596_super_test/01: CompileTimeError
issue31596_super_test/03: CompileTimeError
-issue_25671a_test/01: CompileTimeError
-issue_25671b_test/01: CompileTimeError
known_identifier_usage_error_test/none: RuntimeError
left_shift_test: RuntimeError
library_env_test/has_mirror_support: RuntimeError
@@ -2503,7 +2460,7 @@
malbounded_type_test_test/01: MissingCompileTimeError
malbounded_type_test_test/02: MissingCompileTimeError
many_generic_instanceof_test: RuntimeError
-many_overridden_no_such_method_test: CompileTimeError
+many_overridden_no_such_method_test: RuntimeError
map_literal11_test/none: MissingRuntimeError
map_literal3_test/01: MissingCompileTimeError
map_literal3_test/02: MissingCompileTimeError
@@ -2634,16 +2591,16 @@
no_main_test/01: CompileTimeError
no_such_method_mock_test: RuntimeError
no_such_method_native_test: RuntimeError
-no_such_method_test: CompileTimeError
+no_such_method_test: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/05: RuntimeError
nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
null_no_such_method_test: CompileTimeError
-null_test/mirrors: CompileTimeError
-null_test/none: CompileTimeError
+null_test/mirrors: RuntimeError
+null_test/none: RuntimeError
number_identity2_test: RuntimeError
numbers_test: RuntimeError
operator4_test: RuntimeError
-overridden_no_such_method_test: CompileTimeError
+overridden_no_such_method_test: RuntimeError
override_field_method1_negative_test: Fail
override_field_method2_negative_test: Fail
override_field_method4_negative_test: Fail
@@ -2680,8 +2637,6 @@
override_inheritance_field_test/53: MissingCompileTimeError
override_inheritance_field_test/54: MissingCompileTimeError
override_inheritance_generic_test/02: CompileTimeError
-override_inheritance_method_test/17: CompileTimeError
-override_inheritance_method_test/18: CompileTimeError
override_inheritance_method_test/28: CompileTimeError
override_inheritance_method_test/29: CompileTimeError
override_inheritance_mixed_test/01: MissingCompileTimeError
@@ -2707,10 +2662,9 @@
redirecting_factory_default_values_test/02: MissingCompileTimeError
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
-redirecting_factory_reflection_test: CompileTimeError
-regress_13462_0_test: CompileTimeError
-regress_13462_1_test: CompileTimeError
-regress_18535_test: CompileTimeError
+redirecting_factory_reflection_test: RuntimeError
+regress_13462_1_test: RuntimeError
+regress_18535_test: RuntimeError
regress_21795_test: RuntimeError
regress_23089_test: Crash # Stack Overflow
regress_23408_test: CompileTimeError
@@ -2719,14 +2673,13 @@
regress_24935_test/none: RuntimeError
regress_26175_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
regress_27617_test/1: Crash # Assertion failure: Unexpected constructor j:constructor(Foo._) in ConstructorDataImpl._getConstructorConstant
-regress_28255_test: CompileTimeError
+regress_28255_test: RuntimeError
regress_29025_test: CompileTimeError
regress_29405_test: CompileTimeError
regress_29784_test/01: Crash # Issue 29784
regress_29784_test/02: MissingCompileTimeError # Issue 29784
regress_30339_test: CompileTimeError
regress_31591_test: RuntimeError
-regress_32012_test: Crash # Issue 32078
runtime_type_function_test: RuntimeError
setter4_test: MissingCompileTimeError
setter_no_getter_test/01: CompileTimeError
@@ -2815,12 +2768,11 @@
vm/optimization_test: RuntimeError
vm/optimized_guarded_field_isolates_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
vm/optimized_list_constructor_test: RuntimeError
-vm/reflect_core_vm_test: CompileTimeError
+vm/reflect_core_vm_test: RuntimeError
vm/regress_22480_test: RuntimeError
vm/regress_23238_test: RuntimeError
vm/regress_27201_test: CompileTimeError
vm/regress_28325_test: RuntimeError
-vm/regress_32204_test: Crash
vm/store_to_load_forwarding_phis_vm_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(bindCallback.R) in (local(_RootZone.bindCallback#)) for j:closure_call(_RootZone_bindCallback_closure.call).
vm/type_cast_vm_test: RuntimeError
vm/type_vm_test/28: MissingRuntimeError
@@ -2906,23 +2858,6 @@
bad_typedef_test/00: Crash # Issue 28214
bug31436_test: RuntimeError
built_in_identifier_prefix_test: CompileTimeError
-built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Error only in strong mode
-built_in_identifier_type_annotation_test/52: Crash # Issue 28815
-built_in_identifier_type_annotation_test/53: Crash # Issue 28815
-built_in_identifier_type_annotation_test/54: Crash # Issue 28815
-built_in_identifier_type_annotation_test/55: Crash # Issue 28815
-built_in_identifier_type_annotation_test/57: Crash # Issue 28815
-built_in_identifier_type_annotation_test/58: Crash # Issue 28815
-built_in_identifier_type_annotation_test/59: Crash # Issue 28815
-built_in_identifier_type_annotation_test/60: Crash # Issue 28815
-built_in_identifier_type_annotation_test/61: Crash # Issue 28815
-built_in_identifier_type_annotation_test/62: Crash # Issue 28815
-built_in_identifier_type_annotation_test/63: Crash # Issue 28815
-built_in_identifier_type_annotation_test/64: Crash # Issue 28815
-built_in_identifier_type_annotation_test/65: Crash # Issue 28815
-built_in_identifier_type_annotation_test/66: Crash # Issue 28815
-built_in_identifier_type_annotation_test/67: Crash # Issue 28815
-built_in_identifier_type_annotation_test/68: Crash # Issue 28815
call_constructor_on_unresolvable_class_test/01: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/02: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/03: MissingCompileTimeError
@@ -3271,6 +3206,7 @@
int64_literal_test/*: Skip # This is testing Dart 2.0 int64 semantics.
integer_division_by_zero_test: RuntimeError # Issue 8301
interface_test/00: MissingCompileTimeError
+invalid_override_in_mixin_test/01: MissingCompileTimeError
invocation_mirror2_test: RuntimeError # Issue 6490 (wrong retval).
issue31596_override_test/05: MissingCompileTimeError
issue31596_override_test/06: MissingCompileTimeError
@@ -3592,6 +3528,14 @@
override_inheritance_no_such_method_test/13: MissingCompileTimeError
override_method_with_field_test/02: MissingCompileTimeError
part2_test/01: MissingCompileTimeError
+partial_tearoff_instantiation_test/01: MissingCompileTimeError
+partial_tearoff_instantiation_test/02: MissingRuntimeError
+partial_tearoff_instantiation_test/03: MissingCompileTimeError
+partial_tearoff_instantiation_test/04: MissingRuntimeError
+partial_tearoff_instantiation_test/05: MissingCompileTimeError
+partial_tearoff_instantiation_test/06: MissingCompileTimeError
+partial_tearoff_instantiation_test/07: MissingCompileTimeError
+partial_tearoff_instantiation_test/08: MissingCompileTimeError
positional_parameters_type_test/01: MissingCompileTimeError
positional_parameters_type_test/02: MissingCompileTimeError
prefix16_test/00: MissingCompileTimeError
@@ -3692,8 +3636,7 @@
try_catch_on_syntax_test/07: MissingCompileTimeError
try_catch_on_syntax_test/10: Fail # Issue 19823
try_catch_on_syntax_test/10: MissingCompileTimeError
-try_catch_on_syntax_test/11: MissingCompileTimeError
-try_catch_on_syntax_test/11: Fail # Issue 19823
+try_catch_on_syntax_test/11: MissingCompileTimeError, Fail # Issue 19823
try_catch_syntax_test/08: MissingCompileTimeError
type_checks_in_factory_method_test/01: MissingCompileTimeError
type_inference_accessor_ref_test/03: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index ca259ad..e41601c 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -1,8 +1,8 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-# Sections in this file should contain "$compiler == dartdevc" or dartdevk.
+# Sections in this file should contain "$compiler == dartdevc" or dartdevk.
[ $compiler == dartdevc ]
abstract_override_adds_optional_args_supercall_test: MissingCompileTimeError # Issue #30568
accessor_conflict_export2_test: CompileTimeError # Issue 25626
@@ -12,6 +12,14 @@
accessor_conflict_import_prefixed_test: CompileTimeError # Issue 25626
accessor_conflict_import_test: CompileTimeError # Issue 25626
additional_interface_adds_optional_args_test: CompileTimeError # Issue #30568
+assertion_test: RuntimeError # Issue 30326; Expect.equals(expected: <1>, actual: <0>) fails.
+async_star_test/01: RuntimeError
+async_star_test/03: RuntimeError
+async_star_test/04: RuntimeError
+async_star_test/05: RuntimeError
+async_star_test/none: RuntimeError
+await_future_test: Pass, Timeout # Issue 29920
+bit_operations_test: RuntimeError # No bigints on web.
black_listed_test/none: Fail # Issue 14228
built_in_identifier_prefix_test: CompileTimeError
built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Issue 28816
@@ -46,23 +54,31 @@
cascaded_forwarding_stubs_generic_test: RuntimeError
cascaded_forwarding_stubs_test: CompileTimeError
conflicting_type_variable_and_setter_test: CompileTimeError
+const_evaluation_test/01: RuntimeError # Issue 29920
const_for_in_variable_test/01: MissingCompileTimeError
const_types_test/07: MissingCompileTimeError
const_types_test/08: MissingCompileTimeError
const_types_test/14: MissingCompileTimeError
const_types_test/15: MissingCompileTimeError
constant_type_literal_test/01: MissingCompileTimeError # DDC allows type parameter type literals in const expressions.
+covariance_field_test/03: RuntimeError
+covariant_override/tear_off_type_test: RuntimeError # Issue 28395
default_implementation2_test: CompileTimeError # Issue 30855
+deferred_load_library_wrong_args_test/01: MissingRuntimeError, RuntimeError # Issue 29920
double_identical_test: RuntimeError # Negative and positive zero are distinct, but not in ddc
emit_const_fields_test: CompileTimeError
enum_syntax_test/05: MissingCompileTimeError
enum_syntax_test/06: MissingCompileTimeError
+execute_finally6_test: RuntimeError # Issue 29920
+expect_test: RuntimeError # Issue 29920
export_private_test/01: MissingCompileTimeError # Issue 29920
+f_bounded_quantification3_test: RuntimeError # Issue 29920
field_wierd_name_test: Crash
final_syntax_test/01: MissingCompileTimeError
final_syntax_test/02: MissingCompileTimeError
final_syntax_test/03: MissingCompileTimeError
final_syntax_test/04: MissingCompileTimeError
+forwarding_stub_tearoff_generic_test: RuntimeError
forwarding_stub_tearoff_test: CompileTimeError
function_propagation_test: RuntimeError
fuzzy_arrows_test/01: MissingCompileTimeError
@@ -72,6 +88,7 @@
generic_methods_overriding_test/03: MissingCompileTimeError # Issue 29920
generic_no_such_method_dispatcher_simple_test: Skip # This test is just for kernel.
generic_no_such_method_dispatcher_test: CompileTimeError
+getter_closure_execution_order_test: RuntimeError # Issue 29920
getter_setter_in_lib_test: CompileTimeError
implicit_creation/implicit_const_context_constructor_generic_named_test: CompileTimeError
implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError
@@ -79,6 +96,9 @@
implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError
implicit_creation/implicit_new_or_const_composite_test: RuntimeError
implicit_creation/implicit_new_or_const_generic_test: RuntimeError
+implicit_downcast_during_compound_assignment_test: RuntimeError
+implicit_downcast_during_indexed_compound_assignment_test: RuntimeError
+implicit_downcast_during_indexed_if_null_assignment_test: RuntimeError
import_core_prefix_test: CompileTimeError
import_private_test/01: MissingCompileTimeError # Issue 29920
initializing_formal_final_test: MissingCompileTimeError
@@ -86,6 +106,10 @@
instantiate_tearoff_of_call_test: RuntimeError
interface_test/00: MissingCompileTimeError
internal_library_test/01: MissingCompileTimeError # Issue 29920
+invalid_type_argument_count_test/01: MissingCompileTimeError
+invalid_type_argument_count_test/02: MissingCompileTimeError
+invalid_type_argument_count_test/03: MissingCompileTimeError
+invalid_type_argument_count_test/04: MissingCompileTimeError
issue15606_test/none: CompileTimeError
issue31596_implement_covariant_test: CompileTimeError
issue31596_override_test/01: CompileTimeError
@@ -99,13 +123,21 @@
issue31596_super_test/none: CompileTimeError
issue31596_tearoff_test: CompileTimeError
issue31596_test: CompileTimeError
+label_test: RuntimeError
+lazy_static3_test: RuntimeError # Issue 30852
+lazy_static8_test: RuntimeError # Issue 30852
+left_shift_test: RuntimeError # Ints and doubles are unified.
+library_env_test/has_io_support: RuntimeError # Intended to fail, bool.fromEnvironment("dart.library.async") is false
+library_env_test/has_mirror_support: RuntimeError # Intended to fail, bool.fromEnvironment("dart.library.async") is false
+library_env_test/has_no_html_support: RuntimeError # Intended to fail, bool.fromEnvironment("dart.library.async") is false
method_override_test: CompileTimeError # Negative test
mixin_super_2_test/01: MissingCompileTimeError
mixin_super_2_test/03: MissingCompileTimeError
+mixin_super_test: RuntimeError
+mixin_super_use_test: RuntimeError
mixin_supertype_subclass_test/02: MissingCompileTimeError
mixin_supertype_subclass_test/05: MissingCompileTimeError
mixin_type_parameter_inference_previous_mixin_test/01: CompileTimeError
-mixin_type_parameter_inference_previous_mixin_test/02: CompileTimeError
mixin_type_parameter_inference_previous_mixin_test/02: RuntimeError # should be CompileTimeError, fuzzy arrows
mixin_type_parameter_inference_previous_mixin_test/03: MissingCompileTimeError # fuzzy arrows
mixin_type_parameter_inference_previous_mixin_test/04: MissingCompileTimeError
@@ -125,6 +157,9 @@
multiline_newline_test/01r: CompileTimeError
multiline_newline_test/02: CompileTimeError
multiline_newline_test/02r: CompileTimeError
+multiline_newline_test/03: RuntimeError
+multiline_newline_test/03r: RuntimeError
+multiline_newline_test/none: RuntimeError
multiple_interface_inheritance_test: CompileTimeError # Issue 30552
nested_generic_closure_test: CompileTimeError
override_inheritance_field_test/04: CompileTimeError
@@ -144,19 +179,31 @@
prefix10_negative_test: Fail # Issue 29920
private_access_test/04: MissingCompileTimeError
regress_23408_test: CompileTimeError
+regress_24283_test: RuntimeError # Intended to fail, requires 64-bit numbers.
regress_29025_test: CompileTimeError # Issue 29081
regress_29349_test: CompileTimeError # Issue 31093
regress_29405_test: CompileTimeError # Issue 29421
+regress_29784_test/02: Crash # assert initializers not implemented
regress_29784_test/02: MissingCompileTimeError
regress_30121_test: CompileTimeError # Issue 31087
regress_30339_test: CompileTimeError # As expected. Should we make this a multi test?
reify_typevar_static_test/00: MissingCompileTimeError # Issue 29920
+stacktrace_test: RuntimeError # Issue 29920
string_interpolate_test: CompileTimeError
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
+super_call4_test: RuntimeError
+super_no_such_method1_test: RuntimeError
+super_no_such_method2_test: RuntimeError
+super_no_such_method3_test: RuntimeError
+super_no_such_method4_test: RuntimeError
+super_operator_index5_test: RuntimeError
+super_operator_index7_test: RuntimeError
+super_operator_index8_test: RuntimeError
switch_case_test/none: CompileTimeError
syntax_test/none: CompileTimeError
+truncdiv_test: RuntimeError # Issue 29920
try_catch_on_syntax_test/10: MissingCompileTimeError
try_catch_on_syntax_test/11: MissingCompileTimeError
type_inference_circularity_test: MissingCompileTimeError
@@ -288,23 +335,6 @@
bad_override_test/04: MissingCompileTimeError
bad_override_test/05: MissingCompileTimeError
built_in_identifier_type_annotation_test/05: RuntimeError # Issue 32194
-built_in_identifier_type_annotation_test/22: Crash # Crashes in Fasta, issue 31416
-built_in_identifier_type_annotation_test/52: MissingCompileTimeError
-built_in_identifier_type_annotation_test/53: MissingCompileTimeError
-built_in_identifier_type_annotation_test/54: MissingCompileTimeError
-built_in_identifier_type_annotation_test/55: MissingCompileTimeError
-built_in_identifier_type_annotation_test/57: MissingCompileTimeError
-built_in_identifier_type_annotation_test/58: MissingCompileTimeError
-built_in_identifier_type_annotation_test/59: MissingCompileTimeError
-built_in_identifier_type_annotation_test/60: MissingCompileTimeError
-built_in_identifier_type_annotation_test/61: MissingCompileTimeError
-built_in_identifier_type_annotation_test/62: MissingCompileTimeError
-built_in_identifier_type_annotation_test/63: MissingCompileTimeError
-built_in_identifier_type_annotation_test/64: MissingCompileTimeError
-built_in_identifier_type_annotation_test/65: MissingCompileTimeError
-built_in_identifier_type_annotation_test/66: MissingCompileTimeError
-built_in_identifier_type_annotation_test/67: MissingCompileTimeError
-built_in_identifier_type_annotation_test/68: MissingCompileTimeError
built_in_identifier_type_annotation_test/none: RuntimeError # Issue 32194
call_method_as_cast_test/01: RuntimeError
call_method_as_cast_test/02: RuntimeError
@@ -352,7 +382,6 @@
const_constructor3_test/04: MissingCompileTimeError
const_constructor_nonconst_field_test/01: MissingCompileTimeError
const_dynamic_type_literal_test/02: MissingCompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError
const_instance_field_test/01: MissingCompileTimeError
const_map2_test/00: MissingCompileTimeError
const_map3_test/00: MissingCompileTimeError
@@ -433,7 +462,6 @@
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
instantiate_tearoff_of_call_test: CompileTimeError
-invocation_mirror_test: CompileTimeError # Issue 31402 Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::Invocation'.
issue18628_2_test/01: MissingCompileTimeError
issue31596_override_test/07: MissingCompileTimeError
issue31596_override_test/08: MissingCompileTimeError
@@ -442,8 +470,6 @@
issue31596_super_test/03: CompileTimeError
issue31596_super_test/04: MissingCompileTimeError
issue31596_super_test/05: RuntimeError
-issue_25671a_test/01: CompileTimeError # Warning: The method 'A::noSuchMethod' has fewer positional arguments than those of overridden method 'Object::noSuchMethod'.
-issue_25671b_test/01: CompileTimeError # Warning: The method 'A::noSuchMethod' has fewer positional arguments than those of overridden method 'Object::noSuchMethod'.
library_env_test/has_io_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
library_env_test/has_mirror_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
library_env_test/has_no_html_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
@@ -583,8 +609,6 @@
override_inheritance_field_test/53: MissingCompileTimeError
override_inheritance_field_test/54: MissingCompileTimeError
override_inheritance_generic_test/02: CompileTimeError # Issue 31616
-override_inheritance_method_test/17: CompileTimeError
-override_inheritance_method_test/18: CompileTimeError
override_inheritance_method_test/28: CompileTimeError # Issue 31616
override_inheritance_method_test/29: CompileTimeError # Issue 31616
override_inheritance_mixed_test/01: MissingCompileTimeError
@@ -684,52 +708,6 @@
void_type_usage_test/conditional_return_to_void: MissingCompileTimeError, Crash
wrong_number_type_arguments_test/01: MissingCompileTimeError
-[ $compiler == dartdevc && $runtime != none ]
-assertion_test: RuntimeError # Issue 30326; Expect.equals(expected: <1>, actual: <0>) fails.
-async_star_test/01: RuntimeError
-async_star_test/03: RuntimeError
-async_star_test/04: RuntimeError
-async_star_test/05: RuntimeError
-async_star_test/none: RuntimeError
-await_future_test: Pass, Timeout # Issue 29920
-bit_operations_test: RuntimeError # No bigints on web.
-const_evaluation_test/01: RuntimeError # Issue 29920
-covariance_field_test/03: RuntimeError
-covariant_override/tear_off_type_test: RuntimeError # Issue 28395
-deferred_load_library_wrong_args_test/01: MissingRuntimeError, RuntimeError # Issue 29920
-execute_finally6_test: RuntimeError # Issue 29920
-expect_test: RuntimeError # Issue 29920
-f_bounded_quantification3_test: RuntimeError # Issue 29920
-forwarding_stub_tearoff_generic_test: RuntimeError
-getter_closure_execution_order_test: RuntimeError # Issue 29920
-implicit_downcast_during_compound_assignment_test: RuntimeError
-implicit_downcast_during_indexed_compound_assignment_test: RuntimeError
-implicit_downcast_during_indexed_if_null_assignment_test: RuntimeError
-label_test: RuntimeError
-lazy_static3_test: RuntimeError # Issue 30852
-lazy_static8_test: RuntimeError # Issue 30852
-left_shift_test: RuntimeError # Ints and doubles are unified.
-library_env_test/has_io_support: RuntimeError, OK
-library_env_test/has_mirror_support: RuntimeError, OK
-library_env_test/has_no_html_support: RuntimeError, OK
-mixin_super_test: RuntimeError
-mixin_super_use_test: RuntimeError
-multiline_newline_test/03: RuntimeError
-multiline_newline_test/03r: RuntimeError
-multiline_newline_test/none: RuntimeError
-regress_24283_test: RuntimeError, OK # Requires 64 bit numbers.
-regress_29784_test/02: Crash # assert initializers not implemented
-stacktrace_test: RuntimeError # Issue 29920
-super_call4_test: RuntimeError
-super_no_such_method1_test: RuntimeError
-super_no_such_method2_test: RuntimeError
-super_no_such_method3_test: RuntimeError
-super_no_such_method4_test: RuntimeError
-super_operator_index5_test: RuntimeError
-super_operator_index7_test: RuntimeError
-super_operator_index8_test: RuntimeError
-truncdiv_test: RuntimeError # Issue 29920
-
[ $compiler == dartdevk && $checked ]
assertion_initializer_const_error2_test/*: MissingCompileTimeError
assertion_initializer_const_error2_test/none: Pass
@@ -738,10 +716,6 @@
[ $compiler == dartdevk && !$checked ]
assertion_initializer_const_error2_test/*: SkipByDesign # DDC does not support non-checked mode.
-# Compiler tests for dartdevc and dartdevk. These contain common expectations
-# for all runtimes including $runtime == none. They are organized by: shared
-# expectations for dartdevc and dartdevk, then expectations for dartdevc, and
-# then expectations for dartdevk.
[ $compiler == dartdevc || $compiler == dartdevk ]
abstract_override_adds_optional_args_concrete_subclass_test: MissingCompileTimeError # Issue #30568
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError # Issue #30568
diff --git a/tests/language_2/language_2_flutter.status b/tests/language_2/language_2_flutter.status
index 8ed9601..896791b 100644
--- a/tests/language_2/language_2_flutter.status
+++ b/tests/language_2/language_2_flutter.status
@@ -102,7 +102,6 @@
is_malformed_type_test/99: CompileTimeError
is_not_class2_test: RuntimeError
issue21079_test: CompileTimeError
-issue_25671b_test/01: CompileTimeError
library_env_test/has_mirror_support: RuntimeError, OK
library_env_test/has_no_mirror_support: Pass
list_literal_syntax_test/01: CompileTimeError
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 79a1f4a..d5d228a 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -39,22 +39,6 @@
async_return_types_test/wrongReturnType: MissingCompileTimeError
bad_override_test/01: MissingCompileTimeError
bad_override_test/02: MissingCompileTimeError
-built_in_identifier_type_annotation_test/52: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/53: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/54: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/55: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/57: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/58: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/59: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/60: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/61: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/62: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/63: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/64: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/65: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/66: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/67: MissingCompileTimeError # Issue 28814
-built_in_identifier_type_annotation_test/68: MissingCompileTimeError # Issue 28814
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
check_member_static_test/01: MissingCompileTimeError
@@ -63,8 +47,7 @@
compile_time_constant_o_test/01: MissingCompileTimeError
compile_time_constant_o_test/02: MissingCompileTimeError
const_dynamic_type_literal_test/02: MissingCompileTimeError
-const_factory_with_body_test/01: MissingCompileTimeError # Fasta bug: Const factory with body.
-const_instance_field_test/01: MissingCompileTimeError # Fasta bug: Const instance field.
+const_instance_field_test/01: MissingCompileTimeError # Fasta bug: Const instance field. Issue 32326.
const_map2_test/00: MissingCompileTimeError # KernelVM bug: Constant evaluation.
const_map3_test/00: MissingCompileTimeError # KernelVM bug: Constant evaluation.
const_switch2_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
@@ -103,15 +86,7 @@
identical_const_test/03: MissingCompileTimeError
identical_const_test/04: MissingCompileTimeError
implicit_creation/implicit_const_context_constructor_generic_named_test: CompileTimeError
-implicit_creation/implicit_const_context_constructor_generic_test: CompileTimeError
-implicit_creation/implicit_const_context_constructor_named_test: CompileTimeError
-implicit_creation/implicit_const_context_constructor_test: CompileTimeError
-implicit_creation/implicit_const_context_list_test: CompileTimeError
-implicit_creation/implicit_const_context_map_test: CompileTimeError
implicit_creation/implicit_const_context_prefix_constructor_generic_named_test: CompileTimeError
-implicit_creation/implicit_const_context_prefix_constructor_generic_test: CompileTimeError
-implicit_creation/implicit_const_context_prefix_constructor_named_test: CompileTimeError
-implicit_creation/implicit_const_context_prefix_constructor_test: CompileTimeError
implicit_creation/implicit_new_constructor_generic_named_test: CompileTimeError
implicit_creation/implicit_new_or_const_generic_test: CompileTimeError
implicit_creation/implicit_new_prefix_constructor_generic_named_test: CompileTimeError
@@ -215,6 +190,10 @@
override_inheritance_no_such_method_test/10: MissingCompileTimeError
override_inheritance_no_such_method_test/12: MissingCompileTimeError
override_inheritance_no_such_method_test/13: MissingCompileTimeError
+partial_tearoff_instantiation_test/05: MissingCompileTimeError
+partial_tearoff_instantiation_test/06: MissingCompileTimeError
+partial_tearoff_instantiation_test/07: MissingCompileTimeError
+partial_tearoff_instantiation_test/08: MissingCompileTimeError
redirecting_factory_default_values_test/01: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
redirecting_factory_default_values_test/02: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
regress_22976_test/*: CompileTimeError # Issue 31935
@@ -487,6 +466,13 @@
[ $arch != simarm && $arch != simarm64 && $arch != simdbc64 && $compiler == dartk ]
export_ambiguous_main_test: MissingCompileTimeError
+[ $arch == simdbc64 && $compiler == dartk && $mode == debug && $strong ]
+partial_tearoff_instantiation_test/05: Crash # Issue http://dartbug.com/32340
+partial_tearoff_instantiation_test/06: Crash # Issue http://dartbug.com/32340
+partial_tearoff_instantiation_test/07: Crash # Issue http://dartbug.com/32340
+partial_tearoff_instantiation_test/08: Crash # Issue http://dartbug.com/32340
+partial_tearoff_instantiation_test/none: Crash # Issue http://dartbug.com/32340
+
[ $compiler != dart2js && $fasta ]
compile_time_constant_c_test/02: MissingCompileTimeError
const_constructor_nonconst_field_test/01: MissingCompileTimeError
@@ -504,7 +490,7 @@
mixin_supertype_subclass_test/05: MissingCompileTimeError
[ $compiler == dartk && $mode == debug && $runtime == vm && $strong ]
-const_instance_field_test/01: Crash
+const_instance_field_test/01: Crash # Issue 32326.
cyclic_type_variable_test/01: Crash
cyclic_type_variable_test/02: Crash
cyclic_type_variable_test/03: Crash
@@ -593,13 +579,10 @@
async_star_pause_test: Fail, OK
async_star_test/02: RuntimeError # Issue 31402 (Invocation arguments)
built_in_identifier_prefix_test: CompileTimeError
-built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814
call_method_must_not_be_field_test/03: RuntimeError # Issue 32265
call_method_must_not_be_getter_test/03: RuntimeError # Issue 32265
call_operator_test: RuntimeError, OK
call_with_no_such_method_test: RuntimeError
-cha_deopt1_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-cha_deopt1_test: RuntimeError
compile_time_constant_k_test/01: MissingCompileTimeError
compile_time_constant_k_test/02: MissingCompileTimeError
compile_time_constant_k_test/03: MissingCompileTimeError
@@ -628,40 +611,13 @@
cyclic_type_test/04: RuntimeError, CompileTimeError
cyclic_typedef_test/10: Crash
cyclic_typedef_test/11: Crash
-deferred_call_empty_before_load_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_closurize_load_library_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constant_list_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_constants_test/default_argument2: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_constants_test/reference_after_load: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_type_annotation_test/new: CompileTimeError # Deferred loading kernel issue 30273.
-deferred_constraints_type_annotation_test/new_generic1: CompileTimeError # Deferred loading kernel issue 30273
-deferred_constraints_type_annotation_test/none: CompileTimeError # Deferred loading kernel issue 30273.
-deferred_constraints_type_annotation_test/static_method: CompileTimeError # Deferred loading kernel issue 30273.
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: CompileTimeError # Deferred loading kernel issue 30273.
-deferred_function_type_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_global_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_import_core_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_inlined_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_load_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_load_inval_code_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_call_empty_before_load_test: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_load_constants_test/none: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
deferred_load_library_wrong_args_test/01: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 30273.
-deferred_load_library_wrong_args_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_mixin_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_no_such_method_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_not_loaded_check_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
-deferred_only_constant_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_optimized_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_not_loaded_check_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
deferred_redirecting_factory_test: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_regression_22995_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_regression_28678_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_shadow_load_library_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
deferred_shared_and_unshared_classes_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_static_seperate_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/as: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/is: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/type_annotation: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_static_seperate_test: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
disassemble_test: Pass, Slow
dynamic_prefix_core_test/none: CompileTimeError
emit_const_fields_test: CompileTimeError # Issue 31533
@@ -698,9 +654,6 @@
issue31596_super_test/01: CompileTimeError
issue31596_super_test/03: CompileTimeError
issue31596_super_test/05: RuntimeError
-issue_1751477_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-issue_25671a_test/01: CompileTimeError # Test assumes Dart 1.0 semantics
-issue_25671b_test/01: DartkCrash
least_upper_bound_expansive_test/none: CompileTimeError
library_env_test/has_html_support: RuntimeError # KernelVM bug: Configurable imports.
library_env_test/has_no_io_support: RuntimeError # KernelVM bug: Configurable imports.
@@ -740,18 +693,15 @@
override_inheritance_field_test/26: CompileTimeError # Issue 31616
override_inheritance_field_test/29: CompileTimeError # Issue 31616
override_inheritance_generic_test/02: CompileTimeError
-override_inheritance_method_test/17: CompileTimeError
-override_inheritance_method_test/18: CompileTimeError
override_inheritance_method_test/28: CompileTimeError
override_inheritance_method_test/29: CompileTimeError
parser_quirks_test: CompileTimeError # Issue 31533
redirecting_factory_infinite_steps_test/01: MissingCompileTimeError
redirecting_factory_malbounded_test/01: MissingCompileTimeError
-regress_22443_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+regress_22443_test: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_23089_test: Crash
regress_23408_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_23408_test: RuntimeError
-regress_28278_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_29025_test: CompileTimeError # Issue 31402 (Variable declaration)
regress_29405_test: CompileTimeError # Issue 31402 (Invocation arguments)
regress_30339_test: CompileTimeError # Issue 31402 (Variable declaration)
@@ -810,11 +760,8 @@
assertion_initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
assertion_initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
-cha_deopt2_test: CompileTimeError, DartkCrash # KernelVM bug: Deferred loading kernel issue 30273.
-cha_deopt3_test: CompileTimeError, DartkCrash # KernelVM bug: Deferred loading kernel issue 30273.
-hello_dart_test: Crash
recursive_mixin_test: Crash
-redirecting_factory_reflection_test: Crash
+redirecting_factory_reflection_test: RuntimeError
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
@@ -823,7 +770,7 @@
least_upper_bound_expansive_test/none: RuntimeError # Please triage.
[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled && $strong ]
-const_instance_field_test/01: Crash
+const_instance_field_test/01: Crash # Issue 32326.
cyclic_type_variable_test/01: Crash
cyclic_type_variable_test/02: Crash
cyclic_type_variable_test/03: Crash
@@ -957,14 +904,10 @@
async_star_pause_test: Fail, OK
async_star_test/02: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
built_in_identifier_prefix_test: CompileTimeError
-built_in_identifier_type_annotation_test/22: DartkCrash # Issue 28814
call_method_must_not_be_field_test/03: RuntimeError # Issue 32265
call_method_must_not_be_getter_test/03: RuntimeError # Issue 32265
call_operator_test: RuntimeError, OK
call_with_no_such_method_test: RuntimeError
-cha_deopt1_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-cha_deopt2_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-cha_deopt3_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
checked_setter3_test/01: MissingCompileTimeError
checked_setter3_test/02: MissingCompileTimeError
checked_setter3_test/03: MissingCompileTimeError
@@ -997,42 +940,17 @@
cyclic_typedef_test/11: Crash
deep_nesting1_negative_test: Skip # Issue 31158
deep_nesting2_negative_test: Skip # Issue 31158
-deferred_call_empty_before_load_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
-deferred_closurize_load_library_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constant_list_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_call_empty_before_load_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
deferred_constraints_constants_test: SkipByDesign
deferred_constraints_constants_test/default_argument2: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 30273.
deferred_constraints_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
deferred_constraints_constants_test/reference_after_load: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_constraints_type_annotation_test/new: CompileTimeError
-deferred_constraints_type_annotation_test/new_generic1: CompileTimeError
-deferred_constraints_type_annotation_test/none: CompileTimeError
-deferred_constraints_type_annotation_test/static_method: CompileTimeError
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: CompileTimeError
-deferred_function_type_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_global_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_global_test: Fail
-deferred_import_core_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_inlined_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_load_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_load_inval_code_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_load_constants_test/none: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
deferred_load_library_wrong_args_test/01: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 30273.
-deferred_load_library_wrong_args_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_mixin_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_no_such_method_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_not_loaded_check_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
-deferred_only_constant_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_optimized_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_not_loaded_check_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
deferred_redirecting_factory_test: CompileTimeError, Fail, Crash # Issue 23408, KernelVM bug: Deferred loading kernel issue 30273.
-deferred_regression_22995_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_regression_28678_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_shadow_load_library_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
deferred_shared_and_unshared_classes_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_static_seperate_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/as: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/is: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-deferred_type_dependency_test/type_annotation: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+deferred_static_seperate_test: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
deopt_inlined_function_lazy_test: Skip # Incompatible flag: --deoptimize-alot
dynamic_prefix_core_test/none: CompileTimeError
emit_const_fields_test: CompileTimeError # Issue 31533
@@ -1105,9 +1023,6 @@
issue31596_super_test/01: CompileTimeError
issue31596_super_test/03: CompileTimeError
issue31596_super_test/05: RuntimeError
-issue_1751477_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
-issue_25671a_test/01: CompileTimeError # Test assumes Dart 1.0 semantics
-issue_25671b_test/01: Crash
least_upper_bound_expansive_test/none: RuntimeError
library_env_test/has_html_support: RuntimeError # KernelVM bug: Configurable imports.
library_env_test/has_mirror_support: RuntimeError, OK
@@ -1151,8 +1066,6 @@
override_inheritance_field_test/26: CompileTimeError # Issue 31616
override_inheritance_field_test/29: CompileTimeError # Issue 31616
override_inheritance_generic_test/02: CompileTimeError
-override_inheritance_method_test/17: CompileTimeError
-override_inheritance_method_test/18: CompileTimeError
override_inheritance_method_test/28: CompileTimeError
override_inheritance_method_test/29: CompileTimeError
override_inheritance_mixed_test/08: Pass # Correctly passes.
@@ -1164,12 +1077,11 @@
regress_13462_0_test: SkipByDesign
regress_13462_1_test: SkipByDesign
regress_18535_test: SkipByDesign
-regress_22443_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
+regress_22443_test: RuntimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_23089_test: Crash
regress_23408_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_23408_test: RuntimeError
regress_28255_test: SkipByDesign
-regress_28278_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 30273.
regress_29025_test: CompileTimeError # Issue 31402 (Variable declaration)
regress_29405_test: CompileTimeError # Issue 31402 (Invocation arguments)
regress_30339_test: CompileTimeError # Issue 31402 (Variable declaration)
@@ -1213,7 +1125,6 @@
vm/optimized_stacktrace_test: Skip # Issue 30198
vm/reflect_core_vm_test: SkipByDesign
vm/regress_27671_test: Skip # Unsupported
-vm/regress_27671_test: Crash
vm/regress_29145_test: Skip # Issue 29145
vm/type_cast_vm_test: RuntimeError # Expects line and column numbers
vm/type_vm_test: RuntimeError, Pass # Expects line and column numbers
@@ -1246,9 +1157,18 @@
void_type_usage_test/conditional_return_to_void: MissingCompileTimeError
wrong_number_type_arguments_test/01: MissingCompileTimeError
+[ $compiler == dartkp && $minified ]
+no_such_method_native_test: RuntimeError # Compares symbol #foobar with string "foobar" in noSuchMethod
+recursive_generic_test: RuntimeError # Compares a (dynamic) toString call to 'C<D>'
+tearoff_dynamic_test: RuntimeError # Compares call to "foo" (noSuchMethod) with string "foo"
+type_variable_promotion_test: RuntimeError # Compares runtime type to the string "List<B>"
+
[ $compiler == fasta && $strong ]
deferred_super_dependency_test/01: MissingCompileTimeError
+[ $compiler == fasta && !$strong ]
+invalid_override_in_mixin_test/01: MissingCompileTimeError
+
[ $runtime == vm && $fasta ]
implicit_creation/implicit_new_or_const_composite_test: RuntimeError
implicit_creation/implicit_new_or_const_test: RuntimeError
@@ -1303,7 +1223,7 @@
bad_override_test/04: MissingCompileTimeError
bad_override_test/05: MissingCompileTimeError
bad_override_test/06: MissingCompileTimeError
-built_in_identifier_type_annotation_test/22: Crash # Issue 28814
+built_in_identifier_type_annotation_test/22: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/01: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/02: MissingCompileTimeError
call_constructor_on_unresolvable_class_test/03: MissingCompileTimeError
@@ -1594,6 +1514,10 @@
invalid_cast_test/09: MissingCompileTimeError
invalid_cast_test/10: MissingCompileTimeError
invalid_cast_test/11: MissingCompileTimeError
+invalid_type_argument_count_test/01: MissingCompileTimeError
+invalid_type_argument_count_test/02: MissingCompileTimeError
+invalid_type_argument_count_test/03: MissingCompileTimeError
+invalid_type_argument_count_test/04: MissingCompileTimeError
issue31596_override_test/05: MissingCompileTimeError
issue31596_override_test/06: MissingCompileTimeError
least_upper_bound_expansive_test/01: MissingCompileTimeError
@@ -2035,3 +1959,4 @@
[ $compiler == dartk || $compiler == dartkp ]
generic_function_bounds_test: RuntimeError # Issue 32076
generic_test/01: MissingCompileTimeError
+
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index 65f1f55..726711c 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -1115,6 +1115,7 @@
function_type/function_type96_test: RuntimeError # Issue 30475
function_type/function_type9_test: RuntimeError # Issue 30475
function_type_alias2_test: RuntimeError
+invalid_override_in_mixin_test/01: MissingCompileTimeError
recursive_mixin_test: Crash
type_literal_prefix_call_test: RuntimeError
@@ -1337,4 +1338,8 @@
[ $compiler != dartk && $runtime == vm || $compiler != dartkp && $runtime == dart_precompiled ]
built_in_identifier_type_annotation_test/22: MissingCompileTimeError # Error only in strong mode
int64_literal_test/*: Skip # This is testing Dart 2.0 int64 semantics.
-
+invalid_type_argument_count_test/01: MissingCompileTimeError # Error only in strong mode
+invalid_type_argument_count_test/02: MissingCompileTimeError # Error only in strong mode
+invalid_type_argument_count_test/03: MissingCompileTimeError # Error only in strong mode
+invalid_type_argument_count_test/04: MissingCompileTimeError # Error only in strong mode
+partial_tearoff_instantiation_test/none: CompiletimeError
diff --git a/tests/language_2/partial_tearoff_instantiation_test.dart b/tests/language_2/partial_tearoff_instantiation_test.dart
new file mode 100644
index 0000000..72bd744
--- /dev/null
+++ b/tests/language_2/partial_tearoff_instantiation_test.dart
@@ -0,0 +1,116 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+typedef F1 = void Function<T>(T);
+typedef void F2<T>(T v);
+
+dynamic defaultFLatest;
+
+void defaultF<T>(T v) {
+ defaultFLatest = v;
+}
+
+class X1 {
+ final F1 f;
+ const X1({this.f: defaultF});
+}
+
+class X2 {
+ final F2 f;
+ const X2({this.f: defaultF});
+}
+
+class Y1 {
+ F1 f;
+}
+
+class Y2 {
+ F2 f;
+}
+
+dynamic foo() {
+ if (defaultFLatest == -1) return -1;
+ return "not -1";
+}
+
+void main() {
+ {
+ var x = const X1();
+
+ // OK with implicit dynamic type argument.
+ x.f("hello1");
+ Expect.equals("hello1", defaultFLatest);
+
+ // OK with explicit dynamic type argument.
+ x.f<dynamic>("hello2");
+ Expect.equals("hello2", defaultFLatest);
+
+ // OK with correctly given argument type.
+ x.f<String>("hello3");
+ Expect.equals("hello3", defaultFLatest);
+
+ // OK with correctly given argument type.
+ x.f<int>(42);
+ Expect.equals(42, defaultFLatest);
+
+ // Not OK with incorrectly given argument type.
+ x.f<int>("hello"); //# 01: compile-time error
+
+ // Not OK with incorrectly given argument type.
+ x.f<int>(foo()); //# 02: runtime error
+
+ var y = new Y1();
+ y.f = defaultF;
+
+ // OK with implicit dynamic type argument.
+ y.f("hello4");
+ Expect.equals("hello4", defaultFLatest);
+
+ // OK with explicit dynamic type argument.
+ y.f<dynamic>("hello5");
+ Expect.equals("hello5", defaultFLatest);
+
+ // OK with correctly given argument type.
+ y.f<String>("hello6");
+ Expect.equals("hello6", defaultFLatest);
+
+ // OK with correctly given argument type.
+ y.f<int>(43);
+ Expect.equals(43, defaultFLatest);
+
+ // Not OK with incorrectly given argument type.
+ y.f<int>("hello"); //# 03: compile-time error
+
+ // Not OK with incorrectly given argument type.
+ y.f<int>(foo()); //# 04: runtime error
+ }
+ {
+ var x = const X2();
+
+ // OK with no type arguments.
+ x.f("hello1");
+ Expect.equals("hello1", defaultFLatest);
+
+ // Not OK with a type argument.
+ x.f<dynamic>("hello2"); //# 05: compile-time error
+
+ // Not OK with a type argument.
+ x.f<String>("hello3"); //# 06: compile-time error
+
+ var y = new Y2();
+ y.f = defaultF;
+
+ // OK with no type argument.
+ y.f("hello4");
+ Expect.equals("hello4", defaultFLatest);
+
+ // Not OK with a type argument.
+ y.f<dynamic>("hello5"); //# 07: compile-time error
+
+ // Not OK with a type argument.
+ y.f<String>("hello6"); //# 08: compile-time error
+ }
+}
diff --git a/tests/language_2/regress_32267_test.dart b/tests/language_2/regress_32267_test.dart
new file mode 100644
index 0000000..5180b62
--- /dev/null
+++ b/tests/language_2/regress_32267_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// There was a bug in the Kernel mixin transformation: it copied factory
+// constructors from the mixin into the mixin application class. This could be
+// observed as an unbound type parameter which led to a crash.
+
+class State<T> {}
+
+class A {}
+
+abstract class Mixin<T> {
+ factory Mixin._() => null;
+}
+
+class AState extends State<A> {}
+
+class AStateImpl extends AState with Mixin {}
+
+void main() {
+ new AStateImpl();
+}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 9a42a66..d55049b 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -118,16 +118,6 @@
typed_data/int64_list_load_store_test: RuntimeError # Issue 10275
typed_data/typed_data_hierarchy_int64_test: RuntimeError # Issue 10275
-[ $compiler == dartk ]
-mirrors/invoke_throws_test: Crash
-mirrors/mirrors_test: Crash
-mirrors/redirecting_factory_test/01: Crash
-mirrors/redirecting_factory_test/02: Crash
-mirrors/redirecting_factory_test/none: Crash
-
-[ $compiler == dartkp ]
-mirrors/*: Skip # mirrors are not supported by under precompilation
-
[ $compiler == fasta ]
mirrors/library_imports_bad_metadata_test/01: Crash
mirrors/metadata_allowed_values_test/02: MissingCompileTimeError
@@ -202,10 +192,6 @@
[ $arch != ia32 && $arch != simarm && $arch != simarmv5te && $arch != simarmv6 && $arch != x64 && $mode == debug ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification not yet implemented.
-[ $arch == x64 && $compiler == dartk && $mode == debug && $runtime == vm ]
-mirrors/invocation_fuzz_test: Skip # Because it times out, issue 29439.
-mirrors/variable_is_const_test/01: Crash
-
[ $arch == x64 && $mode == debug && $system == windows && ($runtime == dart_precompiled || $runtime == vm) ]
convert/streamed_conversion_json_utf8_decode_test: Pass, Slow
@@ -304,27 +290,9 @@
math/math2_test: RuntimeError
math/math_test: RuntimeError
-[ $compiler == dartk && $mode == debug && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
-mirrors/invocation_fuzz_test/smi: Pass, Slow
-mirrors/variable_is_const_test/01: Crash # Please triage.
-
-[ $compiler == dartk && $system == windows ]
-mirrors/invocation_fuzz_test/smi: Pass, Timeout # Issue 32137.
-
-# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
-# are to be triaged. Isolate tests are skipped on purpose due to the usage of
-# batch mode.
-[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
-mirrors/invocation_fuzz_test/smi: Crash # Please triage.
-mirrors/library_uri_io_test: RuntimeError # Please triage.
-
[ $compiler != dartk && $compiler != dartkp && ($runtime == dart_precompiled || $runtime == flutter || $runtime == vm) ]
mirrors/initializing_formals_test/01: Fail # initializing formals are implicitly final as of Dart 1.21
-[ $compiler == dartkp && $mode == debug ]
-mirrors/variable_is_const_test/01: Crash
-vm/async_await_catch_stacktrace_test/01: Crash
-
[ $compiler == none && $mode == product ]
mirrors/library_enumeration_deferred_loading_test: RuntimeError, OK # Deferred loaded eagerly
mirrors/library_import_deferred_loading_test: RuntimeError, OK # Deferred loaded eagerly
@@ -333,9 +301,6 @@
[ $compiler == none && !$checked ]
mirrors/reflected_type_generics_test/02: Fail, OK # Type check for a bounded type argument.
-[ $mode == debug && ($compiler == dartk || $compiler == dartkp) ]
-mirrors/other_declarations_location_test: Crash # assertion error, TypeParameter not having position.
-
[ $runtime == chrome && $system == linux ]
mirrors/native_class_test: Pass, Slow
@@ -379,13 +344,6 @@
mirrors/library_uri_io_test: RuntimeError # These use package:unittest
mirrors/library_uri_package_test: RuntimeError # These use package:unittest
-# dartk: checked mode failures
-[ $checked && ($compiler == dartk || $compiler == dartkp) ]
-mirrors/invocation_fuzz_test/smi: Crash
-mirrors/redirecting_factory_different_type_test/01: Crash # Issue 28424
-mirrors/redirecting_factory_different_type_test/none: Crash # Issue 28424
-mirrors/reflected_type_generics_test/02: Pass
-
[ $arch == simarm || $arch == simarmv5te || $arch == simarmv6 ]
convert/chunked_conversion_utf88_test: Skip # Pass, Slow Issue 12644.
convert/utf85_test: Skip # Pass, Slow Issue 12644.
@@ -396,88 +354,10 @@
mirrors/mirrors_used*: SkipByDesign # Invalid tests. MirrorsUsed does not have a specification, and dart:mirrors is not required to hide declarations that are not covered by any MirrorsUsed annotation.
mirrors/symbol_validation_test: RuntimeError # Issue 13596
+# All these tests have been migrated as strong mode compatible tests to
+# lib_2, so skipping these tests for dartk and dartkp
[ $compiler == dartk || $compiler == dartkp ]
-mirrors/class_declarations_test/01: RuntimeError
-mirrors/class_declarations_test/none: RuntimeError
-mirrors/class_mirror_location_test: RuntimeError
-mirrors/constructor_kinds_test/01: RuntimeError
-mirrors/constructor_kinds_test/none: RuntimeError
-mirrors/function_type_mirror_test: RuntimeError
-mirrors/generic_f_bounded_mixin_application_test: RuntimeError
-mirrors/generic_function_typedef_test: RuntimeError
-mirrors/generic_interface_test/01: RuntimeError
-mirrors/generic_interface_test/none: RuntimeError
-mirrors/hot_get_field_test: RuntimeError
-mirrors/hot_set_field_test: RuntimeError
-mirrors/intercepted_object_test: RuntimeError
-mirrors/invocation_fuzz_test/emptyarray: Crash
-mirrors/invocation_fuzz_test/false: Crash
-mirrors/invocation_fuzz_test/none: Crash
-mirrors/invocation_fuzz_test/smi: RuntimeError
-mirrors/invocation_fuzz_test/string: Crash
-mirrors/invoke_private_test: RuntimeError
-mirrors/invoke_private_wrong_library_test: RuntimeError
-mirrors/library_declarations_test/none: RuntimeError
-mirrors/library_enumeration_deferred_loading_test: CompileTimeError # Deferred loading kernel issue 28335.
-mirrors/library_exports_hidden_test: RuntimeError
-mirrors/library_exports_shown_test: RuntimeError
-mirrors/library_import_deferred_loading_test: CompileTimeError # Deferred loading kernel issue 28335.
-mirrors/library_imports_deferred_test: RuntimeError
-mirrors/library_imports_hidden_test: RuntimeError
-mirrors/library_imports_metadata_test: RuntimeError
-mirrors/library_imports_prefixed_show_hide_test: RuntimeError
-mirrors/library_imports_prefixed_test: RuntimeError
-mirrors/library_imports_shown_test: RuntimeError
-mirrors/library_metadata_test: RuntimeError
-mirrors/load_library_test: CompileTimeError
-mirrors/metadata_allowed_values_test/16: Skip # Flaky, crashes.
-mirrors/metadata_constructed_constant_test: Crash
-mirrors/metadata_scope_test/none: RuntimeError
-mirrors/method_mirror_location_test: RuntimeError
-mirrors/method_mirror_source_line_ending_test: Crash
-mirrors/method_mirror_source_test: Crash
-mirrors/mirrors_nsm_mismatch_test: RuntimeError
-mirrors/mirrors_nsm_test/dart2js: RuntimeError
-mirrors/mirrors_reader_test: Crash
-mirrors/mirrors_used_inheritance_test: RuntimeError
-mirrors/mirrors_used_typedef_declaration_test/01: RuntimeError
-mirrors/mirrors_used_typedef_declaration_test/none: RuntimeError
-mirrors/mixin_application_test: RuntimeError
-mirrors/mixin_test: RuntimeError
-mirrors/other_declarations_location_test: RuntimeError
-mirrors/parameter_annotation_mirror_test: RuntimeError
-mirrors/parameter_metadata_test: RuntimeError
-mirrors/parameter_of_mixin_app_constructor_test: RuntimeError
-mirrors/private_class_field_test: RuntimeError
-mirrors/private_symbol_test: RuntimeError
-mirrors/private_types_test: RuntimeError
-mirrors/reflect_class_test/01: RuntimeError
-mirrors/reflect_class_test/02: RuntimeError
-mirrors/reflect_class_test/none: RuntimeError
-mirrors/reflected_type_function_type_test: RuntimeError
-mirrors/reflected_type_generics_test/01: RuntimeError
-mirrors/reflected_type_generics_test/02: RuntimeError
-mirrors/reflected_type_typedefs_test: RuntimeError
-mirrors/reflected_type_typevars_test: RuntimeError
-mirrors/regress_26187_test: RuntimeError
-mirrors/relation_assignable_test: RuntimeError
-mirrors/relation_subclass_test: RuntimeError
-mirrors/relation_subtype_test: RuntimeError
-mirrors/repeated_private_anon_mixin_app_test: RuntimeError
-mirrors/static_members_easier_test: RuntimeError
-mirrors/static_members_test: RuntimeError
-mirrors/symbol_validation_test/01: RuntimeError
-mirrors/symbol_validation_test/none: RuntimeError
-mirrors/type_variable_is_static_test: RuntimeError
-mirrors/type_variable_owner_test/01: RuntimeError
-mirrors/typedef_deferred_library_test: CompileTimeError # Deferred loading kernel issue 28335.
-mirrors/typedef_in_signature_test: RuntimeError
-mirrors/typedef_library_test: RuntimeError
-mirrors/typedef_metadata_test: RuntimeError
-mirrors/typedef_reflected_type_test/01: RuntimeError
-mirrors/typedef_reflected_type_test/none: RuntimeError
-mirrors/typedef_test: RuntimeError
-mirrors/typevariable_mirror_metadata_test: RuntimeError
+*: SkipByDesign
[ $runtime == chrome || $runtime == ff ]
async/stream_timeout_test: SkipSlow # Times out. Issue 22050
diff --git a/tests/lib_2/async/futures_test.dart b/tests/lib_2/async/futures_test.dart
index 81909021..51a3018 100644
--- a/tests/lib_2/async/futures_test.dart
+++ b/tests/lib_2/async/futures_test.dart
@@ -170,7 +170,8 @@
}, onError: (e, s) {
Expect.equals(e, 42);
Expect.identical(st, s);
- return true;
+ }).whenComplete(() {
+ return new Future(() => true);
});
c1.completeError(42, st);
return result;
@@ -235,6 +236,8 @@
throw 'incorrect exception';
}).catchError((error) {
Expect.equals('correct exception', error);
+ }).whenComplete(() {
+ return new Future(() => false);
});
}
diff --git a/tests/lib_2/html/indexeddb_1_test.dart b/tests/lib_2/html/indexeddb_1_test.dart
index d2f7927..419b1c5 100644
--- a/tests/lib_2/html/indexeddb_1_test.dart
+++ b/tests/lib_2/html/indexeddb_1_test.dart
@@ -46,15 +46,15 @@
dbName = nextDatabaseName();
}
createObjectStore(e) {
- var store = e.target.result.createObjectStore(storeName);
+ idb.ObjectStore store = e.target.result.createObjectStore(storeName);
expect(store, isNotNull);
}
- var db;
+ idb.Database db;
return html.window.indexedDB.deleteDatabase(dbName).then((_) {
return html.window.indexedDB
.open(dbName, version: version, onUpgradeNeeded: createObjectStore);
- }).then((result) {
+ }).then((idb.Database result) {
db = result;
var transaction = db.transactionList([storeName], 'readwrite');
transaction.objectStore(storeName).put(value, key);
diff --git a/tests/lib_2/html/indexeddb_2_test.dart b/tests/lib_2/html/indexeddb_2_test.dart
index 8b7be3c..a649638 100644
--- a/tests/lib_2/html/indexeddb_2_test.dart
+++ b/tests/lib_2/html/indexeddb_2_test.dart
@@ -15,35 +15,34 @@
const int VERSION = 1;
testReadWrite(key, value, check,
- [dbName = DB_NAME, storeName = STORE_NAME, version = VERSION]) {
- createObjectStore(e) {
- var store = e.target.result.createObjectStore(storeName);
+ [dbName = DB_NAME, storeName = STORE_NAME, version = VERSION]) async {
+ void createObjectStore(e) {
+ idb.ObjectStore store = e.target.result.createObjectStore(storeName);
expect(store, isNotNull);
}
- var db;
+ idb.Database db;
// Delete any existing DBs.
- return html.window.indexedDB.deleteDatabase(dbName).then(expectAsync((_) {
- return html.window.indexedDB
+ try {
+ await html.window.indexedDB.deleteDatabase(dbName);
+ idb.Database db = await html.window.indexedDB
.open(dbName, version: version, onUpgradeNeeded: createObjectStore);
- })).then(expectAsync((result) {
- db = result;
- var transaction = db.transactionList([storeName], 'readwrite');
+
+ idb.Transaction transaction = db.transactionList([storeName], 'readwrite');
transaction.objectStore(storeName).put(value, key);
- return transaction.completed;
- })).then(expectAsync((db) {
- var transaction = db.transaction(storeName, 'readonly');
- return transaction.objectStore(storeName).getObject(key);
- })).then(expectAsync((object) {
+ db = await transaction.completed;
+ transaction = db.transaction(storeName, 'readonly');
+ var object = await transaction.objectStore(storeName).getObject(key);
+
db.close();
check(value, object);
- })).catchError((e) {
+ } catch (error) {
if (db != null) {
db.close();
}
- throw e;
- });
+ throw error;
+ }
}
List<String> get nonNativeListData {
diff --git a/tests/lib_2/html/indexeddb_3_test.dart b/tests/lib_2/html/indexeddb_3_test.dart
index 50a4d85..6bd5c4a 100644
--- a/tests/lib_2/html/indexeddb_3_test.dart
+++ b/tests/lib_2/html/indexeddb_3_test.dart
@@ -15,7 +15,7 @@
Future<Database> createAndOpenDb() {
return html.window.indexedDB.deleteDatabase(DB_NAME).then((_) {
return html.window.indexedDB.open(DB_NAME, version: VERSION,
- onUpgradeNeeded: (e) {
+ onUpgradeNeeded: (VersionChangeEvent e) {
var db = e.target.result;
db.createObjectStore(STORE_NAME);
});
diff --git a/tests/lib_2/html/indexeddb_5_test.dart b/tests/lib_2/html/indexeddb_5_test.dart
index cc50cea..d4d3a28 100644
--- a/tests/lib_2/html/indexeddb_5_test.dart
+++ b/tests/lib_2/html/indexeddb_5_test.dart
@@ -18,17 +18,14 @@
var indexName = 'name_index';
var db;
- test('init', () {
- return html.window.indexedDB.deleteDatabase(dbName).then((_) {
- return html.window.indexedDB.open(dbName, version: 1,
- onUpgradeNeeded: (e) {
- var db = e.target.result;
- var objectStore = db.createObjectStore(storeName, autoIncrement: true);
- var index =
- objectStore.createIndex(indexName, 'name_index', unique: false);
- });
- }).then((database) {
- db = database;
+ test('init', () async {
+ await html.window.indexedDB.deleteDatabase(dbName);
+ db = await html.window.indexedDB.open(dbName, version: 1,
+ onUpgradeNeeded: (idb.VersionChangeEvent e) {
+ var db = e.target.result;
+ var objectStore = db.createObjectStore(storeName, autoIncrement: true);
+ var index =
+ objectStore.createIndex(indexName, 'name_index', unique: false);
});
});
diff --git a/tests/lib_2/html/js_interop_constructor_name_error1_test.dart b/tests/lib_2/html/js_interop_constructor_name_error1_test.dart
index 37b179f..b534222 100644
--- a/tests/lib_2/html/js_interop_constructor_name_error1_test.dart
+++ b/tests/lib_2/html/js_interop_constructor_name_error1_test.dart
@@ -30,9 +30,6 @@
test('dom-is-js', () {
var e = confuse(new html.DivElement());
- // TODO(26838): When Issue 26838 is fixed and this test passes, move this
- // test into group `HTMLDivElement-types`.
-
// Currently, HTML types are not [JavaScriptObject]s. We could change that
// by having HTML types extend JavaScriptObject, in which case we would
// change this expectation.
diff --git a/tests/lib_2/html/js_interop_constructor_name_error2_test.dart b/tests/lib_2/html/js_interop_constructor_name_error2_test.dart
index d45183e..00c8fd6 100644
--- a/tests/lib_2/html/js_interop_constructor_name_error2_test.dart
+++ b/tests/lib_2/html/js_interop_constructor_name_error2_test.dart
@@ -30,9 +30,6 @@
test('String-is-not-js', () {
var e = confuse('kombucha');
- // TODO(26838): When Issue 26838 is fixed and this test passes, move this
- // test into group `HTMLDivElement-types`.
-
// A String should not be a JS interop type. The type test flags are added
// to Interceptor, but should be added to the class that implements all
// the JS-interop methods.
diff --git a/tests/lib_2/html/js_mock_test.dart b/tests/lib_2/html/js_mock_test.dart
index 871bba2..94e62a7 100644
--- a/tests/lib_2/html/js_mock_test.dart
+++ b/tests/lib_2/html/js_mock_test.dart
@@ -41,10 +41,12 @@
expect(f, isNull);
var doc = document;
- expect(doc is Document, isTrue);
// Fails in dart2js
- // expect(doc is! Element, isTrue);
- expect(doc is Node, isTrue);
+ // expect(doc is Document, isTrue);
+ expect(doc is! Element, isTrue);
+
+ // Fails in dart2js
+ // expect(doc is Node, isTrue);
expect(doc is! MockDocument, isTrue);
expect(doc is! MockElement, isTrue);
diff --git a/tests/lib_2/html/worker_test.dart b/tests/lib_2/html/worker_test.dart
index 783fcf0..dc21b3b 100644
--- a/tests/lib_2/html/worker_test.dart
+++ b/tests/lib_2/html/worker_test.dart
@@ -40,6 +40,7 @@
test('works', () {
// Use Blob to make a local URL so we don't have to have a separate file.
+ // This does not work on browsers using CSP (Content Security Policy).
var blob = new Blob([workerScript], 'text/javascript');
var url = Url.createObjectUrl(blob);
var worker = new Worker(url);
diff --git a/tests/lib_2/html/xhr_test.dart b/tests/lib_2/html/xhr_test.dart
index 4354461..c6b493a 100644
--- a/tests/lib_2/html/xhr_test.dart
+++ b/tests/lib_2/html/xhr_test.dart
@@ -8,11 +8,14 @@
import 'dart:convert';
import 'dart:html';
import 'dart:typed_data';
-import 'package:unittest/html_individual_config.dart';
-import 'package:unittest/unittest.dart';
-main() {
- useHtmlIndividualConfiguration();
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import 'package:async_helper/async_helper.dart';
+
+main() async {
+ useHtmlConfiguration();
+
// Cache blocker is a workaround for:
// https://code.google.com/p/dart/issues/detail?id=11834
var cacheBlocker = new DateTime.now().millisecondsSinceEpoch;
@@ -89,11 +92,11 @@
test('XHR.request No file', () {
HttpRequest.request('NonExistingFile').then((_) {
fail('Request should not have succeeded.');
- }, onError: expectAsync((error) {
- var xhr = error.target;
+ }).catchError((error) {
+ HttpRequest xhr = error.target;
expect(xhr.readyState, equals(HttpRequest.DONE));
validate404(xhr);
- }));
+ });
});
test('XHR.request file', () {
@@ -117,30 +120,36 @@
test('XHR.request withCredentials No file', () {
HttpRequest.request('NonExistingFile', withCredentials: true).then((_) {
fail('Request should not have succeeded.');
- }, onError: expectAsync((error) {
- var xhr = error.target;
+ }).catchError((error) {
+ HttpRequest xhr = error.target;
expect(xhr.readyState, equals(HttpRequest.DONE));
validate404(xhr);
- }));
+ });
});
- test('XHR.request withCredentials file', () {
- HttpRequest.request(url, withCredentials: true).then(expectAsync((xhr) {
+ test('XHR.request withCredentials file', () async {
+ try {
+ HttpRequest xhr = await HttpRequest.request(url, withCredentials: true);
expect(xhr.readyState, equals(HttpRequest.DONE));
validate200Response(xhr);
- }));
+ } catch (error) {
+ fail('Request should succeed.');
+ }
});
test('XHR.getString file', () {
HttpRequest.getString(url).then(expectAsync((str) {}));
});
- test('XHR.getString No file', () {
- HttpRequest.getString('NonExistingFile').then((_) {
+ test('XHR.getString No file', () async {
+ try {
+ await HttpRequest.getString('NonExistingFile');
fail('Succeeded for non-existing file.');
- }, onError: expectAsync((error) {
- validate404(error.target);
- }));
+ } catch (error) {
+ HttpRequest xhr = error.target;
+ expect(xhr.readyState, equals(HttpRequest.DONE));
+ validate404(xhr);
+ }
});
test('XHR.request responseType arraybuffer', () {
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 2d31eaa..ca7739e 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -25,7 +25,7 @@
html/mirrors_js_typed_interop_test: Pass, Slow
html/svgelement_test/PathElement: Pass, RuntimeError # Roll 50 failure
html/wrapping_collections_test: SkipByDesign # Testing an issue that is only relevant to Dartium
-html/xhr_test/xhr: Pass, RuntimeError # Roll 50 failure
+html/xhr_test: Pass, Slow
isolate/browser/issue_12474_test: CompileTimeError # Issue 22529
isolate/enum_const_test/02: RuntimeError # Issue 21817
isolate/error_at_spawnuri_test: SkipByDesign # Test uses a ".dart" URI.
@@ -104,7 +104,7 @@
html/js_typed_interop_lazy_test/none: RuntimeError
html/js_typed_interop_rename_static_test: RuntimeError
html/no_linked_scripts_htmltest: Timeout, Pass # Issue 32262
-html/worker_test/functional/functional: RuntimeError # Issue 32261
+html/worker_test/functional: RuntimeError # Issue 32261
[ $compiler == dart2js && $runtime == chromeOnAndroid ]
html/audiobuffersourcenode_test/supported: Fail # TODO(dart2js-team): Please triage this failure.
@@ -137,8 +137,6 @@
html/input_element_attributes_test: RuntimeError
html/interactive_media_test: RuntimeError
html/js_extend_class_test: RuntimeError
-html/js_interop_constructor_name_error1_test: Fail # Issue 26838
-html/js_interop_constructor_name_error2_test: Fail # Issue 26838
[ $compiler == dart2js && $runtime == drt && !$checked ]
html/audiocontext_test/functional: Pass, Fail
@@ -176,7 +174,6 @@
html/touchevent_test: Fail
html/webgl_1_test: Pass, Fail # Issue 8219
html/websql_test: Fail
-html/xhr_test/xhr: Pass, Fail # Issue 11602
isolate/kill_self_synchronously_test: RuntimeError
[ $compiler == dart2js && $runtime == ie11 ]
@@ -261,12 +258,17 @@
html/element_types_shadow_test: RuntimeError # Issue 29922
html/file_sample_test: Skip # FileSystem not supported on Safari.
html/fileapi_supported_throws_test: Skip # FileSystem not supported on Safari
+html/js_mock_test: RuntimeError # Issue 32286
+html/xhr_test: RuntimeError
isolate/cross_isolate_message_test: Skip # Issue 12627
isolate/message_test: Skip # Issue 12627
[ $compiler == dart2js && $system == linux ]
html/interactive_geolocation_test: Skip # Requires allowing geo location.
+[ $compiler == dart2js && $system == windows ]
+html/xhr_test: RuntimeError
+
[ $compiler == dart2js && $browser ]
html/custom/created_callback_test: RuntimeError
html/fontface_loaded_test: Fail # Support for promises.
@@ -769,4 +771,3 @@
html/custom/attribute_changed_callback_test/unsupported_on_polyfill: Fail # Polyfill does not support
html/custom/entered_left_view_test/viewless_document: Fail # Polyfill does not handle this
html/fontface_test: Fail # Fontface not supported on these.
-
diff --git a/tests/lib_2/lib_2_dartdevc.status b/tests/lib_2/lib_2_dartdevc.status
index e4f21b3..2f18565 100644
--- a/tests/lib_2/lib_2_dartdevc.status
+++ b/tests/lib_2/lib_2_dartdevc.status
@@ -3,8 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dartdevc ]
-async/futures_test: RuntimeError # Issue 29922
-html/xhr_test/xhr: RuntimeError # Issue 29922, strong mode cast failure
+html/xhr_test: Pass, Slow
[ $compiler == dartdevk ]
async/slow_consumer_test: CompileTimeError
@@ -38,7 +37,7 @@
html/css_test: Pass, RuntimeError # Issue 31019
[ $system == windows && ($compiler == dartdevc || $compiler == dartdevk) ]
-html/xhr_test/xhr: Skip # Times out. Issue 21527
+html/xhr_test: Skip # Times out. Issue 21527
[ $compiler == dartdevc || $compiler == dartdevk ]
async/async_await_sync_completer_test: RuntimeError # Issue 29922
@@ -91,8 +90,6 @@
html/element_classes_test: RuntimeError # Issue 29922
html/fontface_loaded_test: RuntimeError
html/gamepad_test: RuntimeError # Issue 31029
-html/indexeddb_1_test/functional: RuntimeError # Issue 29922, strong mode cast failure
-html/indexeddb_2_test: RuntimeError, Skip # Times out. Issue 29922, strong mode cast failure
html/interactive_media_test: Skip # requests interactive permissions (camera, geolocation)
html/isolates_test: RuntimeError # Issue 29922
html/js_typed_interop_default_arg_test/default_value: MissingCompileTimeError # Issue 29922
@@ -130,4 +127,3 @@
typed_data/int64_list_load_store_test: RuntimeError # Issue 29922
typed_data/typed_data_hierarchy_int64_test: RuntimeError # Issue 29922
typed_data/unmodifiable_typed_data_test: RuntimeError # Issue 10275
-
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index dad45d5..883580c 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -52,6 +52,8 @@
[ $compiler == dartk && $mode == debug && $strong ]
mirrors/instance_members_unimplemented_interface_test: Crash
+mirrors/library_import_deferred_loading_test: Crash # Deferred loading kernel issue 28335.
+mirrors/load_library_test: Crash
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
@@ -60,8 +62,8 @@
mirrors/variable_is_const_test/01: Crash # Please triage.
[ $compiler == dartk && $runtime == vm && $checked && $strong ]
-mirrors/redirecting_factory_different_type_test/01: Crash # Issue 28424
-mirrors/redirecting_factory_different_type_test/none: Crash # Issue 28424
+mirrors/redirecting_factory_different_type_test/01: MissingCompileTimeError # Issue 28424
+mirrors/redirecting_factory_different_type_test/none: RuntimeError # Issue 28424
mirrors/reflected_type_generics_test/02: Pass
# ===== dartk + vm status lines =====
@@ -92,11 +94,9 @@
mirrors/constructor_kinds_test/none: RuntimeError
mirrors/constructor_private_name_test: RuntimeError
mirrors/constructors_test: CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/dart2js_mirrors_test: Crash # 31916
+mirrors/dart2js_mirrors_test: RuntimeError # 31916
mirrors/deferred_mirrors_metadata_test: RuntimeError, CompileTimeError # Deferred loading kernel issue 28335.
-mirrors/deferred_mirrors_metatarget_test: CompileTimeError # Deferred loading kernel issue 28335.
mirrors/deferred_mirrors_test: Crash # 31916
-mirrors/deferred_mirrors_update_test: RuntimeError, CompileTimeError # Deferred loading kernel issue 28335.
mirrors/deferred_type_test: CompileTimeError, RuntimeError
mirrors/empty_test: Crash, RuntimeError
mirrors/enum_test: RuntimeError # Issue 31402 (Invocation arguments)
@@ -120,10 +120,10 @@
mirrors/invoke_private_test: RuntimeError
mirrors/invoke_private_wrong_library_test: RuntimeError
mirrors/library_declarations_test/none: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_enumeration_deferred_loading_test: CompileTimeError
+mirrors/library_enumeration_deferred_loading_test: RuntimeError
mirrors/library_exports_hidden_test: RuntimeError, Crash, CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/library_exports_shown_test: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_import_deferred_loading_test: CompileTimeError # Deferred loading kernel issue 28335.
+mirrors/library_import_deferred_loading_test: RuntimeError # Deferred loading kernel issue 28335.
mirrors/library_imports_bad_metadata_test/none: Crash
mirrors/library_imports_deferred_test: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/library_imports_hidden_test: RuntimeError # Issue 31402 (Invocation arguments)
@@ -132,7 +132,7 @@
mirrors/library_imports_prefixed_test: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/library_imports_shown_test: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/library_metadata_test: RuntimeError
-mirrors/load_library_test: CompileTimeError
+mirrors/load_library_test: RuntimeError
mirrors/metadata_allowed_values_test/16: Skip # Flaky, crashes.
mirrors/metadata_constructed_constant_test: Crash, RuntimeError
mirrors/metadata_scope_test/none: RuntimeError
@@ -143,7 +143,7 @@
mirrors/mirrors_nsm_test/dart2js: CompileTimeError # Issue 31533
mirrors/mirrors_nsm_test/none: CompileTimeError # Issue 31533
mirrors/mirrors_reader_test: Crash
-mirrors/mirrors_test: Crash
+mirrors/mirrors_test: RuntimeError
mirrors/mirrors_used*: SkipByDesign # Invalid tests. MirrorsUsed does not have a specification, and dart:mirrors is not required to hide declarations that are not covered by any MirrorsUsed annotation.
mirrors/mirrors_used_inheritance_test: RuntimeError
mirrors/mirrors_used_typedef_declaration_test/01: RuntimeError
@@ -165,10 +165,10 @@
mirrors/private_field_test: RuntimeError
mirrors/private_symbol_test: RuntimeError
mirrors/private_types_test: RuntimeError
-mirrors/redirecting_factory_different_type_test/01: Crash
-mirrors/redirecting_factory_test/01: Crash
-mirrors/redirecting_factory_test/02: Crash
-mirrors/redirecting_factory_test/none: Crash
+mirrors/redirecting_factory_different_type_test/01: MissingCompileTimeError
+mirrors/redirecting_factory_test/01: RuntimeError
+mirrors/redirecting_factory_test/02: RuntimeError
+mirrors/redirecting_factory_test/none: RuntimeError
mirrors/reflect_class_test/none: RuntimeError
mirrors/reflected_type_classes_test/01: RuntimeError
mirrors/reflected_type_function_type_test: RuntimeError
@@ -218,7 +218,7 @@
isolate/request_reply_test: Pass, Timeout
isolate/stacktrace_message_test: RuntimeError
mirrors/class_mirror_type_variables_test: RuntimeError
-mirrors/constructor_optional_args_test: Crash
+mirrors/constructor_optional_args_test: RuntimeError
mirrors/constructors_test: RuntimeError
mirrors/fake_function_with_call_test: RuntimeError
mirrors/generic_bounded_by_type_parameter_test/none: RuntimeError
@@ -240,7 +240,7 @@
mirrors/instance_members_with_override_test: RuntimeError
mirrors/instantiate_abstract_class_test: RuntimeError
mirrors/invoke_closurization2_test: RuntimeError
-mirrors/invoke_throws_test: Crash
+mirrors/invoke_throws_test: RuntimeError
mirrors/library_imports_bad_metadata_test/none: RuntimeError
mirrors/metadata_const_map_test: Crash
mirrors/mixin_members_test: RuntimeError
@@ -249,8 +249,8 @@
mirrors/parameter_is_const_test/none: RuntimeError
mirrors/parameter_test/01: RuntimeError
mirrors/parameter_test/none: RuntimeError
-mirrors/redirecting_factory_different_type_test/02: Crash
-mirrors/redirecting_factory_different_type_test/none: Crash
+mirrors/redirecting_factory_different_type_test/02: MissingCompileTimeError
+mirrors/redirecting_factory_different_type_test/none: RuntimeError
mirrors/regress_16321_test/none: Crash
mirrors/top_level_accessors_test/01: MissingCompileTimeError
mirrors/type_argument_is_type_variable_test: RuntimeError
diff --git a/tests/standalone_2/standalone_2_kernel.status b/tests/standalone_2/standalone_2_kernel.status
index f2594fa..8249747 100644
--- a/tests/standalone_2/standalone_2_kernel.status
+++ b/tests/standalone_2/standalone_2_kernel.status
@@ -36,12 +36,11 @@
# ===== dartk + vm status lines =====
[ $compiler == dartk && $runtime == vm && $strong ]
-io/compile_all_test: Crash
io/http_client_request_test: Pass, Timeout
io/http_compression_test: RuntimeError
io/platform_resolved_executable_test/03: Pass, RuntimeError
io/platform_resolved_executable_test/04: Pass, RuntimeError
-io/secure_builtin_roots_test: Timeout
+io/secure_builtin_roots_test: Pass, Timeout
io/socket_finalizer_test: Pass, Timeout
no_support_debugger_test: Skip # kernel-service snapshot not compatible with flag disabled
regress_29350_test: MissingCompileTimeError
@@ -93,7 +92,7 @@
# ===== dartkp + dart_precompiled status lines =====
[ $compiler == dartkp && $runtime == dart_precompiled && $strong ]
dwarf_stack_trace_test: RuntimeError
-io/compile_all_test: Crash
+io/compile_all_test: RuntimeError # Issue 32338
io/file_fuzz_test: RuntimeError, Pass
io/http_client_connect_test: Skip # Flaky.
io/http_close_test: Crash
diff --git a/tools/VERSION b/tools/VERSION
index d08b1b6..9bcd14c 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 30
+PRERELEASE 31
PRERELEASE_PATCH 0
diff --git a/tools/dom/dom.json b/tools/dom/dom.json
index 52e3ab7..8a113c8 100644
--- a/tools/dom/dom.json
+++ b/tools/dom/dom.json
@@ -8088,6 +8088,9 @@
"dart_action": "unstable",
"members": {
"IDBVersionChangeEvent": {},
+ "Xyzzy": {
+ "support_level": "untriaged"
+ },
"dataLoss": {
"support_level": "untriaged"
},
@@ -8095,7 +8098,10 @@
"support_level": "untriaged"
},
"newVersion": {},
- "oldVersion": {}
+ "oldVersion": {},
+ "target": {
+ "support_level": "untriaged"
+ }
},
"support_level": "stable"
},
diff --git a/tools/dom/idl/dart/dart.idl b/tools/dom/idl/dart/dart.idl
index ca1993b..e7e1549 100644
--- a/tools/dom/idl/dart/dart.idl
+++ b/tools/dom/idl/dart/dart.idl
@@ -150,6 +150,7 @@
interface IDBCursor {
[DartName=next, CallWith=ExecutionContext, ImplementedAs=continueFunction, RaisesException] void continue([DartForceOptional] optional any key);
};
+
[DartSupplemental]
interface IDBIndex {
[CallWith=ExecutionContext, RaisesException] IDBRequest count([Default=Undefined] optional any key);
@@ -432,9 +433,6 @@
[DartSuppress] void send(sequence<unsigned long> data, optional double timestamp);
};
-[DartSuppress]
-interface MutationEvent {};
-
// Tweaks types required for Dart strong mode.
[DartSupplemental]
interface HTMLCollection {
diff --git a/tools/dom/scripts/databasebuilder.py b/tools/dom/scripts/databasebuilder.py
index 95dcd42..5c3ab8c 100755
--- a/tools/dom/scripts/databasebuilder.py
+++ b/tools/dom/scripts/databasebuilder.py
@@ -515,7 +515,6 @@
imported_interfaces = self._imported_interfaces
# Step 1: Pre process imported interfaces
-# for interface, import_options in imported_interfaces.iteritems():
for interface, import_options in imported_interfaces:
self._annotate(interface, import_options)
diff --git a/tools/dom/templates/html/impl/impl_IDBFactory.darttemplate b/tools/dom/templates/html/impl/impl_IDBFactory.darttemplate
index eaed1fe..7488d85 100644
--- a/tools/dom/templates/html/impl/impl_IDBFactory.darttemplate
+++ b/tools/dom/templates/html/impl/impl_IDBFactory.darttemplate
@@ -17,8 +17,8 @@
@DomName('IDBFactory.open')
Future<Database> open(String name,
- {int version, void onUpgradeNeeded(VersionChangeEvent),
- void onBlocked(Event)}) {
+ {int version, void onUpgradeNeeded(VersionChangeEvent event),
+ void onBlocked(Event event)}) {
if ((version == null) != (onUpgradeNeeded == null)) {
return new Future.error(new ArgumentError(
'version and onUpgradeNeeded must be specified together'));
diff --git a/tools/dom/templates/html/impl/impl_IDBVersionChangeEvent.darttemplate b/tools/dom/templates/html/impl/impl_IDBVersionChangeEvent.darttemplate
new file mode 100644
index 0000000..60faa8d
--- /dev/null
+++ b/tools/dom/templates/html/impl/impl_IDBVersionChangeEvent.darttemplate
@@ -0,0 +1,14 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of $LIBRARYNAME;
+
+$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
+$!MEMBERS
+ @JSName('target')
+ @DomName('IDBVersionChangeEvent.target')
+ @DocsEditable()
+ final OpenDBRequest target;
+}
+
diff --git a/tools/infra/config/cq.cfg b/tools/infra/config/cq.cfg
index 2c729e6..0e116ef 100644
--- a/tools/infra/config/cq.cfg
+++ b/tools/infra/config/cq.cfg
@@ -24,10 +24,7 @@
builders { name: "vm-linux-release-x64-try"}
builders { name: "vm-mac-release-x64-try"}
builders { name: "dart2js-linux-d8-hostchecked-try"}
- builders {
- name: "dart2js-linux-d8-kernel-minified-try"
- experiment_percentage: 100
- }
+ builders { name: "dart2js-linux-d8-kernel-minified-try" }
builders { name: "dart2js-linux-none-only-unittest-try"}
builders { name: "pkg-linux-release-try"}
builders { name: "dart2js-linux-chrome-try"}
diff --git a/tools/sdks/linux/dart-sdk.tar.gz.sha1 b/tools/sdks/linux/dart-sdk.tar.gz.sha1
index f443005..fcfff24 100644
--- a/tools/sdks/linux/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/linux/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-d324de88855f3b114d49b7e6d8062f7b09086def
\ No newline at end of file
+e1d5dbecbca504ffa66db767045aeb3714a2a696
\ No newline at end of file
diff --git a/tools/sdks/mac/dart-sdk.tar.gz.sha1 b/tools/sdks/mac/dart-sdk.tar.gz.sha1
index ddd536d..9921e91 100644
--- a/tools/sdks/mac/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/mac/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-f660c896556152fdc6870af8a1b5dc9441e2d922
\ No newline at end of file
+3e694dc99bb13d9b094401c6424764459109676e
\ No newline at end of file
diff --git a/tools/sdks/win/dart-sdk.tar.gz.sha1 b/tools/sdks/win/dart-sdk.tar.gz.sha1
index 687ceaa..81e6c51 100644
--- a/tools/sdks/win/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/win/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-80630eb22ebe2e6c7fcf0dcc464fba9bdc6b94ff
\ No newline at end of file
+8ea5e44f520f93a65f05f36f1d7886d04650d29a
\ No newline at end of file
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index fc3dead..a6d9f5f 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -709,8 +709,16 @@
/// almost identical configurations are tested simultaneosly.
Command computeRemoveKernelFileCommand(String tempDir, List arguments,
Map<String, String> environmentOverrides) {
- var exec = 'rm';
- var args = [tempKernelFile(tempDir)];
+ String exec;
+ List<String> args;
+
+ if (Platform.isWindows) {
+ exec = 'cmd.exe';
+ args = <String>['/c', 'del', tempKernelFile(tempDir)];
+ } else {
+ exec = 'rm';
+ args = <String>[tempKernelFile(tempDir)];
+ }
return Command.compilation('remove_kernel_file', tempDir,
bootstrapDependencies(), exec, args, environmentOverrides,
@@ -1045,14 +1053,18 @@
bool get _isStrong;
bool get _isAot;
+ String get executableScriptSuffix;
+
List<Uri> bootstrapDependencies();
- String tempKernelFile(String tempDir) => '$tempDir/out.dill';
+ String tempKernelFile(String tempDir) =>
+ new Path('$tempDir/out.dill').toNativePath();
Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
Map<String, String> environmentOverrides) {
- final genKernel =
- Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath();
+ final genKernel = Platform.script
+ .resolve('../../../pkg/vm/tool/gen_kernel${executableScriptSuffix}')
+ .toFilePath();
final kernelBinariesFolder = _useSdk
? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
diff --git a/utils/kernel-service/BUILD.gn b/utils/kernel-service/BUILD.gn
index 7d1bfd1..6f539d9 100644
--- a/utils/kernel-service/BUILD.gn
+++ b/utils/kernel-service/BUILD.gn
@@ -53,12 +53,12 @@
# flags --no-strong-mode once https://github.com/dart-lang/sdk/issues/31623
# is fixed.
args = [
- "--packages=file:///" + rebase_path("../../.packages"),
- "--platform=file:///" + rebase_path("$root_out_dir/vm_platform.dill"),
+ "--packages=" + rebase_path("../../.packages"),
+ "--platform=" + rebase_path("$root_out_dir/vm_platform.dill"),
"--no-aot",
"--no-strong-mode",
"--no-embed-sources",
"--output=" + rebase_path("$root_gen_dir/kernel_service.dill"),
- "file:///" + rebase_path(kernel_service_script),
+ rebase_path(kernel_service_script),
]
}