Version 2.9.0-15.0.dev
Merge commit '391d3bcdd861efde45bd77e9cbdce814cbda3762' into dev
diff --git a/DEPS b/DEPS
index dd69128..ab45592 100644
--- a/DEPS
+++ b/DEPS
@@ -44,11 +44,11 @@
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
# hashes. It requires access to the dart-build-access group, which EngProd
# has.
- "co19_rev": "9dacb12cf963ce92fb056b7f2fb87096fd576e9a",
+ "co19_rev": "c6adf63baea76b1f7e7833482eec023fd244fc33",
"co19_2_rev": "620c1148c8b7a3d7f74afacf348c46f109eb64f2",
# The internal benchmarks to use. See go/dart-benchmarks-internal
- "benchmarks_internal_rev": "4f5285d3711ed4225d0bf5673379e7afdc6cb8e5",
+ "benchmarks_internal_rev": "6c5cf5ca4f29f0e498a9ad51146ccb2ad3bbd2b4",
"checkout_benchmarks_internal": False,
# As Flutter does, we use Fuchsia's GN and Clang toolchain. These revision
@@ -122,14 +122,14 @@
"mustache_rev": "664737ecad027e6b96d0d1e627257efa0e46fcb1",
"oauth2_tag": "1.6.0",
"package_config_rev": "9c586d04bd26fef01215fd10e7ab96a3050cfa64",
- "path_rev": "4b8c83cd5ccfcc8101acd2940ffb5a44d24ec57e",
+ "path_rev": "4f3bb71843fe5493ba490828a1721821d7b33746",
"pedantic_tag": "v1.9.0",
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_rev": "86fbb2cde9bbc66c8d159909d2f65a5981ea5b50",
"protobuf_rev": "3746c8fd3f2b0147623a8e3db89c3ff4330de760",
"pub_rev": "6178cdf284baf2345d1ea578b7176a754aa576fe",
"pub_semver_tag": "v1.4.4",
- "quiver-dart_tag": "2.0.0+1",
+ "quiver-dart_tag": "246e754fe45cecb6aa5f3f13b4ed61037ff0d784",
"resource_rev": "f8e37558a1c4f54550aa463b88a6a831e3e33cd6",
"root_certificates_rev": "16ef64be64c7dfdff2b9f4b910726e635ccc519e",
"rust_revision": "60960a260f7b5c695fd0717311d72ce62dd4eb43",
@@ -501,7 +501,7 @@
],
"dep_type": "cipd",
},
- Var("dart_root") + "/benchmarks/FfiCall/dart/native/out/": {
+ Var("dart_root") + "/benchmarks/FfiCall/native/out/": {
"packages": [
{
"package": "dart/benchmarks/fficall",
@@ -559,21 +559,21 @@
],
},
{
- # Pull Debian wheezy sysroot for i386 Linux
+ # Pull Debian sysroot for i386 Linux
'name': 'sysroot_i386',
'pattern': '.',
'action': ['python', 'sdk/build/linux/sysroot_scripts/install-sysroot.py',
'--arch', 'i386'],
},
{
- # Pull Debian wheezy sysroot for amd64 Linux
+ # Pull Debian sysroot for amd64 Linux
'name': 'sysroot_amd64',
'pattern': '.',
'action': ['python', 'sdk/build/linux/sysroot_scripts/install-sysroot.py',
'--arch', 'amd64'],
},
{
- # Pull Debian wheezy sysroot for arm Linux
+ # Pull Debian sysroot for arm Linux
'name': 'sysroot_amd64',
'pattern': '.',
'action': ['python', 'sdk/build/linux/sysroot_scripts/install-sysroot.py',
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 85551ac..5f27094 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -67,7 +67,10 @@
a test, the test's counterpart (if it exists at all) should be in the CL
too.
"""
- DIRS = ["co19", "corelib", "ffi", "language", "lib", "standalone"]
+ DIRS = [
+ "tests/co19", "tests/corelib", "tests/ffi", "tests/language",
+ "tests/lib", "tests/standalone", "runtime/tests/vm/dart"
+ ]
files = [git_file.LocalPath() for git_file in input_api.AffectedTextFiles()]
unsynchronized = []
@@ -75,8 +78,8 @@
if file.endswith('.status'): continue
for dir in DIRS:
- legacy_dir = "tests/{}_2/".format(dir)
- nnbd_dir = "tests/{}/".format(dir)
+ legacy_dir = "{}_2/".format(dir)
+ nnbd_dir = "{}/".format(dir)
counterpart = None
if file.startswith(legacy_dir):
diff --git a/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart b/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
index fe904ee..b7ed19e 100644
--- a/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
+++ b/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
@@ -2,6 +2,8 @@
// 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.
+// ignore_for_file: avoid_function_literals_in_foreach_calls
+
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:fixnum/fixnum.dart';
@@ -38,23 +40,25 @@
: seed = (BigInt.one << bits) - BigInt.one,
super(name);
+ @override
void setup() {
- BigInt b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (b.bitLength < bits) {
b = seed;
}
- String string = b.toString();
+ final string = b.toString();
strings.add(string);
totalLength += string.length;
b = b - (b >> 8);
}
}
+ @override
void run() {
- for (String s in strings) {
- BigInt b = BigInt.parse(s);
+ for (final s in strings) {
+ final b = BigInt.parse(s);
sink1 = s;
sink2 = b;
}
@@ -73,23 +77,25 @@
: seed = (Int64.ONE << bits) - Int64.ONE,
super(name);
+ @override
void setup() {
- Int64 b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (int64UnsignedBitLength(b) < bits) {
b = seed;
}
- String string = b.toStringUnsigned();
+ final string = b.toStringUnsigned();
strings.add(string);
totalLength += string.length;
b = b - b.shiftRightUnsigned(8);
}
}
+ @override
void run() {
- for (String s in strings) {
- Int64 b = Int64.parseInt(s);
+ for (final s in strings) {
+ final b = Int64.parseInt(s);
sink1 = s;
sink2 = b;
}
@@ -109,14 +115,15 @@
nativeBigInt.one),
super(name);
+ @override
void setup() {
- Object b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (nativeBigInt.bitLength(b) < bits) {
b = seed;
}
- String string = nativeBigInt.toStringMethod(b);
+ final string = nativeBigInt.toStringMethod(b);
strings.add(string);
totalLength += string.length;
b = nativeBigInt.subtract(
@@ -124,9 +131,10 @@
}
}
+ @override
void run() {
- for (String s in strings) {
- Object b = nativeBigInt.parse(s);
+ for (final s in strings) {
+ final b = nativeBigInt.parse(s);
sink1 = s;
sink2 = b;
}
@@ -143,26 +151,28 @@
: seed = (BigInt.one << bits) - BigInt.one,
super(name);
+ @override
void setup() {
- BigInt b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (b.bitLength < bits) {
b = seed;
}
- String string = b.toString();
+ final string = b.toString();
values.add(b - BigInt.one); // We add 'one' back later.
totalLength += string.length;
b = b - (b >> 8);
}
}
+ @override
void run() {
- for (BigInt b0 in values) {
+ for (final b0 in values) {
// Instances might cache `toString()`, so use arithmetic to create a new
// instance to try to protect against measuring a cached string.
- BigInt b = b0 + BigInt.one;
- String s = b.toString();
+ final b = b0 + BigInt.one;
+ final s = b.toString();
sink1 = s;
sink2 = b;
}
@@ -179,26 +189,28 @@
: seed = (Int64.ONE << bits) - Int64.ONE,
super(name);
+ @override
void setup() {
- Int64 b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (int64UnsignedBitLength(b) < bits) {
b = seed;
}
- String string = b.toStringUnsigned();
+ final string = b.toStringUnsigned();
values.add(b - Int64.ONE);
totalLength += string.length;
b = b - b.shiftRightUnsigned(8);
}
}
+ @override
void run() {
- for (Int64 b0 in values) {
+ for (final b0 in values) {
// Instances might cache `toString()`, so use arithmetic to create a new
// instance to try to protect against measuring a cached string.
- Int64 b = b0 + Int64.ONE;
- String s = b.toStringUnsigned();
+ final b = b0 + Int64.ONE;
+ final s = b.toStringUnsigned();
sink1 = s;
sink2 = b;
}
@@ -218,15 +230,16 @@
nativeBigInt.one),
super(name);
+ @override
void setup() {
final one = nativeBigInt.one;
- Object b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (nativeBigInt.bitLength(b) < bits) {
b = seed;
}
- String string = nativeBigInt.toStringMethod(b);
+ final string = nativeBigInt.toStringMethod(b);
values.add(nativeBigInt.subtract(b, one)); // We add 'one' back later.
totalLength += string.length;
b = nativeBigInt.subtract(
@@ -234,13 +247,14 @@
}
}
+ @override
void run() {
final one = nativeBigInt.one;
- for (Object b0 in values) {
+ for (final b0 in values) {
// Instances might cache `toString()`, so use arithmetic to create a new
// instance to try to protect against measuring a cached string.
- Object b = nativeBigInt.add(b0, one);
- String s = nativeBigInt.toStringMethod(b);
+ final b = nativeBigInt.add(b0, one);
+ final s = nativeBigInt.toStringMethod(b);
sink1 = s;
sink2 = b;
}
@@ -251,6 +265,7 @@
/// [DummyBenchmark] instantly returns a fixed 'slow' result.
class DummyBenchmark extends BenchmarkBase {
DummyBenchmark(String name) : super(name);
+ @override
double measure() => 2000 * 1000 * 1.0; // A rate of one run per 2s.
}
@@ -274,7 +289,7 @@
: () => DummyBenchmark(name);
}
-main() {
+void main() {
final benchmarks = [
() => ParseInt64Benchmark('Int64.parse.0009.bits', 9),
() => ParseInt64Benchmark('Int64.parse.0032.bits', 32),
diff --git a/benchmarks/BigIntParsePrint/dart/native_version_dummy.dart b/benchmarks/BigIntParsePrint/dart/native_version_dummy.dart
index 3858e92..b3b83ecf 100644
--- a/benchmarks/BigIntParsePrint/dart/native_version_dummy.dart
+++ b/benchmarks/BigIntParsePrint/dart/native_version_dummy.dart
@@ -9,23 +9,41 @@
class _DummyMethods implements NativeBigIntMethods {
const _DummyMethods();
+ @override
bool get enabled => false;
static Object bad(String message) => UnimplementedError(message);
+ @override
Object parse(String string) => throw bad('parse');
+
+ @override
String toStringMethod(Object value) => throw bad('toStringMethod');
+ @override
Object fromInt(int i) => throw bad('fromInt');
+ @override
Object get one => throw bad('one');
+
+ @override
Object get eight => throw bad('eight');
+ @override
int bitLength(Object value) => throw bad('bitLength');
+
+ @override
bool isEven(Object value) => throw bad('isEven');
+ @override
Object add(Object left, Object right) => throw bad('add');
+
+ @override
Object shiftLeft(Object value, Object count) => throw bad('shiftLeft');
+
+ @override
Object shiftRight(Object value, Object count) => throw bad('shiftRight');
+
+ @override
Object subtract(Object left, Object right) => throw bad('subtract');
}
diff --git a/benchmarks/BigIntParsePrint/dart/native_version_javascript.dart b/benchmarks/BigIntParsePrint/dart/native_version_javascript.dart
index fb7e83a..e8a6bae 100644
--- a/benchmarks/BigIntParsePrint/dart/native_version_javascript.dart
+++ b/benchmarks/BigIntParsePrint/dart/native_version_javascript.dart
@@ -2,8 +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.
-import 'native_version.dart';
+@JS()
+library native_version_javascript;
+
import 'package:js/js.dart';
+import 'native_version.dart';
const NativeBigIntMethods nativeBigInt = _Methods();
@@ -43,6 +46,7 @@
const _Methods();
+ @override
bool get enabled {
if (!_initialized) {
_initialize();
@@ -51,6 +55,7 @@
}
void _initialize() {
+ _initialized = true;
try {
_setup();
_enabled = true;
@@ -64,27 +69,37 @@
}
}
- static Object bad(String message) {
- throw UnimplementedError(message);
- }
-
+ @override
Object parse(String string) => _parse(string);
+ @override
String toStringMethod(Object value) => _toStringMethod(value);
+ @override
Object fromInt(int i) => _fromInt(i);
+ @override
Object get one => _one;
+ @override
Object get eight => _eight;
+ @override
int bitLength(Object value) => _bitLength(value);
+ @override
bool isEven(Object value) => _isEven(value);
+ @override
Object add(Object left, Object right) => _add(left, right);
+
+ @override
Object shiftLeft(Object value, Object count) => _shiftLeft(value, count);
+
+ @override
Object shiftRight(Object value, Object count) => _shiftRight(value, count);
+
+ @override
Object subtract(Object left, Object right) => _subtract(left, right);
}
diff --git a/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart b/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
index fe904ee..b7ed19e 100644
--- a/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
+++ b/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
@@ -2,6 +2,8 @@
// 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.
+// ignore_for_file: avoid_function_literals_in_foreach_calls
+
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:fixnum/fixnum.dart';
@@ -38,23 +40,25 @@
: seed = (BigInt.one << bits) - BigInt.one,
super(name);
+ @override
void setup() {
- BigInt b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (b.bitLength < bits) {
b = seed;
}
- String string = b.toString();
+ final string = b.toString();
strings.add(string);
totalLength += string.length;
b = b - (b >> 8);
}
}
+ @override
void run() {
- for (String s in strings) {
- BigInt b = BigInt.parse(s);
+ for (final s in strings) {
+ final b = BigInt.parse(s);
sink1 = s;
sink2 = b;
}
@@ -73,23 +77,25 @@
: seed = (Int64.ONE << bits) - Int64.ONE,
super(name);
+ @override
void setup() {
- Int64 b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (int64UnsignedBitLength(b) < bits) {
b = seed;
}
- String string = b.toStringUnsigned();
+ final string = b.toStringUnsigned();
strings.add(string);
totalLength += string.length;
b = b - b.shiftRightUnsigned(8);
}
}
+ @override
void run() {
- for (String s in strings) {
- Int64 b = Int64.parseInt(s);
+ for (final s in strings) {
+ final b = Int64.parseInt(s);
sink1 = s;
sink2 = b;
}
@@ -109,14 +115,15 @@
nativeBigInt.one),
super(name);
+ @override
void setup() {
- Object b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (nativeBigInt.bitLength(b) < bits) {
b = seed;
}
- String string = nativeBigInt.toStringMethod(b);
+ final string = nativeBigInt.toStringMethod(b);
strings.add(string);
totalLength += string.length;
b = nativeBigInt.subtract(
@@ -124,9 +131,10 @@
}
}
+ @override
void run() {
- for (String s in strings) {
- Object b = nativeBigInt.parse(s);
+ for (final s in strings) {
+ final b = nativeBigInt.parse(s);
sink1 = s;
sink2 = b;
}
@@ -143,26 +151,28 @@
: seed = (BigInt.one << bits) - BigInt.one,
super(name);
+ @override
void setup() {
- BigInt b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (b.bitLength < bits) {
b = seed;
}
- String string = b.toString();
+ final string = b.toString();
values.add(b - BigInt.one); // We add 'one' back later.
totalLength += string.length;
b = b - (b >> 8);
}
}
+ @override
void run() {
- for (BigInt b0 in values) {
+ for (final b0 in values) {
// Instances might cache `toString()`, so use arithmetic to create a new
// instance to try to protect against measuring a cached string.
- BigInt b = b0 + BigInt.one;
- String s = b.toString();
+ final b = b0 + BigInt.one;
+ final s = b.toString();
sink1 = s;
sink2 = b;
}
@@ -179,26 +189,28 @@
: seed = (Int64.ONE << bits) - Int64.ONE,
super(name);
+ @override
void setup() {
- Int64 b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (int64UnsignedBitLength(b) < bits) {
b = seed;
}
- String string = b.toStringUnsigned();
+ final string = b.toStringUnsigned();
values.add(b - Int64.ONE);
totalLength += string.length;
b = b - b.shiftRightUnsigned(8);
}
}
+ @override
void run() {
- for (Int64 b0 in values) {
+ for (final b0 in values) {
// Instances might cache `toString()`, so use arithmetic to create a new
// instance to try to protect against measuring a cached string.
- Int64 b = b0 + Int64.ONE;
- String s = b.toStringUnsigned();
+ final b = b0 + Int64.ONE;
+ final s = b.toStringUnsigned();
sink1 = s;
sink2 = b;
}
@@ -218,15 +230,16 @@
nativeBigInt.one),
super(name);
+ @override
void setup() {
final one = nativeBigInt.one;
- Object b = seed;
- int totalLength = 0;
+ var b = seed;
+ var totalLength = 0;
while (totalLength < requiredDigits) {
if (nativeBigInt.bitLength(b) < bits) {
b = seed;
}
- String string = nativeBigInt.toStringMethod(b);
+ final string = nativeBigInt.toStringMethod(b);
values.add(nativeBigInt.subtract(b, one)); // We add 'one' back later.
totalLength += string.length;
b = nativeBigInt.subtract(
@@ -234,13 +247,14 @@
}
}
+ @override
void run() {
final one = nativeBigInt.one;
- for (Object b0 in values) {
+ for (final b0 in values) {
// Instances might cache `toString()`, so use arithmetic to create a new
// instance to try to protect against measuring a cached string.
- Object b = nativeBigInt.add(b0, one);
- String s = nativeBigInt.toStringMethod(b);
+ final b = nativeBigInt.add(b0, one);
+ final s = nativeBigInt.toStringMethod(b);
sink1 = s;
sink2 = b;
}
@@ -251,6 +265,7 @@
/// [DummyBenchmark] instantly returns a fixed 'slow' result.
class DummyBenchmark extends BenchmarkBase {
DummyBenchmark(String name) : super(name);
+ @override
double measure() => 2000 * 1000 * 1.0; // A rate of one run per 2s.
}
@@ -274,7 +289,7 @@
: () => DummyBenchmark(name);
}
-main() {
+void main() {
final benchmarks = [
() => ParseInt64Benchmark('Int64.parse.0009.bits', 9),
() => ParseInt64Benchmark('Int64.parse.0032.bits', 32),
diff --git a/benchmarks/BigIntParsePrint/dart2/native_version_dummy.dart b/benchmarks/BigIntParsePrint/dart2/native_version_dummy.dart
index 3858e92..b3b83ecf 100644
--- a/benchmarks/BigIntParsePrint/dart2/native_version_dummy.dart
+++ b/benchmarks/BigIntParsePrint/dart2/native_version_dummy.dart
@@ -9,23 +9,41 @@
class _DummyMethods implements NativeBigIntMethods {
const _DummyMethods();
+ @override
bool get enabled => false;
static Object bad(String message) => UnimplementedError(message);
+ @override
Object parse(String string) => throw bad('parse');
+
+ @override
String toStringMethod(Object value) => throw bad('toStringMethod');
+ @override
Object fromInt(int i) => throw bad('fromInt');
+ @override
Object get one => throw bad('one');
+
+ @override
Object get eight => throw bad('eight');
+ @override
int bitLength(Object value) => throw bad('bitLength');
+
+ @override
bool isEven(Object value) => throw bad('isEven');
+ @override
Object add(Object left, Object right) => throw bad('add');
+
+ @override
Object shiftLeft(Object value, Object count) => throw bad('shiftLeft');
+
+ @override
Object shiftRight(Object value, Object count) => throw bad('shiftRight');
+
+ @override
Object subtract(Object left, Object right) => throw bad('subtract');
}
diff --git a/benchmarks/BigIntParsePrint/dart2/native_version_javascript.dart b/benchmarks/BigIntParsePrint/dart2/native_version_javascript.dart
index fb7e83a..e8a6bae 100644
--- a/benchmarks/BigIntParsePrint/dart2/native_version_javascript.dart
+++ b/benchmarks/BigIntParsePrint/dart2/native_version_javascript.dart
@@ -2,8 +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.
-import 'native_version.dart';
+@JS()
+library native_version_javascript;
+
import 'package:js/js.dart';
+import 'native_version.dart';
const NativeBigIntMethods nativeBigInt = _Methods();
@@ -43,6 +46,7 @@
const _Methods();
+ @override
bool get enabled {
if (!_initialized) {
_initialize();
@@ -51,6 +55,7 @@
}
void _initialize() {
+ _initialized = true;
try {
_setup();
_enabled = true;
@@ -64,27 +69,37 @@
}
}
- static Object bad(String message) {
- throw UnimplementedError(message);
- }
-
+ @override
Object parse(String string) => _parse(string);
+ @override
String toStringMethod(Object value) => _toStringMethod(value);
+ @override
Object fromInt(int i) => _fromInt(i);
+ @override
Object get one => _one;
+ @override
Object get eight => _eight;
+ @override
int bitLength(Object value) => _bitLength(value);
+ @override
bool isEven(Object value) => _isEven(value);
+ @override
Object add(Object left, Object right) => _add(left, right);
+
+ @override
Object shiftLeft(Object value, Object count) => _shiftLeft(value, count);
+
+ @override
Object shiftRight(Object value, Object count) => _shiftRight(value, count);
+
+ @override
Object subtract(Object left, Object right) => _subtract(left, right);
}
diff --git a/benchmarks/FfiCall/dart/FfiCall.dart b/benchmarks/FfiCall/dart/FfiCall.dart
index a2857e4..b790a85 100644
--- a/benchmarks/FfiCall/dart/FfiCall.dart
+++ b/benchmarks/FfiCall/dart/FfiCall.dart
@@ -20,7 +20,7 @@
//
DynamicLibrary ffiTestFunctions = dlopenPlatformSpecific("native_functions",
- path: Platform.script.resolve("native/out/").path);
+ path: Platform.script.resolve("../native/out/").path);
typedef NativeFunction1Uint8 = Uint8 Function(Uint8);
typedef Function1int = int Function(int);
diff --git a/benchmarks/FfiCall/dart2/FfiCall.dart b/benchmarks/FfiCall/dart2/FfiCall.dart
index a2857e4..b790a85 100644
--- a/benchmarks/FfiCall/dart2/FfiCall.dart
+++ b/benchmarks/FfiCall/dart2/FfiCall.dart
@@ -20,7 +20,7 @@
//
DynamicLibrary ffiTestFunctions = dlopenPlatformSpecific("native_functions",
- path: Platform.script.resolve("native/out/").path);
+ path: Platform.script.resolve("../native/out/").path);
typedef NativeFunction1Uint8 = Uint8 Function(Uint8);
typedef Function1int = int Function(int);
diff --git a/benchmarks/FfiCall/dart/native/.gitignore b/benchmarks/FfiCall/native/.gitignore
similarity index 100%
rename from benchmarks/FfiCall/dart/native/.gitignore
rename to benchmarks/FfiCall/native/.gitignore
diff --git a/benchmarks/FfiCall/dart/native/Makefile b/benchmarks/FfiCall/native/Makefile
similarity index 100%
rename from benchmarks/FfiCall/dart/native/Makefile
rename to benchmarks/FfiCall/native/Makefile
diff --git a/benchmarks/FfiCall/dart/native/native_functions.c b/benchmarks/FfiCall/native/native_functions.c
similarity index 100%
rename from benchmarks/FfiCall/dart/native/native_functions.c
rename to benchmarks/FfiCall/native/native_functions.c
diff --git a/benchmarks/IsolateJson/dart2/IsolateJson.dart b/benchmarks/IsolateJson/dart2/IsolateJson.dart
index 6d11738..459c133 100644
--- a/benchmarks/IsolateJson/dart2/IsolateJson.dart
+++ b/benchmarks/IsolateJson/dart2/IsolateJson.dart
@@ -115,7 +115,7 @@
Future<void> main() async {
final jsonString =
- File('benchmarks/IsolateJson2/dart/sample.json').readAsStringSync();
+ File('benchmarks/IsolateJson/dart2/sample.json').readAsStringSync();
final json250KB = utf8.encode(jsonString); // 294356 bytes
final decoded = json.decode(utf8.decode(json250KB));
final decoded1MB = <dynamic, dynamic>{
diff --git a/benchmarks/TypedDataDuplicate/dart/TypedDataDuplicate.dart b/benchmarks/TypedDataDuplicate/dart/TypedDataDuplicate.dart
index afebf7a..c21c575 100644
--- a/benchmarks/TypedDataDuplicate/dart/TypedDataDuplicate.dart
+++ b/benchmarks/TypedDataDuplicate/dart/TypedDataDuplicate.dart
@@ -10,27 +10,30 @@
abstract class Uint8ListCopyBenchmark extends BenchmarkBase {
final int size;
- Uint8List input;
- Uint8List result;
+ late Uint8List input;
+ late Uint8List result;
Uint8ListCopyBenchmark(String method, this.size)
: super('TypedDataDuplicate.Uint8List.$size.$method');
+ @override
void setup() {
input = Uint8List(size);
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
input[i] = (i + 3) & 0xff;
}
}
+ @override
void warmup() {
- for (int i = 0; i < 100; ++i) {
+ for (var i = 0; i < 100; ++i) {
run();
}
}
+ @override
void teardown() {
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
if (result[i] != ((i + 3) & 0xff)) {
throw 'Unexpected result';
}
@@ -41,6 +44,7 @@
class Uint8ListCopyViaFromListBenchmark extends Uint8ListCopyBenchmark {
Uint8ListCopyViaFromListBenchmark(int size) : super('fromList', size);
+ @override
void run() {
result = Uint8List.fromList(input);
}
@@ -49,31 +53,36 @@
class Uint8ListCopyViaLoopBenchmark extends Uint8ListCopyBenchmark {
Uint8ListCopyViaLoopBenchmark(int size) : super('loop', size);
+ @override
void run() {
- result = Uint8List(input.length);
+ final input = this.input;
+ final result = Uint8List(input.length);
for (var i = 0; i < input.length; i++) {
result[i] = input[i];
}
+ this.result = result;
}
}
abstract class Float64ListCopyBenchmark extends BenchmarkBase {
final int size;
- Float64List input;
- Float64List result;
+ late Float64List input;
+ late Float64List result;
Float64ListCopyBenchmark(String method, this.size)
: super('TypedDataDuplicate.Float64List.$size.$method');
+ @override
void setup() {
input = Float64List(size);
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
input[i] = (i - 7).toDouble();
}
}
+ @override
void teardown() {
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
if (result[i] != (i - 7).toDouble()) {
throw 'Unexpected result';
}
@@ -84,6 +93,7 @@
class Float64ListCopyViaFromListBenchmark extends Float64ListCopyBenchmark {
Float64ListCopyViaFromListBenchmark(int size) : super('fromList', size);
+ @override
void run() {
result = Float64List.fromList(input);
}
@@ -92,15 +102,18 @@
class Float64ListCopyViaLoopBenchmark extends Float64ListCopyBenchmark {
Float64ListCopyViaLoopBenchmark(int size) : super('loop', size);
+ @override
void run() {
- result = Float64List(input.length);
+ final input = this.input;
+ final result = Float64List(input.length);
for (var i = 0; i < input.length; i++) {
result[i] = input[i];
}
+ this.result = result;
}
}
-main() {
+void main() {
final sizes = [8, 32, 256, 16384];
final benchmarks = [
for (int size in sizes) ...[
diff --git a/benchmarks/TypedDataDuplicate/dart2/TypedDataDuplicate.dart b/benchmarks/TypedDataDuplicate/dart2/TypedDataDuplicate.dart
index afebf7a..d9fb31a 100644
--- a/benchmarks/TypedDataDuplicate/dart2/TypedDataDuplicate.dart
+++ b/benchmarks/TypedDataDuplicate/dart2/TypedDataDuplicate.dart
@@ -16,21 +16,24 @@
Uint8ListCopyBenchmark(String method, this.size)
: super('TypedDataDuplicate.Uint8List.$size.$method');
+ @override
void setup() {
input = Uint8List(size);
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
input[i] = (i + 3) & 0xff;
}
}
+ @override
void warmup() {
- for (int i = 0; i < 100; ++i) {
+ for (var i = 0; i < 100; ++i) {
run();
}
}
+ @override
void teardown() {
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
if (result[i] != ((i + 3) & 0xff)) {
throw 'Unexpected result';
}
@@ -41,6 +44,7 @@
class Uint8ListCopyViaFromListBenchmark extends Uint8ListCopyBenchmark {
Uint8ListCopyViaFromListBenchmark(int size) : super('fromList', size);
+ @override
void run() {
result = Uint8List.fromList(input);
}
@@ -49,11 +53,14 @@
class Uint8ListCopyViaLoopBenchmark extends Uint8ListCopyBenchmark {
Uint8ListCopyViaLoopBenchmark(int size) : super('loop', size);
+ @override
void run() {
- result = Uint8List(input.length);
+ final input = this.input;
+ final result = Uint8List(input.length);
for (var i = 0; i < input.length; i++) {
result[i] = input[i];
}
+ this.result = result;
}
}
@@ -65,15 +72,17 @@
Float64ListCopyBenchmark(String method, this.size)
: super('TypedDataDuplicate.Float64List.$size.$method');
+ @override
void setup() {
input = Float64List(size);
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
input[i] = (i - 7).toDouble();
}
}
+ @override
void teardown() {
- for (int i = 0; i < size; ++i) {
+ for (var i = 0; i < size; ++i) {
if (result[i] != (i - 7).toDouble()) {
throw 'Unexpected result';
}
@@ -84,6 +93,7 @@
class Float64ListCopyViaFromListBenchmark extends Float64ListCopyBenchmark {
Float64ListCopyViaFromListBenchmark(int size) : super('fromList', size);
+ @override
void run() {
result = Float64List.fromList(input);
}
@@ -92,15 +102,18 @@
class Float64ListCopyViaLoopBenchmark extends Float64ListCopyBenchmark {
Float64ListCopyViaLoopBenchmark(int size) : super('loop', size);
+ @override
void run() {
- result = Float64List(input.length);
+ final input = this.input;
+ final result = Float64List(input.length);
for (var i = 0; i < input.length; i++) {
result[i] = input[i];
}
+ this.result = result;
}
}
-main() {
+void main() {
final sizes = [8, 32, 256, 16384];
final benchmarks = [
for (int size in sizes) ...[
diff --git a/build/.gitignore b/build/.gitignore
index 869cdb4..f7bbb04 100644
--- a/build/.gitignore
+++ b/build/.gitignore
@@ -1,7 +1,7 @@
# Generated file containing information about the VS toolchain on Windows
win_toolchain.json
-# Pulled Debian wheezy sysroots
+# Pulled Debian jessie sysroots
linux/debian_jessie_arm-sysroot
linux/debian_jessie_arm64-sysroot
linux/debian_jessie_amd64-sysroot
diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni
index 092022a..c4ee9ad 100644
--- a/build/config/sysroot.gni
+++ b/build/config/sysroot.gni
@@ -33,7 +33,8 @@
}
}
-if (current_toolchain == default_toolchain && target_sysroot != "") {
+if ((current_toolchain == host_toolchain ||
+ current_toolchain == default_toolchain) && target_sysroot != "") {
sysroot = target_sysroot
} else if (is_android) {
import("//build/config/android/config.gni")
diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py
index 1fe6998..cbe8fff 100755
--- a/build/linux/sysroot_scripts/install-sysroot.py
+++ b/build/linux/sysroot_scripts/install-sysroot.py
@@ -5,16 +5,15 @@
"""Install Debian sysroots for building chromium.
"""
-# The sysroot is needed to ensure that binaries will run on Debian Wheezy,
-# the oldest supported linux distribution. For ARM64 linux, we have Debian
-# Jessie sysroot as Jessie is the first version with ARM64 support. This script
-# can be run manually but is more often run as part of gclient hooks. When run
-# from hooks this script is a no-op on non-linux platforms.
+# The sysroot is needed to ensure that binaries will run on Debian Jessie,
+# the oldest supported linux distribution. This script can be run manually
+# but is more often run as part of gclient hooks. When run from hooks this
+# script is a no-op on non-linux platforms.
# The sysroot image could be constructed from scratch based on the current
-# state or Debian Wheezy/Jessie but for consistency we currently use a
-# pre-built root image. The image will normally need to be rebuilt every time
-# chrome's build dependencies are changed.
+# state or Debian Jessie but for consistency we currently use a pre-built root
+# image. The image will normally need to be rebuilt every time chrome's build
+# dependencies are changed.
import hashlib
import json
diff --git a/build/linux/sysroot_scripts/sysroots.json b/build/linux/sysroot_scripts/sysroots.json
index 32b3dd9..5688cd0 100644
--- a/build/linux/sysroot_scripts/sysroots.json
+++ b/build/linux/sysroot_scripts/sysroots.json
@@ -40,29 +40,5 @@
"Sha1Sum": "d1591e8fc6a273af1fbf3d1a864f098081d06dd1",
"SysrootDir": "ubuntu_trusty_arm-sysroot",
"Tarball": "ubuntu_trusty_arm_sysroot.tgz"
- },
- "wheezy_amd64": {
- "Revision": "7031a828c5dcedc937bbf375c42daab08ca6162f",
- "Sha1Sum": "3a150574635247c7fc7f135df10c2565d745c76c",
- "SysrootDir": "debian_wheezy_amd64-sysroot",
- "Tarball": "debian_wheezy_amd64_sysroot.tgz"
- },
- "wheezy_arm": {
- "Revision": "7031a828c5dcedc937bbf375c42daab08ca6162f",
- "Sha1Sum": "65a16e16ffbb570f044c7139871665bb6689be1c",
- "SysrootDir": "debian_wheezy_arm-sysroot",
- "Tarball": "debian_wheezy_arm_sysroot.tgz"
- },
- "wheezy_i386": {
- "Revision": "7031a828c5dcedc937bbf375c42daab08ca6162f",
- "Sha1Sum": "e7fa85ede53048dd3e8f3ea8009af954f0b7ef0d",
- "SysrootDir": "debian_wheezy_i386-sysroot",
- "Tarball": "debian_wheezy_i386_sysroot.tgz"
- },
- "wheezy_mips": {
- "Revision": "7031a828c5dcedc937bbf375c42daab08ca6162f",
- "Sha1Sum": "edf929f216611a7fae41e537687c75be50c8fdec",
- "SysrootDir": "debian_wheezy_mips-sysroot",
- "Tarball": "debian_wheezy_mips_sysroot.tgz"
}
}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
index 7f7f609..7b8ebfb 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
@@ -933,6 +933,30 @@
}
return identifier;
}
+
+ Token ensureIdentifierPotentiallyRecovered(
+ Token token, Parser parser, bool isRecovered) {
+ // Fast path good case.
+ Token identifier = token.next;
+ assert(identifier.kind != IDENTIFIER_TOKEN);
+ if (identifier.type.isPseudo) {
+ if (optional('Function', identifier)) {
+ parser.reportRecoverableErrorWithToken(
+ identifier, codes.templateExpectedIdentifier);
+ }
+ return identifier;
+ }
+
+ // If not recovered, recover as normal.
+ if (!isRecovered || !token.isKeywordOrIdentifier) {
+ return ensureIdentifier(token, parser);
+ }
+
+ // If already recovered, use the given token.
+ parser.reportRecoverableErrorWithToken(
+ identifier, codes.templateExpectedIdentifier);
+ return identifier;
+ }
}
/// See [IdentifierContext.typeReference].
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
index 7b8fe3a..bd57ab1 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -1100,34 +1100,52 @@
assert(optional('typedef', typedefKeyword));
listener.beginFunctionTypeAlias(typedefKeyword);
TypeInfo typeInfo = computeType(typedefKeyword, /* required = */ false);
- Token token = typeInfo.skipType(typedefKeyword).next;
+ Token token = typeInfo.skipType(typedefKeyword);
+ Token next = token.next;
Token equals;
TypeParamOrArgInfo typeParam =
- computeTypeParamOrArg(token, /* inDeclaration = */ true);
- if (typeInfo == noType &&
- (token.kind == IDENTIFIER_TOKEN || token.type.isPseudo) &&
- optional('=', typeParam.skip(token).next)) {
- listener.handleIdentifier(token, IdentifierContext.typedefDeclaration);
- token = typeParam.parseVariables(token, this).next;
+ computeTypeParamOrArg(next, /* inDeclaration = */ true);
+ // Allow voidType here if the next is "=" as 'void' has then been used as
+ // an identifier (not legal, but an error will be given).
+ if (typeInfo == noType && optional('=', typeParam.skip(next).next)) {
+ // New style typedef, e.g. typedef foo = void Function();".
+
+ // Parse as recovered here to 'force' using it as an identifier as we've
+ // already established that the next token is the equal sign we're looking
+ // for.
+ token = ensureIdentifierPotentiallyRecovered(token,
+ IdentifierContext.typedefDeclaration, /* isRecovered = */ true);
+
+ token = typeParam.parseVariables(token, this);
+ next = token.next;
// parseVariables rewrites so even though we checked in the if,
// we might not have an equal here now.
- if (!optional('=', token) && optional('=', token.next)) {
+ if (!optional('=', next) && optional('=', next.next)) {
// Recovery after recovery: A token was inserted, but we'll skip it now
// to get more in line with what we thought in the if before.
- token = token.next;
+ next = next.next;
}
- if (optional('=', token)) {
- equals = token;
+ if (optional('=', next)) {
+ equals = next;
token = computeType(equals, /* required = */ true)
.ensureTypeOrVoid(equals, this);
} else {
// A rewrite caused the = to disappear
token = parseFormalParametersRequiredOpt(
- token, MemberKind.FunctionTypeAlias);
+ next, MemberKind.FunctionTypeAlias);
}
} else {
+ // Old style typedef, e.g. "typedef void foo();".
token = typeInfo.parseType(typedefKeyword, this);
- token = ensureIdentifier(token, IdentifierContext.typedefDeclaration);
+ next = token.next;
+ bool isIdentifierRecovered = false;
+ if (next.kind != IDENTIFIER_TOKEN &&
+ optional('(', typeParam.skip(next).next)) {
+ // Recovery: Not a valid identifier, but is used as such.
+ isIdentifierRecovered = true;
+ }
+ token = ensureIdentifierPotentiallyRecovered(
+ token, IdentifierContext.typedefDeclaration, isIdentifierRecovered);
token = typeParam.parseVariables(token, this);
token =
parseFormalParametersRequiredOpt(token, MemberKind.FunctionTypeAlias);
diff --git a/pkg/analysis_server/lib/src/cider/completion.dart b/pkg/analysis_server/lib/src/cider/completion.dart
index b6e249d..d87d611 100644
--- a/pkg/analysis_server/lib/src/cider/completion.dart
+++ b/pkg/analysis_server/lib/src/cider/completion.dart
@@ -81,6 +81,7 @@
);
var dartdocDirectiveInfo = DartdocDirectiveInfo();
+ var suggestionsTimer = Stopwatch()..start();
var suggestions = await _logger.runAsync('Compute suggestions', () async {
var includedElementKinds = <ElementKind>{};
var includedElementNames = <String>{};
@@ -95,19 +96,23 @@
return await manager.computeSuggestions(completionRequest);
});
+ suggestionsTimer.stop();
_dartCompletionRequest = await DartCompletionRequestImpl.from(
completionRequest,
dartdocDirectiveInfo,
);
+ var importsTimer = Stopwatch();
if (_dartCompletionRequest.includeIdentifiers) {
_logger.run('Add imported suggestions', () {
+ importsTimer.start();
suggestions.addAll(
_importedLibrariesSuggestions(
resolvedUnit.libraryElement,
),
);
+ importsTimer.stop();
});
}
@@ -124,7 +129,9 @@
suggestions: suggestions,
performance: CiderCompletionPerformance(
file: getFileTimer.elapsed,
+ imports: importsTimer.elapsed,
resolution: resolutionTimer.elapsed,
+ suggestions: suggestionsTimer.elapsed,
),
prefixStart: CiderPosition(line, column - filter._pattern.length),
);
@@ -195,12 +202,20 @@
/// The elapsed time for file access.
final Duration file;
+ /// The elapsed time to compute import suggestions.
+ final Duration imports;
+
/// The elapsed time for resolution.
final Duration resolution;
+ /// The elapsed time to compute suggestions.
+ final Duration suggestions;
+
CiderCompletionPerformance({
@required this.file,
+ @required this.imports,
@required this.resolution,
+ @required this.suggestions,
});
}
@@ -293,7 +308,18 @@
return '';
}
- double _score(CompletionSuggestion e) => _matcher.score(e.completion);
+ double _score(CompletionSuggestion e) {
+ var suggestionTextToMatch = e.completion;
+
+ if (e.kind == CompletionSuggestionKind.NAMED_ARGUMENT) {
+ var index = suggestionTextToMatch.indexOf(':');
+ if (index != -1) {
+ suggestionTextToMatch = suggestionTextToMatch.substring(0, index);
+ }
+ }
+
+ return _matcher.score(suggestionTextToMatch);
+ }
}
/// [CompletionSuggestion] scored using [FuzzyMatcher].
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 2e99a15..0042028 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -24,7 +24,6 @@
import 'package:analysis_server/src/services/completion/dart/label_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/library_member_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/library_prefix_contributor.dart';
-import 'package:analysis_server/src/services/completion/dart/local_constructor_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/local_library_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/local_reference_contributor.dart';
import 'package:analysis_server/src/services/completion/dart/named_constructor_contributor.dart';
@@ -140,7 +139,6 @@
LabelContributor(),
LibraryMemberContributor(),
LibraryPrefixContributor(),
- LocalConstructorContributor(),
LocalLibraryContributor(),
LocalReferenceContributor(),
NamedConstructorContributor(),
@@ -457,17 +455,7 @@
}
@override
- LibraryElement get libraryElement {
- //TODO(danrubel) build the library element rather than all the declarations
- var unit = target.unit;
- if (unit != null) {
- var elem = unit.declaredElement;
- if (elem != null) {
- return elem.library;
- }
- }
- return null;
- }
+ LibraryElement get libraryElement => result.libraryElement;
@override
OpType get opType {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
deleted file mode 100644
index d1a62d3..0000000
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (c) 2015, 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:analysis_server/src/protocol_server.dart'
- show CompletionSuggestion;
-import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-
-/// A contributor that produces suggestions based on the constructors declared
-/// in the same file in which suggestions were requested.
-class LocalConstructorContributor extends DartCompletionContributor {
- @override
- Future<List<CompletionSuggestion>> computeSuggestions(
- DartCompletionRequest request, SuggestionBuilder builder) async {
- var opType = request.opType;
- if (!opType.isPrefixed && opType.includeConstructorSuggestions) {
- var unit = request.target.unit;
- // TODO(brianwilkerson) Consider iterating over
- // `unit.declaredElement.types` instead.
- for (var declaration in unit.declarations) {
- if (declaration is ClassDeclaration) {
- var classElement = declaration.declaredElement;
- if (classElement != null) {
- for (var constructor in classElement.constructors) {
- if (!classElement.isAbstract || constructor.isFactory) {
- builder.suggestConstructor(constructor);
- }
- }
- }
- }
- }
- }
- return const <CompletionSuggestion>[];
- }
-}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index bb767ec..1129301 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -36,6 +36,7 @@
if (opType.includeReturnValueSuggestions ||
opType.includeTypeNameSuggestions ||
opType.includeVoidReturnSuggestions ||
+ opType.includeConstructorSuggestions ||
suggestLocalFields) {
// Do not suggest local variables within the current expression.
while (node is Expression) {
@@ -94,6 +95,10 @@
/// Only used when [useNewRelevance] is `false`.
int privateMemberRelevance = DART_RELEVANCE_DEFAULT;
+ /// As elements are added locally, walking up the AST structure, we don't add
+ /// completions if we have previously see some [Element] name.
+ final Set<String> declaredNames = {};
+
_LocalVisitor(this.request, this.builder, {@required this.suggestLocalFields})
: opType = request.opType,
useNewRelevance = request.useNewRelevance,
@@ -137,8 +142,23 @@
@override
void declaredClass(ClassDeclaration declaration) {
- if (opType.includeTypeNameSuggestions) {
- builder.suggestClass(declaration.declaredElement, kind: _defaultKind);
+ var classElt = declaration.declaredElement;
+ if (shouldSuggest(classElt)) {
+ if (opType.includeTypeNameSuggestions) {
+ builder.suggestClass(classElt, kind: _defaultKind);
+ }
+
+ // Generate the suggestions for the constructors. We are required to loop
+ // through elements here instead of using declaredConstructor() due to
+ // implicit constructors (i.e. there is no AstNode for an implicit
+ // constructor)
+ if (!opType.isPrefixed && opType.includeConstructorSuggestions) {
+ for (var constructor in classElt.constructors) {
+ if (!classElt.isAbstract || constructor.isFactory) {
+ builder.suggestConstructor(constructor);
+ }
+ }
+ }
}
}
@@ -151,14 +171,13 @@
@override
void declaredConstructor(ConstructorDeclaration declaration) {
- // TODO(jwren) ignored, currently handled by
- // local_constructor_contributor_test.dart, consider moving the
- // functionality into this file.
+ // ignored: constructor completions are handled in declaredClass() above
}
@override
void declaredEnum(EnumDeclaration declaration) {
- if (opType.includeTypeNameSuggestions) {
+ if (shouldSuggest(declaration.declaredElement) &&
+ opType.includeTypeNameSuggestions) {
builder.suggestClass(declaration.declaredElement, kind: _defaultKind);
for (var enumConstant in declaration.constants) {
if (!enumConstant.isSynthetic) {
@@ -170,17 +189,20 @@
@override
void declaredExtension(ExtensionDeclaration declaration) {
- if (opType.includeReturnValueSuggestions && declaration.name != null) {
+ if (shouldSuggest(declaration.declaredElement) &&
+ opType.includeReturnValueSuggestions &&
+ declaration.name != null) {
builder.suggestExtension(declaration.declaredElement, kind: _defaultKind);
}
}
@override
void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
- if ((opType.includeReturnValueSuggestions &&
+ var field = varDecl.declaredElement;
+ if ((shouldSuggest(field) &&
+ opType.includeReturnValueSuggestions &&
(!opType.inStaticMethodBody || fieldDecl.isStatic)) ||
suggestLocalFields) {
- var field = varDecl.declaredElement;
var inheritanceDistance = -1.0;
var enclosingClass = request.target.containingNode
.thisOrAncestorOfType<ClassDeclaration>();
@@ -195,8 +217,9 @@
@override
void declaredFunction(FunctionDeclaration declaration) {
- if (opType.includeReturnValueSuggestions ||
- opType.includeVoidReturnSuggestions) {
+ if (shouldSuggest(declaration.declaredElement) &&
+ (opType.includeReturnValueSuggestions ||
+ opType.includeVoidReturnSuggestions)) {
if (declaration.isSetter) {
if (!opType.includeVoidReturnSuggestions) {
return;
@@ -240,17 +263,19 @@
@override
void declaredLocalVar(SimpleIdentifier id, TypeAnnotation typeName) {
- if (opType.includeReturnValueSuggestions) {
+ if (shouldSuggest(id.staticElement) &&
+ opType.includeReturnValueSuggestions) {
builder.suggestLocalVariable(id.staticElement as LocalVariableElement);
}
}
@override
void declaredMethod(MethodDeclaration declaration) {
- if ((opType.includeReturnValueSuggestions ||
+ var element = declaration.declaredElement;
+ if (shouldSuggest(element) &&
+ (opType.includeReturnValueSuggestions ||
opType.includeVoidReturnSuggestions) &&
(!opType.inStaticMethodBody || declaration.isStatic)) {
- var element = declaration.declaredElement;
var inheritanceDistance = -1.0;
var enclosingClass = request.target.containingNode
.thisOrAncestorOfType<ClassDeclaration>();
@@ -271,18 +296,19 @@
@override
void declaredMixin(MixinDeclaration declaration) {
- if (opType.includeTypeNameSuggestions) {
+ if (shouldSuggest(declaration.declaredElement) &&
+ opType.includeTypeNameSuggestions) {
builder.suggestClass(declaration.declaredElement, kind: _defaultKind);
}
}
@override
void declaredParam(SimpleIdentifier id, TypeAnnotation typeName) {
- if (opType.includeReturnValueSuggestions) {
+ var element = id.staticElement;
+ if (shouldSuggest(element) && opType.includeReturnValueSuggestions) {
if (_isUnused(id.name)) {
return;
}
- var element = id.staticElement;
if (element is ParameterElement) {
builder.suggestParameter(element);
} else if (element is LocalVariableElement) {
@@ -294,8 +320,9 @@
@override
void declaredTopLevelVar(
VariableDeclarationList varList, VariableDeclaration varDecl) {
- if (opType.includeReturnValueSuggestions) {
- var variableElement = varDecl.declaredElement;
+ var variableElement = varDecl.declaredElement;
+ if (shouldSuggest(variableElement) &&
+ opType.includeReturnValueSuggestions) {
builder.suggestTopLevelPropertyAccessor(
(variableElement as TopLevelVariableElement).getter);
}
@@ -303,11 +330,18 @@
@override
void declaredTypeParameter(TypeParameter node) {
- if (opType.includeTypeNameSuggestions) {
+ if (shouldSuggest(node.declaredElement) &&
+ opType.includeTypeNameSuggestions) {
builder.suggestTypeParameter(node.declaredElement);
}
}
+ /// Before completions are added by this contributor, we verify with this
+ /// method if the element has already been added, this prevents suggesting
+ /// [Element]s that are shadowed.
+ bool shouldSuggest(Element element) =>
+ element != null && declaredNames.add(element.name);
+
/// Return `true` if the [identifier] is composed of one or more underscore
/// characters and nothing else.
bool _isUnused(String identifier) => RegExp(r'^_+$').hasMatch(identifier);
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
index c8d6130..02b14e5 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
@@ -19,13 +19,11 @@
Future<List<CompletionSuggestion>> computeSuggestions(
DartCompletionRequest request, SuggestionBuilder builder) async {
var node = request.target.containingNode;
- var libraryElement = request.libraryElement;
- if (libraryElement == null) {
- return const <CompletionSuggestion>[];
- }
-
- // Build the list of suggestions
if (node is ConstructorName) {
+ var libraryElement = request.libraryElement;
+ if (libraryElement == null) {
+ return const <CompletionSuggestion>[];
+ }
var typeName = node.type;
if (typeName != null) {
var type = typeName.type;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
index 440f88d..bbce0d6 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/abstract_producer.dart
@@ -4,6 +4,8 @@
import 'dart:math' as math;
+import 'package:analysis_server/plugin/edit/fix/fix_dart.dart';
+import 'package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart';
import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analysis_server/src/utilities/flutter.dart';
import 'package:analyzer/dart/analysis/results.dart';
@@ -78,6 +80,26 @@
Future<void> compute(DartChangeBuilder builder);
+ /// Return the class, enum or mixin declaration for the given [element].
+ Future<ClassOrMixinDeclaration> getClassOrMixinDeclaration(
+ ClassElement element) async {
+ var result = await sessionHelper.getElementDeclaration(element);
+ if (result.node is ClassOrMixinDeclaration) {
+ return result.node;
+ }
+ return null;
+ }
+
+ /// Return the extension declaration for the given [element].
+ Future<ExtensionDeclaration> getExtensionDeclaration(
+ ExtensionElement element) async {
+ var result = await sessionHelper.getElementDeclaration(element);
+ if (result.node is ExtensionDeclaration) {
+ return result.node;
+ }
+ return null;
+ }
+
/// Return the class element associated with the [target], or `null` if there
/// is no such class element.
ClassElement getTargetClassElement(Expression target) {
@@ -216,30 +238,6 @@
// we don't know
return null;
}
-
- /// Return `true` if the [node] might be a type name.
- bool mightBeTypeIdentifier(AstNode node) {
- if (node is SimpleIdentifier) {
- var parent = node.parent;
- if (parent is TypeName) {
- return true;
- }
- return _isNameOfType(node.name);
- }
- return false;
- }
-
- /// Return `true` if the [name] is capitalized.
- bool _isNameOfType(String name) {
- if (name.isEmpty) {
- return false;
- }
- var firstLetter = name.substring(0, 1);
- if (firstLetter.toUpperCase() != firstLetter) {
- return false;
- }
- return true;
- }
}
class CorrectionProducerContext {
@@ -258,6 +256,7 @@
final AnalysisSessionHelper sessionHelper;
final ResolvedUnitResult resolvedResult;
final ChangeWorkspace workspace;
+ final DartFixContext dartFixContext;
final Diagnostic diagnostic;
@@ -266,6 +265,7 @@
CorrectionProducerContext({
@required this.resolvedResult,
@required this.workspace,
+ this.dartFixContext,
this.diagnostic,
this.selectionOffset = -1,
this.selectionLength = 0,
@@ -404,6 +404,11 @@
return utils.getRangeText(range);
}
+ /// Return the top-level declarations with the [name] in libraries that are
+ /// available to this context.
+ List<TopLevelDeclaration> getTopLevelDeclarations(String name) =>
+ _context.dartFixContext.getTopLevelDeclarations(name);
+
/// Return `true` the lint with the given [name] is enabled.
bool isLintEnabled(String name) {
return _context.isLintEnabled(name);
@@ -430,6 +435,42 @@
// invalid selection (part of node, etc)
return false;
}
+
+ /// Return `true` if the given [node] is in a location where an implicit
+ /// constructor invocation would be allowed.
+ bool mightBeImplicitConstructor(AstNode node) {
+ if (node is SimpleIdentifier) {
+ var parent = node.parent;
+ if (parent is MethodInvocation) {
+ return parent.realTarget == null;
+ }
+ }
+ return false;
+ }
+
+ /// Return `true` if the [node] might be a type name.
+ bool mightBeTypeIdentifier(AstNode node) {
+ if (node is SimpleIdentifier) {
+ var parent = node.parent;
+ if (parent is TypeName) {
+ return true;
+ }
+ return _isNameOfType(node.name);
+ }
+ return false;
+ }
+
+ /// Return `true` if the [name] is capitalized.
+ bool _isNameOfType(String name) {
+ if (name.isEmpty) {
+ return false;
+ }
+ var firstLetter = name.substring(0, 1);
+ if (firstLetter.toUpperCase() != firstLetter) {
+ return false;
+ }
+ return true;
+ }
}
extension DartFileEditBuilderExtension on DartFileEditBuilder {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart
index 36a1f39..5793f60 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_explicit_cast.dart
@@ -17,10 +17,13 @@
@override
Future<void> compute(DartChangeBuilder builder) async {
- Expression target = coveredNode;
- if (target is! Expression) {
+ Expression target;
+ if (coveredNode is Expression) {
+ target = coveredNode;
+ } else {
return;
}
+
var fromType = target.staticType;
DartType toType;
var parent = target.parent;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart
new file mode 100644
index 0000000..7638459
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart
@@ -0,0 +1,109 @@
+// Copyright (c) 2020, 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:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analysis_server/src/services/correction/executable_parameters.dart';
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+
+class AddMissingParameter extends MultiCorrectionProducer {
+ @override
+ Iterable<CorrectionProducer> get producers sync* {
+ if (node is! ArgumentList) {
+ return;
+ }
+ var context = ExecutableParameters(sessionHelper, node.parent);
+ if (context == null) {
+ return;
+ }
+
+ // Suggest adding a required positional parameter.
+ yield _AddMissingRequiredPositionalParameter(context);
+
+ // Suggest adding the first optional positional parameter.
+ if (context.optionalPositional.isEmpty && context.named.isEmpty) {
+ yield _AddMissingOptionalPositionalParameter(context);
+ }
+ }
+
+ /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
+ static AddMissingParameter newInstance() => AddMissingParameter();
+}
+
+/// A correction processor that can make one of the possible change computed by
+/// the [AddMissingParameter] producer.
+class _AddMissingOptionalPositionalParameter extends _AddMissingParameter {
+ _AddMissingOptionalPositionalParameter(ExecutableParameters context)
+ : super(context);
+
+ @override
+ FixKind get fixKind => DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ var prefix = context.required.isNotEmpty ? ', [' : '[';
+ if (context.required.isNotEmpty) {
+ var prevNode = await context.getParameterNode(context.required.last);
+ await _addParameter(builder, prevNode?.end, prefix, ']');
+ } else {
+ var parameterList = await context.getParameterList();
+ var offset = parameterList?.leftParenthesis?.end;
+ await _addParameter(builder, offset, prefix, ']');
+ }
+ }
+}
+
+/// A correction processor that can make one of the possible change computed by
+/// the [AddMissingParameter] producer.
+abstract class _AddMissingParameter extends CorrectionProducer {
+ ExecutableParameters context;
+
+ _AddMissingParameter(this.context);
+
+ Future<void> _addParameter(DartChangeBuilder builder, int offset,
+ String prefix, String suffix) async {
+ ArgumentList argumentList = node;
+ List<Expression> arguments = argumentList.arguments;
+ var numRequired = context.required.length;
+ if (numRequired >= arguments.length) {
+ return;
+ }
+ var argument = arguments[numRequired];
+ if (offset != null) {
+ await builder.addFileEdit(context.file, (builder) {
+ builder.addInsertion(offset, (builder) {
+ builder.write(prefix);
+ builder.writeParameterMatchingArgument(
+ argument, numRequired, <String>{});
+ builder.write(suffix);
+ });
+ });
+ }
+ }
+}
+
+/// A correction processor that can make one of the possible change computed by
+/// the [AddMissingParameter] producer.
+class _AddMissingRequiredPositionalParameter extends _AddMissingParameter {
+ _AddMissingRequiredPositionalParameter(ExecutableParameters context)
+ : super(context);
+
+ @override
+ FixKind get fixKind => DartFixKind.ADD_MISSING_PARAMETER_REQUIRED;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ if (context.required.isNotEmpty) {
+ var prevNode = await context.getParameterNode(context.required.last);
+ await _addParameter(builder, prevNode?.end, ', ', '');
+ } else {
+ var parameterList = await context.getParameterList();
+ var offset = parameterList?.leftParenthesis?.end;
+ var suffix = context.executable.parameters.isNotEmpty ? ', ' : '';
+ await _addParameter(builder, offset, '', suffix);
+ }
+ }
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart b/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart
index d40698f..048191c 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/change_to.dart
@@ -4,7 +4,6 @@
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
import 'package:analysis_server/src/services/correction/fix.dart';
-import 'package:analysis_server/src/services/correction/fix_internal.dart';
import 'package:analysis_server/src/services/correction/levenshtein.dart';
import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analysis_server/src/services/search/hierarchy.dart';
@@ -14,6 +13,9 @@
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:analyzer_plugin/utilities/range_factory.dart';
+/// A predicate is a one-argument function that returns a boolean value.
+typedef _ElementPredicate = bool Function(Element argument);
+
class ChangeTo extends CorrectionProducer {
/// The kind of elements that should be proposed.
final _ReplacementKind _kind;
@@ -104,7 +106,7 @@
}
Future<void> _proposeClassOrMixinMember(DartChangeBuilder builder,
- Expression target, ElementPredicate predicate) async {
+ Expression target, _ElementPredicate predicate) async {
if (node is SimpleIdentifier) {
var name = (node as SimpleIdentifier).name;
var finder = _ClosestElementFinder(name, predicate);
@@ -259,7 +261,7 @@
/// A function used to filter the possible elements to those of the right
/// kind.
- final ElementPredicate _predicate;
+ final _ElementPredicate _predicate;
int _distance = _maxDistance;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_function.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_function.dart
new file mode 100644
index 0000000..e5a3616
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_function.dart
@@ -0,0 +1,68 @@
+// Copyright (c) 2020, 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:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+import 'package:analyzer_plugin/utilities/range_factory.dart';
+
+class CreateFunction extends CorrectionProducer {
+ String _functionName;
+
+ @override
+ List<Object> get fixArguments => [_functionName];
+
+ @override
+ FixKind get fixKind => DartFixKind.CREATE_FUNCTION;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ // should be the name of the invocation
+ if (node is SimpleIdentifier && node.parent is MethodInvocation) {
+ } else {
+ return;
+ }
+ _functionName = (node as SimpleIdentifier).name;
+ var invocation = node.parent as MethodInvocation;
+ // function invocation has no target
+ var target = invocation.realTarget;
+ if (target != null) {
+ return;
+ }
+ // prepare environment
+ int insertOffset;
+ String sourcePrefix;
+ AstNode enclosingMember =
+ node.thisOrAncestorOfType<CompilationUnitMember>();
+ insertOffset = enclosingMember.end;
+ sourcePrefix = '$eol$eol';
+ utils.targetClassElement = null;
+ // build method source
+ await builder.addFileEdit(file, (DartFileEditBuilder builder) {
+ builder.addInsertion(insertOffset, (DartEditBuilder builder) {
+ builder.write(sourcePrefix);
+ // append return type
+ {
+ var type = inferUndefinedExpressionType(invocation);
+ if (builder.writeType(type, groupName: 'RETURN_TYPE')) {
+ builder.write(' ');
+ }
+ }
+ // append name
+ builder.addLinkedEdit('NAME', (DartLinkedEditBuilder builder) {
+ builder.write(_functionName);
+ });
+ builder.write('(');
+ builder.writeParametersMatchingArguments(invocation.argumentList);
+ builder.write(') {$eol}');
+ });
+ builder.addLinkedPosition(range.node(node), 'NAME');
+ });
+ }
+
+ /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
+ static CreateFunction newInstance() => CreateFunction();
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
index cf91806..20b80bb 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
@@ -4,14 +4,22 @@
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer_plugin/protocol/protocol_common.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer_plugin/protocol/protocol_common.dart' show Position;
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+import 'package:analyzer_plugin/utilities/range_factory.dart';
class CreateMethod extends CorrectionProducer {
+ /// The kind of method to be created.
+ final _MethodKind _kind;
+
String _memberName;
+ CreateMethod(this._kind);
+
@override
List<Object> get fixArguments => [_memberName];
@@ -20,6 +28,14 @@
@override
Future<void> compute(DartChangeBuilder builder) async {
+ if (_kind == _MethodKind.equalsOrHashCode) {
+ await createEqualsOrHashCode(builder);
+ } else if (_kind == _MethodKind.method) {
+ await createMethod(builder);
+ }
+ }
+
+ Future<void> createEqualsOrHashCode(DartChangeBuilder builder) async {
final methodDecl = node.thisOrAncestorOfType<MethodDeclaration>();
final classDecl = methodDecl.thisOrAncestorOfType<ClassDeclaration>();
if (methodDecl != null && classDecl != null) {
@@ -51,6 +67,112 @@
}
}
- /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
- static CreateMethod newInstance() => CreateMethod();
+ Future<void> createMethod(DartChangeBuilder builder) async {
+ if (node is! SimpleIdentifier || node.parent is! MethodInvocation) {
+ return;
+ }
+ _memberName = (node as SimpleIdentifier).name;
+ var invocation = node.parent as MethodInvocation;
+ // prepare environment
+ Element targetElement;
+ var staticModifier = false;
+
+ CompilationUnitMember targetNode;
+ var target = invocation.realTarget;
+ var utils = this.utils;
+ if (target is ExtensionOverride) {
+ targetElement = target.staticElement;
+ targetNode = await getExtensionDeclaration(targetElement);
+ if (targetNode == null) {
+ return;
+ }
+ } else if (target is Identifier &&
+ target.staticElement is ExtensionElement) {
+ targetElement = target.staticElement;
+ targetNode = await getExtensionDeclaration(targetElement);
+ if (targetNode == null) {
+ return;
+ }
+ staticModifier = true;
+ } else if (target == null) {
+ targetElement = unit.declaredElement;
+ var enclosingMember = node.thisOrAncestorOfType<ClassMember>();
+ if (enclosingMember == null) {
+ // If the undefined identifier isn't inside a class member, then it
+ // doesn't make sense to create a method.
+ return;
+ }
+ targetNode = enclosingMember.parent;
+ staticModifier = inStaticContext;
+ } else {
+ var targetClassElement = getTargetClassElement(target);
+ if (targetClassElement == null) {
+ return;
+ }
+ targetElement = targetClassElement;
+ if (targetClassElement.librarySource.isInSystemLibrary) {
+ return;
+ }
+ // prepare target ClassDeclaration
+ targetNode = await getClassOrMixinDeclaration(targetClassElement);
+ if (targetNode == null) {
+ return;
+ }
+ // maybe static
+ if (target is Identifier) {
+ staticModifier = target.staticElement.kind == ElementKind.CLASS;
+ }
+ // use different utils
+ var targetPath = targetClassElement.source.fullName;
+ var targetResolveResult =
+ await resolvedResult.session.getResolvedUnit(targetPath);
+ utils = CorrectionUtils(targetResolveResult);
+ }
+ var targetLocation = utils.prepareNewMethodLocation(targetNode);
+ var targetFile = targetElement.source.fullName;
+ // build method source
+ await builder.addFileEdit(targetFile, (DartFileEditBuilder builder) {
+ builder.addInsertion(targetLocation.offset, (DartEditBuilder builder) {
+ builder.write(targetLocation.prefix);
+ // maybe "static"
+ if (staticModifier) {
+ builder.write('static ');
+ }
+ // append return type
+ {
+ var type = inferUndefinedExpressionType(invocation);
+ if (builder.writeType(type, groupName: 'RETURN_TYPE')) {
+ builder.write(' ');
+ }
+ }
+ // append name
+ builder.addLinkedEdit('NAME', (DartLinkedEditBuilder builder) {
+ builder.write(_memberName);
+ });
+ builder.write('(');
+ builder.writeParametersMatchingArguments(invocation.argumentList);
+ builder.write(') {}');
+ builder.write(targetLocation.suffix);
+ });
+ if (targetFile == file) {
+ builder.addLinkedPosition(range.node(node), 'NAME');
+ }
+ });
+ }
+
+ /// Return an instance of this class that will create either an equals
+ /// (operator =) or `hashCode` method based on the existing other half of the
+ /// pair. Used as a tear-off in `FixProcessor`.
+ static CreateMethod equalsOrHashCode() =>
+ CreateMethod(_MethodKind.equalsOrHashCode);
+
+ /// Return an instance of this class that will create a method based on an
+ /// invocation of an undefined method. Used as a tear-off in `FixProcessor`.
+ static CreateMethod method() => CreateMethod(_MethodKind.method);
+}
+
+/// A representation of the kind of element that should be suggested.
+enum _MethodKind {
+ equalsOrHashCode,
+ method,
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart
new file mode 100644
index 0000000..97160ba
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_method_or_function.dart
@@ -0,0 +1,180 @@
+// Copyright (c) 2020, 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:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/correction/util.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/nullability_suffix.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+import 'package:analyzer_plugin/utilities/range_factory.dart';
+
+class CreateMethodOrFunction extends CorrectionProducer {
+ FixKind _fixKind;
+
+ String _functionName;
+
+ @override
+ List<Object> get fixArguments => [_functionName];
+
+ @override
+ FixKind get fixKind => _fixKind;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ if (node is SimpleIdentifier) {
+ var nameNode = node as SimpleIdentifier;
+ // prepare argument expression (to get parameter)
+ ClassElement targetElement;
+ Expression argument;
+ {
+ var target = getQualifiedPropertyTarget(node);
+ if (target != null) {
+ var targetType = target.staticType;
+ if (targetType != null && targetType.element is ClassElement) {
+ targetElement = targetType.element as ClassElement;
+ argument = target.parent as Expression;
+ } else {
+ return;
+ }
+ } else {
+ var enclosingClass =
+ node.thisOrAncestorOfType<ClassOrMixinDeclaration>();
+ targetElement = enclosingClass?.declaredElement;
+ argument = nameNode;
+ }
+ }
+ argument = stepUpNamedExpression(argument);
+ // should be argument of some invocation
+ var parameterElement = argument.staticParameterElement;
+ if (parameterElement == null) {
+ return;
+ }
+ // should be parameter of function type
+ var parameterType = parameterElement.type;
+ if (parameterType is InterfaceType && parameterType.isDartCoreFunction) {
+ parameterType = FunctionTypeImpl(
+ typeFormals: const [],
+ parameters: const [],
+ returnType: typeProvider.dynamicType,
+ nullabilitySuffix: NullabilitySuffix.none,
+ );
+ }
+ if (parameterType is! FunctionType) {
+ return;
+ }
+ var functionType = parameterType as FunctionType;
+ // add proposal
+ if (targetElement != null) {
+ await _createMethod(builder, targetElement, functionType);
+ } else {
+ await _createFunction(builder, functionType);
+ }
+ }
+ }
+
+ /// Prepares proposal for creating function corresponding to the given
+ /// [FunctionType].
+ Future<void> _createExecutable(
+ DartChangeBuilder builder,
+ FunctionType functionType,
+ String name,
+ String targetFile,
+ int insertOffset,
+ bool isStatic,
+ String prefix,
+ String sourcePrefix,
+ String sourceSuffix,
+ Element target) async {
+ // build method source
+ await builder.addFileEdit(targetFile, (DartFileEditBuilder builder) {
+ builder.addInsertion(insertOffset, (DartEditBuilder builder) {
+ builder.write(sourcePrefix);
+ builder.write(prefix);
+ // may be static
+ if (isStatic) {
+ builder.write('static ');
+ }
+ // append return type
+ if (builder.writeType(functionType.returnType,
+ groupName: 'RETURN_TYPE')) {
+ builder.write(' ');
+ }
+ // append name
+ builder.addLinkedEdit('NAME', (DartLinkedEditBuilder builder) {
+ builder.write(name);
+ });
+ // append parameters
+ builder.writeParameters(functionType.parameters);
+ // close method
+ builder.write(' {$eol$prefix}');
+ builder.write(sourceSuffix);
+ });
+ if (targetFile == file) {
+ builder.addLinkedPosition(range.node(node), 'NAME');
+ }
+ });
+ }
+
+ /// Adds proposal for creating method corresponding to the given
+ /// [FunctionType] in the given [ClassElement].
+ Future<void> _createFunction(
+ DartChangeBuilder builder, FunctionType functionType) async {
+ var name = (node as SimpleIdentifier).name;
+ // prepare environment
+ var insertOffset = unit.end;
+ // prepare prefix
+ var prefix = '';
+ var sourcePrefix = '$eol';
+ var sourceSuffix = eol;
+ await _createExecutable(builder, functionType, name, file, insertOffset,
+ false, prefix, sourcePrefix, sourceSuffix, unit.declaredElement);
+ _fixKind = DartFixKind.CREATE_FUNCTION;
+ _functionName = name;
+ }
+
+ /// Adds proposal for creating method corresponding to the given
+ /// [FunctionType] in the given [ClassElement].
+ Future<void> _createMethod(DartChangeBuilder builder,
+ ClassElement targetClassElement, FunctionType functionType) async {
+ var name = (node as SimpleIdentifier).name;
+ // prepare environment
+ var targetSource = targetClassElement.source;
+ // prepare insert offset
+ var targetNode = await getClassOrMixinDeclaration(targetClassElement);
+ if (targetNode == null) {
+ return;
+ }
+ var insertOffset = targetNode.end - 1;
+ // prepare prefix
+ var prefix = ' ';
+ String sourcePrefix;
+ if (targetNode.members.isEmpty) {
+ sourcePrefix = '';
+ } else {
+ sourcePrefix = eol;
+ }
+ var sourceSuffix = eol;
+ await _createExecutable(
+ builder,
+ functionType,
+ name,
+ targetSource.fullName,
+ insertOffset,
+ inStaticContext,
+ prefix,
+ sourcePrefix,
+ sourceSuffix,
+ targetClassElement);
+ _fixKind = DartFixKind.CREATE_METHOD;
+ _functionName = name;
+ }
+
+ /// Return an instance of this class. Used as a tear-off in `FixProcessor`.
+ static CreateMethodOrFunction newInstance() => CreateMethodOrFunction();
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart
new file mode 100644
index 0000000..3f8754c
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart
@@ -0,0 +1,373 @@
+// Copyright (c) 2020, 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:collection';
+
+import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
+import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart';
+import 'package:analysis_server/src/services/correction/namespace.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/source/source_range.dart';
+import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_dart.dart';
+import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
+import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
+import 'package:analyzer_plugin/utilities/range_factory.dart';
+
+class ImportLibrary extends MultiCorrectionProducer {
+ final _ImportKind _importKind;
+
+ ImportLibrary(this._importKind);
+
+ @override
+ Iterable<CorrectionProducer> get producers sync* {
+ if (_importKind == _ImportKind.dartAsync) {
+ yield* _importLibrary(DartFixKind.IMPORT_ASYNC, Uri.parse('dart:async'));
+ } else if (_importKind == _ImportKind.forExtension) {
+ if (node is SimpleIdentifier) {
+ var extensionName = (node as SimpleIdentifier).name;
+ yield* _importLibraryForElement(
+ extensionName,
+ const [ElementKind.EXTENSION],
+ const [TopLevelDeclarationKind.extension]);
+ }
+ } else if (_importKind == _ImportKind.forFunction) {
+ if (node is SimpleIdentifier) {
+ if (node.parent is MethodInvocation) {
+ var invocation = node.parent as MethodInvocation;
+ if (invocation.realTarget != null || invocation.methodName != node) {
+ return;
+ }
+ }
+
+ var name = (node as SimpleIdentifier).name;
+ yield* _importLibraryForElement(name, const [
+ ElementKind.FUNCTION,
+ ElementKind.TOP_LEVEL_VARIABLE
+ ], const [
+ TopLevelDeclarationKind.function,
+ TopLevelDeclarationKind.variable
+ ]);
+ }
+ } else if (_importKind == _ImportKind.forTopLevelVariable) {
+ var node = this.node;
+ if (node is Annotation) {
+ Annotation annotation = node;
+ var name = annotation.name;
+ if (name != null && name.staticElement == null) {
+ if (annotation.arguments != null) {
+ return;
+ }
+ node = name;
+ }
+ }
+ if (node is SimpleIdentifier) {
+ var name = node.name;
+ yield* _importLibraryForElement(
+ name,
+ const [ElementKind.TOP_LEVEL_VARIABLE],
+ const [TopLevelDeclarationKind.variable]);
+ }
+ } else if (_importKind == _ImportKind.forType) {
+ var node = this.node;
+ if (node is Annotation) {
+ Annotation annotation = node;
+ var name = annotation.name;
+ if (name != null && name.staticElement == null) {
+ if (annotation.arguments == null) {
+ return;
+ }
+ node = name;
+ }
+ }
+ if (mightBeTypeIdentifier(node)) {
+ var typeName = (node is SimpleIdentifier)
+ ? node.name
+ : (node as PrefixedIdentifier).prefix.name;
+ yield* _importLibraryForElement(
+ typeName,
+ const [ElementKind.CLASS, ElementKind.FUNCTION_TYPE_ALIAS],
+ const [TopLevelDeclarationKind.type]);
+ } else if (mightBeImplicitConstructor(node)) {
+ var typeName = (node as SimpleIdentifier).name;
+ yield* _importLibraryForElement(typeName, const [ElementKind.CLASS],
+ const [TopLevelDeclarationKind.type]);
+ }
+ }
+ }
+
+ @override
+ bool mightBeTypeIdentifier(AstNode node) {
+ if (super.mightBeTypeIdentifier(node)) {
+ return true;
+ }
+ if (node is PrefixedIdentifier) {
+ var parent = node.parent;
+ if (parent is TypeName) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// Return the relative uri from the passed [library] to the given [path].
+ /// If the [path] is not in the LibraryElement, `null` is returned.
+ String _getRelativeURIFromLibrary(LibraryElement library, String path) {
+ var librarySource = library?.librarySource;
+ if (librarySource == null) {
+ return null;
+ }
+ var pathCtx = resourceProvider.pathContext;
+ var libraryDirectory = pathCtx.dirname(librarySource.fullName);
+ var sourceDirectory = pathCtx.dirname(path);
+ if (pathCtx.isWithin(libraryDirectory, path) ||
+ pathCtx.isWithin(sourceDirectory, libraryDirectory)) {
+ var relativeFile = pathCtx.relative(path, from: libraryDirectory);
+ return pathCtx.split(relativeFile).join('/');
+ }
+ return null;
+ }
+
+ Iterable<CorrectionProducer> _importLibrary(FixKind fixKind, Uri library,
+ [String relativeURI]) sync* {
+ yield _ImportAbsoluteLibrary(fixKind, library);
+ if (relativeURI != null && relativeURI.isNotEmpty) {
+ yield _ImportRelativeLibrary(fixKind, relativeURI);
+ }
+ }
+
+ Iterable<CorrectionProducer> _importLibraryForElement(
+ String name,
+ List<ElementKind> elementKinds,
+ List<TopLevelDeclarationKind> kinds2) sync* {
+ // ignore if private
+ if (name.startsWith('_')) {
+ return;
+ }
+ // may be there is an existing import,
+ // but it is with prefix and we don't use this prefix
+ var alreadyImportedWithPrefix = <String>{};
+ for (var imp in libraryElement.imports) {
+ // prepare element
+ var libraryElement = imp.importedLibrary;
+ var element = getExportedElement(libraryElement, name);
+ if (element == null) {
+ continue;
+ }
+ if (element is PropertyAccessorElement) {
+ element = (element as PropertyAccessorElement).variable;
+ }
+ if (!elementKinds.contains(element.kind)) {
+ continue;
+ }
+ // may be apply prefix
+ var prefix = imp.prefix;
+ if (prefix != null) {
+ yield _ImportLibraryPrefix(imp);
+ continue;
+ }
+ // may be update "show" directive
+ var combinators = imp.combinators;
+ if (combinators.length == 1 && combinators[0] is ShowElementCombinator) {
+ var showCombinator = combinators[0] as ShowElementCombinator;
+ // prepare new set of names to show
+ Set<String> showNames = SplayTreeSet<String>();
+ showNames.addAll(showCombinator.shownNames);
+ showNames.add(name);
+ // prepare library name - unit name or 'dart:name' for SDK library
+ var libraryName =
+ libraryElement.definingCompilationUnit.source.uri.toString();
+ if (libraryElement.isInSdk) {
+ libraryName = libraryElement.source.shortName;
+ }
+ // don't add this library again
+ alreadyImportedWithPrefix.add(libraryElement.source.fullName);
+ yield _ImportLibraryShow(libraryName, showCombinator, showNames);
+ }
+ }
+ // Find new top-level declarations.
+ var declarations = getTopLevelDeclarations(name);
+ for (var declaration in declarations) {
+ // Check the kind.
+ if (!kinds2.contains(declaration.kind)) {
+ continue;
+ }
+ // Check the source.
+ if (alreadyImportedWithPrefix.contains(declaration.path)) {
+ continue;
+ }
+ // Check that the import doesn't end with '.template.dart'
+ if (declaration.uri.path.endsWith('.template.dart')) {
+ continue;
+ }
+ // Compute the fix kind.
+ FixKind fixKind;
+ if (declaration.uri.isScheme('dart')) {
+ fixKind = DartFixKind.IMPORT_LIBRARY_SDK;
+ } else if (_isLibSrcPath(declaration.path)) {
+ // Bad: non-API.
+ fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT3;
+ } else if (declaration.isExported) {
+ // Ugly: exports.
+ fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT2;
+ } else {
+ // Good: direct declaration.
+ fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT1;
+ }
+ // Add the fix.
+ var relativeURI =
+ _getRelativeURIFromLibrary(libraryElement, declaration.path);
+ yield* _importLibrary(fixKind, declaration.uri, relativeURI);
+ }
+ }
+
+ bool _isLibSrcPath(String path) {
+ var parts = resourceProvider.pathContext.split(path);
+ for (var i = 0; i < parts.length - 2; i++) {
+ if (parts[i] == 'lib' && parts[i + 1] == 'src') {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// Return an instance of this class that will add an import of `dart:async`.
+ /// Used as a tear-off in `FixProcessor`.
+ static ImportLibrary dartAsync() => ImportLibrary(_ImportKind.dartAsync);
+
+ /// Return an instance of this class that will add an import for an extension.
+ /// Used as a tear-off in `FixProcessor`.
+ static ImportLibrary forExtension() =>
+ ImportLibrary(_ImportKind.forExtension);
+
+ /// Return an instance of this class that will add an import for a top-level
+ /// function. Used as a tear-off in `FixProcessor`.
+ static ImportLibrary forFunction() => ImportLibrary(_ImportKind.forFunction);
+
+ /// Return an instance of this class that will add an import for a top-level
+ /// variable. Used as a tear-off in `FixProcessor`.
+ static ImportLibrary forTopLevelVariable() =>
+ ImportLibrary(_ImportKind.forTopLevelVariable);
+
+ /// Return an instance of this class that will add an import for a type (class
+ /// or mixin). Used as a tear-off in `FixProcessor`.
+ static ImportLibrary forType() => ImportLibrary(_ImportKind.forType);
+}
+
+/// A correction processor that can make one of the possible change computed by
+/// the [ImportLibrary] producer.
+class _ImportAbsoluteLibrary extends CorrectionProducer {
+ final FixKind _fixKind;
+
+ final Uri _library;
+
+ String _uriText;
+
+ _ImportAbsoluteLibrary(this._fixKind, this._library);
+
+ @override
+ List<Object> get fixArguments => [_uriText];
+
+ @override
+ FixKind get fixKind => _fixKind;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ await builder.addFileEdit(file, (DartFileEditBuilder builder) {
+ _uriText = builder.importLibrary(_library);
+ });
+ }
+}
+
+enum _ImportKind {
+ dartAsync,
+ forExtension,
+ forFunction,
+ forTopLevelVariable,
+ forType
+}
+
+/// A correction processor that can make one of the possible change computed by
+/// the [ImportLibrary] producer.
+class _ImportLibraryPrefix extends CorrectionProducer {
+ final ImportElement _importElement;
+
+ String _libraryName;
+
+ String _prefixName;
+
+ _ImportLibraryPrefix(this._importElement);
+
+ @override
+ List<Object> get fixArguments => [_libraryName, _prefixName];
+
+ @override
+ FixKind get fixKind => DartFixKind.IMPORT_LIBRARY_PREFIX;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ var libraryElement = _importElement.importedLibrary;
+ var prefix = _importElement.prefix;
+ _libraryName = libraryElement.displayName;
+ _prefixName = prefix.displayName;
+ await builder.addFileEdit(file, (DartFileEditBuilder builder) {
+ builder.addSimpleReplacement(range.startLength(node, 0), '$_prefixName.');
+ });
+ }
+}
+
+/// A correction processor that can make one of the possible change computed by
+/// the [ImportLibrary] producer.
+class _ImportLibraryShow extends CorrectionProducer {
+ final String _libraryName;
+
+ final ShowElementCombinator _showCombinator;
+
+ final Set<String> _showNames;
+
+ _ImportLibraryShow(this._libraryName, this._showCombinator, this._showNames);
+
+ @override
+ List<Object> get fixArguments => [_libraryName];
+
+ @override
+ FixKind get fixKind => DartFixKind.IMPORT_LIBRARY_SHOW;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ var newShowCode = 'show ${_showNames.join(', ')}';
+ var offset = _showCombinator.offset;
+ var length = _showCombinator.end - offset;
+ var libraryFile = resolvedResult.libraryElement.source.fullName;
+ await builder.addFileEdit(libraryFile, (DartFileEditBuilder builder) {
+ builder.addSimpleReplacement(SourceRange(offset, length), newShowCode);
+ });
+ }
+}
+
+/// A correction processor that can make one of the possible change computed by
+/// the [ImportLibrary] producer.
+class _ImportRelativeLibrary extends CorrectionProducer {
+ final FixKind _fixKind;
+
+ final String _relativeURI;
+
+ _ImportRelativeLibrary(this._fixKind, this._relativeURI);
+
+ @override
+ List<Object> get fixArguments => [_relativeURI];
+
+ @override
+ FixKind get fixKind => _fixKind;
+
+ @override
+ Future<void> compute(DartChangeBuilder builder) async {
+ await builder.addFileEdit(file, (DartFileEditBuilder builder) {
+ if (builder is DartFileEditBuilderImpl) {
+ builder.importLibraryWithRelativeUri(_relativeURI);
+ }
+ });
+ }
+}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart
index 956fd02..9a4baf9 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_const.dart
@@ -5,6 +5,7 @@
import 'package:analysis_server/src/services/correction/dart/abstract_producer.dart';
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
@@ -30,16 +31,21 @@
@override
Future<void> compute(DartChangeBuilder builder) async {
final expression = node;
+
+ Token constToken;
if (expression is InstanceCreationExpression) {
- final constToken = expression.keyword;
- await builder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addDeletion(range.startStart(constToken, constToken.next));
- });
+ constToken = expression.keyword;
} else if (expression is TypedLiteralImpl) {
- final constToken = expression.constKeyword;
- await builder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addDeletion(range.startStart(constToken, constToken.next));
- });
+ constToken = expression.constKeyword;
}
+
+ // Might be an implicit `const`.
+ if (constToken == null) {
+ return;
+ }
+
+ await builder.addFileEdit(file, (DartFileEditBuilder builder) {
+ builder.addDeletion(range.startStart(constToken, constToken.next));
+ });
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart
index 15cab104..00a254b 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused_parameter.dart
@@ -18,6 +18,10 @@
Future<void> compute(DartChangeBuilder builder) async {
if (node is FormalParameter) {
var parameter = node as FormalParameter;
+ if (parameter.parent is DefaultFormalParameter) {
+ parameter = parameter.parent;
+ }
+
var parameterList = parameter.parent as FormalParameterList;
var parameters = parameterList.parameters;
var index = parameters.indexOf(parameter);
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index c1caa95..ebba073 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -163,7 +163,9 @@
69,
'Add optional positional parameter');
static const ADD_MISSING_PARAMETER_REQUIRED = FixKind(
- 'dart.fix.add.missingParameterRequired', 70, 'Add required parameter');
+ 'dart.fix.add.missingParameterRequired',
+ 70,
+ 'Add required positional parameter');
static const ADD_MISSING_REQUIRED_ARGUMENT = FixKind(
'dart.fix.add.missingRequiredArgument',
70,
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 e7f0719..3db208c 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
-import 'dart:collection';
import 'dart:core';
import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
@@ -17,6 +16,7 @@
import 'package:analysis_server/src/services/correction/dart/add_explicit_cast.dart';
import 'package:analysis_server/src/services/correction/dart/add_field_formal_parameters.dart';
import 'package:analysis_server/src/services/correction/dart/add_missing_enum_case_clauses.dart';
+import 'package:analysis_server/src/services/correction/dart/add_missing_parameter.dart';
import 'package:analysis_server/src/services/correction/dart/add_missing_parameter_named.dart';
import 'package:analysis_server/src/services/correction/dart/add_missing_required_argument.dart';
import 'package:analysis_server/src/services/correction/dart/add_ne_null.dart';
@@ -59,14 +59,17 @@
import 'package:analysis_server/src/services/correction/dart/create_constructor_super.dart';
import 'package:analysis_server/src/services/correction/dart/create_field.dart';
import 'package:analysis_server/src/services/correction/dart/create_file.dart';
+import 'package:analysis_server/src/services/correction/dart/create_function.dart';
import 'package:analysis_server/src/services/correction/dart/create_getter.dart';
import 'package:analysis_server/src/services/correction/dart/create_local_variable.dart';
import 'package:analysis_server/src/services/correction/dart/create_method.dart';
+import 'package:analysis_server/src/services/correction/dart/create_method_or_function.dart';
import 'package:analysis_server/src/services/correction/dart/create_missing_overrides.dart';
import 'package:analysis_server/src/services/correction/dart/create_mixin.dart';
import 'package:analysis_server/src/services/correction/dart/create_no_such_method.dart';
import 'package:analysis_server/src/services/correction/dart/create_setter.dart';
import 'package:analysis_server/src/services/correction/dart/extend_class_for_mixin.dart';
+import 'package:analysis_server/src/services/correction/dart/import_library.dart';
import 'package:analysis_server/src/services/correction/dart/inline_invocation.dart';
import 'package:analysis_server/src/services/correction/dart/inline_typedef.dart';
import 'package:analysis_server/src/services/correction/dart/insert_semicolon.dart';
@@ -138,36 +141,18 @@
import 'package:analysis_server/src/services/correction/dart/use_rethrow.dart';
import 'package:analysis_server/src/services/correction/dart/wrap_in_future.dart';
import 'package:analysis_server/src/services/correction/dart/wrap_in_text.dart';
-import 'package:analysis_server/src/services/correction/executable_parameters.dart';
import 'package:analysis_server/src/services/correction/fix.dart';
-import 'package:analysis_server/src/services/correction/fix/dart/top_level_declarations.dart';
-import 'package:analysis_server/src/services/correction/namespace.dart';
import 'package:analysis_server/src/services/correction/util.dart';
import 'package:analysis_server/src/services/linter/lint_names.dart';
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/dart/element/nullability_suffix.dart';
-import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/dart/element/type_system.dart';
import 'package:analyzer/error/error.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/dart/ast/utilities.dart';
-import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart'
hide AnalysisError, Element, ElementKind;
import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_dart.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
-import 'package:analyzer_plugin/utilities/change_builder/change_builder_dart.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart' hide FixContributor;
-import 'package:analyzer_plugin/utilities/range_factory.dart';
-
-/// A predicate is a one-argument function that returns a boolean value.
-typedef ElementPredicate = bool Function(Element argument);
/// A function that can be executed to create a multi-correction producer.
typedef MultiProducerGenerator = MultiCorrectionProducer Function();
@@ -275,8 +260,6 @@
/// The computer for Dart fixes.
class FixProcessor extends BaseProcessor {
- static const int MAX_LEVENSHTEIN_DISTANCE = 3;
-
/// A map from the names of lint rules to a list of generators used to create
/// the correction producers used to build fixes for those diagnostics. The
/// generators used for non-lint diagnostics are in the [nonLintProducerMap].
@@ -351,7 +334,7 @@
ReplaceWithBrackets.newInstance,
],
LintNames.hash_and_equals: [
- CreateMethod.newInstance,
+ CreateMethod.equalsOrHashCode,
],
LintNames.no_duplicate_case_values: [
RemoveDuplicateCase.newInstance,
@@ -496,6 +479,22 @@
/// generators used for lint rules are in the [lintMultiProducerMap].
static const Map<ErrorCode, List<MultiProducerGenerator>>
nonLintMultiProducerMap = {
+ CompileTimeErrorCode.CONST_WITH_NON_TYPE: [
+ ImportLibrary.forType,
+ ],
+ CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS: [
+ AddMissingParameter.newInstance,
+ ],
+ CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED: [
+ AddMissingParameter.newInstance,
+ ],
+ CompileTimeErrorCode.INVALID_ANNOTATION: [
+ ImportLibrary.forTopLevelVariable,
+ ImportLibrary.forType,
+ ],
+ CompileTimeErrorCode.MIXIN_OF_NON_CLASS: [
+ ImportLibrary.forType,
+ ],
CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT: [
AddSuperConstructorInvocation.newInstance,
],
@@ -503,12 +502,59 @@
AddSuperConstructorInvocation.newInstance,
CreateConstructorSuper.newInstance,
],
+ CompileTimeErrorCode.UNDEFINED_ANNOTATION: [
+ ImportLibrary.forTopLevelVariable,
+ ImportLibrary.forType,
+ ],
+ CompileTimeErrorCode.UNDEFINED_CLASS: [
+ ImportLibrary.forType,
+ ],
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT: [
AddSuperConstructorInvocation.newInstance,
],
CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER: [
ChangeArgumentName.newInstance,
],
+ HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE: [
+ ImportLibrary.dartAsync,
+ ],
+ StaticWarningCode.CAST_TO_NON_TYPE: [
+ ImportLibrary.forType,
+ ],
+ StaticWarningCode.NEW_WITH_NON_TYPE: [
+ ImportLibrary.forType,
+ ],
+ StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE: [
+ ImportLibrary.forType,
+ ],
+ StaticWarningCode.NOT_A_TYPE: [
+ ImportLibrary.forType,
+ ],
+ StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME: [
+ ImportLibrary.forType,
+ ],
+ StaticWarningCode.UNDEFINED_IDENTIFIER: [
+ ImportLibrary.forExtension,
+ ImportLibrary.forFunction,
+ ImportLibrary.forTopLevelVariable,
+ ImportLibrary.forType,
+ ],
+ StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT: [
+ ImportLibrary.forType,
+ ],
+ StaticTypeWarningCode.UNDEFINED_FUNCTION: [
+ ImportLibrary.forExtension,
+ ImportLibrary.forFunction,
+ ImportLibrary.forType,
+ ],
+ StaticTypeWarningCode.UNDEFINED_GETTER: [
+ ImportLibrary.forTopLevelVariable,
+ ImportLibrary.forType,
+ ],
+ StaticTypeWarningCode.UNDEFINED_METHOD: [
+ ImportLibrary.forFunction,
+ ImportLibrary.forType,
+ ],
};
/// A map from error codes to a list of generators used to create the
@@ -562,7 +608,6 @@
CompileTimeErrorCode.MIXIN_OF_NON_CLASS: [
ChangeTo.classOrMixin,
],
-// CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT : [],
CompileTimeErrorCode.NULLABLE_TYPE_IN_EXTENDS_CLAUSE: [
RemoveQuestionMark.newInstance,
],
@@ -590,6 +635,7 @@
],
CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD: [
ChangeTo.method,
+ CreateMethod.method,
],
CompileTimeErrorCode.UNDEFINED_EXTENSION_SETTER: [
ChangeTo.getterOrSetter,
@@ -603,8 +649,8 @@
CompileTimeErrorCode
.UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE: [
// TODO(brianwilkerson) Consider adding fixes to create a field, getter,
- // method or setter. The existing _addFix methods would need to be
- // updated so that only the appropriate subset is generated.
+ // method or setter. The existing producers would need to be updated so
+ // that only the appropriate subset is generated.
QualifyReference.newInstance,
],
CompileTimeErrorCode.URI_DOES_NOT_EXIST: [
@@ -639,6 +685,8 @@
HintCode.DUPLICATE_SHOWN_NAME: [
RemoveNameFromCombinator.newInstance,
],
+ // TODO(brianwilkerson) Add a fix to convert the path to a package: import.
+// HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE: [],
HintCode.INVALID_FACTORY_ANNOTATION: [
RemoveAnnotation.newInstance,
],
@@ -681,6 +729,8 @@
HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER: [
RemoveAnnotation.newInstance,
],
+ // TODO(brianwilkerson) Add a fix to normalize the path.
+// HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT: [],
HintCode.SDK_VERSION_AS_EXPRESSION_IN_CONST_CONTEXT: [
UpdateSdkConstraints.version_2_2_2,
],
@@ -723,6 +773,12 @@
HintCode.UNNECESSARY_CAST: [
RemoveUnnecessaryCast.newInstance,
],
+ // TODO(brianwilkerson) Add a fix to remove the method.
+// HintCode.UNNECESSARY_NO_SUCH_METHOD: [],
+ // TODO(brianwilkerson) Add a fix to remove the type check.
+// HintCode.UNNECESSARY_TYPE_CHECK_FALSE: [],
+ // TODO(brianwilkerson) Add a fix to remove the type check.
+// HintCode.UNNECESSARY_TYPE_CHECK_TRUE: [],
HintCode.UNUSED_CATCH_CLAUSE: [
RemoveUnusedCatchClause.newInstance,
],
@@ -747,7 +803,6 @@
HintCode.UNUSED_SHOWN_NAME: [
RemoveNameFromCombinator.newInstance,
],
-
ParserErrorCode.EXPECTED_TOKEN: [
InsertSemicolon.newInstance,
],
@@ -760,7 +815,6 @@
ParserErrorCode.VAR_AS_TYPE_NAME: [
ReplaceVarWithDynamic.newInstance,
],
-
StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE: [
ReplaceReturnTypeFuture.newInstance,
],
@@ -784,6 +838,7 @@
StaticTypeWarningCode.UNDEFINED_FUNCTION: [
ChangeTo.function,
CreateClass.newInstance,
+ CreateFunction.newInstance,
],
StaticTypeWarningCode.UNDEFINED_GETTER: [
ChangeTo.getterOrSetter,
@@ -791,11 +846,14 @@
CreateField.newInstance,
CreateGetter.newInstance,
CreateLocalVariable.newInstance,
+ CreateMethodOrFunction.newInstance,
CreateMixin.newInstance,
],
StaticTypeWarningCode.UNDEFINED_METHOD: [
ChangeTo.method,
CreateClass.newInstance,
+ CreateFunction.newInstance,
+ CreateMethod.method,
],
StaticTypeWarningCode.UNDEFINED_SETTER: [
ChangeTo.getterOrSetter,
@@ -812,7 +870,6 @@
// updated so that only the appropriate subset is generated.
QualifyReference.newInstance,
],
-
StaticWarningCode.ASSIGNMENT_TO_FINAL: [
MakeFieldNotFinal.newInstance,
],
@@ -881,7 +938,6 @@
CreateNoSuchMethod.newInstance,
MakeClassAbstract.newInstance,
],
-// StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE : [],
StaticWarningCode.NOT_A_TYPE: [
ChangeTo.classOrMixin,
CreateClass.newInstance,
@@ -901,6 +957,7 @@
CreateField.newInstance,
CreateGetter.newInstance,
CreateLocalVariable.newInstance,
+ CreateMethodOrFunction.newInstance,
CreateMixin.newInstance,
CreateSetter.newInstance,
],
@@ -909,584 +966,27 @@
],
};
- final DartFixContext context;
-
- final ResourceProvider resourceProvider;
- final TypeSystem typeSystem;
-
- final LibraryElement unitLibraryElement;
- final CompilationUnit unit;
- final AnalysisError error;
-
- final int errorOffset;
-
- final int errorLength;
+ final DartFixContext fixContext;
final List<Fix> fixes = <Fix>[];
- FixProcessor(this.context)
- : resourceProvider = context.resolveResult.session.resourceProvider,
- typeSystem = context.resolveResult.typeSystem,
- unitLibraryElement = context.resolveResult.libraryElement,
- unit = context.resolveResult.unit,
- error = context.error,
- errorOffset = context.error.offset,
- errorLength = context.error.length,
- super(
- resolvedResult: context.resolveResult,
- workspace: context.workspace,
+ FixProcessor(this.fixContext)
+ : super(
+ resolvedResult: fixContext.resolveResult,
+ workspace: fixContext.workspace,
);
- DartType get coreTypeBool => context.resolveResult.typeProvider.boolType;
-
Future<List<Fix>> compute() async {
- node = NodeLocator2(errorOffset).searchWithin(unit);
-
- // analyze ErrorCode
- var errorCode = error.errorCode;
- if (errorCode == CompileTimeErrorCode.INVALID_ANNOTATION ||
- errorCode == CompileTimeErrorCode.UNDEFINED_ANNOTATION) {
- if (node is Annotation) {
- Annotation annotation = node;
- var name = annotation.name;
- if (name != null && name.staticElement == null) {
- node = name;
- if (annotation.arguments == null) {
- await _addFix_importLibrary_withTopLevelVariable();
- } else {
- await _addFix_importLibrary_withType();
- }
- }
- }
- }
- // TODO(brianwilkerson) Define a syntax for deprecated members to indicate
- // how to update the code and implement a fix to apply the update.
-// if (errorCode == HintCode.DEPRECATED_MEMBER_USE ||
-// errorCode == HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE) {
-// await _addFix_replaceDeprecatedMemberUse();
-// }
- // TODO(brianwilkerson) Add a fix to convert the path to a package: import.
-// if (errorCode == HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE) {
-// await _addFix_convertPathToPackageUri();
-// }
- // TODO(brianwilkerson) Add a fix to normalize the path.
-// if (errorCode == HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT) {
-// await _addFix_normalizeUri();
-// }
- if (errorCode == HintCode.SDK_VERSION_ASYNC_EXPORTED_FROM_CORE) {
- await _addFix_importAsync();
- }
- // TODO(brianwilkerson) Add a fix to remove the method.
-// if (errorCode == HintCode.UNNECESSARY_NO_SUCH_METHOD) {
-// await _addFix_removeMethodDeclaration();
-// }
- // TODO(brianwilkerson) Add a fix to remove the type check.
-// if (errorCode == HintCode.UNNECESSARY_TYPE_CHECK_FALSE ||
-// errorCode == HintCode.UNNECESSARY_TYPE_CHECK_TRUE) {
-// await _addFix_removeUnnecessaryTypeCheck();
-// }
- if (errorCode == CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS ||
- errorCode ==
- CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED) {
- await _addFix_addMissingParameter();
- }
- if (errorCode == CompileTimeErrorCode.CONST_WITH_NON_TYPE ||
- errorCode == CompileTimeErrorCode.MIXIN_OF_NON_CLASS ||
- errorCode == CompileTimeErrorCode.UNDEFINED_CLASS ||
- errorCode == StaticWarningCode.CAST_TO_NON_TYPE ||
- errorCode == StaticWarningCode.NEW_WITH_NON_TYPE ||
- errorCode == StaticWarningCode.NOT_A_TYPE ||
- errorCode == StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME) {
- await _addFix_importLibrary_withType();
- }
- if (errorCode == StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE) {
- await _addFix_importLibrary_withType();
- }
- if (errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER) {
- await _addFix_createFunction_forFunctionType();
- await _addFix_importLibrary_withType();
- await _addFix_importLibrary_withExtension();
- await _addFix_importLibrary_withFunction();
- await _addFix_importLibrary_withTopLevelVariable();
- }
- if (errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT) {
- await _addFix_importLibrary_withType();
- }
- if (errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION) {
- await _addFix_importLibrary_withExtension();
- await _addFix_importLibrary_withFunction();
- await _addFix_importLibrary_withType();
- await _addFix_undefinedFunction_create();
- }
- if (errorCode == StaticTypeWarningCode.UNDEFINED_GETTER) {
- await _addFix_createFunction_forFunctionType();
- await _addFix_importLibrary_withTopLevelVariable();
- await _addFix_importLibrary_withType();
- }
- if (errorCode == StaticTypeWarningCode.UNDEFINED_METHOD) {
- await _addFix_importLibrary_withFunction();
- await _addFix_importLibrary_withType();
- await _addFix_createMethod();
- await _addFix_undefinedFunction_create();
- }
- if (errorCode == CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD) {
- await _addFix_createMethod();
- }
await _addFromProducers();
-
- // done
return fixes;
}
Future<Fix> computeFix() async {
- var fixes = await compute();
+ await _addFromProducers();
fixes.sort(Fix.SORT_BY_RELEVANCE);
return fixes.isNotEmpty ? fixes.first : null;
}
- Future<void> _addFix_addMissingParameter() async {
- // The error is reported on ArgumentList.
- if (node is! ArgumentList) {
- return;
- }
- ArgumentList argumentList = node;
- List<Expression> arguments = argumentList.arguments;
-
- // Prepare the invoked element.
- var context = ExecutableParameters(sessionHelper, node.parent);
- if (context == null) {
- return;
- }
-
- // prepare the argument to add a new parameter for
- var numRequired = context.required.length;
- if (numRequired >= arguments.length) {
- return;
- }
- var argument = arguments[numRequired];
-
- Future<void> addParameter(
- FixKind kind, int offset, String prefix, String suffix) async {
- if (offset != null) {
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(context.file, (builder) {
- builder.addInsertion(offset, (builder) {
- builder.write(prefix);
- builder.writeParameterMatchingArgument(
- argument, numRequired, <String>{});
- builder.write(suffix);
- });
- });
- _addFixFromBuilder(changeBuilder, kind);
- }
- }
-
- // Suggest adding a required parameter.
- {
- var kind = DartFixKind.ADD_MISSING_PARAMETER_REQUIRED;
- if (context.required.isNotEmpty) {
- var prevNode = await context.getParameterNode(context.required.last);
- await addParameter(kind, prevNode?.end, ', ', '');
- } else {
- var parameterList = await context.getParameterList();
- var offset = parameterList?.leftParenthesis?.end;
- var suffix = context.executable.parameters.isNotEmpty ? ', ' : '';
- await addParameter(kind, offset, '', suffix);
- }
- }
-
- // Suggest adding the first optional positional parameter.
- if (context.optionalPositional.isEmpty && context.named.isEmpty) {
- var kind = DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL;
- var prefix = context.required.isNotEmpty ? ', [' : '[';
- if (context.required.isNotEmpty) {
- var prevNode = await context.getParameterNode(context.required.last);
- await addParameter(kind, prevNode?.end, prefix, ']');
- } else {
- var parameterList = await context.getParameterList();
- var offset = parameterList?.leftParenthesis?.end;
- await addParameter(kind, offset, prefix, ']');
- }
- }
- }
-
- Future<void> _addFix_createFunction_forFunctionType() async {
- if (node is SimpleIdentifier) {
- var nameNode = node as SimpleIdentifier;
- // prepare argument expression (to get parameter)
- ClassElement targetElement;
- Expression argument;
- {
- var target = getQualifiedPropertyTarget(node);
- if (target != null) {
- var targetType = target.staticType;
- if (targetType != null && targetType.element is ClassElement) {
- targetElement = targetType.element as ClassElement;
- argument = target.parent as Expression;
- } else {
- return;
- }
- } else {
- var enclosingClass =
- node.thisOrAncestorOfType<ClassOrMixinDeclaration>();
- targetElement = enclosingClass?.declaredElement;
- argument = nameNode;
- }
- }
- argument = stepUpNamedExpression(argument);
- // should be argument of some invocation
- var parameterElement = argument.staticParameterElement;
- if (parameterElement == null) {
- return;
- }
- // should be parameter of function type
- var parameterType = parameterElement.type;
- if (parameterType is InterfaceType && parameterType.isDartCoreFunction) {
- parameterType = FunctionTypeImpl(
- typeFormals: const [],
- parameters: const [],
- returnType: typeProvider.dynamicType,
- nullabilitySuffix: NullabilitySuffix.none,
- );
- }
- if (parameterType is! FunctionType) {
- return;
- }
- var functionType = parameterType as FunctionType;
- // add proposal
- if (targetElement != null) {
- await _addProposal_createFunction_method(targetElement, functionType);
- } else {
- await _addProposal_createFunction_function(functionType);
- }
- }
- }
-
- Future<void> _addFix_createMethod() async {
- if (node is! SimpleIdentifier || node.parent is! MethodInvocation) {
- return;
- }
- var name = (node as SimpleIdentifier).name;
- var invocation = node.parent as MethodInvocation;
- // prepare environment
- Element targetElement;
- var staticModifier = false;
-
- CompilationUnitMember targetNode;
- var target = invocation.realTarget;
- var utils = this.utils;
- if (target is ExtensionOverride) {
- targetElement = target.staticElement;
- targetNode = await _getExtensionDeclaration(targetElement);
- if (targetNode == null) {
- return;
- }
- } else if (target is Identifier &&
- target.staticElement is ExtensionElement) {
- targetElement = target.staticElement;
- targetNode = await _getExtensionDeclaration(targetElement);
- if (targetNode == null) {
- return;
- }
- staticModifier = true;
- } else if (target == null) {
- targetElement = unit.declaredElement;
- var enclosingMember = node.thisOrAncestorOfType<ClassMember>();
- if (enclosingMember == null) {
- // If the undefined identifier isn't inside a class member, then it
- // doesn't make sense to create a method.
- return;
- }
- targetNode = enclosingMember.parent;
- staticModifier = _inStaticContext();
- } else {
- var targetClassElement = _getTargetClassElement(target);
- if (targetClassElement == null) {
- return;
- }
- targetElement = targetClassElement;
- if (targetClassElement.librarySource.isInSystemLibrary) {
- return;
- }
- // prepare target ClassDeclaration
- targetNode = await _getClassDeclaration(targetClassElement);
- if (targetNode == null) {
- return;
- }
- // maybe static
- if (target is Identifier) {
- staticModifier = target.staticElement.kind == ElementKind.CLASS;
- }
- // use different utils
- var targetPath = targetClassElement.source.fullName;
- var targetResolveResult = await session.getResolvedUnit(targetPath);
- utils = CorrectionUtils(targetResolveResult);
- }
- var targetLocation = utils.prepareNewMethodLocation(targetNode);
- var targetFile = targetElement.source.fullName;
- // build method source
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(targetFile, (DartFileEditBuilder builder) {
- builder.addInsertion(targetLocation.offset, (DartEditBuilder builder) {
- builder.write(targetLocation.prefix);
- // maybe "static"
- if (staticModifier) {
- builder.write('static ');
- }
- // append return type
- {
- var type = _inferUndefinedExpressionType(invocation);
- if (builder.writeType(type, groupName: 'RETURN_TYPE')) {
- builder.write(' ');
- }
- }
- // append name
- builder.addLinkedEdit('NAME', (DartLinkedEditBuilder builder) {
- builder.write(name);
- });
- builder.write('(');
- builder.writeParametersMatchingArguments(invocation.argumentList);
- builder.write(') {}');
- builder.write(targetLocation.suffix);
- });
- if (targetFile == file) {
- builder.addLinkedPosition(range.node(node), 'NAME');
- }
- });
- _addFixFromBuilder(changeBuilder, DartFixKind.CREATE_METHOD, args: [name]);
- }
-
- Future<void> _addFix_importAsync() async {
- await _addFix_importLibrary(
- DartFixKind.IMPORT_ASYNC, Uri.parse('dart:async'));
- }
-
- Future<void> _addFix_importLibrary(FixKind kind, Uri library,
- [String relativeURI]) async {
- String uriText;
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
- uriText = builder.importLibrary(library);
- });
- _addFixFromBuilder(changeBuilder, kind, args: [uriText]);
-
- if (relativeURI != null && relativeURI.isNotEmpty) {
- var changeBuilder2 = _newDartChangeBuilder();
- await changeBuilder2.addFileEdit(file, (DartFileEditBuilder builder) {
- if (builder is DartFileEditBuilderImpl) {
- builder.importLibraryWithRelativeUri(relativeURI);
- }
- });
- _addFixFromBuilder(changeBuilder2, kind, args: [relativeURI]);
- }
- }
-
- Future<void> _addFix_importLibrary_withElement(
- String name,
- List<ElementKind> elementKinds,
- List<TopLevelDeclarationKind> kinds2) async {
- // ignore if private
- if (name.startsWith('_')) {
- return;
- }
- // may be there is an existing import,
- // but it is with prefix and we don't use this prefix
- var alreadyImportedWithPrefix = <String>{};
- for (var imp in unitLibraryElement.imports) {
- // prepare element
- var libraryElement = imp.importedLibrary;
- var element = getExportedElement(libraryElement, name);
- if (element == null) {
- continue;
- }
- if (element is PropertyAccessorElement) {
- element = (element as PropertyAccessorElement).variable;
- }
- if (!elementKinds.contains(element.kind)) {
- continue;
- }
- // may be apply prefix
- var prefix = imp.prefix;
- if (prefix != null) {
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addSimpleReplacement(
- range.startLength(node, 0), '${prefix.displayName}.');
- });
- _addFixFromBuilder(changeBuilder, DartFixKind.IMPORT_LIBRARY_PREFIX,
- args: [libraryElement.displayName, prefix.displayName]);
- continue;
- }
- // may be update "show" directive
- var combinators = imp.combinators;
- if (combinators.length == 1 && combinators[0] is ShowElementCombinator) {
- var showCombinator = combinators[0] as ShowElementCombinator;
- // prepare new set of names to show
- Set<String> showNames = SplayTreeSet<String>();
- showNames.addAll(showCombinator.shownNames);
- showNames.add(name);
- // prepare library name - unit name or 'dart:name' for SDK library
- var libraryName =
- libraryElement.definingCompilationUnit.source.uri.toString();
- if (libraryElement.isInSdk) {
- libraryName = libraryElement.source.shortName;
- }
- // don't add this library again
- alreadyImportedWithPrefix.add(libraryElement.source.fullName);
- // update library
- var newShowCode = 'show ${showNames.join(', ')}';
- var offset = showCombinator.offset;
- var length = showCombinator.end - offset;
- var libraryFile = context.resolveResult.libraryElement.source.fullName;
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(libraryFile,
- (DartFileEditBuilder builder) {
- builder.addSimpleReplacement(
- SourceRange(offset, length), newShowCode);
- });
- _addFixFromBuilder(changeBuilder, DartFixKind.IMPORT_LIBRARY_SHOW,
- args: [libraryName]);
- }
- }
- // Find new top-level declarations.
- {
- var declarations = context.getTopLevelDeclarations(name);
- for (var declaration in declarations) {
- // Check the kind.
- if (!kinds2.contains(declaration.kind)) {
- continue;
- }
- // Check the source.
- if (alreadyImportedWithPrefix.contains(declaration.path)) {
- continue;
- }
- // Check that the import doesn't end with '.template.dart'
- if (declaration.uri.path.endsWith('.template.dart')) {
- continue;
- }
- // Compute the fix kind.
- FixKind fixKind;
- if (declaration.uri.isScheme('dart')) {
- fixKind = DartFixKind.IMPORT_LIBRARY_SDK;
- } else if (_isLibSrcPath(declaration.path)) {
- // Bad: non-API.
- fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT3;
- } else if (declaration.isExported) {
- // Ugly: exports.
- fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT2;
- } else {
- // Good: direct declaration.
- fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT1;
- }
- // Add the fix.
- var relativeURI =
- _getRelativeURIFromLibrary(unitLibraryElement, declaration.path);
- await _addFix_importLibrary(fixKind, declaration.uri, relativeURI);
- }
- }
- }
-
- Future<void> _addFix_importLibrary_withExtension() async {
- if (node is SimpleIdentifier) {
- var extensionName = (node as SimpleIdentifier).name;
- await _addFix_importLibrary_withElement(
- extensionName,
- const [ElementKind.EXTENSION],
- const [TopLevelDeclarationKind.extension]);
- }
- }
-
- Future<void> _addFix_importLibrary_withFunction() async {
- if (node is SimpleIdentifier) {
- if (node.parent is MethodInvocation) {
- var invocation = node.parent as MethodInvocation;
- if (invocation.realTarget != null || invocation.methodName != node) {
- return;
- }
- }
-
- var name = (node as SimpleIdentifier).name;
- await _addFix_importLibrary_withElement(name, const [
- ElementKind.FUNCTION,
- ElementKind.TOP_LEVEL_VARIABLE
- ], const [
- TopLevelDeclarationKind.function,
- TopLevelDeclarationKind.variable
- ]);
- }
- }
-
- Future<void> _addFix_importLibrary_withTopLevelVariable() async {
- if (node is SimpleIdentifier) {
- var name = (node as SimpleIdentifier).name;
- await _addFix_importLibrary_withElement(
- name,
- const [ElementKind.TOP_LEVEL_VARIABLE],
- const [TopLevelDeclarationKind.variable]);
- }
- }
-
- Future<void> _addFix_importLibrary_withType() async {
- if (_mayBeTypeIdentifier(node)) {
- var typeName = (node as SimpleIdentifier).name;
- await _addFix_importLibrary_withElement(
- typeName,
- const [ElementKind.CLASS, ElementKind.FUNCTION_TYPE_ALIAS],
- const [TopLevelDeclarationKind.type]);
- } else if (_mayBeImplicitConstructor(node)) {
- var typeName = (node as SimpleIdentifier).name;
- await _addFix_importLibrary_withElement(typeName,
- const [ElementKind.CLASS], const [TopLevelDeclarationKind.type]);
- }
- }
-
- Future<void> _addFix_undefinedFunction_create() async {
- // should be the name of the invocation
- if (node is SimpleIdentifier && node.parent is MethodInvocation) {
- } else {
- return;
- }
- var name = (node as SimpleIdentifier).name;
- var invocation = node.parent as MethodInvocation;
- // function invocation has no target
- var target = invocation.realTarget;
- if (target != null) {
- return;
- }
- // prepare environment
- int insertOffset;
- String sourcePrefix;
- AstNode enclosingMember =
- node.thisOrAncestorOfType<CompilationUnitMember>();
- insertOffset = enclosingMember.end;
- sourcePrefix = '$eol$eol';
- utils.targetClassElement = null;
- // build method source
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(file, (DartFileEditBuilder builder) {
- builder.addInsertion(insertOffset, (DartEditBuilder builder) {
- builder.write(sourcePrefix);
- // append return type
- {
- var type = _inferUndefinedExpressionType(invocation);
- if (builder.writeType(type, groupName: 'RETURN_TYPE')) {
- builder.write(' ');
- }
- }
- // append name
- builder.addLinkedEdit('NAME', (DartLinkedEditBuilder builder) {
- builder.write(name);
- });
- builder.write('(');
- builder.writeParametersMatchingArguments(invocation.argumentList);
- builder.write(') {$eol}');
- });
- builder.addLinkedPosition(range.node(node), 'NAME');
- });
- _addFixFromBuilder(changeBuilder, DartFixKind.CREATE_FUNCTION,
- args: [name]);
- }
-
void _addFixFromBuilder(ChangeBuilder builder, FixKind kind,
{List<Object> args, bool importsOnly = false}) {
if (builder == null) return;
@@ -1500,11 +1000,13 @@
}
Future<void> _addFromProducers() async {
+ var error = fixContext.error;
var context = CorrectionProducerContext(
+ dartFixContext: fixContext,
diagnostic: error,
resolvedResult: resolvedResult,
- selectionOffset: errorOffset,
- selectionLength: errorLength,
+ selectionOffset: fixContext.error.offset,
+ selectionLength: fixContext.error.length,
workspace: workspace,
);
@@ -1515,7 +1017,7 @@
Future<void> compute(CorrectionProducer producer) async {
producer.configure(context);
- var builder = _newDartChangeBuilder();
+ var builder = DartChangeBuilderImpl.forWorkspace(context.workspace);
await producer.compute(builder);
_addFixFromBuilder(builder, producer.fixKind,
args: producer.fixArguments);
@@ -1548,347 +1050,4 @@
}
}
}
-
- /// Prepares proposal for creating function corresponding to the given
- /// [FunctionType].
- Future<DartChangeBuilder> _addProposal_createFunction(
- FunctionType functionType,
- String name,
- String targetFile,
- int insertOffset,
- bool isStatic,
- String prefix,
- String sourcePrefix,
- String sourceSuffix,
- Element target) async {
- // build method source
- var changeBuilder = _newDartChangeBuilder();
- await changeBuilder.addFileEdit(targetFile, (DartFileEditBuilder builder) {
- builder.addInsertion(insertOffset, (DartEditBuilder builder) {
- builder.write(sourcePrefix);
- builder.write(prefix);
- // may be static
- if (isStatic) {
- builder.write('static ');
- }
- // append return type
- if (builder.writeType(functionType.returnType,
- groupName: 'RETURN_TYPE')) {
- builder.write(' ');
- }
- // append name
- builder.addLinkedEdit('NAME', (DartLinkedEditBuilder builder) {
- builder.write(name);
- });
- // append parameters
- builder.writeParameters(functionType.parameters);
- // close method
- builder.write(' {$eol$prefix}');
- builder.write(sourceSuffix);
- });
- if (targetFile == file) {
- builder.addLinkedPosition(range.node(node), 'NAME');
- }
- });
- return changeBuilder;
- }
-
- /// Adds proposal for creating method corresponding to the given
- /// [FunctionType] in the given [ClassElement].
- Future<void> _addProposal_createFunction_function(
- FunctionType functionType) async {
- var name = (node as SimpleIdentifier).name;
- // prepare environment
- var insertOffset = unit.end;
- // prepare prefix
- var prefix = '';
- var sourcePrefix = '$eol';
- var sourceSuffix = eol;
- var changeBuilder = await _addProposal_createFunction(
- functionType,
- name,
- file,
- insertOffset,
- false,
- prefix,
- sourcePrefix,
- sourceSuffix,
- unit.declaredElement);
- _addFixFromBuilder(changeBuilder, DartFixKind.CREATE_FUNCTION,
- args: [name]);
- }
-
- /// Adds proposal for creating method corresponding to the given
- /// [FunctionType] in the given [ClassElement].
- Future<void> _addProposal_createFunction_method(
- ClassElement targetClassElement, FunctionType functionType) async {
- var name = (node as SimpleIdentifier).name;
- // prepare environment
- var targetSource = targetClassElement.source;
- // prepare insert offset
- var targetNode = await _getClassDeclaration(targetClassElement);
- if (targetNode == null) {
- return;
- }
- var insertOffset = targetNode.end - 1;
- // prepare prefix
- var prefix = ' ';
- String sourcePrefix;
- if (targetNode.members.isEmpty) {
- sourcePrefix = '';
- } else {
- sourcePrefix = eol;
- }
- var sourceSuffix = eol;
- var changeBuilder = await _addProposal_createFunction(
- functionType,
- name,
- targetSource.fullName,
- insertOffset,
- _inStaticContext(),
- prefix,
- sourcePrefix,
- sourceSuffix,
- targetClassElement);
- _addFixFromBuilder(changeBuilder, DartFixKind.CREATE_METHOD, args: [name]);
- }
-
- /// Return the class, enum or mixin declaration for the given [element].
- Future<ClassOrMixinDeclaration> _getClassDeclaration(
- ClassElement element) async {
- var result = await sessionHelper.getElementDeclaration(element);
- if (result.node is ClassOrMixinDeclaration) {
- return result.node;
- }
- return null;
- }
-
- /// Return the extension declaration for the given [element].
- Future<ExtensionDeclaration> _getExtensionDeclaration(
- ExtensionElement element) async {
- var result = await sessionHelper.getElementDeclaration(element);
- if (result.node is ExtensionDeclaration) {
- return result.node;
- }
- return null;
- }
-
- /// Return the relative uri from the passed [library] to the given [path].
- /// If the [path] is not in the LibraryElement, `null` is returned.
- String _getRelativeURIFromLibrary(LibraryElement library, String path) {
- var librarySource = library?.librarySource;
- if (librarySource == null) {
- return null;
- }
- var pathCtx = resourceProvider.pathContext;
- var libraryDirectory = pathCtx.dirname(librarySource.fullName);
- var sourceDirectory = pathCtx.dirname(path);
- if (pathCtx.isWithin(libraryDirectory, path) ||
- pathCtx.isWithin(sourceDirectory, libraryDirectory)) {
- var relativeFile = pathCtx.relative(path, from: libraryDirectory);
- return pathCtx.split(relativeFile).join('/');
- }
- return null;
- }
-
- /// Returns an expected [DartType] of [expression], may be `null` if cannot be
- /// inferred.
- DartType _inferUndefinedExpressionType(Expression expression) {
- var parent = expression.parent;
- // myFunction();
- if (parent is ExpressionStatement) {
- if (expression is MethodInvocation) {
- return VoidTypeImpl.instance;
- }
- }
- // return myFunction();
- if (parent is ReturnStatement) {
- var executable = getEnclosingExecutableElement(expression);
- return executable?.returnType;
- }
- // int v = myFunction();
- if (parent is VariableDeclaration) {
- var variableDeclaration = parent;
- if (variableDeclaration.initializer == expression) {
- var variableElement = variableDeclaration.declaredElement;
- if (variableElement != null) {
- return variableElement.type;
- }
- }
- }
- // myField = 42;
- if (parent is AssignmentExpression) {
- var assignment = parent;
- if (assignment.leftHandSide == expression) {
- var rhs = assignment.rightHandSide;
- if (rhs != null) {
- return rhs.staticType;
- }
- }
- }
- // v = myFunction();
- if (parent is AssignmentExpression) {
- var assignment = parent;
- if (assignment.rightHandSide == expression) {
- if (assignment.operator.type == TokenType.EQ) {
- // v = myFunction();
- var lhs = assignment.leftHandSide;
- if (lhs != null) {
- return lhs.staticType;
- }
- } else {
- // v += myFunction();
- var method = assignment.staticElement;
- if (method != null) {
- var parameters = method.parameters;
- if (parameters.length == 1) {
- return parameters[0].type;
- }
- }
- }
- }
- }
- // v + myFunction();
- if (parent is BinaryExpression) {
- var binary = parent;
- var method = binary.staticElement;
- if (method != null) {
- if (binary.rightOperand == expression) {
- var parameters = method.parameters;
- return parameters.length == 1 ? parameters[0].type : null;
- }
- }
- }
- // foo( myFunction() );
- if (parent is ArgumentList) {
- var parameter = expression.staticParameterElement;
- return parameter?.type;
- }
- // bool
- {
- // assert( myFunction() );
- if (parent is AssertStatement) {
- var statement = parent;
- if (statement.condition == expression) {
- return coreTypeBool;
- }
- }
- // if ( myFunction() ) {}
- if (parent is IfStatement) {
- var statement = parent;
- if (statement.condition == expression) {
- return coreTypeBool;
- }
- }
- // while ( myFunction() ) {}
- if (parent is WhileStatement) {
- var statement = parent;
- if (statement.condition == expression) {
- return coreTypeBool;
- }
- }
- // do {} while ( myFunction() );
- if (parent is DoStatement) {
- var statement = parent;
- if (statement.condition == expression) {
- return coreTypeBool;
- }
- }
- // !myFunction()
- if (parent is PrefixExpression) {
- var prefixExpression = parent;
- if (prefixExpression.operator.type == TokenType.BANG) {
- return coreTypeBool;
- }
- }
- // binary expression '&&' or '||'
- if (parent is BinaryExpression) {
- var binaryExpression = parent;
- var operatorType = binaryExpression.operator.type;
- if (operatorType == TokenType.AMPERSAND_AMPERSAND ||
- operatorType == TokenType.BAR_BAR) {
- return coreTypeBool;
- }
- }
- }
- // we don't know
- return null;
- }
-
- /// Returns `true` if [node] is in static context.
- bool _inStaticContext() {
- // constructor initializer cannot reference "this"
- if (node.thisOrAncestorOfType<ConstructorInitializer>() != null) {
- return true;
- }
- // field initializer cannot reference "this"
- if (node.thisOrAncestorOfType<FieldDeclaration>() != null) {
- return true;
- }
- // static method
- var method = node.thisOrAncestorOfType<MethodDeclaration>();
- return method != null && method.isStatic;
- }
-
- bool _isLibSrcPath(String path) {
- var parts = resourceProvider.pathContext.split(path);
- for (var i = 0; i < parts.length - 2; i++) {
- if (parts[i] == 'lib' && parts[i + 1] == 'src') {
- return true;
- }
- }
- return false;
- }
-
- DartChangeBuilder _newDartChangeBuilder() {
- return DartChangeBuilderImpl.forWorkspace(context.workspace);
- }
-
- static ClassElement _getTargetClassElement(Expression target) {
- var type = target.staticType;
- if (type is InterfaceType) {
- return type.element;
- } else if (target is Identifier) {
- var element = target.staticElement;
- if (element is ClassElement) {
- return element;
- }
- }
- return null;
- }
-
- static bool _isNameOfType(String name) {
- if (name.isEmpty) {
- return false;
- }
- var firstLetter = name.substring(0, 1);
- if (firstLetter.toUpperCase() != firstLetter) {
- return false;
- }
- return true;
- }
-
- /// Return `true` if the given [node] is in a location where an implicit
- /// constructor invocation would be allowed.
- static bool _mayBeImplicitConstructor(AstNode node) {
- if (node is SimpleIdentifier) {
- var parent = node.parent;
- if (parent is MethodInvocation) {
- return parent.realTarget == null;
- }
- }
- return false;
- }
-
- /// Returns `true` if [node] is a type name.
- static bool _mayBeTypeIdentifier(AstNode node) {
- if (node is SimpleIdentifier) {
- var parent = node.parent;
- if (parent is TypeName) {
- return true;
- }
- return _isNameOfType(node.name);
- }
- return false;
- }
}
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index 22e4923..d98a7c5 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -142,7 +142,7 @@
class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', <String>['1+x', '2+x']);
buildTests('testCommentSnippets025', '''
-class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''',
+class C {num m() {var q; num x=!1 q!3 + !2/**/;}}''',
<String>['1+q', '2+q', '3+q']);
buildTests('testCommentSnippets026', '''
@@ -227,6 +227,10 @@
class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''',
<String>['1+List', '1+XXX.fisk']);
+ buildTests('testCommentSnippets045', '''
+class List{}class XXX {XXX.fisk();}main() {main(); !1}}''',
+ <String>['1+List', '1+XXX.fisk']);
+
buildTests('testCommentSnippets047', '''
f(){int x;int y=!1;}''', <String>['1+x']);
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 4837c81..5a1faf0 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
@@ -197,10 +197,14 @@
}
}
- void assertNotSuggested(String completion) {
- var suggestion = suggestions.firstWhere(
- (CompletionSuggestion cs) => cs.completion == completion,
- orElse: () => null);
+ void assertNotSuggested(String completion, {ElementKind elemKind}) {
+ var suggestion = suggestions.firstWhere((CompletionSuggestion cs) {
+ if (elemKind == null) {
+ return cs.completion == completion;
+ } else {
+ return cs.completion == completion && cs.element.kind == elemKind;
+ }
+ }, orElse: () => null);
if (suggestion != null) {
failedCompletion('did not expect completion: $completion\n $suggestion');
}
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
deleted file mode 100644
index ce3c6be..0000000
--- a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
+++ /dev/null
@@ -1,4148 +0,0 @@
-// Copyright (c) 2014, 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:analysis_server/src/protocol_server.dart';
-import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/local_constructor_contributor.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'completion_contributor_util.dart';
-
-void main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(LocalConstructorContributorTest);
- });
-}
-
-@reflectiveTest
-class LocalConstructorContributorTest extends DartCompletionContributorTest {
- @override
- DartCompletionContributor createContributor() {
- return LocalConstructorContributor();
- }
-
- /// Sanity check. Permutations tested in local_ref_contributor.
- Future<void> test_ArgDefaults_cons_with_required_named() async {
- addMetaPackage();
- addTestSource('''
-import 'package:meta/meta.dart';
-
-class A {
- A(int bar, {bool boo, @required int baz});
- baz() {
- new A^
- }
-}''');
- await computeSuggestions();
-
- assertSuggestConstructor('A', defaultArgListString: 'bar, baz: null');
- }
-
- Future<void> test_ArgumentList() async {
- // ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-bool hasLength(int expected) { }
-void baz() { }''');
- addTestSource('''
-import 'a.dart';
-class B { }
-String bar() => true;
-void main() {expect(^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void> test_ArgumentList_imported_function() async {
- // ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-bool hasLength(int expected) { }
-expect(arg) { }
-void baz() { }''');
- addTestSource('''
-import 'a.dart';
-class B { }
-String bar() => true;
-void main() {expect(^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void>
- test_ArgumentList_InstanceCreationExpression_functionalArg() async {
- // ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-class A { A(f()) { } }
-bool hasLength(int expected) { }
-void baz() { }''');
- addTestSource('''
-import 'dart:async';
-import 'a.dart';
-class B { }
-String bar() => true;
-void main() {new A(^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('A');
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void> test_ArgumentList_InstanceCreationExpression_typedefArg() async {
- // ArgumentList InstanceCreationExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-typedef Funct();
-class A { A(Funct f) { } }
-bool hasLength(int expected) { }
-void baz() { }''');
- addTestSource('''
-import 'dart:async';
-import 'a.dart';
-class B { }
-String bar() => true;
-void main() {new A(^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('A');
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void> test_ArgumentList_local_function() async {
- // ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-bool hasLength(int expected) { }
-void baz() { }''');
- addTestSource('''
-import 'a.dart';
-expect(arg) { }
-class B { }
-String bar() => true;
-void main() {expect(^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void> test_ArgumentList_local_method() async {
- // ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-bool hasLength(int expected) { }
-void baz() { }''');
- addTestSource('''
-import 'a.dart';
-class B {
- expect(arg) { }
- void foo() {expect(^)}}
-String bar() => true;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void> test_ArgumentList_MethodInvocation_functionalArg() async {
- // ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-class A { A(f()) { } }
-bool hasLength(int expected) { }
-void baz() { }''');
- addTestSource('''
-import 'dart:async';
-import 'a.dart';
-class B { }
-String bar(f()) => true;
-void main() {bar(^);}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('A');
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void> test_ArgumentList_MethodInvocation_methodArg() async {
- // ArgumentList MethodInvocation ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-library A;
-class A { A(f()) { } }
-bool hasLength(int expected) { }
-void baz() { }''');
- addTestSource('''
-import 'dart:async';
-import 'a.dart';
-class B { String bar(f()) => true; }
-void main() {new B().bar(^);}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('hasLength');
- assertNotSuggested('identical');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('B');
- } else {
- assertNotSuggested('B');
- }
- assertNotSuggested('A');
- assertNotSuggested('Object');
- assertNotSuggested('main');
- assertNotSuggested('baz');
- assertNotSuggested('print');
- }
-
- Future<void> test_ArgumentList_namedParam() async {
- // SimpleIdentifier NamedExpression ArgumentList MethodInvocation
- // ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
-library A;
-bool hasLength(int expected) { }''');
- addTestSource('''
-import 'a.dart';
-String bar() => true;
-void main() {expect(foo: ^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('bar');
- assertNotSuggested('hasLength');
- assertNotSuggested('main');
- }
-
- Future<void> test_AsExpression() async {
- // SimpleIdentifier TypeName AsExpression
- addTestSource('''
- class A {var b; X _c; foo() {var a; (a as ^).foo();}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('Object');
- assertNotSuggested('A');
- assertNotSuggested('==');
- }
-
- Future<void> test_AssignmentExpression_name() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // VariableDeclarationStatement Block
- addTestSource('class A {} main() {int a; int ^b = 1;}');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_AssignmentExpression_RHS() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // VariableDeclarationStatement Block
- addTestSource('class A {} main() {int a; int b = ^}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('main');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('Object');
- }
-
- Future<void> test_AssignmentExpression_type() async {
- // SimpleIdentifier TypeName VariableDeclarationList
- // VariableDeclarationStatement Block
- addTestSource('''
-class A {} main() {
- int a;
- ^ b = 1;
-}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('int');
- // TODO (danrubel) When entering 1st of 2 identifiers on assignment LHS
- // the user may be either (1) entering a type for the assignment
- // or (2) starting a new statement.
- // Consider suggesting only types
- // if only spaces separates the 1st and 2nd identifiers.
- //assertNotSuggested('a');
- //assertNotSuggested('main');
- //assertNotSuggested('identical');
- }
-
- Future<void> test_AssignmentExpression_type_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
- // VariableDeclarationStatement Block
- addTestSource('''
-class A {} main() {
- int a;
- ^
- b = 1;
-}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('int');
- // Allow non-types preceding an identifier on LHS of assignment
- // if newline follows first identifier
- // because user is probably starting a new statement
- assertNotSuggested('a');
- assertNotSuggested('main');
- assertNotSuggested('identical');
- }
-
- Future<void> test_AssignmentExpression_type_partial() async {
- // SimpleIdentifier TypeName VariableDeclarationList
- // VariableDeclarationStatement Block
- addTestSource('''
-class A {} main() {
- int a;
- int^ b = 1;
-}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 3);
- expect(replacementLength, 3);
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('int');
- // TODO (danrubel) When entering 1st of 2 identifiers on assignment LHS
- // the user may be either (1) entering a type for the assignment
- // or (2) starting a new statement.
- // Consider suggesting only types
- // if only spaces separates the 1st and 2nd identifiers.
- //assertNotSuggested('a');
- //assertNotSuggested('main');
- //assertNotSuggested('identical');
- }
-
- Future<void> test_AssignmentExpression_type_partial_newline() async {
- // SimpleIdentifier TypeName VariableDeclarationList
- // VariableDeclarationStatement Block
- addTestSource('''
-class A {} main() {
- int a;
- i^
- b = 1;
-}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('int');
- // Allow non-types preceding an identifier on LHS of assignment
- // if newline follows first identifier
- // because user is probably starting a new statement
- assertNotSuggested('a');
- assertNotSuggested('main');
- assertNotSuggested('identical');
- }
-
- Future<void> test_AwaitExpression() async {
- // SimpleIdentifier AwaitExpression ExpressionStatement
- addTestSource('''
-class A {int x; int y() => 0;}
-main() async {A a; await ^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('main');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('Object');
- }
-
- Future<void> test_BinaryExpression_LHS() async {
- // SimpleIdentifier BinaryExpression VariableDeclaration
- // VariableDeclarationList VariableDeclarationStatement
- addTestSource('main() {int a = 1, b = ^ + 2;}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('Object');
- assertNotSuggested('b');
- }
-
- Future<void> test_BinaryExpression_RHS() async {
- // SimpleIdentifier BinaryExpression VariableDeclaration
- // VariableDeclarationList VariableDeclarationStatement
- addTestSource('main() {int a = 1, b = 2 + ^;}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('Object');
- assertNotSuggested('b');
- assertNotSuggested('==');
- }
-
- Future<void> test_Block() async {
- // Block BlockFunctionBody MethodDeclaration
- addSource('/testAB.dart', '''
-export "dart:math" hide max;
-class A {int x;}
-@deprecated D1() {int x;}
-class _B {boo() { partBoo() {}} }''');
- addSource('/testCD.dart', '''
-String T1;
-var _T2;
-class C { }
-class D { }''');
- addSource('/testEEF.dart', '''
-class EE { }
-class F { }''');
- addSource('/testG.dart', 'class G { }');
- addSource('/testH.dart', '''
-class H { }
-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;
-int T5;
-var _T6;
-String get T7 => 'hello';
-set T8(int value) { partT8() {} }
-Z D2() {int x;}
-class X {
- int get clog => 8;
- set blog(value) { }
- a() {
- var f;
- localF(int arg1) { }
- {var x;}
- ^ var r;
- }
- void b() { }}
-class Z { }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
-
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('X');
- assertSuggestConstructor('Z');
- } else {
- assertNotSuggested('X');
- assertNotSuggested('Z');
- }
- assertNotSuggested('a');
- assertNotSuggested('b');
- assertNotSuggested('localF');
- assertNotSuggested('f');
- // Don't suggest locals out of scope
- assertNotSuggested('r');
- assertNotSuggested('x');
- assertNotSuggested('partT8');
-
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('C');
- assertNotSuggested('partBoo');
- // hidden element suggested as low relevance
- // but imported results are partially filtered
- //assertNotSuggested('D');
- //assertNotSuggested(
- // 'D1', null, true, COMPLETION_RELEVANCE_LOW);
- assertNotSuggested('D2');
- assertNotSuggested('EE');
- // hidden element suggested as low relevance
- //assertNotSuggested('F');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('g');
- assertNotSuggested('G');
- //assertNotSuggested('H');
- assertNotSuggested('Object');
- assertNotSuggested('min');
- assertNotSuggested('_T2');
- //assertNotSuggested('T3');
- assertNotSuggested('_T4');
- assertNotSuggested('T5');
- assertNotSuggested('_T6');
- assertNotSuggested('==');
- assertNotSuggested('T7');
- assertNotSuggested('T8');
- assertNotSuggested('clog');
- assertNotSuggested('blog');
- // TODO (danrubel) suggest HtmlElement as low relevance
- assertNotSuggested('HtmlElement');
- assertNotSuggested('Uri');
- assertNotSuggested('parseIPv6Address');
- assertNotSuggested('parseHex');
- }
-
- Future<void> test_Block_final() async {
- // Block BlockFunctionBody MethodDeclaration
- addSource('/testAB.dart', '''
-export "dart:math" hide max;
-class A {int x;}
-@deprecated D1() {int x;}
-class _B {boo() { partBoo() {}} }''');
- addSource('/testCD.dart', '''
-String T1;
-var _T2;
-class C { }
-class D { }''');
- addSource('/testEEF.dart', '''
-class EE { }
-class F { }''');
- addSource('/testG.dart', 'class G { }');
- addSource('/testH.dart', '''
-class H { }
-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;
-int T5;
-var _T6;
-String get T7 => 'hello';
-set T8(int value) { partT8() {} }
-Z D2() {int x;}
-class X {
- int get clog => 8;
- set blog(value) { }
- a() {
- var f;
- localF(int arg1) { }
- {var x;}
- final ^
- }
- void b() { }}
-class Z { }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
-
- assertNotSuggested('X');
- assertNotSuggested('Z');
- assertNotSuggested('a');
- assertNotSuggested('b');
- assertNotSuggested('localF');
- assertNotSuggested('f');
- // Don't suggest locals out of scope
- assertNotSuggested('r');
- assertNotSuggested('x');
- assertNotSuggested('partT8');
-
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('C');
- assertNotSuggested('partBoo');
- // hidden element suggested as low relevance
- // but imported results are partially filtered
- //assertNotSuggested('D');
- //assertNotSuggested(
- // 'D1', null, true, COMPLETION_RELEVANCE_LOW);
- assertNotSuggested('D2');
- assertNotSuggested('EE');
- // hidden element suggested as low relevance
- //assertNotSuggested('F');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('g');
- assertNotSuggested('G');
- //assertNotSuggested('H');
- assertNotSuggested('Object');
- assertNotSuggested('min');
- //assertNotSuggested(
- // 'max',
- // 'num',
- // false,
- // COMPLETION_RELEVANCE_LOW);
- assertNotSuggested('T1');
- assertNotSuggested('_T2');
- //assertNotSuggested('T3');
- assertNotSuggested('_T4');
- assertNotSuggested('T5');
- assertNotSuggested('_T6');
- assertNotSuggested('==');
- assertNotSuggested('T7');
- assertNotSuggested('T8');
- assertNotSuggested('clog');
- assertNotSuggested('blog');
- // TODO (danrubel) suggest HtmlElement as low relevance
- assertNotSuggested('HtmlElement');
- assertNotSuggested('Uri');
- assertNotSuggested('parseIPv6Address');
- assertNotSuggested('parseHex');
- }
-
- Future<void> test_Block_final2() async {
- addTestSource('main() {final S^ v;}');
- await computeSuggestions();
-
- assertNotSuggested('String');
- }
-
- Future<void> test_Block_final3() async {
- addTestSource('main() {final ^ v;}');
- await computeSuggestions();
-
- assertNotSuggested('String');
- }
-
- Future<void> test_Block_final_final() async {
- // Block BlockFunctionBody MethodDeclaration
- addSource('/testAB.dart', '''
-export "dart:math" hide max;
-class A {int x;}
-@deprecated D1() {int x;}
-class _B {boo() { partBoo() {}} }''');
- addSource('/testCD.dart', '''
-String T1;
-var _T2;
-class C { }
-class D { }''');
- addSource('/testEEF.dart', '''
-class EE { }
-class F { }''');
- addSource('/testG.dart', 'class G { }');
- addSource('/testH.dart', '''
-class H { }
-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;
-int T5;
-var _T6;
-String get T7 => 'hello';
-set T8(int value) { partT8() {} }
-Z D2() {int x;}
-class X {
- int get clog => 8;
- set blog(value) { }
- a() {
- final ^
- final var f;
- localF(int arg1) { }
- {var x;}
- }
- void b() { }}
-class Z { }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
-
- assertNotSuggested('X');
- assertNotSuggested('Z');
- assertNotSuggested('a');
- assertNotSuggested('b');
- assertNotSuggested('localF');
- assertNotSuggested('f');
- // Don't suggest locals out of scope
- assertNotSuggested('r');
- assertNotSuggested('x');
- assertNotSuggested('partT8');
-
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('C');
- assertNotSuggested('partBoo');
- // hidden element suggested as low relevance
- // but imported results are partially filtered
- //assertNotSuggested('D');
- //assertNotSuggested(
- // 'D1', null, true, COMPLETION_RELEVANCE_LOW);
- assertNotSuggested('D2');
- assertNotSuggested('EE');
- // hidden element suggested as low relevance
- //assertNotSuggested('F');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('g');
- assertNotSuggested('G');
- //assertNotSuggested('H');
- assertNotSuggested('Object');
- assertNotSuggested('min');
- //assertNotSuggested(
- // 'max',
- // 'num',
- // false,
- // COMPLETION_RELEVANCE_LOW);
- assertNotSuggested('T1');
- assertNotSuggested('_T2');
- //assertNotSuggested('T3');
- assertNotSuggested('_T4');
- assertNotSuggested('T5');
- assertNotSuggested('_T6');
- assertNotSuggested('==');
- assertNotSuggested('T7');
- assertNotSuggested('T8');
- assertNotSuggested('clog');
- assertNotSuggested('blog');
- // TODO (danrubel) suggest HtmlElement as low relevance
- assertNotSuggested('HtmlElement');
- assertNotSuggested('Uri');
- assertNotSuggested('parseIPv6Address');
- assertNotSuggested('parseHex');
- }
-
- Future<void> test_Block_final_var() async {
- // Block BlockFunctionBody MethodDeclaration
- addSource('/testAB.dart', '''
-export "dart:math" hide max;
-class A {int x;}
-@deprecated D1() {int x;}
-class _B {boo() { partBoo() {}} }''');
- addSource('/testCD.dart', '''
-String T1;
-var _T2;
-class C { }
-class D { }''');
- addSource('/testEEF.dart', '''
-class EE { }
-class F { }''');
- addSource('/testG.dart', 'class G { }');
- addSource('/testH.dart', '''
-class H { }
-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;
-int T5;
-var _T6;
-String get T7 => 'hello';
-set T8(int value) { partT8() {} }
-Z D2() {int x;}
-class X {
- int get clog => 8;
- set blog(value) { }
- a() {
- final ^
- var f;
- localF(int arg1) { }
- {var x;}
- }
- void b() { }}
-class Z { }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
-
- assertNotSuggested('X');
- assertNotSuggested('Z');
- assertNotSuggested('a');
- assertNotSuggested('b');
- assertNotSuggested('localF');
- assertNotSuggested('f');
- // Don't suggest locals out of scope
- assertNotSuggested('r');
- assertNotSuggested('x');
- assertNotSuggested('partT8');
-
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('C');
- assertNotSuggested('partBoo');
- // hidden element suggested as low relevance
- // but imported results are partially filtered
- //assertNotSuggested('D');
- //assertNotSuggested(
- // 'D1', null, true, COMPLETION_RELEVANCE_LOW);
- assertNotSuggested('D2');
- assertNotSuggested('EE');
- // hidden element suggested as low relevance
- //assertNotSuggested('F');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('g');
- assertNotSuggested('G');
- //assertNotSuggested('H');
- assertNotSuggested('Object');
- assertNotSuggested('min');
- //assertNotSuggested(
- // 'max',
- // 'num',
- // false,
- // COMPLETION_RELEVANCE_LOW);
- assertNotSuggested('T1');
- assertNotSuggested('_T2');
- //assertNotSuggested('T3');
- assertNotSuggested('_T4');
- assertNotSuggested('T5');
- assertNotSuggested('_T6');
- assertNotSuggested('==');
- assertNotSuggested('T7');
- assertNotSuggested('T8');
- assertNotSuggested('clog');
- assertNotSuggested('blog');
- // TODO (danrubel) suggest HtmlElement as low relevance
- assertNotSuggested('HtmlElement');
- assertNotSuggested('Uri');
- assertNotSuggested('parseIPv6Address');
- assertNotSuggested('parseHex');
- }
-
- Future<void> test_Block_identifier_partial() async {
- addSource('/testAB.dart', '''
-export "dart:math" hide max;
-class A {int x;}
-@deprecated D1() {int x;}
-class _B { }''');
- addSource('/testCD.dart', '''
-String T1;
-var _T2;
-class C { }
-class D { }''');
- addSource('/testEEF.dart', '''
-class EE { }
-class F { }''');
- addSource('/testG.dart', 'class G { }');
- addSource('/testH.dart', '''
-class H { }
-class D3 { }
-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;
-int T5;
-var _T6;
-Z D2() {int x;}
-class X {a() {var f; {var x;} D^ var r;} void b() { }}
-class Z { }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
-
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('X');
- assertSuggestConstructor('Z');
- } else {
- assertNotSuggested('X');
- assertNotSuggested('Z');
- }
- assertNotSuggested('a');
- assertNotSuggested('b');
- assertNotSuggested('f');
- // Don't suggest locals out of scope
- assertNotSuggested('r');
- assertNotSuggested('x');
-
- // imported elements are portially filtered
- //assertNotSuggested('A');
- assertNotSuggested('_B');
- //assertNotSuggested('C');
- // hidden element suggested as low relevance
- assertNotSuggested('D');
- assertNotSuggested('D1');
- assertNotSuggested('D2');
- // unimported elements suggested with low relevance
- assertNotSuggested('D3');
- //assertNotSuggested('EE');
- // hidden element suggested as low relevance
- //assertNotSuggested('F');
- //assertSuggestLibraryPrefix('g');
- assertNotSuggested('G');
- //assertNotSuggested('H');
- //assertNotSuggested('Object');
- //assertNotSuggested('min');
- //assertNotSuggested(
- // 'max',
- // 'num',
- // false,
- // COMPLETION_RELEVANCE_LOW);
- //assertSuggestTopLevelVarGetterSetter('T1', 'String');
- assertNotSuggested('_T2');
- //assertNotSuggested('T3');
- assertNotSuggested('_T4');
- //assertNotSuggested('T5');
- //assertSuggestTopLevelVar('_T6', null);
- assertNotSuggested('==');
- // TODO (danrubel) suggest HtmlElement as low relevance
- assertNotSuggested('HtmlElement');
- }
-
- Future<void> test_Block_inherited_imported() async {
- // Block BlockFunctionBody MethodDeclaration ClassDeclaration
- addSource('/home/test/lib/b.dart', '''
-lib B;
-class F { var f1; f2() { } get f3 => 0; set f4(fx) { } var _pf; }
-class E extends F { var e1; e2() { } }
-class I { int i1; i2() { } }
-class M { var m1; int m2() { } }''');
- addTestSource('''
-import "b.dart";
-class A extends E implements I with M {a() {^}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // TODO (danrubel) prefer fields over getters
- // If add `get e1;` to interface I
- // then suggestions include getter e1 rather than field e1
- assertNotSuggested('e1');
- assertNotSuggested('f1');
- assertNotSuggested('i1');
- assertNotSuggested('m1');
- assertNotSuggested('f3');
- assertNotSuggested('f4');
- assertNotSuggested('e2');
- assertNotSuggested('f2');
- assertNotSuggested('i2');
- //assertNotSuggested('m2');
- assertNotSuggested('==');
- }
-
- Future<void> test_Block_inherited_local() async {
- // Block BlockFunctionBody MethodDeclaration ClassDeclaration
- addTestSource('''
-class F { var f1; f2() { } get f3 => 0; set f4(fx) { } }
-class E extends F { var e1; e2() { } }
-class I { int i1; i2() { } }
-class M { var m1; int m2() { } }
-class A extends E implements I with M {a() {^}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('e1');
- assertNotSuggested('f1');
- assertNotSuggested('i1');
- assertNotSuggested('m1');
- assertNotSuggested('f3');
- assertNotSuggested('f4');
- assertNotSuggested('e2');
- assertNotSuggested('f2');
- assertNotSuggested('i2');
- assertNotSuggested('m2');
- }
-
- Future<void> test_Block_local_function() async {
- addSource('/testAB.dart', '''
-export "dart:math" hide max;
-class A {int x;}
-@deprecated D1() {int x;}
-class _B {boo() { partBoo() {}} }''');
- addSource('/testCD.dart', '''
-String T1;
-var _T2;
-class C { }
-class D { }''');
- addSource('/testEEF.dart', '''
-class EE { }
-class F { }''');
- addSource('/testG.dart', 'class G { }');
- addSource('/testH.dart', '''
-class H { }
-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;
-int T5;
-var _T6;
-String get T7 => 'hello';
-set T8(int value) { partT8() {} }
-Z D2() {int x;}
-class X {
- int get clog => 8;
- set blog(value) { }
- a() {
- var f;
- localF(int arg1) { }
- {var x;}
- p^ var r;
- }
- void b() { }}
-class Z { }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
-
- assertNotSuggested('partT8');
- assertNotSuggested('partBoo');
- assertNotSuggested('parseIPv6Address');
- assertNotSuggested('parseHex');
- }
-
- Future<void> test_Block_unimported() async {
- addPackageFile('aaa', 'a.dart', 'class A {}');
- addTestSource('main() { ^ }');
-
- await computeSuggestions();
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
-
- // Not imported, so not suggested
- assertNotSuggested('A');
- assertNotSuggested('Future');
- }
-
- Future<void> test_CascadeExpression_selector1() async {
- // PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart";
-class A {var b; X _c;}
-class X{}
-// looks like a cascade to the parser
-// but the user is trying to get completions for a non-cascade
-main() {A a; a.^.z}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('Object');
- assertNotSuggested('A');
- assertNotSuggested('B');
- assertNotSuggested('X');
- assertNotSuggested('z');
- assertNotSuggested('==');
- }
-
- Future<void> test_CascadeExpression_selector2() async {
- // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart";
-class A {var b; X _c;}
-class X{}
-main() {A a; a..^z}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 1);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('Object');
- assertNotSuggested('A');
- assertNotSuggested('B');
- assertNotSuggested('X');
- assertNotSuggested('z');
- assertNotSuggested('==');
- }
-
- Future<void> test_CascadeExpression_selector2_withTrailingReturn() async {
- // PropertyAccess CascadeExpression ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart";
-class A {var b; X _c;}
-class X{}
-main() {A a; a..^ return}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('Object');
- assertNotSuggested('A');
- assertNotSuggested('B');
- assertNotSuggested('X');
- assertNotSuggested('z');
- assertNotSuggested('==');
- }
-
- Future<void> test_CascadeExpression_target() async {
- // SimpleIdentifier CascadeExpression ExpressionStatement
- addTestSource('''
-class A {var b; X _c;}
-class X{}
-main() {A a; a^..b}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('a');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- assertSuggestConstructor('X');
- } else {
- assertNotSuggested('A');
- assertNotSuggested('X');
- }
- // top level results are partially filtered
- //assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_CatchClause_onType() async {
- // TypeName CatchClause TryStatement
- addTestSource('class A {a() {try{var x;} on ^ {}}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('Object');
- assertNotSuggested('a');
- assertNotSuggested('x');
- }
-
- Future<void> test_CatchClause_onType_noBrackets() async {
- // TypeName CatchClause TryStatement
- addTestSource('class A {a() {try{var x;} on ^}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('Object');
- assertNotSuggested('x');
- }
-
- Future<void> test_CatchClause_typed() async {
- // Block CatchClause TryStatement
- addTestSource('class A {a() {try{var x;} on E catch (e) {^}}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('e');
- assertNotSuggested('a');
- assertNotSuggested('Object');
- assertNotSuggested('x');
- }
-
- Future<void> test_CatchClause_untyped() async {
- // Block CatchClause TryStatement
- addTestSource('class A {a() {try{var x;} catch (e, s) {^}}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('e');
- assertNotSuggested('s');
- assertNotSuggested('a');
- assertNotSuggested('Object');
- assertNotSuggested('x');
- }
-
- Future<void> test_ClassDeclaration_body() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart" as x;
-@deprecated class A {^}
-class _B {}
-A T;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('Object');
- assertNotSuggested('T');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('x');
- }
-
- Future<void> test_ClassDeclaration_body_final() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart" as x;
-class A {final ^}
-class _B {}
-A T;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('Object');
- assertNotSuggested('T');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('x');
- }
-
- Future<void> test_ClassDeclaration_body_final_field() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart" as x;
-class A {final ^ A(){}}
-class _B {}
-A T;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('String');
- assertNotSuggested('T');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('x');
- }
-
- Future<void> test_ClassDeclaration_body_final_field2() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart" as Soo;
-class A {final S^ A();}
-class _B {}
-A Sew;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('String');
- assertNotSuggested('Sew');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('Soo');
- }
-
- Future<void> test_ClassDeclaration_body_final_final() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart" as x;
-class A {final ^ final foo;}
-class _B {}
-A T;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('Object');
- assertNotSuggested('T');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('x');
- }
-
- Future<void> test_ClassDeclaration_body_final_var() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/b.dart', '''
-class B { }''');
- addTestSource('''
-import "b.dart" as x;
-class A {final ^ var foo;}
-class _B {}
-A T;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('_B');
- assertNotSuggested('Object');
- assertNotSuggested('T');
- // Suggested by LibraryPrefixContributor
- assertNotSuggested('x');
- }
-
- Future<void> test_Combinator_hide() async {
- // SimpleIdentifier HideCombinator ImportDirective
- addSource('/testAB.dart', '''
-library libAB;
-part 'partAB.dart';
-class A { }
-class B { }''');
- addSource('/partAB.dart', '''
-part of libAB;
-var T1;
-PB F1() => new PB();
-class PB { }''');
- addSource('/testCD.dart', '''
-class C { }
-class D { }''');
- addTestSource('''
-import "testAB.dart" hide ^;
-import "testCD.dart";
-class X {}''');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_Combinator_show() async {
- // SimpleIdentifier HideCombinator ImportDirective
- addSource('/testAB.dart', '''
-library libAB;
-part 'partAB.dart';
-class A { }
-class B { }''');
- addSource('/partAB.dart', '''
-part of libAB;
-var T1;
-PB F1() => new PB();
-typedef PB2 F2(int blat);
-class Clz = Object with Object;
-class PB { }''');
- addSource('/testCD.dart', '''
-class C { }
-class D { }''');
- addTestSource('''
-import "testAB.dart" show ^;
-import "testCD.dart";
-class X {}''');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_ConditionalExpression_elseExpression() async {
- // SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-class B {int x;}
-class C {foo(){var f; {var x;} return a ? T1 : T^}}''');
- await computeSuggestions();
-
- // top level results are partially filtered based on first char
- assertNotSuggested('T2');
- // TODO (danrubel) getter is being suggested instead of top level var
- //assertNotSuggested('T1');
- }
-
- Future<void> test_ConditionalExpression_elseExpression_empty() async {
- // SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-class B {int x;}
-class C {foo(){var f; {var x;} return a ? T1 : ^}}''');
- await computeSuggestions();
-
- assertNotSuggested('x');
- assertNotSuggested('f');
- assertNotSuggested('foo');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C');
- } else {
- assertNotSuggested('C');
- }
- assertNotSuggested('F2');
- assertNotSuggested('T2');
- assertNotSuggested('A');
- assertNotSuggested('F1');
- // TODO (danrubel) getter is being suggested instead of top level var
- //assertNotSuggested('T1');
- }
-
- Future<void> test_ConditionalExpression_partial_thenExpression() async {
- // SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-class B {int x;}
-class C {foo(){var f; {var x;} return a ? T^}}''');
- await computeSuggestions();
-
- // top level results are partially filtered based on first char
- assertNotSuggested('T2');
- // TODO (danrubel) getter is being suggested instead of top level var
- //assertNotSuggested('T1');
- }
-
- Future<void> test_ConditionalExpression_partial_thenExpression_empty() async {
- // SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-class B {int x;}
-class C {foo(){var f; {var x;} return a ? ^}}''');
- await computeSuggestions();
-
- assertNotSuggested('x');
- assertNotSuggested('f');
- assertNotSuggested('foo');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C');
- } else {
- assertNotSuggested('C');
- }
- assertNotSuggested('F2');
- assertNotSuggested('T2');
- assertNotSuggested('A');
- assertNotSuggested('F1');
- // TODO (danrubel) getter is being suggested instead of top level var
- //assertNotSuggested('T1');
- }
-
- Future<void> test_ConditionalExpression_thenExpression() async {
- // SimpleIdentifier ConditionalExpression ReturnStatement
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-class B {int x;}
-class C {foo(){var f; {var x;} return a ? T^ : c}}''');
- await computeSuggestions();
-
- // top level results are partially filtered based on first char
- assertNotSuggested('T2');
- // TODO (danrubel) getter is being suggested instead of top level var
- //assertNotSuggested('T1');
- }
-
- Future<void> test_constructor_parameters_mixed_required_and_named() async {
- addTestSource('class A {A(x, {int y}) {^}}');
- await computeSuggestions();
- assertNotSuggested('x');
- assertNotSuggested('y');
- }
-
- Future<void>
- test_constructor_parameters_mixed_required_and_positional() async {
- addTestSource('class A {A(x, [int y]) {^}}');
- await computeSuggestions();
- assertNotSuggested('x');
- assertNotSuggested('y');
- }
-
- Future<void> test_constructor_parameters_named() async {
- addTestSource('class A {A({x, int y}) {^}}');
- await computeSuggestions();
- assertNotSuggested('x');
- assertNotSuggested('y');
- }
-
- Future<void> test_constructor_parameters_positional() async {
- addTestSource('class A {A([x, int y]) {^}}');
- await computeSuggestions();
- assertNotSuggested('x');
- assertNotSuggested('y');
- }
-
- Future<void> test_constructor_parameters_required() async {
- addTestSource('class A {A(x, int y) {^}}');
- await computeSuggestions();
- assertNotSuggested('x');
- assertNotSuggested('y');
- }
-
- Future<void> test_ConstructorName_importedClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
- // InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
-lib B;
-int T1;
-F1() { }
-class X {X.c(); X._d(); z() {}}''');
- addTestSource('''
-import "b.dart";
-var m;
-main() {new X.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by NamedConstructorContributor
- assertNotSuggested('c');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('_d');
- assertNotSuggested('z');
- assertNotSuggested('m');
- }
-
- Future<void> test_ConstructorName_importedFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
- // InstanceCreationExpression
- addSource('/home/test/lib/b.dart', '''
-lib B;
-int T1;
-F1() { }
-class X {factory X.c(); factory X._d(); z() {}}''');
- addTestSource('''
-import "b.dart";
-var m;
-main() {new X.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by NamedConstructorContributor
- assertNotSuggested('c');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('_d');
- assertNotSuggested('z');
- assertNotSuggested('m');
- }
-
- Future<void> test_ConstructorName_importedFactory2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
- // InstanceCreationExpression
- addTestSource('''
- main() {new String.fr^omCharCodes([]);}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 2);
- expect(replacementLength, 13);
- // Suggested by NamedConstructorContributor
- assertNotSuggested('fromCharCodes');
- assertNotSuggested('isEmpty');
- assertNotSuggested('isNotEmpty');
- assertNotSuggested('length');
- assertNotSuggested('Object');
- assertNotSuggested('String');
- }
-
- Future<void> test_ConstructorName_localClass() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
- // InstanceCreationExpression
- addTestSource('''
-int T1;
-F1() { }
-class X {X.c(); X._d(); z() {}}
-main() {new X.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by NamedConstructorContributor
- assertNotSuggested('c');
- assertNotSuggested('_d');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('z');
- assertNotSuggested('m');
- }
-
- Future<void> test_ConstructorName_localFactory() async {
- // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
- // InstanceCreationExpression
- addTestSource('''
-int T1;
-F1() { }
-class X {factory X.c(); factory X._d(); z() {}}
-main() {new X.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by NamedConstructorContributor
- assertNotSuggested('c');
- assertNotSuggested('_d');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('z');
- assertNotSuggested('m');
- }
-
- Future<void> test_DefaultFormalParameter_named_expression() async {
- // DefaultFormalParameter FormalParameterList MethodDeclaration
- addTestSource('''
-foo() { }
-void bar() { }
-class A {a(blat: ^) { }}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('foo');
- assertNotSuggested('a');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('String');
- assertNotSuggested('identical');
- assertNotSuggested('bar');
- }
-
- Future<void> test_enum() async {
- addTestSource('enum E { one, two } main() {^}');
- await computeSuggestions();
- assertNotSuggested('E');
- assertNotSuggested('one');
- assertNotSuggested('two');
- }
-
- Future<void> test_enum_deprecated() async {
- addTestSource('@deprecated enum E { one, two } main() {^}');
- await computeSuggestions();
- assertNotSuggested('E');
- assertNotSuggested('one');
- assertNotSuggested('two');
- }
-
- Future<void> test_ExpressionStatement_identifier() async {
- // SimpleIdentifier ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-_B F1() { }
-class A {int x;}
-class _B { }''');
- addTestSource('''
-import "a.dart";
-typedef int F2(int blat);
-class Clz = Object with Object;
-class C {foo(){^} void bar() {}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('A');
- assertNotSuggested('F1');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C');
- } else {
- assertNotSuggested('C');
- }
- assertNotSuggested('foo');
- assertNotSuggested('bar');
- assertNotSuggested('F2');
- assertNotSuggested('Clz');
- assertNotSuggested('x');
- assertNotSuggested('_B');
- }
-
- Future<void> test_ExpressionStatement_name() async {
- // ExpressionStatement Block BlockFunctionBody MethodDeclaration
- addSource('/home/test/lib/a.dart', '''
- B T1;
- class B{}''');
- addTestSource('''
- import "a.dart";
- class C {a() {C ^}}''');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_FieldDeclaration_name_typed() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
- addTestSource('''
- import "a.dart";
- class C {A ^}''');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_FieldDeclaration_name_var() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // FieldDeclaration
- addSource('/home/test/lib/a.dart', 'class A { }');
- addTestSource('''
- import "a.dart";
- class C {var ^}''');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_FieldFormalParameter_in_non_constructor() async {
- // SimpleIdentifier FieldFormalParameter FormalParameterList
- addTestSource('class A {B(this.^foo) {}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 3);
- assertNoSuggestions();
- }
-
- Future<void> test_ForEachStatement_body_typed() async {
- // Block ForEachStatement
- addTestSource('main(args) {for (int foo in bar) {^}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('args');
- assertNotSuggested('foo');
- assertNotSuggested('Object');
- }
-
- Future<void> test_ForEachStatement_body_untyped() async {
- // Block ForEachStatement
- addTestSource('main(args) {for (foo in bar) {^}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('args');
- assertNotSuggested('foo');
- assertNotSuggested('Object');
- }
-
- Future<void> test_ForEachStatement_iterable() async {
- // SimpleIdentifier ForEachStatement Block
- addTestSource('main(args) {for (int foo in ^) {}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('args');
- assertNotSuggested('Object');
- }
-
- Future<void> test_ForEachStatement_loopVariable() async {
- // SimpleIdentifier ForEachStatement Block
- addTestSource('main(args) {for (^ in args) {}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('args');
- assertNotSuggested('String');
- }
-
- Future<void> test_ForEachStatement_loopVariable_type() async {
- // SimpleIdentifier ForEachStatement Block
- addTestSource('main(args) {for (^ foo in args) {}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('args');
- assertNotSuggested('foo');
- assertNotSuggested('String');
- }
-
- Future<void> test_ForEachStatement_loopVariable_type2() async {
- // DeclaredIdentifier ForEachStatement Block
- addTestSource('main(args) {for (S^ foo in args) {}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('args');
- assertNotSuggested('foo');
- assertNotSuggested('String');
- }
-
- Future<void> test_FormalParameterList() async {
- // FormalParameterList MethodDeclaration
- addTestSource('''
-foo() { }
-void bar() { }
-class A {a(^) { }}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('foo');
- assertNotSuggested('a');
- assertNotSuggested('A');
- assertNotSuggested('String');
- assertNotSuggested('identical');
- assertNotSuggested('bar');
- }
-
- Future<void> test_ForStatement_body() async {
- // Block ForStatement
- addTestSource('main(args) {for (int i; i < 10; ++i) {^}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('i');
- assertNotSuggested('Object');
- }
-
- Future<void> test_ForStatement_condition() async {
- // SimpleIdentifier ForStatement
- addTestSource('main() {for (int index = 0; i^)}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('index');
- }
-
- Future<void> test_ForStatement_initializer() async {
- // SimpleIdentifier ForStatement
- addTestSource('main() {List a; for (^)}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('Object');
- assertNotSuggested('int');
- }
-
- Future<void> test_ForStatement_updaters() async {
- // SimpleIdentifier ForStatement
- addTestSource('main() {for (int index = 0; index < 10; i^)}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('index');
- }
-
- Future<void> test_ForStatement_updaters_prefix_expression() async {
- // SimpleIdentifier PrefixExpression ForStatement
- addTestSource('''
-void bar() { }
-main() {for (int index = 0; index < 10; ++i^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('index');
- assertNotSuggested('main');
- assertNotSuggested('bar');
- }
-
- Future<void> test_function_parameters_mixed_required_and_named() async {
- addTestSource('''
-void m(x, {int y}) {}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_function_parameters_mixed_required_and_positional() async {
- addTestSource('''
-void m(x, [int y]) {}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_function_parameters_named() async {
- addTestSource('''
-void m({x, int y}) {}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_function_parameters_none() async {
- addTestSource('''
-void m() {}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_function_parameters_positional() async {
- addTestSource('''
-void m([x, int y]) {}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_function_parameters_required() async {
- addTestSource('''
-void m(x, int y) {}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_FunctionDeclaration_returnType_afterComment() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-/* */ ^ zoo(z) { } String name;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertNotSuggested('name');
- }
-
- Future<void> test_FunctionDeclaration_returnType_afterComment2() async {
- // FunctionDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-/** */ ^ zoo(z) { } String name;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertNotSuggested('name');
- }
-
- Future<void> test_FunctionDeclaration_returnType_afterComment3() async {
- // FunctionDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-/// some dartdoc
-class C2 { }
-^ zoo(z) { } String name;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertNotSuggested('name');
- }
-
- Future<void> test_FunctionExpression_body_function() async {
- // Block BlockFunctionBody FunctionExpression
- addTestSource('''
- void bar() { }
- String foo(List args) {x.then((R b) {^});}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('foo');
- assertNotSuggested('bar');
- assertNotSuggested('args');
- assertNotSuggested('b');
- assertNotSuggested('Object');
- }
-
- Future<void> test_IfStatement() async {
- // SimpleIdentifier IfStatement
- addTestSource('''
- class A {var b; X _c; foo() {A a; if (true) ^}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('Object');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('==');
- }
-
- Future<void> test_IfStatement_condition() async {
- // SimpleIdentifier IfStatement Block BlockFunctionBody
- addTestSource('''
-class A {int x; int y() => 0;}
-main(){var a; if (^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('main');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('Object');
- }
-
- Future<void> test_IfStatement_empty() async {
- // SimpleIdentifier IfStatement
- addTestSource('''
- class A {var b; X _c; foo() {A a; if (^) something}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('Object');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('==');
- }
-
- Future<void> test_IfStatement_invocation() async {
- // SimpleIdentifier PrefixIdentifier IfStatement
- addTestSource('''
-main() {var a; if (a.^) something}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('toString');
- assertNotSuggested('Object');
- assertNotSuggested('A');
- assertNotSuggested('==');
- }
-
- Future<void> test_ignore_symbol_being_completed() async {
- addTestSource('class MyClass { } main(MC^) { }');
- await computeSuggestions();
- assertNotSuggested('MyClass');
- assertNotSuggested('MC');
- }
-
- Future<void> test_ImportDirective_dart() async {
- // SimpleStringLiteral ImportDirective
- addTestSource('''
-import "dart^";
-main() {}''');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_inDartDoc_reference1() async {
- addTestSource('''
-/// The [^
-main(aaa, bbb) {}''');
- await computeSuggestions();
- assertNotSuggested('main');
- }
-
- Future<void> test_inDartDoc_reference2() async {
- addTestSource('''
-/// The [m^
-main(aaa, bbb) {}''');
- await computeSuggestions();
- assertNotSuggested('main');
- }
-
- Future<void> test_inDartDoc_reference3() async {
- addTestSource('''
-/// The [^]
-main(aaa, bbb) {}''');
- await computeSuggestions();
- assertNotSuggested('main');
- }
-
- Future<void> test_inDartDoc_reference4() async {
- addTestSource('''
-/// The [m^]
-main(aaa, bbb) {}''');
- await computeSuggestions();
- assertNotSuggested('main');
- }
-
- Future<void> test_IndexExpression() async {
- // ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-class B {int x;}
-class C {foo(){var f; {var x;} f[^]}}''');
- await computeSuggestions();
-
- assertNotSuggested('x');
- assertNotSuggested('f');
- assertNotSuggested('foo');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C');
- } else {
- assertNotSuggested('C');
- }
- assertNotSuggested('F2');
- assertNotSuggested('T2');
- assertNotSuggested('A');
- assertNotSuggested('F1');
- // TODO (danrubel) getter is being suggested instead of top level var
- //assertNotSuggested('T1');
- }
-
- Future<void> test_IndexExpression2() async {
- // SimpleIdentifier IndexExpression ExpressionStatement Block
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-class B {int x;}
-class C {foo(){var f; {var x;} f[T^]}}''');
- await computeSuggestions();
-
- // top level results are partially filtered based on first char
- assertNotSuggested('T2');
- // TODO (danrubel) getter is being suggested instead of top level var
- //assertNotSuggested('T1');
- }
-
- Future<void> test_InstanceCreationExpression() async {
- addTestSource('''
-class A {foo(){var f; {var x;}}}
-class B {B(this.x, [String boo]) { } int x;}
-class C {C.bar({boo: 'hoo', int z: 0}) { } }
-main() {new ^ String x = "hello";}''');
- await computeSuggestions();
- CompletionSuggestion suggestion;
-
- suggestion = assertSuggestConstructor('A', elemOffset: -1);
- expect(suggestion.element.parameters, '()');
- expect(suggestion.element.returnType, 'A');
- expect(suggestion.declaringType, 'A');
- expect(suggestion.parameterNames, hasLength(0));
- expect(suggestion.requiredParameterCount, 0);
- expect(suggestion.hasNamedParameters, false);
-
- suggestion = assertSuggestConstructor('B');
- expect(suggestion.element.parameters, '(int x, [String boo])');
- expect(suggestion.element.returnType, 'B');
- expect(suggestion.declaringType, 'B');
- expect(suggestion.parameterNames, hasLength(2));
- expect(suggestion.parameterNames[0], 'x');
- expect(suggestion.parameterTypes[0], 'int');
- expect(suggestion.parameterNames[1], 'boo');
- expect(suggestion.parameterTypes[1], 'String');
- expect(suggestion.requiredParameterCount, 1);
- expect(suggestion.hasNamedParameters, false);
-
- suggestion = assertSuggestConstructor('C.bar');
- expect(
- suggestion.element.parameters, '({dynamic boo = \'hoo\', int z = 0})');
- expect(suggestion.element.returnType, 'C');
- expect(suggestion.declaringType, 'C');
- expect(suggestion.parameterNames, hasLength(2));
- expect(suggestion.parameterNames[0], 'boo');
- expect(suggestion.parameterTypes[0], 'dynamic');
- expect(suggestion.parameterNames[1], 'z');
- expect(suggestion.parameterTypes[1], 'int');
- expect(suggestion.requiredParameterCount, 0);
- expect(suggestion.hasNamedParameters, true);
- }
-
- Future<void> test_InstanceCreationExpression_abstractClass() async {
- addTestSource('''
-abstract class A {
- A();
- A.generative();
- factory A.factory() => A();
-}
-
-main() {
- new ^;
-}''');
- await computeSuggestions();
-
- assertNotSuggested('A');
- assertNotSuggested('A.generative');
- assertSuggestConstructor('A.factory');
- }
-
- Future<void>
- test_InstanceCreationExpression_abstractClass_implicitConstructor() async {
- addTestSource('''
-abstract class A {}
-
-main() {
- new ^;
-}''');
- await computeSuggestions();
-
- assertNotSuggested('A');
- }
-
- Future<void>
- test_InstanceCreationExpression_assignment_expression_filter() async {
- addTestSource('''
-class A {} class B extends A {} class C implements A {} class D {}
-main() {
- A 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);
- assertSuggestConstructor('D', elemOffset: -1);
- }
-
- Future<void>
- test_InstanceCreationExpression_assignment_expression_filter2() async {
- addTestSource('''
-class A {} class B extends A {} class C implements A {} class D {}
-main() {
- A 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);
- assertSuggestConstructor('D', elemOffset: -1);
- }
-
- Future<void> test_InstanceCreationExpression_imported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-class A {A(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-import "dart:async";
-int T2;
-F2() { }
-class B {B(this.x, [String boo]) { } int x;}
-class C {foo(){var f; {var x;} new ^}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('Future');
- assertNotSuggested('A');
- assertSuggestConstructor('B');
- assertSuggestConstructor('C');
- assertNotSuggested('f');
- assertNotSuggested('x');
- assertNotSuggested('foo');
- assertNotSuggested('F1');
- assertNotSuggested('F2');
- assertNotSuggested('T1');
- assertNotSuggested('T2');
- }
-
- Future<void> test_InstanceCreationExpression_invocationArgument() async {
- addTestSource('''
-class A {} class B extends A {} class C {}
-void foo(A a) {}
-main() {
- foo(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);
- }
-
- Future<void>
- test_InstanceCreationExpression_invocationArgument_named() async {
- addTestSource('''
-class A {} class B extends A {} class C {}
-void foo({A a}) {}
-main() {
- foo(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);
- }
-
- Future<void> test_InstanceCreationExpression_unimported() async {
- // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
- addSource('/testAB.dart', 'class Foo { }');
- addTestSource('class C {foo(){new F^}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('Future');
- assertNotSuggested('Foo');
- }
-
- Future<void>
- test_InstanceCreationExpression_variable_declaration_filter() async {
- addTestSource('''
-class A {} class B extends A {} class C implements A {} class D {}
-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);
- assertSuggestConstructor('D', elemOffset: -1);
- }
-
- Future<void>
- test_InstanceCreationExpression_variable_declaration_filter2() async {
- addTestSource('''
-class A {} class B extends A {} class C implements A {} class D {}
-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);
- assertSuggestConstructor('D', elemOffset: -1);
- }
-
- Future<void> test_InterpolationExpression() async {
- // SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-main() {String name; print("hello \$^");}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C2');
- } else {
- assertNotSuggested('C2');
- }
- assertNotSuggested('name');
- }
-
- Future<void> test_InterpolationExpression_block() async {
- // SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-main() {String name; print("hello \${^}");}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C2');
- } else {
- assertNotSuggested('C2');
- }
- assertNotSuggested('name');
- }
-
- Future<void> test_InterpolationExpression_block2() async {
- // SimpleIdentifier InterpolationExpression StringInterpolation
- addTestSource('main() {String name; print("hello \${n^}");}');
- await computeSuggestions();
-
- assertNotSuggested('name');
- // top level results are partially filtered
- //assertNotSuggested('Object');
- }
-
- Future<void> test_InterpolationExpression_prefix_selector() async {
- // SimpleIdentifier PrefixedIdentifier InterpolationExpression
- addTestSource('main() {String name; print("hello \${name.^}");}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('length');
- assertNotSuggested('name');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_InterpolationExpression_prefix_selector2() async {
- // SimpleIdentifier PrefixedIdentifier InterpolationExpression
- addTestSource('main() {String name; print("hello \$name.^");}');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_InterpolationExpression_prefix_target() async {
- // SimpleIdentifier PrefixedIdentifier InterpolationExpression
- addTestSource('main() {String name; print("hello \${nam^e.length}");}');
- await computeSuggestions();
-
- assertNotSuggested('name');
- // top level results are partially filtered
- //assertNotSuggested('Object');
- assertNotSuggested('length');
- }
-
- Future<void> test_IsExpression() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
- addSource('/home/test/lib/b.dart', '''
-lib B;
-foo() { }
-class X {X.c(); X._d(); z() {}}''');
- addTestSource('''
-import "b.dart";
-class Y {Y.c(); Y._d(); z() {}}
-main() {var x; if (x is ^) { }}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('X');
- assertNotSuggested('Y');
- assertNotSuggested('x');
- assertNotSuggested('main');
- assertNotSuggested('foo');
- }
-
- Future<void> test_IsExpression_target() async {
- // IfStatement Block BlockFunctionBody
- addTestSource('''
-foo() { }
-void bar() { }
-class A {int x; int y() => 0;}
-main(){var a; if (^ is A)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('main');
- assertNotSuggested('foo');
- assertNotSuggested('bar');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('Object');
- }
-
- Future<void> test_IsExpression_type() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
- addTestSource('''
-class A {int x; int y() => 0;}
-main(){var a; if (a is ^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('main');
- assertNotSuggested('A');
- assertNotSuggested('Object');
- }
-
- Future<void> test_IsExpression_type_partial() async {
- // SimpleIdentifier TypeName IsExpression IfStatement
- addTestSource('''
-class A {int x; int y() => 0;}
-main(){var a; if (a is Obj^)}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 3);
- expect(replacementLength, 3);
- assertNotSuggested('a');
- assertNotSuggested('main');
- assertNotSuggested('A');
- assertNotSuggested('Object');
- }
-
- Future<void> test_keyword() async {
- addSource('/home/test/lib/b.dart', '''
-lib B;
-int newT1;
-int T1;
-nowIsIt() { }
-class X {factory X.c(); factory X._d(); z() {}}''');
- addTestSource('''
-import "b.dart";
-String newer() {}
-var m;
-main() {new^ X.c();}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 3);
- expect(replacementLength, 3);
- assertNotSuggested('c');
- assertNotSuggested('_d');
- // Imported suggestion are filtered by 1st character
- assertNotSuggested('nowIsIt');
- assertNotSuggested('T1');
- assertNotSuggested('newT1');
- assertNotSuggested('z');
- assertNotSuggested('m');
- assertNotSuggested('newer');
- }
-
- Future<void> test_Literal_list() async {
- // ']' ListLiteral ArgumentList MethodInvocation
- addTestSource('main() {var Some; print([^]);}');
- await computeSuggestions();
-
- assertNotSuggested('Some');
- assertNotSuggested('String');
- }
-
- Future<void> test_Literal_list2() async {
- // SimpleIdentifier ListLiteral ArgumentList MethodInvocation
- addTestSource('main() {var Some; print([S^]);}');
- await computeSuggestions();
-
- assertNotSuggested('Some');
- assertNotSuggested('String');
- }
-
- Future<void> test_Literal_string() async {
- // SimpleStringLiteral ExpressionStatement Block
- addTestSource('class A {a() {"hel^lo"}}');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_localVariableDeclarationName() async {
- addTestSource('main() {String m^}');
- await computeSuggestions();
-
- assertNotSuggested('main');
- assertNotSuggested('min');
- }
-
- Future<void> test_MapLiteralEntry() async {
- // MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-foo = {^''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C2');
- } else {
- assertNotSuggested('C2');
- }
- }
-
- Future<void> test_MapLiteralEntry1() async {
- // MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-foo = {T^''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('T1');
- assertNotSuggested('T2');
- }
-
- Future<void> test_MapLiteralEntry2() async {
- // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-foo = {7:T^};''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('T1');
- assertNotSuggested('T2');
- }
-
- Future<void> test_method_parameters_mixed_required_and_named() async {
- addTestSource('''
-class A {
- void m(x, {int y}) {}
-}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_method_parameters_mixed_required_and_positional() async {
- addTestSource('''
-class A {
- void m(x, [int y]) {}
-}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_method_parameters_named() async {
- addTestSource('''
-class A {
- void m({x, int y}) {}
-}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_method_parameters_none() async {
- addTestSource('''
-class A {
- void m() {}
-}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_method_parameters_positional() async {
- addTestSource('''
-class A {
- void m([x, int y]) {}
-}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_method_parameters_required() async {
- addTestSource('''
-class A {
- void m(x, int y) {}
-}
-class B extends A {
- main() {^}
-}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_MethodDeclaration_body_getters() async {
- // Block BlockFunctionBody MethodDeclaration
- addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- }
-
- Future<void> test_MethodDeclaration_body_static() async {
- // Block BlockFunctionBody MethodDeclaration
- addSource('/testC.dart', '''
-class C {
- c1() {}
- var c2;
- static c3() {}
- static var c4;}''');
- addTestSource('''
-import "testC.dart";
-class B extends C {
- b1() {}
- var b2;
- static b3() {}
- static var b4;}
-class A extends B {
- a1() {}
- var a2;
- static a3() {}
- static var a4;
- static a() {^}}''');
- await computeSuggestions();
-
- assertNotSuggested('a1');
- assertNotSuggested('a2');
- assertNotSuggested('a3');
- assertNotSuggested('a4');
- assertNotSuggested('b1');
- assertNotSuggested('b2');
- assertNotSuggested('b3');
- assertNotSuggested('b4');
- assertNotSuggested('c1');
- assertNotSuggested('c2');
- assertNotSuggested('c3');
- assertNotSuggested('c4');
- }
-
- Future<void> test_MethodDeclaration_members() async {
- // Block BlockFunctionBody MethodDeclaration
- addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
-
- assertNotSuggested('_a');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('bool');
- }
-
- Future<void> test_MethodDeclaration_parameters_named() async {
- // Block BlockFunctionBody MethodDeclaration
- addTestSource('class A {@deprecated Z a(X x, _, b, {y: boo}) {^}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('a');
- assertNotSuggested('x');
- assertNotSuggested('y');
- assertNotSuggested('b');
- assertNotSuggested('int');
- assertNotSuggested('_');
- }
-
- Future<void> test_MethodDeclaration_parameters_positional() async {
- // Block BlockFunctionBody MethodDeclaration
- addTestSource('''
-foo() { }
-void bar() { }
-class A {Z a(X x, [int y=1]) {^}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('foo');
- assertNotSuggested('bar');
- assertNotSuggested('a');
- assertNotSuggested('x');
- assertNotSuggested('y');
- assertNotSuggested('String');
- }
-
- Future<void> test_MethodDeclaration_returnType() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 {^ zoo(z) { } String name; }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertNotSuggested('name');
- }
-
- Future<void> test_MethodDeclaration_returnType_afterComment() async {
- // ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 {/* */ ^ zoo(z) { } String name; }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertNotSuggested('name');
- }
-
- Future<void> test_MethodDeclaration_returnType_afterComment2() async {
- // MethodDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 {/** */ ^ zoo(z) { } String name; }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertNotSuggested('name');
- }
-
- Future<void> test_MethodDeclaration_returnType_afterComment3() async {
- // MethodDeclaration ClassDeclaration CompilationUnit
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
- addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 {
- /// some dartdoc
- ^ zoo(z) { } String name; }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertNotSuggested('T2');
- assertNotSuggested('F2');
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertNotSuggested('name');
- }
-
- Future<void> test_MethodInvocation_no_semicolon() async {
- // MethodInvocation ExpressionStatement Block
- addTestSource('''
-main() { }
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- var b; X _c;
- X get d => new A();get _e => new A();
- // no semicolon between completion point and next statement
- set s1(I x) {} set _s2(I x) {x.^ m(null);}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('a');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_missing_params_constructor() async {
- addTestSource('class C1{C1{} main(){C^}}');
- await computeSuggestions();
- }
-
- Future<void> test_missing_params_function() async {
- addTestSource('int f1{} main(){f^}');
- await computeSuggestions();
- }
-
- Future<void> test_missing_params_method() async {
- addTestSource('class C1{int f1{} main(){f^}}');
- await computeSuggestions();
- }
-
- Future<void> test_new_instance() async {
- addTestSource('import "dart:math"; class A {x() {new Random().^}}');
- await computeSuggestions();
-
- assertNotSuggested('nextBool');
- assertNotSuggested('nextDouble');
- assertNotSuggested('nextInt');
- assertNotSuggested('Random');
- assertNotSuggested('Object');
- assertNotSuggested('A');
- }
-
- Future<void> test_overrides() async {
- addTestSource('''
-class A {m() {}}
-class B extends A {m() {^}}
-''');
- await computeSuggestions();
- assertNotSuggested('m');
- }
-
- Future<void> test_parameterName_excludeTypes() async {
- addTestSource('m(int ^) {}');
- await computeSuggestions();
-
- assertNotSuggested('int');
- assertNotSuggested('bool');
- }
-
- Future<void> test_partFile_TypeName() async {
- // SimpleIdentifier TypeName ConstructorName
- addSource('/home/test/lib/b.dart', '''
-lib B;
-int T1;
-F1() { }
-class X {X.c(); X._d(); z() {}}''');
- addSource('/home/test/lib/a.dart', '''
-library libA;
-import "b.dart";
-part "${resourceProvider.pathContext.basename(testFile)}";
-class A { }
-var m;''');
- addTestSource('''
-part of libA;
-class B { B.bar(int x); }
-main() {new ^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertSuggestConstructor('B.bar');
- assertNotSuggested('Object');
- assertNotSuggested('X.c');
- assertNotSuggested('X._d');
- assertNotSuggested('A');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('_d');
- assertNotSuggested('z');
- assertNotSuggested('m');
- }
-
- Future<void> test_partFile_TypeName2() async {
- // SimpleIdentifier TypeName ConstructorName
- addSource('/home/test/lib/b.dart', '''
-lib B;
-int T1;
-F1() { }
-class X {X.c(); X._d(); z() {}}''');
- addSource('/home/test/lib/a.dart', '''
-part of libA;
-class B { }''');
- addTestSource('''
-library libA;
-import "b.dart";
-part "a.dart";
-class A { A({String boo: 'hoo'}) { } }
-main() {new ^}
-var m;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertSuggestConstructor('A');
- assertNotSuggested('Object');
- assertNotSuggested('X.c');
- assertNotSuggested('X._d');
- assertNotSuggested('B');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('_d');
- assertNotSuggested('z');
- assertNotSuggested('m');
- }
-
- Future<void> test_PrefixedIdentifier_class_const() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
- addSource('/home/test/lib/b.dart', '''
-lib B;
-class I {
- static const scI = 'boo';
- X get f => new A();
- get _g => new A();}
-class B implements I {
- static const int scB = 12;
- var b; X _c;
- X get d => new A();get _e => new A();
- set s1(I x) {} set _s2(I x) {}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- addTestSource('''
-import "b.dart";
-class A extends B {
- static const String scA = 'foo';
- w() { }}
-main() {A.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by StaticMemberContributor
- assertNotSuggested('scA');
- assertNotSuggested('scB');
- assertNotSuggested('scI');
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('a');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('w');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_PrefixedIdentifier_class_imported() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
-lib B;
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- static const int sc = 12;
- @deprecated var b; X _c;
- X get d => new A();get _e => new A();
- set s1(I x) {} set _s2(I x) {}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- addTestSource('''
-import "b.dart";
-main() {A a; a.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('sc');
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('a');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_PrefixedIdentifier_class_local() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('''
-main() {A a; a.^}
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- static const int sc = 12;
- var b; X _c;
- X get d => new A();get _e => new A();
- set s1(I x) {} set _s2(I x) {}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('sc');
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('a');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_PrefixedIdentifier_getter() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('String get g => "one"; f() {g.^}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_library() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
-lib B;
-var T1;
-class X { }
-class Y { }''');
- addTestSource('''
-import "b.dart" as b;
-var T2;
-class A { }
-main() {b.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by LibraryMemberContributor
- assertNotSuggested('X');
- assertNotSuggested('Y');
- assertNotSuggested('T1');
- assertNotSuggested('T2');
- assertNotSuggested('Object');
- assertNotSuggested('b');
- assertNotSuggested('A');
- assertNotSuggested('==');
- }
-
- Future<void> test_PrefixedIdentifier_library_typesOnly() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
- addSource('/home/test/lib/b.dart', '''
-lib B;
-var T1;
-class X { }
-class Y { }''');
- addTestSource('''
-import "b.dart" as b;
-var T2;
-class A { }
-foo(b.^ f) {}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by LibraryMemberContributor
- assertNotSuggested('X');
- assertNotSuggested('Y');
- assertNotSuggested('T1');
- assertNotSuggested('T2');
- assertNotSuggested('Object');
- assertNotSuggested('b');
- assertNotSuggested('A');
- assertNotSuggested('==');
- }
-
- Future<void> test_PrefixedIdentifier_library_typesOnly2() async {
- // SimpleIdentifier PrefixedIdentifier TypeName
- addSource('/home/test/lib/b.dart', '''
-lib B;
-var T1;
-class X { }
-class Y { }''');
- addTestSource('''
-import "b.dart" as b;
-var T2;
-class A { }
-foo(b.^) {}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by LibraryMemberContributor
- assertNotSuggested('X');
- assertNotSuggested('Y');
- assertNotSuggested('T1');
- assertNotSuggested('T2');
- assertNotSuggested('Object');
- assertNotSuggested('b');
- assertNotSuggested('A');
- assertNotSuggested('==');
- }
-
- Future<void> test_PrefixedIdentifier_parameter() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/b.dart', '''
-lib B;
-class _W {M y; var _z;}
-class X extends _W {}
-class M{}''');
- addTestSource('''
-import "b.dart";
-foo(X x) {x.^}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('y');
- assertNotSuggested('_z');
- assertNotSuggested('==');
- }
-
- Future<void> test_PrefixedIdentifier_prefix() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
-class A {static int bar = 10;}
-_B() {}''');
- addTestSource('''
-import "a.dart";
-class X {foo(){A^.bar}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('A');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('X');
- } else {
- assertNotSuggested('X');
- }
- assertNotSuggested('foo');
- assertNotSuggested('bar');
- assertNotSuggested('_B');
- }
-
- Future<void> test_PrefixedIdentifier_propertyAccess() async {
- // PrefixedIdentifier ExpressionStatement Block BlockFunctionBody
- addTestSource('class A {String x; int get foo {x.^}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('isEmpty');
- assertNotSuggested('compareTo');
- }
-
- Future<void> test_PrefixedIdentifier_propertyAccess_newStmt() async {
- // PrefixedIdentifier ExpressionStatement Block BlockFunctionBody
- addTestSource('class A {String x; int get foo {x.^ int y = 0;}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('isEmpty');
- assertNotSuggested('compareTo');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_const() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('const String g = "hello"; f() {g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_field() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('class A {String g; f() {g.^ int y = 0;}}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_function() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('String g() => "one"; f() {g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_functionTypeAlias() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('typedef String g(); f() {g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_getter() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('String get g => "one"; f() {g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_local_typed() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('f() {String g; g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_local_untyped() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('f() {var g = "hello"; g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_method() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('class A {String g() {}; f() {g.^ int y = 0;}}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_param() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('class A {f(String g) {g.^ int y = 0;}}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_param2() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('f(String g) {g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_PrefixedIdentifier_trailingStmt_topLevelVar() async {
- // SimpleIdentifier PrefixedIdentifier ExpressionStatement
- addTestSource('String g; f() {g.^ int y = 0;}');
- await computeSuggestions();
-
- assertNotSuggested('length');
- }
-
- Future<void> test_prioritization() async {
- addTestSource('main() {var ab; var _ab; ^}');
- await computeSuggestions();
- assertNotSuggested('ab');
- assertNotSuggested('_ab');
- }
-
- Future<void> test_prioritization_private() async {
- addTestSource('main() {var ab; var _ab; _^}');
- await computeSuggestions();
- assertNotSuggested('ab');
- assertNotSuggested('_ab');
- }
-
- Future<void> test_prioritization_public() async {
- addTestSource('main() {var ab; var _ab; a^}');
- await computeSuggestions();
- assertNotSuggested('ab');
- assertNotSuggested('_ab');
- }
-
- Future<void> test_PropertyAccess_expression() async {
- // SimpleIdentifier MethodInvocation PropertyAccess ExpressionStatement
- addTestSource('class A {a() {"hello".to^String().length}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 2);
- expect(replacementLength, 8);
- assertNotSuggested('length');
- assertNotSuggested('A');
- assertNotSuggested('a');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_PropertyAccess_noTarget() async {
- // SimpleIdentifier PropertyAccess ExpressionStatement
- addSource('/testAB.dart', 'class Foo { }');
- addTestSource('class C {foo(){.^}}');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_PropertyAccess_noTarget2() async {
- // SimpleIdentifier PropertyAccess ExpressionStatement
- addSource('/testAB.dart', 'class Foo { }');
- addTestSource('main() {.^}');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_PropertyAccess_selector() async {
- // SimpleIdentifier PropertyAccess ExpressionStatement Block
- addTestSource('class A {a() {"hello".length.^}}');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('isEven');
- assertNotSuggested('A');
- assertNotSuggested('a');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_shadowed_name() async {
- addTestSource('var a; class A { var a; m() { ^ } }');
- await computeSuggestions();
- assertNotSuggested('a');
- }
-
- Future<void> test_SwitchStatement_c() async {
- // SwitchStatement Block BlockFunctionBody MethodDeclaration
- addTestSource('class A {String g(int x) {switch(x) {c^}}}');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_SwitchStatement_case() async {
- // SwitchStatement Block BlockFunctionBody MethodDeclaration
- addTestSource('class A {String g(int x) {var t; switch(x) {case 0: ^}}}');
- await computeSuggestions();
-
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('A');
- } else {
- assertNotSuggested('A');
- }
- assertNotSuggested('g');
- assertNotSuggested('t');
- assertNotSuggested('String');
- }
-
- Future<void> test_SwitchStatement_empty() async {
- // SwitchStatement Block BlockFunctionBody MethodDeclaration
- addTestSource('class A {String g(int x) {switch(x) {^}}}');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_ThisExpression_block() async {
- // MethodInvocation ExpressionStatement Block
- addTestSource('''
-main() { }
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- A() {}
- A.z() {}
- var b; X _c;
- X get d => new A();get _e => new A();
- // no semicolon between completion point and next statement
- set s1(I x) {} set _s2(I x) {this.^ m(null);}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('z');
- assertNotSuggested('I');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_ThisExpression_constructor() async {
- // MethodInvocation ExpressionStatement Block
- addTestSource('''
-main() { }
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- A() {this.^}
- A.z() {}
- var b; X _c;
- X get d => new A();get _e => new A();
- // no semicolon between completion point and next statement
- set s1(I x) {} set _s2(I x) {m(null);}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('z');
- assertNotSuggested('I');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_ThisExpression_constructor_param() async {
- // SimpleIdentifier FieldFormalParameter FormalParameterList
- addTestSource('''
-main() { }
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- A(this.^) {}
- A.z() {}
- var b; X _c; static sb;
- X get d => new A();get _e => new A();
- // no semicolon between completion point and next statement
- set s1(I x) {} set _s2(I x) {m(null);}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Contributed by FieldFormalConstructorContributor
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('sb');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('z');
- assertNotSuggested('I');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_ThisExpression_constructor_param2() async {
- // SimpleIdentifier FieldFormalParameter FormalParameterList
- addTestSource('''
-main() { }
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- A(this.b^) {}
- A.z() {}
- var b; X _c;
- X get d => new A();get _e => new A();
- // no semicolon between completion point and next statement
- set s1(I x) {} set _s2(I x) {m(null);}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- // Contributed by FieldFormalConstructorContributor
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('z');
- assertNotSuggested('I');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_ThisExpression_constructor_param3() async {
- // SimpleIdentifier FieldFormalParameter FormalParameterList
- addTestSource('''
-main() { }
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- A(this.^b) {}
- A.z() {}
- var b; X _c;
- X get d => new A();get _e => new A();
- // no semicolon between completion point and next statement
- set s1(I x) {} set _s2(I x) {m(null);}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 1);
- // Contributed by FieldFormalConstructorContributor
- assertNotSuggested('b');
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('z');
- assertNotSuggested('I');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_ThisExpression_constructor_param4() async {
- // SimpleIdentifier FieldFormalParameter FormalParameterList
- addTestSource('''
-main() { }
-class I {X get f => new A();get _g => new A();}
-class A implements I {
- A(this.b, this.^) {}
- A.z() {}
- var b; X _c;
- X get d => new A();get _e => new A();
- // no semicolon between completion point and next statement
- set s1(I x) {} set _s2(I x) {m(null);}
- m(X x) {} I _n(X x) {}}
-class X{}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('b');
- // Contributed by FieldFormalConstructorContributor
- assertNotSuggested('_c');
- assertNotSuggested('d');
- assertNotSuggested('_e');
- assertNotSuggested('f');
- assertNotSuggested('_g');
- assertNotSuggested('m');
- assertNotSuggested('_n');
- assertNotSuggested('s1');
- assertNotSuggested('_s2');
- assertNotSuggested('z');
- assertNotSuggested('I');
- assertNotSuggested('A');
- assertNotSuggested('X');
- assertNotSuggested('Object');
- assertNotSuggested('==');
- }
-
- Future<void> test_TopLevelVariableDeclaration_typed_name() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // TopLevelVariableDeclaration
- addTestSource('class A {} B ^');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_TopLevelVariableDeclaration_untyped_name() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // TopLevelVariableDeclaration
- addTestSource('class A {} var ^');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_TypeArgumentList() async {
- // SimpleIdentifier BinaryExpression ExpressionStatement
- addSource('/home/test/lib/a.dart', '''
-class C1 {int x;}
-F1() => 0;
-typedef String T1(int blat);''');
- addTestSource('''
-import "a.dart";'
-class C2 {int x;}
-F2() => 0;
-typedef int T2(int blat);
-class C<E> {}
-main() { C<^> c; }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('C1');
- assertNotSuggested('T1');
- assertNotSuggested('C2');
- assertNotSuggested('T2');
- assertNotSuggested('F1');
- assertNotSuggested('F2');
- }
-
- Future<void> test_TypeArgumentList2() async {
- // TypeName TypeArgumentList TypeName
- addSource('/home/test/lib/a.dart', '''
-class C1 {int x;}
-F1() => 0;
-typedef String T1(int blat);''');
- addTestSource('''
-import "a.dart";'
-class C2 {int x;}
-F2() => 0;
-typedef int T2(int blat);
-class C<E> {}
-main() { C<C^> c; }''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset - 1);
- expect(replacementLength, 1);
- assertNotSuggested('C1');
- assertNotSuggested('C2');
- }
-
- Future<void> test_VariableDeclaration_name() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // VariableDeclarationStatement Block
- addSource('/home/test/lib/b.dart', '''
-lib B;
-foo() { }
-class _B { }
-class X {X.c(); X._d(); z() {}}''');
- addTestSource('''
-import "b.dart";
-class Y {Y.c(); Y._d(); z() {}}
-main() {var ^}''');
- await computeSuggestions();
-
- assertNoSuggestions();
- }
-
- Future<void> test_VariableDeclarationList_final() async {
- // VariableDeclarationList VariableDeclarationStatement Block
- addTestSource('main() {final ^} class C { }');
- await computeSuggestions();
-
- assertNotSuggested('Object');
- assertNotSuggested('C');
- assertNotSuggested('==');
- }
-
- Future<void> test_VariableDeclarationStatement_RHS() async {
- // SimpleIdentifier VariableDeclaration VariableDeclarationList
- // VariableDeclarationStatement
- addSource('/home/test/lib/b.dart', '''
-lib B;
-foo() { }
-class _B { }
-class X {X.c(); X._d(); z() {}}''');
- addTestSource('''
-import "b.dart";
-class Y {Y.c(); Y._d(); z() {}}
-class C {bar(){var f; {var x;} var e = ^}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('X');
- assertNotSuggested('_B');
- assertNotSuggested('Y');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C');
- } else {
- assertNotSuggested('C');
- }
- assertNotSuggested('f');
- assertNotSuggested('x');
- assertNotSuggested('e');
- }
-
- Future<void> test_VariableDeclarationStatement_RHS_missing_semicolon() async {
- // VariableDeclaration VariableDeclarationList
- // VariableDeclarationStatement
- addSource('/home/test/lib/b.dart', '''
-lib B;
-foo1() { }
-void bar1() { }
-class _B { }
-class X {X.c(); X._d(); z() {}}''');
- addTestSource('''
-import "b.dart";
-foo2() { }
-void bar2() { }
-class Y {Y.c(); Y._d(); z() {}}
-class C {bar(){var f; {var x;} var e = ^ var g}}''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('X');
- assertNotSuggested('foo1');
- assertNotSuggested('bar1');
- assertNotSuggested('foo2');
- assertNotSuggested('bar2');
- assertNotSuggested('_B');
- assertNotSuggested('Y');
- if (suggestConstructorsWithoutNew) {
- assertSuggestConstructor('C');
- } else {
- assertNotSuggested('C');
- }
- assertNotSuggested('f');
- assertNotSuggested('x');
- assertNotSuggested('e');
- }
-}
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 88f43e4..b6e17f7 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
@@ -2325,6 +2325,24 @@
assertSuggestEnumConst('F.four');
}
+ Future<void> test_enum_shadowed() async {
+ addTestSource('''
+enum E { one, two }
+main() {
+ int E = 0;
+ ^
+}
+''');
+ await computeSuggestions();
+
+ assertSuggest('E', elemKind: ElementKind.LOCAL_VARIABLE);
+
+ // Enum and all its constants are shadowed by the local variable.
+ assertNotSuggested('E', elemKind: ElementKind.ENUM);
+ assertNotSuggested('E.one', elemKind: ElementKind.ENUM_CONSTANT);
+ assertNotSuggested('E.two', elemKind: ElementKind.ENUM_CONSTANT);
+ }
+
Future<void> test_expression_localVariable() async {
addTestSource('''
void f() {
@@ -2565,7 +2583,24 @@
assertNotSuggested('x');
}
- Future<void> test_extensionDeclaration_unnamed() async {
+ Future<void> test_ExtensionDeclaration_shadowed() async {
+ // ExtensionDeclaration CompilationUnit
+ addTestSource('''
+extension E on int {
+ void m() {
+ int E = 1;
+ ^
+ }
+}
+''');
+ await computeSuggestions();
+
+ assertNotSuggested('E', elemKind: ElementKind.EXTENSION);
+ assertSuggest('E', elemKind: ElementKind.LOCAL_VARIABLE);
+ }
+
+ Future<void> test_ExtensionDeclaration_unnamed() async {
+ // ExtensionDeclaration CompilationUnit
addTestSource('''
extension on String {
void something() => this.^
@@ -2599,6 +2634,23 @@
assertNoSuggestions();
}
+ Future<void> test_FieldDeclaration_shadowed() async {
+ // SimpleIdentifier VariableDeclaration VariableDeclarationList
+ // FieldDeclaration
+ addTestSource('''
+class A {
+ int foo;
+ void bar() {
+ int foo; ^
+ }
+}
+''');
+ await computeSuggestions();
+
+ assertNotSuggested('foo', elemKind: ElementKind.FIELD);
+ assertSuggest('foo', elemKind: ElementKind.LOCAL_VARIABLE);
+ }
+
Future<void> test_FieldFormalParameter_in_non_constructor() async {
// SimpleIdentifier FieldFormalParameter FormalParameterList
addTestSource('class A {B(this.^foo) {}}');
@@ -3035,6 +3087,20 @@
assertNotSuggested('name');
}
+ Future<void> test_FunctionDeclaration_shadowed() async {
+ // Block BlockFunctionBody FunctionDeclaration
+ addTestSource('''
+void bar() {
+ int bar = 1;
+ ^
+}
+''');
+ await computeSuggestions();
+
+ assertNotSuggested('bar', elemKind: ElementKind.FUNCTION);
+ assertSuggest('bar', elemKind: ElementKind.LOCAL_VARIABLE);
+ }
+
Future<void> test_FunctionExpression_body_function() async {
// Block BlockFunctionBody FunctionExpression
addTestSource('''
@@ -3304,8 +3370,115 @@
class C {C.bar({boo: 'hoo', int z: 0}) { } }
main() {new ^ String x = "hello";}''');
await computeSuggestions();
- // Suggested by LocalConstructorContributor
- assertNoSuggestions();
+ CompletionSuggestion suggestion;
+
+ suggestion = assertSuggestConstructor('A', elemOffset: -1);
+ expect(suggestion.element.parameters, '()');
+ expect(suggestion.element.returnType, 'A');
+ expect(suggestion.declaringType, 'A');
+ expect(suggestion.parameterNames, hasLength(0));
+ expect(suggestion.requiredParameterCount, 0);
+ expect(suggestion.hasNamedParameters, false);
+
+ suggestion = assertSuggestConstructor('B');
+ expect(suggestion.element.parameters, '(int x, [String boo])');
+ expect(suggestion.element.returnType, 'B');
+ expect(suggestion.declaringType, 'B');
+ expect(suggestion.parameterNames, hasLength(2));
+ expect(suggestion.parameterNames[0], 'x');
+ expect(suggestion.parameterTypes[0], 'int');
+ expect(suggestion.parameterNames[1], 'boo');
+ expect(suggestion.parameterTypes[1], 'String');
+ expect(suggestion.requiredParameterCount, 1);
+ expect(suggestion.hasNamedParameters, false);
+
+ suggestion = assertSuggestConstructor('C.bar');
+ expect(
+ suggestion.element.parameters, '({dynamic boo = \'hoo\', int z = 0})');
+ expect(suggestion.element.returnType, 'C');
+ expect(suggestion.declaringType, 'C');
+ expect(suggestion.parameterNames, hasLength(2));
+ expect(suggestion.parameterNames[0], 'boo');
+ expect(suggestion.parameterTypes[0], 'dynamic');
+ expect(suggestion.parameterNames[1], 'z');
+ expect(suggestion.parameterTypes[1], 'int');
+ expect(suggestion.requiredParameterCount, 0);
+ expect(suggestion.hasNamedParameters, true);
+ }
+
+ Future<void> test_InstanceCreationExpression_abstractClass() async {
+ addTestSource('''
+abstract class A {
+ A();
+ A.generative();
+ factory A.factory() => A();
+}
+
+main() {
+ new ^;
+}''');
+ await computeSuggestions();
+
+ assertNotSuggested('A');
+ assertNotSuggested('A.generative');
+ assertSuggestConstructor('A.factory');
+ }
+
+ Future<void>
+ test_InstanceCreationExpression_abstractClass_implicitConstructor() async {
+ addTestSource('''
+abstract class A {}
+
+main() {
+ new ^;
+}''');
+ await computeSuggestions();
+
+ assertNotSuggested('A');
+ }
+
+ Future<void>
+ test_InstanceCreationExpression_assignment_expression_filter() async {
+ addTestSource('''
+class A {} class B extends A {} class C implements A {} class D {}
+main() {
+ A 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);
+ assertSuggestConstructor('D', elemOffset: -1);
+ }
+
+ Future<void>
+ test_InstanceCreationExpression_assignment_expression_filter2() async {
+ addTestSource('''
+class A {} class B extends A {} class C implements A {} class D {}
+main() {
+ A 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);
+ assertSuggestConstructor('D', elemOffset: -1);
}
Future<void> test_InstanceCreationExpression_imported() async {
@@ -3328,9 +3501,8 @@
assertNotSuggested('Object');
assertNotSuggested('Future');
assertNotSuggested('A');
- // Suggested by LocalConstructorContributor
- assertNotSuggested('B');
- assertNotSuggested('C');
+ assertSuggestConstructor('B');
+ assertSuggestConstructor('C');
assertNotSuggested('f');
assertNotSuggested('x');
assertNotSuggested('foo');
@@ -3340,9 +3512,46 @@
assertNotSuggested('T2');
}
+ Future<void> test_InstanceCreationExpression_invocationArgument() async {
+ addTestSource('''
+class A {} class B extends A {} class C {}
+void foo(A a) {}
+main() {
+ foo(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);
+ }
+
+ Future<void>
+ test_InstanceCreationExpression_invocationArgument_named() async {
+ addTestSource('''
+class A {} class B extends A {} class C {}
+void foo({A a}) {}
+main() {
+ foo(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);
+ }
+
Future<void> test_InstanceCreationExpression_unimported() async {
// SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
- addSource('/home/test/lib/ab.dart', 'class Foo { }');
+ addSource('/testAB.dart', 'class Foo { }');
addTestSource('class C {foo(){new F^}}');
await computeSuggestions();
@@ -3352,35 +3561,46 @@
assertNotSuggested('Foo');
}
- Future<void> test_InterpolationExpression() async {
- // SimpleIdentifier InterpolationExpression StringInterpolation
- addSource('/home/test/lib/a.dart', '''
-int T1;
-F1() { }
-typedef D1();
-class C1 {C1(this.x) { } int x;}''');
+ Future<void>
+ test_InstanceCreationExpression_variable_declaration_filter() async {
addTestSource('''
-import "a.dart";
-int T2;
-F2() { }
-typedef D2();
-class C2 { }
-main() {String name; print("hello \$^");}''');
+class A {} class B extends A {} class C implements A {} class D {}
+main() {
+ A a = new ^
+}''');
await computeSuggestions();
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- assertNotSuggested('Object');
- assertNotSuggested('T1');
- assertNotSuggested('F1');
- assertNotSuggested('D1');
- assertNotSuggested('C1');
- assertSuggestTopLevelVar('T2', 'int',
- relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
- assertSuggestFunction('F2', null, relevance: DART_RELEVANCE_LOCAL_FUNCTION);
- assertNotSuggested('D2');
- assertNotSuggested('C2');
- assertSuggestLocalVariable('name', 'String');
+ 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);
+ assertSuggestConstructor('D', elemOffset: -1);
+ }
+
+ Future<void>
+ test_InstanceCreationExpression_variable_declaration_filter2() async {
+ addTestSource('''
+class A {} class B extends A {} class C implements A {} class D {}
+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);
+ assertSuggestConstructor('D', elemOffset: -1);
}
Future<void> test_InterpolationExpression_block() async {
@@ -3627,6 +3847,97 @@
assertNoSuggestions();
}
+ Future<void> test_localConstructor() async {
+ addMetaPackage();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+class A {
+ A(int bar, {bool boo, @required int baz});
+ baz() {
+ new ^
+ }
+}''');
+ await computeSuggestions();
+ assertSuggestConstructor('A', defaultArgListString: 'bar, baz: null');
+ }
+
+ Future<void> test_localConstructor2() async {
+ addMetaPackage();
+ addTestSource('''class A {A.named();} main() {^}}''');
+ await computeSuggestions();
+ assertSuggestConstructor('A.named');
+ }
+
+ Future<void> test_localConstructor_abstract() async {
+ addMetaPackage();
+ addTestSource('''
+abstract class A {
+ A();
+ baz() {
+ ^
+ }
+}''');
+ await computeSuggestions();
+ assertNotSuggested('A', elemKind: ElementKind.CONSTRUCTOR);
+ }
+
+ Future<void> test_localConstructor_defaultConstructor() async {
+ addMetaPackage();
+ addTestSource('''class A {} main() {^}}''');
+ await computeSuggestions();
+ assertSuggestConstructor('A');
+ }
+
+ Future<void> test_localConstructor_factory() async {
+ addMetaPackage();
+ addTestSource('''
+abstract class A {
+ factory A();
+ baz() {
+ ^
+ }
+}''');
+ await computeSuggestions();
+ assertSuggestConstructor('A');
+ }
+
+ Future<void> test_localConstructor_optionalNew() async {
+ addMetaPackage();
+ addTestSource('''
+import 'package:meta/meta.dart';
+
+class A {
+ A(int bar, {bool boo, @required int baz});
+ baz() {
+ ^
+ }
+}''');
+ await computeSuggestions();
+ assertSuggestConstructor('A', defaultArgListString: 'bar, baz: null');
+ }
+
+ Future<void> test_localConstructor_shadowed() async {
+ addTestSource('''
+class A {
+ A();
+ A.named();
+}
+main() {
+ int A = 0;
+ ^
+}
+''');
+ await computeSuggestions();
+
+ assertSuggest('A');
+
+ // Class and all its constructors are shadowed by the local variable.
+ assertNotSuggested('A', elemKind: ElementKind.CLASS);
+ assertNotSuggested('A', elemKind: ElementKind.CONSTRUCTOR);
+ assertNotSuggested('A.named', elemKind: ElementKind.CONSTRUCTOR);
+ }
+
Future<void> test_localVariableDeclarationName() async {
addTestSource('main() {String m^}');
await computeSuggestions();
@@ -4113,6 +4424,24 @@
assertNotSuggested('name');
}
+ Future<void> test_MethodDeclaration_shadowed() async {
+ // MethodDeclaration ClassDeclaration CompilationUnit
+ addTestSource('''
+class A {
+ void foo() {}
+ void bar(List list) {
+ for (var foo in list) {
+ ^
+ }
+ }
+}
+''');
+ await computeSuggestions();
+
+ assertNotSuggested('foo', elemKind: ElementKind.METHOD);
+ assertSuggest('foo', elemKind: ElementKind.LOCAL_VARIABLE);
+ }
+
Future<void> test_MethodInvocation_no_semicolon() async {
// MethodInvocation ExpressionStatement Block
addTestSource('''
@@ -4161,7 +4490,7 @@
await computeSuggestions();
}
- Future<void> test_mixinDeclaration_body() async {
+ Future<void> test_MixinDeclaration_body() async {
// MixinDeclaration CompilationUnit
addSource('/home/test/lib/b.dart', '''
class B { }''');
@@ -4190,7 +4519,8 @@
assertNotSuggested('x');
}
- Future<void> test_mixinDeclaration_method_access() async {
+ Future<void> test_MixinDeclaration_method_access() async {
+ // MixinDeclaration CompilationUnit
addTestSource(r'''
class A { }
@@ -4203,7 +4533,8 @@
assertSuggestMethod('_x', 'X', 'int');
}
- Future<void> test_mixinDeclaration_property_access() async {
+ Future<void> test_MixinDeclaration_property_access() async {
+ // MixinDeclaration CompilationUnit
addTestSource(r'''
class A { }
@@ -4216,6 +4547,22 @@
assertSuggestField('_x', 'int');
}
+ Future<void> test_MixinDeclaration_shadowed() async {
+ // MixinDeclaration CompilationUnit
+ addTestSource('''
+mixin foo on Object {
+ void bar() {
+ int foo;
+ ^
+ }
+}
+''');
+ await computeSuggestions();
+
+ assertNotSuggested('foo', elemKind: ElementKind.MIXIN);
+ assertSuggest('foo', elemKind: ElementKind.LOCAL_VARIABLE);
+ }
+
Future<void> test_new_instance() async {
addTestSource('import "dart:math"; class A {x() {new Random().^}}');
await computeSuggestions();
@@ -4245,72 +4592,17 @@
assertNotSuggested('bool');
}
- Future<void> test_partFile_TypeName() async {
- // SimpleIdentifier TypeName ConstructorName
- addSource('/home/test/lib/b.dart', '''
-lib B;
-int T1;
-F1() { }
-class X {X.c(); X._d(); z() {}}''');
- addSource('/home/test/lib/a.dart', '''
-library libA;
-import "b.dart";
-part "${resourceProvider.pathContext.basename(testFile)}";
-class A { }
-var m;''');
+ Future<void> test_parameterName_shadowed() async {
addTestSource('''
-part of libA;
-class B { B.bar(int x); }
-main() {new ^}''');
+foo(int bar) {
+ int bar;
+ ^
+}
+''');
await computeSuggestions();
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by LocalConstructorContributor
- assertNotSuggested('B.bar');
- assertNotSuggested('Object');
- assertNotSuggested('X.c');
- assertNotSuggested('X._d');
- assertNotSuggested('A');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('_d');
- assertNotSuggested('z');
- assertNotSuggested('m');
- }
-
- Future<void> test_partFile_TypeName2() async {
- // SimpleIdentifier TypeName ConstructorName
- addSource('/home/test/lib/b.dart', '''
-lib B;
-int T1;
-F1() { }
-class X {X.c(); X._d(); z() {}}''');
- addSource('/home/test/lib/a.dart', '''
-part of libA;
-class B { }''');
- addTestSource('''
-library libA;
-import "b.dart";
-part "a.dart";
-class A { A({String boo: 'hoo'}) { } }
-main() {new ^}
-var m;''');
- await computeSuggestions();
-
- expect(replacementOffset, completionOffset);
- expect(replacementLength, 0);
- // Suggested by LocalConstructorContributor
- assertNotSuggested('A');
- assertNotSuggested('Object');
- assertNotSuggested('X.c');
- assertNotSuggested('X._d');
- assertNotSuggested('B');
- assertNotSuggested('F1');
- assertNotSuggested('T1');
- assertNotSuggested('_d');
- assertNotSuggested('z');
- assertNotSuggested('m');
+ assertNotSuggested('bar', elemKind: ElementKind.PARAMETER);
+ assertSuggest('bar', elemKind: ElementKind.LOCAL_VARIABLE);
}
Future<void> test_PrefixedIdentifier_class_const() async {
@@ -5004,6 +5296,22 @@
assertNotSuggested('==');
}
+ Future<void> test_TopLevelVariableDeclaration_shadow() async {
+ // SimpleIdentifier VariableDeclaration VariableDeclarationList
+ // TopLevelVariableDeclaration
+ addTestSource('''
+var foo;
+void bar() {
+ var foo;
+ ^
+}
+''');
+ await computeSuggestions();
+
+ assertNotSuggested('foo', elemKind: ElementKind.TOP_LEVEL_VARIABLE);
+ assertSuggest('foo', elemKind: ElementKind.LOCAL_VARIABLE);
+ }
+
Future<void> test_TopLevelVariableDeclaration_typed_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
@@ -5022,16 +5330,6 @@
assertNoSuggestions();
}
- Future<void> test_type_typeParameter_classDeclaration() async {
- addTestSource('''
-class A<T> {
- ^ m() {}
-}
-''');
- await computeSuggestions();
- assertSuggestTypeParameter('T');
- }
-
Future<void> test_TypeArgumentList() async {
// SimpleIdentifier BinaryExpression ExpressionStatement
addSource('/home/test/lib/a.dart', '''
@@ -5079,6 +5377,30 @@
assertSuggestClass('C2');
}
+ Future<void> test_TypeParameter_classDeclaration() async {
+ addTestSource('''
+class A<T> {
+ ^ m() {}
+}
+''');
+ await computeSuggestions();
+ assertSuggestTypeParameter('T');
+ }
+
+ Future<void> test_TypeParameter_shadowed() async {
+ addTestSource('''
+class A<T> {
+ m() {
+ int T;
+ ^
+ }
+}
+''');
+ await computeSuggestions();
+ assertNotSuggested('T', elemKind: ElementKind.TYPE_PARAMETER);
+ assertSuggest('T', elemKind: ElementKind.LOCAL_VARIABLE);
+ }
+
Future<void> test_VariableDeclaration_name() async {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// VariableDeclarationStatement Block
diff --git a/pkg/analysis_server/test/services/completion/dart/test_all.dart b/pkg/analysis_server/test/services/completion/dart/test_all.dart
index 181a87e..63e74ff 100644
--- a/pkg/analysis_server/test/services/completion/dart/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/dart/test_all.dart
@@ -22,7 +22,6 @@
import 'language_model_test.dart' as language_model_test;
import 'library_member_contributor_test.dart' as library_member_test;
import 'library_prefix_contributor_test.dart' as library_prefix_test;
-import 'local_constructor_contributor_test.dart' as local_constructor_test;
import 'local_library_contributor_test.dart' as local_lib_test;
import 'local_reference_contributor_test.dart' as local_ref_test;
import 'named_constructor_contributor_test.dart' as named_contributor_test;
@@ -54,7 +53,6 @@
// language_model_test.main();
library_member_test.main();
library_prefix_test.main();
- local_constructor_test.main();
local_lib_test.main();
local_ref_test.main();
named_contributor_test.main();
diff --git a/pkg/analysis_server/test/src/cider/completion_test.dart b/pkg/analysis_server/test/src/cider/completion_test.dart
index 0ab4c89..a1d3a4a 100644
--- a/pkg/analysis_server/test/src/cider/completion_test.dart
+++ b/pkg/analysis_server/test/src/cider/completion_test.dart
@@ -5,7 +5,7 @@
import 'package:analysis_server/src/cider/completion.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart'
- show CompletionSuggestion, ElementKind;
+ show CompletionSuggestion, CompletionSuggestionKind, ElementKind;
import 'package:meta/meta.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -214,6 +214,32 @@
]);
}
+ Future<void> test_filterSort_namedArgument_hasPrefix() async {
+ await _compute(r'''
+void foo({int aaa, int bbb});
+
+void f() {
+ foo(a^);
+}
+''');
+
+ _assertHasNamedArgument(name: 'aaa');
+ _assertNoNamedArgument(name: 'bbb');
+ }
+
+ Future<void> test_filterSort_namedArgument_noPrefix() async {
+ await _compute(r'''
+void foo({int aaa, int bbb});
+
+void f() {
+ foo(^);
+}
+''');
+
+ _assertHasNamedArgument(name: 'aaa');
+ _assertHasNamedArgument(name: 'bbb');
+ }
+
Future<void> test_filterSort_preferLocal() async {
await _compute(r'''
var a = 0;
@@ -288,6 +314,12 @@
return matching.single;
}
+ CompletionSuggestion _assertHasNamedArgument({@required String name}) {
+ var matching = _matchingNamedArgumentSuggestions(name: name);
+ expect(matching, hasLength(1), reason: 'Expected exactly one completion');
+ return matching.single;
+ }
+
CompletionSuggestion _assertHasTopLevelVariable({@required String text}) {
var matching = _matchingCompletions(
text: text,
@@ -309,6 +341,11 @@
expect(matching, isEmpty, reason: 'Expected zero completions');
}
+ void _assertNoNamedArgument({@required String name}) {
+ var matching = _matchingNamedArgumentSuggestions(name: name);
+ expect(matching, isEmpty, reason: 'Expected zero completions');
+ }
+
void _assertOrder(List<CompletionSuggestion> suggestions) {
var lastIndex = -2;
for (var suggestion in suggestions) {
@@ -352,6 +389,22 @@
}).toList();
}
+ List<CompletionSuggestion> _matchingNamedArgumentSuggestions({
+ @required String name,
+ }) {
+ return _suggestions.where((e) {
+ if (e.kind != CompletionSuggestionKind.NAMED_ARGUMENT) {
+ return false;
+ }
+
+ if (!e.completion.startsWith('$name:')) {
+ return false;
+ }
+
+ return true;
+ }).toList();
+ }
+
CiderCompletionComputer _newComputer() {
return _computer = CiderCompletionComputer(
logger,
diff --git a/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart b/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
index 436ea7e..1f84c34 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/add_explicit_cast_test.dart
@@ -460,4 +460,17 @@
class B {}
''');
}
+
+ Future<void> test_notExpression_incomplete() async {
+ await resolveTestUnit(r'''
+void foo(int a) {
+ a = a < ;
+}
+''');
+ await assertNoFix(
+ errorFilter: (e) {
+ return e.errorCode == StaticTypeWarningCode.INVALID_ASSIGNMENT;
+ },
+ );
+ }
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart
index 0e0d309..8051ea2 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_const_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analysis_server/src/services/correction/fix.dart';
+import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -19,7 +20,7 @@
@override
FixKind get kind => DartFixKind.REMOVE_CONST;
- Future<void> test_const_with_non_const() async {
+ Future<void> test_explicitConst() async {
await resolveTestUnit('''
class A {
A();
@@ -39,4 +40,21 @@
}
''');
}
+
+ Future<void> test_implicitConst() async {
+ await resolveTestUnit('''
+class A {
+ A();
+}
+void f() {
+ const a = A();
+ print(a);
+}
+''');
+ await assertNoFix(
+ errorFilter: (e) {
+ return e.errorCode == CompileTimeErrorCode.CONST_WITH_NON_CONST;
+ },
+ );
+ }
}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
index 1b691b3..30937b9 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_parameter_test.dart
@@ -98,6 +98,19 @@
''');
}
+ Future<void> test_last_optionalNamed_noDefaultValue() async {
+ await resolveTestUnit('''
+class C {
+ C({int x});
+}
+''');
+ await assertHasFix('''
+class C {
+ C();
+}
+''');
+ }
+
Future<void> test_last_optionalNamed_previous_optionalNamed() async {
await resolveTestUnit('''
class C {
@@ -128,6 +141,19 @@
''');
}
+ Future<void> test_last_optionalPositional_noDefaultValue() async {
+ await resolveTestUnit('''
+class C {
+ C([int x]);
+}
+''');
+ await assertHasFix('''
+class C {
+ C();
+}
+''');
+ }
+
Future<void>
test_last_optionalPositional_previous_optionalPositional() async {
await resolveTestUnit('''
diff --git a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
index 5139b42..41158e2 100644
--- a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
+++ b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
@@ -515,20 +515,36 @@
metrics.topLevelMrrComputer.printMean();
print('');
- var table = <List<String>>[];
- var computerMap = metrics.locationMmrComputers;
- var locations = computerMap.keys.toList()..sort();
- table.add(['Location', 'count', 'mmr', 'mmr_5']);
- for (var location in locations) {
- var computer = computerMap[location];
- var mmr = (1 / computer.mrr).toStringAsFixed(3);
- var mrr_5 = (1 / computer.mrr_5).toStringAsFixed(3);
- table.add([computer.name, computer.count.toString(), mmr, mrr_5]);
+ if (verbose) {
+ var lines = <LocationTableLine>[];
+ for (var entry in metrics.locationMmrComputers.entries) {
+ var count = entry.value.count;
+ var mrr = (1 / entry.value.mrr);
+ var mrr_5 = (1 / entry.value.mrr_5);
+ var product = count * mrr;
+ lines.add(LocationTableLine(
+ label: entry.key,
+ product: product,
+ count: count,
+ mrr: mrr,
+ mrr_5: mrr_5));
+ }
+ lines.sort((first, second) => second.product.compareTo(first.product));
+ var table = <List<String>>[];
+ table.add(['Location', 'Product', 'Count', 'Mmr', 'Mmr_5']);
+ for (var line in lines) {
+ var location = line.label;
+ var product = line.product.truncate().toString();
+ var count = line.count.toString();
+ var mrr = line.mrr.toStringAsFixed(3);
+ var mrr_5 = line.mrr_5.toStringAsFixed(3);
+ table.add([location, product, count, mrr, mrr_5]);
+ }
+ var buffer = StringBuffer();
+ buffer.writeTable(table);
+ print(buffer.toString());
+ print('');
}
- var buffer = StringBuffer();
- buffer.writeTable(table);
- print(buffer.toString());
- print('');
metrics.charsBeforeTop.printMean();
metrics.charsBeforeTopFive.printMean();
@@ -1020,6 +1036,23 @@
}
}
+/// The data to be printed on a single line in the table of mmr values per
+/// completion location.
+class LocationTableLine {
+ final String label;
+ final double product;
+ final int count;
+ final double mrr;
+ final double mrr_5;
+
+ LocationTableLine(
+ {@required this.label,
+ @required this.product,
+ @required this.count,
+ @required this.mrr,
+ @required this.mrr_5});
+}
+
class MetricsSuggestionListener implements SuggestionListener {
Map<protocol.CompletionSuggestion, String> featureMap = {};
diff --git a/pkg/analysis_server/tool/lsp_spec/README.md b/pkg/analysis_server/tool/lsp_spec/README.md
index 55c2c6f..a96bd24 100644
--- a/pkg/analysis_server/tool/lsp_spec/README.md
+++ b/pkg/analysis_server/tool/lsp_spec/README.md
@@ -37,64 +37,65 @@
- Method: The LSP method name
- Basic Impl: This method has an implementation but may assume some client capabilities
- Capabilities: Only types from the original spec or as advertised in client capabilities are returned
+- Plugins: This functionality works with server plugins
- Tests: Has automated tests
- Tested Client: Has been manually tested in at least one LSP client editor
-| Method | Basic Impl | Capabilities | Tests | Tested Client | Notes |
-| - | - | - | - | - | - |
-| initialize | ✅ | ✅ | ✅ | ✅ | trace and other options NYI
-| initialized | ✅ | ✅ | ✅ | ✅ |
-| shutdown | ✅ | ✅ | ✅ | ✅ | supported but does nothing |
-| exit | ✅ | ✅ | ✅ | ✅ |
-| $/cancelRequest | ✅ | ✅ | ✅ | ✅ |
-| window/showMessage | ✅ | | | |
-| window/showMessageRequest | | | | |
-| window/logMessage | ✅ | | | |
-| telemetry/event | | | | |
-| client/registerCapability | ✅ | ✅ | ✅ | ✅ |
-| client/unregisterCapability | ✅ | ✅ | ✅ | ✅ |
-| workspace/workspaceFolders | | | | |
-| workspace/didChangeWorkspaceFolders | ✅ | ✅ | ✅ | ✅ |
-| workspace/didChangeConfiguration | ✅ | ✅ | ✅ | ✅ |
-| workspace/configuration | ✅ | ✅ | ✅ | ✅ |
-| workspace/didChangeWatchedFiles | | | | | unused, server does own watching |
-| workspace/symbol | ✅ | ✅ | ✅ | ✅ |
-| workspace/executeCommand | ✅ | ✅ | ✅ | ✅ |
-| workspace/applyEdit | ✅ | ✅ | ✅ | ✅ |
-| textDocument/didOpen | ✅ | ✅ | ✅ | ✅ |
-| textDocument/didChange | ✅ | ✅ | ✅ | ✅ |
-| textDocument/willSave | | | | |
-| textDocument/willSaveWaitUntil | | | | |
-| textDocument/didClose | ✅ | ✅ | ✅ | ✅ |
-| textDocument/publishDiagnostics | ✅ | ✅ | ✅ | ✅ |
-| textDocument/completion | ✅ | ✅ | ✅ | ✅ |
-| completionItem/resolve | ✅ | ✅ | ✅ | ✅ |
-| textDocument/hover | ✅ | ✅ | ✅ | ✅ |
-| textDocument/signatureHelp | ✅ | ✅ | ✅ | ✅ | trigger character handling outstanding
-| textDocument/declaration | | | | |
-| textDocument/definition | ✅ | ✅ | ✅ | ✅ |
-| textDocument/typeDefinition | | | | |
-| textDocument/implementation | ✅ | ✅ | ✅ | ✅ |
-| textDocument/references | ✅ | ✅ | ✅ | ✅ |
-| textDocument/documentHighlight | ✅ | ✅ | ✅ | ✅ |
-| textDocument/documentSymbol | ✅ | ✅ | ✅ | ✅ |
-| textDocument/codeAction (sortMembers) | ✅ | ✅ | ✅ | ✅ |
-| textDocument/codeAction (organiseImports) | ✅ | ✅ | ✅ | ✅ |
-| textDocument/codeAction (refactors) | ✅ | ✅ | ✅ | ✅ |
-| textDocument/codeAction (assists) | ✅ | ✅ | ✅ | ✅ | Only if the client advertises `codeActionLiteralSupport` with `Refactor`
-| textDocument/codeAction (fixes) | ✅ | ✅ | ✅ | ✅ | Only if the client advertises `codeActionLiteralSupport` with `QuickFix`
-| textDocument/codeLens | | | | |
-| codeLens/resolve | | | | |
-| textDocument/documentLink | | | | |
-| documentLink/resolve | | | | |
-| textDocument/documentColor | | | | |
-| textDocument/colorPresentation | | | | |
-| textDocument/formatting | ✅ | ✅ | ✅ | ✅ |
-| textDocument/rangeFormatting | | | | | requires support from dart_style?
-| textDocument/onTypeFormatting | ✅ | ✅ | ✅ | ✅ |
-| textDocument/rename | ✅ | ✅ | ✅ | ✅ |
-| textDocument/prepareRename | ✅ | ✅ | ✅ | ✅ |
-| textDocument/foldingRange | ✅ | ✅ | ✅ | ✅ |
+| Method | Basic Impl | Capabilities | Plugins | Tests | Tested Client | Notes |
+| - | - | - | - | - | - | - |
+| initialize | ✅ | ✅ | N/A | ✅ | ✅ | trace and other options NYI
+| initialized | ✅ | ✅ | N/A | ✅ | ✅ |
+| shutdown | ✅ | ✅ | N/A | ✅ | ✅ | supported but does nothing |
+| exit | ✅ | ✅ | N/A | ✅ | ✅ |
+| $/cancelRequest | ✅ | ✅ | | ✅ | ✅ |
+| window/showMessage | ✅ | | | | |
+| window/showMessageRequest | | | | | |
+| window/logMessage | ✅ | | | | |
+| telemetry/event | | | | | |
+| client/registerCapability | ✅ | ✅ | ✅ | ✅ | ✅ |
+| client/unregisterCapability | ✅ | ✅ | ✅ | ✅ | ✅ |
+| workspace/workspaceFolders | | | | | |
+| workspace/didChangeWorkspaceFolders | ✅ | ✅ | ✅ | ✅ | ✅ |
+| workspace/didChangeConfiguration | ✅ | ✅ | | ✅ | ✅ |
+| workspace/configuration | ✅ | ✅ | | ✅ | ✅ |
+| workspace/didChangeWatchedFiles | | | | | | unused, server does own watching |
+| workspace/symbol | ✅ | ✅ | | ✅ | ✅ |
+| workspace/executeCommand | ✅ | ✅ | | ✅ | ✅ |
+| workspace/applyEdit | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/didOpen | ✅ | ✅ | ✅ | ✅ | ✅ |
+| textDocument/didChange | ✅ | ✅ | ✅ | ✅ | ✅ |
+| textDocument/willSave | | | | | |
+| textDocument/willSaveWaitUntil | | | | | |
+| textDocument/didClose | ✅ | ✅ | ✅ | ✅ | ✅ |
+| textDocument/publishDiagnostics | ✅ | ✅ | ✅ | ✅ | ✅ |
+| textDocument/completion | ✅ | ✅ | ✅ | ✅ | ✅ |
+| completionItem/resolve | ✅ | ✅ | ✅ | ✅ | ✅ |
+| textDocument/hover | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/signatureHelp | ✅ | ✅ | | ✅ | ✅ | trigger character handling outstanding
+| textDocument/declaration | | | | | |
+| textDocument/definition | ✅ | ✅ | ✅ | ✅ | ✅ |
+| textDocument/typeDefinition | | | | | |
+| textDocument/implementation | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/references | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/documentHighlight | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/documentSymbol | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/codeAction (sortMembers) | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/codeAction (organiseImports) | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/codeAction (refactors) | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/codeAction (assists) | ✅ | ✅ | | ✅ | ✅ | Only if the client advertises `codeActionLiteralSupport` with `Refactor`
+| textDocument/codeAction (fixes) | ✅ | ✅ | | ✅ | ✅ | Only if the client advertises `codeActionLiteralSupport` with `QuickFix`
+| textDocument/codeLens | | | | | |
+| codeLens/resolve | | | | | |
+| textDocument/documentLink | | | | | |
+| documentLink/resolve | | | | | |
+| textDocument/documentColor | | | | | |
+| textDocument/colorPresentation | | | | | |
+| textDocument/formatting | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/rangeFormatting | | | | | | requires support from dart_style?
+| textDocument/onTypeFormatting | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/rename | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/prepareRename | ✅ | ✅ | | ✅ | ✅ |
+| textDocument/foldingRange | ✅ | ✅ | ✅ | ✅ | ✅ |
## Custom Methods
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 1ecfb41..90a78b3 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -94,7 +94,9 @@
CompileTimeErrorCode.CONFLICTING_METHOD_AND_FIELD,
CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS,
- CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER,
+ CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION,
+ CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS,
+ CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION,
CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD,
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 3248eb8..5eded9d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -442,7 +442,7 @@
_unitElementRequestedParts.isNotEmpty) {
return AnalysisDriverPriority.general;
}
- _clearLibraryContext();
+ clearLibraryContext();
return AnalysisDriverPriority.nothing;
}
@@ -486,6 +486,17 @@
_changeFile(path);
}
+ /// Clear the library context and any related data structures. Mostly we do
+ /// this to reduce memory consumption. The library context holds to every
+ /// library that was resynthesized, but after some initial analysis we might
+ /// not get again to many of these libraries. So, we should clear the context
+ /// periodically.
+ @visibleForTesting
+ void clearLibraryContext() {
+ _libraryContext = null;
+ _currentSession.clearHierarchies();
+ }
+
/// Some state on which analysis depends has changed, so the driver needs to be
/// re-configured with the new state.
///
@@ -1170,7 +1181,7 @@
_throwIfNotAbsolutePath(path);
_throwIfChangesAreNotAllowed();
_fileTracker.removeFile(path);
- _clearLibraryContext();
+ clearLibraryContext();
_priorityResults.clear();
}
@@ -1185,7 +1196,7 @@
/// Implementation for [changeFile].
void _changeFile(String path) {
_fileTracker.changeFile(path);
- _clearLibraryContext();
+ clearLibraryContext();
_priorityResults.clear();
}
@@ -1193,27 +1204,17 @@
/// of state.
void _changeHook(String path) {
_createNewSession(path);
- _clearLibraryContext();
+ clearLibraryContext();
_priorityResults.clear();
_scheduler.notify(this);
}
- /// Clear the library context and any related data structures. Mostly we do
- /// this to reduce memory consumption. The library context holds to every
- /// library that was resynthesized, but after some initial analysis we might
- /// not get again to many of these libraries. So, we should clear the context
- /// periodically.
- void _clearLibraryContext() {
- _libraryContext = null;
- _currentSession.clearHierarchies();
- }
-
/// There was an exception during a file analysis, we don't know why.
/// But it might have been caused by an inconsistency of files state, and
/// the library context state. Reset the library context, and hope that
/// we will solve the inconsistency while loading / building summaries.
void _clearLibraryContextAfterException() {
- _clearLibraryContext();
+ clearLibraryContext();
}
/// Return the cached or newly computed analysis result of the file with the
@@ -1504,7 +1505,7 @@
LibraryContext _createLibraryContext(FileState library) {
if (_libraryContext != null) {
if (_libraryContext.pack()) {
- _clearLibraryContext();
+ clearLibraryContext();
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index a8c69a1..a3288c9 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -709,7 +709,14 @@
}
@override
- List<InterfaceType> get interfaces {
+ List<InterfaceType> get interfaces =>
+ ElementTypeProvider.current.getClassInterfaces(this);
+
+ set interfaces(List<InterfaceType> interfaces) {
+ _interfaces = interfaces;
+ }
+
+ List<InterfaceType> get interfacesInternal {
if (_interfaces != null) {
return _interfaces;
}
@@ -730,10 +737,6 @@
return _interfaces = const <InterfaceType>[];
}
- set interfaces(List<InterfaceType> interfaces) {
- _interfaces = interfaces;
- }
-
@override
bool get isAbstract {
if (linkedNode != null) {
@@ -5155,8 +5158,7 @@
@override
final LinkedUnitContext linkedContext;
- @override
- final bool isNonNullableByDefault;
+ final bool isNonNullableByDefaultInternal;
/// The compilation unit that defines this library.
CompilationUnitElement _definingCompilationUnit;
@@ -5202,7 +5204,7 @@
/// Initialize a newly created library element in the given [context] to have
/// the given [name] and [offset].
LibraryElementImpl(this.context, this.session, String name, int offset,
- this.nameLength, this.isNonNullableByDefault)
+ this.nameLength, this.isNonNullableByDefaultInternal)
: linkedContext = null,
super(name, offset);
@@ -5215,7 +5217,7 @@
this.linkedContext,
Reference reference,
CompilationUnit linkedNode)
- : isNonNullableByDefault = linkedContext.isNNBD,
+ : isNonNullableByDefaultInternal = linkedContext.isNNBD,
super.forLinkedNode(null, reference, linkedNode) {
_name = name;
_nameOffset = offset;
@@ -5445,6 +5447,10 @@
return false;
}
+ @override
+ bool get isNonNullableByDefault =>
+ ElementTypeProvider.current.isLibraryNonNullableByDefault(this);
+
/// Return `true` if the receiver directly or indirectly imports the
/// 'dart:html' libraries.
bool get isOrImportsBrowserLibrary {
diff --git a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
index f668b54..5935eaa 100644
--- a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
@@ -10,6 +10,7 @@
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/dart/element/generic_inferrer.dart';
import 'package:analyzer/src/dart/element/member.dart';
+import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/dart/element/type_algebra.dart';
import 'package:analyzer/src/dart/element/type_schema.dart';
import 'package:analyzer/src/dart/resolver/resolution_result.dart';
@@ -252,28 +253,40 @@
/// Return extensions for the [type] that match the given [name] in the
/// current scope.
List<_InstantiatedExtension> _getApplicable(DartType type, String name) {
+ if (identical(type, NeverTypeImpl.instance)) {
+ return const <_InstantiatedExtension>[];
+ }
+
var candidates = _getExtensionsWithMember(name);
var instantiatedExtensions = <_InstantiatedExtension>[];
for (var candidate in candidates) {
- var typeParameters = candidate.extension.typeParameters;
- var inferrer = GenericInferrer(_typeSystem, typeParameters);
+ var extension = candidate.extension;
+
+ var freshTypes = getFreshTypeParameters(extension.typeParameters);
+ var freshTypeParameters = freshTypes.freshTypeParameters;
+ var rawExtendedType = freshTypes.substitute(extension.extendedType);
+
+ var inferrer = GenericInferrer(_typeSystem, freshTypeParameters);
inferrer.constrainArgument(
type,
- candidate.extension.extendedType,
+ rawExtendedType,
'extendedType',
);
- var typeArguments = inferrer.infer(typeParameters, failAtError: true);
+ var typeArguments = inferrer.infer(
+ freshTypeParameters,
+ failAtError: true,
+ );
if (typeArguments == null) {
continue;
}
var substitution = Substitution.fromPairs(
- typeParameters,
+ extension.typeParameters,
typeArguments,
);
var extendedType = substitution.substituteType(
- candidate.extension.extendedType,
+ extension.extendedType,
);
if (!_isSubtypeOf(type, extendedType)) {
continue;
diff --git a/pkg/analyzer/lib/src/dart/sdk/sdk.dart b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
index f72c2a9..2826ac3 100644
--- a/pkg/analyzer/lib/src/dart/sdk/sdk.dart
+++ b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
@@ -255,6 +255,17 @@
@override
String get allowedExperimentsJson {
+ var coreSource = mapDartUri('dart:core');
+ if (coreSource != null) {
+ var coreFile = resourceProvider.getFile(coreSource.fullName);
+ var embeddedFolder = coreFile.parent.parent;
+ try {
+ return embeddedFolder
+ .getChildAssumingFolder('_internal')
+ .getChildAssumingFile('allowed_experiments.json')
+ .readAsStringSync();
+ } catch (_) {}
+ }
return null;
}
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 038437f..4fefde5 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -871,13 +871,30 @@
* 0: the name of the type variable
*/
static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_CLASS =
- CompileTimeErrorCode(
+ CompileTimeErrorCodeWithUniqueName(
+ 'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
'CONFLICTING_TYPE_VARIABLE_AND_CLASS',
"'{0}' can't be used to name both a type variable and the class in "
"which the type variable is defined.",
correction: "Try renaming either the type variable or the class.");
/**
+ * It is a compile time error if an extension declares a type parameter with
+ * the same name as the extension.
+ *
+ * Parameters:
+ * 0: the name of the type variable
+ */
+ static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_EXTENSION =
+ CompileTimeErrorCodeWithUniqueName(
+ 'CONFLICTING_TYPE_VARIABLE_AND_CONTAINER',
+ 'CONFLICTING_TYPE_VARIABLE_AND_EXTENSION',
+ "'{0}' can't be used to name both a type variable and the extension "
+ "in which the type variable is defined.",
+ correction:
+ "Try renaming either the type variable or the extension.");
+
+ /**
* 7. Classes: It is a compile time error if a generic class declares a type
* variable with the same name as the class or any of its members or
* constructors.
@@ -885,14 +902,28 @@
* Parameters:
* 0: the name of the type variable
*/
- static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER =
- CompileTimeErrorCode(
+ static const CompileTimeErrorCode CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS =
+ CompileTimeErrorCodeWithUniqueName(
'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
+ 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS',
"'{0}' can't be used to name both a type variable and a member in "
"this class.",
correction: "Try renaming either the type variable or the member.");
/**
+ * It is a compile time error if a generic extension declares a member with
+ * the same basename as the name of any of the extension's type parameters.
+ */
+ static const CompileTimeErrorCode
+ CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION =
+ CompileTimeErrorCodeWithUniqueName(
+ 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER',
+ 'CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION',
+ "'{0}' can't be used to name both a type variable and a member in "
+ "this extension.",
+ correction: "Try renaming either the type variable or the member.");
+
+ /**
* 16.12.2 Const: It is a compile-time error if evaluation of a constant
* object results in an uncaught exception being thrown.
*/
diff --git a/pkg/analyzer/lib/src/generated/element_type_provider.dart b/pkg/analyzer/lib/src/generated/element_type_provider.dart
index 6eb52b0..e1c9985 100644
--- a/pkg/analyzer/lib/src/generated/element_type_provider.dart
+++ b/pkg/analyzer/lib/src/generated/element_type_provider.dart
@@ -32,6 +32,9 @@
void freshTypeParameterCreated(TypeParameterElement newTypeParameter,
TypeParameterElement oldTypeParameter) {}
+ List<InterfaceType> getClassInterfaces(ClassElementImpl element) =>
+ element.interfacesInternal;
+
/// Queries the parameters of an executable element's signature.
///
/// Equivalent to `getExecutableType(...).parameters`.
@@ -62,4 +65,8 @@
/// Queries the type of a variable element.
DartType getVariableType(VariableElementImpl variable) =>
variable.typeInternal;
+
+ /// Queries whether NNBD is enabled for a library.
+ bool isLibraryNonNullableByDefault(LibraryElementImpl element) =>
+ element.isNonNullableByDefaultInternal;
}
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 02f3df6..b4ecb6a 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -432,7 +432,7 @@
_checkForBuiltInIdentifierAsName(
node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
_checkForNoDefaultSuperConstructorImplicit(node);
- _checkForConflictingTypeVariableErrorCodes();
+ _checkForConflictingClassTypeVariableErrorCodes();
TypeName superclass = node.extendsClause?.superclass;
ImplementsClause implementsClause = node.implementsClause;
WithClause withClause = node.withClause;
@@ -583,6 +583,7 @@
void visitExtensionDeclaration(ExtensionDeclaration node) {
_enclosingExtension = node.declaredElement;
_duplicateDefinitionVerifier.checkExtension(node);
+ _checkForConflictingExtensionTypeVariableErrorCodes();
_checkForFinalNotInitializedInClass(node.members);
GetterSetterTypesVerifier(
@@ -786,6 +787,8 @@
@override
void visitGenericTypeAlias(GenericTypeAlias node) {
+ _checkForBuiltInIdentifierAsName(
+ node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
_checkForTypeAliasCannotReferenceItself(node, node.declaredElement);
super.visitGenericTypeAlias(node);
}
@@ -914,7 +917,11 @@
_checkForStaticAccessToInstanceMember(typeReference, methodName);
_checkForInstanceAccessToStaticMember(
typeReference, node.target, methodName);
- _checkForUnnecessaryNullAware(target, node.operator);
+
+ // For `C?.foo()` the type of `C` is not set, it is not an expression.
+ if (target.staticType != null) {
+ _checkForUnnecessaryNullAware(target, node.operator);
+ }
} else {
_checkForUnqualifiedReferenceToNonLocalStaticMember(methodName);
}
@@ -934,7 +941,7 @@
_duplicateDefinitionVerifier.checkMixin(node);
_checkForBuiltInIdentifierAsName(
node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
- _checkForConflictingTypeVariableErrorCodes();
+ _checkForConflictingClassTypeVariableErrorCodes();
OnClause onClause = node.onClause;
ImplementsClause implementsClause = node.implementsClause;
@@ -1846,7 +1853,7 @@
* See [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS], and
* [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER].
*/
- void _checkForConflictingTypeVariableErrorCodes() {
+ void _checkForConflictingClassTypeVariableErrorCodes() {
for (TypeParameterElement typeParameter in _enclosingClass.typeParameters) {
String name = typeParameter.name;
// name is same as the name of the enclosing class
@@ -1861,7 +1868,34 @@
_enclosingClass.getGetter(name) != null ||
_enclosingClass.getSetter(name) != null) {
_errorReporter.reportErrorForElement(
- CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER,
+ CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS,
+ typeParameter,
+ [name]);
+ }
+ }
+ }
+
+ /// Verify all conflicts between type variable and enclosing extension.
+ ///
+ /// See [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION], and
+ /// [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION_MEMBER].
+ void _checkForConflictingExtensionTypeVariableErrorCodes() {
+ for (TypeParameterElement typeParameter
+ in _enclosingExtension.typeParameters) {
+ String name = typeParameter.name;
+ // name is same as the name of the enclosing class
+ if (_enclosingExtension.name == name) {
+ _errorReporter.reportErrorForElement(
+ CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION,
+ typeParameter,
+ [name]);
+ }
+ // check members
+ if (_enclosingExtension.getMethod(name) != null ||
+ _enclosingExtension.getGetter(name) != null ||
+ _enclosingExtension.getSetter(name) != null) {
+ _errorReporter.reportErrorForElement(
+ CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION,
typeParameter,
[name]);
}
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 3786641..533c75d 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -1,5 +1,5 @@
name: analyzer
-version: 0.39.10
+version: 0.39.11-dev
description: This package provides a library that performs static analysis of Dart code.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer
diff --git a/pkg/analyzer/test/embedder_tests.dart b/pkg/analyzer/test/embedder_tests.dart
index 01ba2eb..c59eb00 100644
--- a/pkg/analyzer/test/embedder_tests.dart
+++ b/pkg/analyzer/test/embedder_tests.dart
@@ -26,7 +26,7 @@
..newFile('/home/.pub-cache/fox/lib/_embedder.yaml', r'''
embedded_libs:
"dart:deep": "deep/directory/file.dart"
- "dart:core" : "core.dart"
+ "dart:core" : "core/core.dart"
"dart:fox": "slippy.dart"
"dart:bear": "grizzly.dart"
"dart:relative": "../relative.dart"
diff --git a/pkg/analyzer/test/generated/compile_time_error_code.dart b/pkg/analyzer/test/generated/compile_time_error_code.dart
index 87521ae..2522f3f 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code.dart
@@ -148,87 +148,6 @@
]);
}
- test_conflictingGenericInterfaces_hierarchyLoop() async {
- // There is no interface conflict here, but there is a loop in the class
- // hierarchy leading to a finite set of implemented types; this loop
- // shouldn't cause non-termination.
- await assertErrorsInCode('''
-class A<T> implements B<T> {}
-class B<T> implements A<T> {}
-''', [
- error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 6, 1),
- error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 36, 1),
- ]);
- }
-
- test_conflictingGenericInterfaces_noConflict() async {
- await assertNoErrorsInCode('''
-class I<T> {}
-class A implements I<int> {}
-class B implements I<int> {}
-class C extends A implements B {}
-''');
- }
-
- test_conflictingTypeVariableAndClass() async {
- await assertErrorsInCode(r'''
-class T<T> {
-}
-''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS, 8, 1),
- ]);
- }
-
- test_conflictingTypeVariableAndMember_field() async {
- await assertErrorsInCode(r'''
-class A<T> {
- var T;
-}
-''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
- ]);
- }
-
- test_conflictingTypeVariableAndMember_getter() async {
- await assertErrorsInCode(r'''
-class A<T> {
- get T => null;
-}
-''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
- ]);
- }
-
- test_conflictingTypeVariableAndMember_method() async {
- await assertErrorsInCode(r'''
-class A<T> {
- T() {}
-}
-''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
- ]);
- }
-
- test_conflictingTypeVariableAndMember_method_static() async {
- await assertErrorsInCode(r'''
-class A<T> {
- static T() {}
-}
-''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
- ]);
- }
-
- test_conflictingTypeVariableAndMember_setter() async {
- await assertErrorsInCode(r'''
-class A<T> {
- set T(x) {}
-}
-''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
- ]);
- }
-
test_consistentCaseExpressionTypes_dynamic() async {
// Even though A.S and S have a static type of "dynamic", we should see
// that they match 'abc', because they are constant strings.
diff --git a/pkg/analyzer/test/source/embedder_test.dart b/pkg/analyzer/test/source/embedder_test.dart
index bf44c30..d44bc06 100644
--- a/pkg/analyzer/test/source/embedder_test.dart
+++ b/pkg/analyzer/test/source/embedder_test.dart
@@ -41,7 +41,7 @@
}
// Check that they map to the correct paths.
- expectResolved('dart:core', '$foxLib/core.dart');
+ expectResolved('dart:core', '$foxLib/core/core.dart');
expectResolved('dart:fox', '$foxLib/slippy.dart');
expectResolved('dart:bear', '$foxLib/grizzly.dart');
expectResolved('dart:relative', '$foxPath/relative.dart');
@@ -104,7 +104,7 @@
expect(source.fullName, posixToOSPath(posixPath));
}
- expectSource('dart:core', '$foxLib/core.dart');
+ expectSource('dart:core', '$foxLib/core/core.dart');
expectSource('dart:fox', '$foxLib/slippy.dart');
expectSource('dart:deep', '$foxLib/deep/directory/file.dart');
expectSource('dart:deep/part.dart', '$foxLib/deep/directory/part.dart');
@@ -128,7 +128,7 @@
// We have five mappings.
expect(resolver, hasLength(5));
// Check that they map to the correct paths.
- expectResolved('dart:core', '$foxLib/core.dart');
+ expectResolved('dart:core', '$foxLib/core/core.dart');
expectResolved('dart:fox', '$foxLib/slippy.dart');
expectResolved('dart:bear', '$foxLib/grizzly.dart');
expectResolved('dart:relative', '$foxPath/relative.dart');
diff --git a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
index 6b72e16..1c9f147 100644
--- a/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/extension_method_test.dart
@@ -1446,6 +1446,21 @@
@override
bool get typeToStringWithNullability => true;
+ test_instance_getter_fromInstance_Never() async {
+ await assertNoErrorsInCode('''
+extension E on Never {
+ int get foo => 0;
+}
+
+f(Never a) {
+ a.foo;
+}
+''');
+ var access = findNode.prefixed('a.foo');
+ assertElementNull(access);
+ assertType(access, 'Never');
+ }
+
test_instance_getter_fromInstance_nullable() async {
await assertNoErrorsInCode('''
extension E on int? {
@@ -1476,6 +1491,28 @@
assertType(identifier, 'int');
}
+ test_instance_method_fromInstance_Never() async {
+ await assertErrorsInCode('''
+extension E on Never {
+ void foo() {}
+}
+
+f(Never a) {
+ a.foo();
+}
+''', [
+ error(HintCode.RECEIVER_OF_TYPE_NEVER, 57, 1),
+ error(HintCode.DEAD_CODE, 62, 3),
+ ]);
+ assertMethodInvocation2(
+ findNode.methodInvocation('a.foo()'),
+ element: null,
+ typeArgumentTypes: [],
+ invokeType: 'dynamic',
+ type: 'Never',
+ );
+ }
+
test_instance_method_fromInstance_nullable() async {
await assertNoErrorsInCode('''
extension E on int? {
diff --git a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
index b975ed7..e1ad947 100644
--- a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
@@ -245,7 +245,8 @@
var T;
}
''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
]);
}
@@ -255,7 +256,8 @@
get T => null;
}
''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
]);
}
@@ -265,7 +267,8 @@
T() {}
}
''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
]);
}
@@ -275,7 +278,8 @@
static T() {}
}
''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
]);
}
@@ -285,7 +289,8 @@
void set T(_) {}
}
''', [
- error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, 8, 1),
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
]);
}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
index c0f77b5..e27cd4e 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
@@ -64,6 +64,25 @@
assertType(invocation, 'Map<int, double>');
}
+ test_implicit_method_internal() async {
+ await assertNoErrorsInCode(r'''
+extension E<T> on List<T> {
+ List<T> foo() => this;
+ List<T> bar(List<T> other) => other.foo();
+}
+''');
+ assertMethodInvocation2(
+ findNode.methodInvocation('other.foo()'),
+ element: elementMatcher(
+ findElement.method('foo'),
+ substitution: {'T': 'T'},
+ ),
+ typeArgumentTypes: [],
+ invokeType: 'List<T> Function()',
+ type: 'List<T>',
+ );
+ }
+
test_implicit_method_onTypeParameter() async {
await assertNoErrorsInCode('''
extension E<T> on T {
diff --git a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
index 50066f4..233301b 100644
--- a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
+++ b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
@@ -26,6 +26,21 @@
@reflectiveTest
class EmbedderSdkTest extends EmbedderRelatedTest {
+ void test_allowedExperimentsJson() {
+ EmbedderYamlLocator locator = EmbedderYamlLocator({
+ 'fox': <Folder>[pathTranslator.getResource(foxLib)]
+ });
+ EmbedderSdk sdk = EmbedderSdk(resourceProvider, locator.embedderYamls);
+
+ expect(sdk.allowedExperimentsJson, isNull);
+
+ pathTranslator.newFile(
+ '$foxLib/_internal/allowed_experiments.json',
+ 'foo bar',
+ );
+ expect(sdk.allowedExperimentsJson, 'foo bar');
+ }
+
void test_creation() {
EmbedderYamlLocator locator = EmbedderYamlLocator({
'fox': <Folder>[pathTranslator.getResource(foxLib)]
@@ -79,7 +94,7 @@
expect(source.fullName, posixToOSPath(posixPath));
}
- expectSource('dart:core', '$foxLib/core.dart');
+ expectSource('dart:core', '$foxLib/core/core.dart');
expectSource('dart:fox', '$foxLib/slippy.dart');
expectSource('dart:deep', '$foxLib/deep/directory/file.dart');
expectSource('dart:deep/part.dart', '$foxLib/deep/directory/part.dart');
diff --git a/pkg/analyzer/test/src/diagnostics/built_in_identifier_as_typedef_name_test.dart b/pkg/analyzer/test/src/diagnostics/built_in_identifier_as_typedef_name_test.dart
index c695a45..2163187 100644
--- a/pkg/analyzer/test/src/diagnostics/built_in_identifier_as_typedef_name_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/built_in_identifier_as_typedef_name_test.dart
@@ -30,6 +30,7 @@
await assertErrorsInCode(r'''
typedef void as();
''', [
+ error(ParserErrorCode.MISSING_IDENTIFIER, 13, 2),
error(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, 13, 2),
]);
}
@@ -39,11 +40,7 @@
typedef as = void Function();
''', [
error(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, 8, 2),
- // TODO(#42158): I think recovery could be much better here.
- error(ParserErrorCode.EXPECTED_EXECUTABLE, 11, 1),
- error(ParserErrorCode.EXPECTED_TOKEN, 11, 1),
- error(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS, 11, 1),
- error(ParserErrorCode.MISSING_FUNCTION_BODY, 28, 1),
+ error(ParserErrorCode.MISSING_IDENTIFIER, 8, 2)
]);
}
}
diff --git a/pkg/analyzer/test/src/diagnostics/conflicting_generic_interfaces_test.dart b/pkg/analyzer/test/src/diagnostics/conflicting_generic_interfaces_test.dart
index c12c914..2364d00 100644
--- a/pkg/analyzer/test/src/diagnostics/conflicting_generic_interfaces_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/conflicting_generic_interfaces_test.dart
@@ -18,21 +18,6 @@
@reflectiveTest
class ConflictingGenericInterfacesTest extends DriverResolutionTest {
- disabled_test_hierarchyLoop_infinite() async {
- // There is an interface conflict here due to a loop in the class
- // hierarchy leading to an infinite set of implemented types; this loop
- // shouldn't cause non-termination.
-
- // TODO(paulberry): this test is currently disabled due to non-termination
- // bugs elsewhere in the analyzer.
- await assertErrorsInCode('''
-class A<T> implements B<List<T>> {}
-class B<T> implements A<List<T>> {}
-''', [
- error(CompileTimeErrorCode.CONFLICTING_GENERIC_INTERFACES, 0, 0),
- ]);
- }
-
test_class_extends_implements() async {
await assertErrorsInCode('''
class I<T> {}
@@ -76,6 +61,15 @@
error(CompileTimeErrorCode.CONFLICTING_GENERIC_INTERFACES, 75, 28),
]);
}
+
+ test_noConflict() async {
+ await assertNoErrorsInCode('''
+class I<T> {}
+class A implements I<int> {}
+class B implements I<int> {}
+class C extends A implements B {}
+''');
+ }
}
@reflectiveTest
diff --git a/pkg/analyzer/test/src/diagnostics/conflicting_type_variable_and_container_test.dart b/pkg/analyzer/test/src/diagnostics/conflicting_type_variable_and_container_test.dart
new file mode 100644
index 0000000..3403efa
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/conflicting_type_variable_and_container_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2020, 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/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ConflictingTypeVariableAndClassTest);
+ defineReflectiveTests(ConflictingTypeVariableAndExtensionTest);
+ });
+}
+
+@reflectiveTest
+class ConflictingTypeVariableAndClassTest extends DriverResolutionTest {
+ test_conflict_on_class() async {
+ await assertErrorsInCode(r'''
+class T<T> {}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS, 8, 1),
+ ]);
+ }
+
+ test_conflict_on_mixin() async {
+ await assertErrorsInCode(r'''
+mixin T<T> {}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS, 8, 1),
+ ]);
+ }
+}
+
+@reflectiveTest
+class ConflictingTypeVariableAndExtensionTest extends DriverResolutionTest {
+ test_conflict() async {
+ await assertErrorsInCode(r'''
+extension T<T> on String {}
+''', [
+ error(
+ CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION, 12, 1),
+ ]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/conflicting_type_variable_and_member_test.dart b/pkg/analyzer/test/src/diagnostics/conflicting_type_variable_and_member_test.dart
new file mode 100644
index 0000000..7cd84a8b
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/conflicting_type_variable_and_member_test.dart
@@ -0,0 +1,110 @@
+// Copyright (c) 2020, 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/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ConflictingTypeVariableAndMemberExtensionTest);
+ defineReflectiveTests(ConflictingTypeVariableAndMemberTest);
+ });
+}
+
+@reflectiveTest
+class ConflictingTypeVariableAndMemberExtensionTest
+ extends DriverResolutionTest {
+ test_getter() async {
+ await assertErrorsInCode(r'''
+extension A<T> on String {
+ get T => null;
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION,
+ 12, 1),
+ ]);
+ }
+
+ test_method() async {
+ await assertErrorsInCode(r'''
+extension A<T> on String {
+ T() {}
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION,
+ 12, 1),
+ ]);
+ }
+
+ test_setter() async {
+ await assertErrorsInCode(r'''
+extension A<T> on String {
+ set T(x) {}
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION,
+ 12, 1),
+ ]);
+ }
+}
+
+@reflectiveTest
+class ConflictingTypeVariableAndMemberTest extends DriverResolutionTest {
+ test_field() async {
+ await assertErrorsInCode(r'''
+class A<T> {
+ var T;
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
+ ]);
+ }
+
+ test_getter() async {
+ await assertErrorsInCode(r'''
+class A<T> {
+ get T => null;
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
+ ]);
+ }
+
+ test_method() async {
+ await assertErrorsInCode(r'''
+class A<T> {
+ T() {}
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
+ ]);
+ }
+
+ test_method_static() async {
+ await assertErrorsInCode(r'''
+class A<T> {
+ static T() {}
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
+ ]);
+ }
+
+ test_setter() async {
+ await assertErrorsInCode(r'''
+class A<T> {
+ set T(x) {}
+}
+''', [
+ error(CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS, 8,
+ 1),
+ ]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_null_aware_operator_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_null_aware_operator_test.dart
index 87edfd6..1d72a87 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_null_aware_operator_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_null_aware_operator_test.dart
@@ -24,6 +24,30 @@
[EnableString.non_nullable],
);
+ test_getter_class() async {
+ await assertNoErrorsInCode('''
+class C {
+ static int x = 0;
+}
+
+f() {
+ C?.x;
+}
+''');
+ }
+
+ test_getter_extension() async {
+ await assertNoErrorsInCode('''
+extension E on int {
+ static int x = 0;
+}
+
+f() {
+ E?.x;
+}
+''');
+ }
+
test_getter_legacy() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.5
@@ -40,6 +64,18 @@
''');
}
+ test_getter_mixin() async {
+ await assertNoErrorsInCode('''
+mixin M {
+ static int x = 0;
+}
+
+f() {
+ M?.x;
+}
+''');
+ }
+
test_getter_nonNullable() async {
await assertErrorsInCode('''
f(int x) {
@@ -61,18 +97,6 @@
''');
}
- test_getter_Type() async {
- await assertNoErrorsInCode('''
-class C {
- static int x = 0;
-}
-
-f() {
- C?.x;
-}
-''');
- }
-
test_index_legacy() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.5
@@ -114,6 +138,30 @@
''');
}
+ test_method_class() async {
+ await assertNoErrorsInCode('''
+class C {
+ static void foo() {}
+}
+
+f() {
+ C?.foo();
+}
+''');
+ }
+
+ test_method_extension() async {
+ await assertNoErrorsInCode('''
+extension E on int {
+ static void foo() {}
+}
+
+f() {
+ E?.foo();
+}
+''');
+ }
+
test_method_legacy() async {
newFile('/test/lib/a.dart', content: r'''
// @dart = 2.5
@@ -130,6 +178,18 @@
''');
}
+ test_method_mixin() async {
+ await assertNoErrorsInCode('''
+mixin M {
+ static void foo() {}
+}
+
+f() {
+ M?.foo();
+}
+''');
+ }
+
test_method_nonNullable() async {
await assertErrorsInCode('''
f(int x) {
@@ -191,4 +251,40 @@
}
''');
}
+
+ test_setter_class() async {
+ await assertNoErrorsInCode('''
+class C {
+ static int x = 0;
+}
+
+f() {
+ C?.x = 0;
+}
+''');
+ }
+
+ test_setter_extension() async {
+ await assertNoErrorsInCode('''
+extension E on int {
+ static int x = 0;
+}
+
+f() {
+ E?.x = 0;
+}
+''');
+ }
+
+ test_setter_mixin() async {
+ await assertNoErrorsInCode('''
+mixin M {
+ static int x = 0;
+}
+
+f() {
+ M?.x = 0;
+}
+''');
+ }
}
diff --git a/pkg/analyzer/test/src/diagnostics/recursive_interface_inheritance_test.dart b/pkg/analyzer/test/src/diagnostics/recursive_interface_inheritance_test.dart
new file mode 100644
index 0000000..8650d66
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/recursive_interface_inheritance_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2020, 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/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/driver_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(RecursiveInterfaceInheritanceTest);
+ });
+}
+
+@reflectiveTest
+class RecursiveInterfaceInheritanceTest extends DriverResolutionTest {
+ test_loop() async {
+ await assertErrorsInCode('''
+class A implements B {}
+class B implements A {}
+''', [
+ error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 6, 1),
+ error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 30, 1),
+ ]);
+ }
+
+ test_loop_generic() async {
+ await assertErrorsInCode('''
+class A<T> implements B<T> {}
+class B<T> implements A<T> {}
+''', [
+ error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 6, 1),
+ error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 36, 1),
+ ]);
+ }
+
+ test_loop_generic_typeArgument() async {
+ await assertErrorsInCode('''
+class A<T> implements B<List<T>> {}
+class B<T> implements A<List<T>> {}
+''', [
+ error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 6, 1),
+ error(CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, 42, 1),
+ ]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index f6ce164..615827a 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -50,6 +50,10 @@
as conflicting_generic_interfaces;
import 'conflicting_static_and_instance_test.dart'
as conflicting_static_and_instance;
+import 'conflicting_type_variable_and_container_test.dart'
+ as conflicting_type_variable_and_container;
+import 'conflicting_type_variable_and_member_test.dart'
+ as conflicting_type_variable_and_member;
import 'const_constructor_param_type_mismatch_test.dart'
as const_constructor_param_type_mismatch;
import 'const_constructor_with_mixin_with_field_test.dart'
@@ -384,6 +388,8 @@
import 'recursive_constructor_redirect_test.dart'
as recursive_constructor_redirect;
import 'recursive_factory_redirect_test.dart' as recursive_factory_redirect;
+import 'recursive_interface_inheritance_test.dart'
+ as recursive_interface_inheritance;
import 'redirect_generative_to_missing_constructor_test.dart'
as redirect_generative_to_missing_constructor;
import 'redirect_generative_to_non_generative_constructor_test.dart'
@@ -553,6 +559,8 @@
concrete_class_with_abstract_member.main();
conflicting_generic_interfaces.main();
conflicting_static_and_instance.main();
+ conflicting_type_variable_and_container.main();
+ conflicting_type_variable_and_member.main();
const_constructor_param_type_mismatch.main();
const_constructor_with_mixin_with_field.main();
const_eval_throws_exception.main();
@@ -777,6 +785,7 @@
recursive_compile_time_constant.main();
recursive_constructor_redirect.main();
recursive_factory_redirect.main();
+ recursive_interface_inheritance.main();
redirect_generative_to_missing_constructor.main();
redirect_generative_to_non_generative_constructor.main();
redirect_to_abstract_class_constructor.main();
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 9978fd4..a7ea7ee 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
@@ -99,51 +99,11 @@
@override
void visitCompilationUnit(CompilationUnit node) {
- node.declarations.forEach((Declaration declaration) {
- if (declaration is ClassDeclaration) {
- declaredClass(declaration);
- _visitTypeParameters(declaration, declaration.typeParameters);
- } else if (declaration is EnumDeclaration) {
- declaredEnum(declaration);
- } else if (declaration is ExtensionDeclaration) {
- declaredExtension(declaration);
- _visitTypeParameters(declaration, declaration.typeParameters);
- } else if (declaration is FunctionDeclaration) {
- declaredFunction(declaration);
- _visitTypeParameters(
- declaration,
- declaration.functionExpression.typeParameters,
- );
- } else if (declaration is TopLevelVariableDeclaration) {
- var varList = declaration.variables;
- if (varList != null) {
- varList.variables.forEach((VariableDeclaration varDecl) {
- declaredTopLevelVar(varList, varDecl);
- });
- }
- } else if (declaration is ClassTypeAlias) {
- declaredClassTypeAlias(declaration);
- _visitTypeParameters(declaration, declaration.typeParameters);
- } else if (declaration is FunctionTypeAlias) {
- declaredFunctionTypeAlias(declaration);
- _visitTypeParameters(declaration, declaration.typeParameters);
- } else if (declaration is GenericTypeAlias) {
- declaredGenericTypeAlias(declaration);
- _visitTypeParameters(declaration, declaration.typeParameters);
- _visitTypeParameters(
- declaration.functionType,
- declaration.functionType?.typeParameters,
- );
- } else if (declaration is MixinDeclaration) {
- declaredMixin(declaration);
- _visitTypeParameters(declaration, declaration.typeParameters);
- }
- });
+ _visitCompilationUnit(node);
}
@override
void visitConstructorDeclaration(ConstructorDeclaration node) {
- declaredConstructor(node);
_visitParamList(node.parameters);
visitNode(node);
}
@@ -243,6 +203,58 @@
}
}
+ void _visitCompilationUnit(CompilationUnit node) {
+ node.declarations.forEach((Declaration declaration) {
+ if (declaration is ClassDeclaration) {
+ declaredClass(declaration);
+ _visitTypeParameters(declaration, declaration.typeParameters);
+ // Call declaredConstructor all ConstructorDeclarations when the class
+ // is called: constructors are accessible if the class is accessible.
+ for (var classDeclaration
+ in node.declarations.whereType<ClassDeclaration>()) {
+ for (var constructor
+ in classDeclaration.members.whereType<ConstructorDeclaration>()) {
+ declaredConstructor(constructor);
+ }
+ }
+ } else if (declaration is EnumDeclaration) {
+ declaredEnum(declaration);
+ } else if (declaration is ExtensionDeclaration) {
+ declaredExtension(declaration);
+ _visitTypeParameters(declaration, declaration.typeParameters);
+ } else if (declaration is FunctionDeclaration) {
+ declaredFunction(declaration);
+ _visitTypeParameters(
+ declaration,
+ declaration.functionExpression.typeParameters,
+ );
+ } else if (declaration is TopLevelVariableDeclaration) {
+ var varList = declaration.variables;
+ if (varList != null) {
+ varList.variables.forEach((VariableDeclaration varDecl) {
+ declaredTopLevelVar(varList, varDecl);
+ });
+ }
+ } else if (declaration is ClassTypeAlias) {
+ declaredClassTypeAlias(declaration);
+ _visitTypeParameters(declaration, declaration.typeParameters);
+ } else if (declaration is FunctionTypeAlias) {
+ declaredFunctionTypeAlias(declaration);
+ _visitTypeParameters(declaration, declaration.typeParameters);
+ } else if (declaration is GenericTypeAlias) {
+ declaredGenericTypeAlias(declaration);
+ _visitTypeParameters(declaration, declaration.typeParameters);
+ _visitTypeParameters(
+ declaration.functionType,
+ declaration.functionType?.typeParameters,
+ );
+ } else if (declaration is MixinDeclaration) {
+ declaredMixin(declaration);
+ _visitTypeParameters(declaration, declaration.typeParameters);
+ }
+ });
+ }
+
void _visitParamList(FormalParameterList paramList) {
if (paramList != null) {
paramList.parameters.forEach((FormalParameter param) {
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 965758e..22bd612 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -169,6 +169,11 @@
"supported levels are: 0, 1, 2, 3, 4");
return;
}
+ if (optimizationLevel != null) {
+ print("Optimization level '$argument' ignored "
+ "due to preceding '-O$optimizationLevel'");
+ return;
+ }
optimizationLevel = value;
}
diff --git a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
index 13fbaf9..8079a1e 100644
--- a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
@@ -95,7 +95,13 @@
for (int i = 0; i < selector.argumentCount; i++) {
String name = 'arg$i';
- parameters.add(new jsAst.Parameter(name));
+ parameters.add(jsAst.Parameter(name));
+ arguments.add(js('#', name));
+ }
+
+ for (int i = 0; i < selector.typeArgumentCount; i++) {
+ String name = '\$T${i + 1}';
+ parameters.add(jsAst.Parameter(name));
arguments.add(js('#', name));
}
diff --git a/pkg/compiler/lib/src/js_model/element_map_impl.dart b/pkg/compiler/lib/src/js_model/element_map_impl.dart
index 7c7d005..fe06ca1 100644
--- a/pkg/compiler/lib/src/js_model/element_map_impl.dart
+++ b/pkg/compiler/lib/src/js_model/element_map_impl.dart
@@ -1331,9 +1331,10 @@
bool mayLookupInMain() {
var mainUri = elementEnvironment.mainLibrary.canonicalUri;
// Tests permit lookup outside of dart: libraries.
- return mainUri.path.contains('tests/compiler/dart2js_native') ||
- mainUri.path.contains(RegExp(r'(?<!generated_)tests/dart2js_2/internal')) ||
- mainUri.path.contains(RegExp(r'(?<!generated_)tests/dart2js_2/native'));
+ return mainUri.path
+ .contains(RegExp(r'(?<!generated_)tests/dart2js_2/internal')) ||
+ mainUri.path
+ .contains(RegExp(r'(?<!generated_)tests/dart2js_2/native'));
}
DartType lookup(String typeName, {bool required}) {
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index 531eb4f..b0748af 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -35,10 +35,11 @@
bool maybeEnableNative(Uri uri) {
bool allowedTestLibrary() {
String scriptName = uri.path;
- return scriptName.contains('tests/compiler/dart2js_native') ||
- scriptName.contains(RegExp(r'(?<!generated_)tests/dart2js_2/native')) ||
- scriptName.contains(RegExp(r'(?<!generated_)tests/dart2js_2/internal')) ||
- scriptName.contains('generated_tests/dart2js_native/native_test');
+ return scriptName
+ .contains(RegExp(r'(?<!generated_)tests/dart2js_2/native')) ||
+ scriptName
+ .contains(RegExp(r'(?<!generated_)tests/dart2js_2/internal')) ||
+ scriptName.contains('generated_tests/dart2js_2/native/native_test');
}
bool allowedDartLibrary() {
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index e9f7974..7031f2e 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -915,9 +915,10 @@
bool mayLookupInMain() {
var mainUri = elementEnvironment.mainLibrary.canonicalUri;
// Tests permit lookup outside of dart: libraries.
- return mainUri.path.contains('tests/compiler/dart2js_native') ||
- mainUri.path.contains(RegExp(r'(?<!generated_)tests/dart2js_2/internal')) ||
- mainUri.path.contains(RegExp(r'(?<!generated_)tests/dart2js_2/native'));
+ return mainUri.path
+ .contains(RegExp(r'(?<!generated_)tests/dart2js_2/internal')) ||
+ mainUri.path
+ .contains(RegExp(r'(?<!generated_)tests/dart2js_2/native'));
}
DartType lookup(String typeName, {bool required}) {
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 770ab50..b3fac71 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -1494,7 +1494,13 @@
// handler or check types at this point.
return;
}
- HInstruction newParameter = localsHandler.directLocals[local];
+ if (elidedParameters.contains(local)) {
+ // Elided parameters are initialized to a default value that is
+ // statically checked.
+ return;
+ }
+
+ HInstruction newParameter = localsHandler.readLocal(local);
assert(newParameter != null, "No initial instruction for ${local}.");
DartType type = _getDartTypeIfValid(variable.type);
@@ -1508,7 +1514,7 @@
targetElement, newParameter, type);
}
- localsHandler.directLocals[local] = newParameter;
+ localsHandler.updateLocal(local, newParameter);
}
function.positionalParameters.forEach(_handleParameter);
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index ebfce15..f844949 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -2309,6 +2309,9 @@
accept(HVisitor visitor) => visitor.visitLocalGet(this);
HLocalValue get local => inputs[0];
+
+ @override
+ String toString() => 'HLocalGet($local).$hashCode';
}
class HLocalSet extends HLocalAccess {
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index ff1f05e..539a383 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -312,12 +312,40 @@
// can also be constant folded away.
next = replacement;
}
- block.remove(instruction);
+ _removeInstructionAndPureDeadInputs(instruction);
}
instruction = next;
}
}
+ /// Removes [instruction] and the DAG of pure instructions that are transitive
+ /// inputs to [instruction].
+ ///
+ /// It is worth doing the cleanup of removing the instructions in the
+ /// simplifier as it reduces the `usedBy` count, which enables rewrites that
+ /// are sensitive to the use count. Such rewrites can occur much earlier with
+ /// 'online' usedBy counting. The cost of visiting all inputs of a rewritten
+ /// instruction is regained by avoiding visiting the dead instructions in
+ /// subsequent passes.
+ void _removeInstructionAndPureDeadInputs(HInstruction instruction) {
+ List<HInstruction> worklist = instruction.inputs.toList();
+ instruction.block.remove(instruction);
+ for (int i = 0; i < worklist.length; i++) {
+ HInstruction next = worklist[i];
+ HBasicBlock block = next.block;
+ if (block == null) continue; // Already removed.
+ if (next.usedBy.isEmpty && next.isPure(_abstractValueDomain)) {
+ // Special cases that are removed properly by other phases.
+ if (next is HParameterValue) continue;
+ if (next is HLocalValue) continue;
+ if (next is HConstant) continue;
+ if (next is HPhi) continue;
+ worklist.addAll(next.inputs);
+ block.remove(next);
+ }
+ }
+ }
+
// Simplify some CFG diamonds to equivalent expressions.
simplifyPhis(HBasicBlock block) {
// Is [block] the join point for a simple diamond that generates a single
@@ -481,13 +509,64 @@
// convert to a value parameter.
if (node.usedAsVariable()) {
- if (!node.usedBy.every((user) => user is HLocalGet)) return node;
// Trivial SSA-conversion. Replace all HLocalGet instructions with the
// parameter.
- for (HLocalGet user in node.usedBy.toList()) {
- user.block.rewrite(user, node);
+ //
+ // If there is a single assignment, it could dominate all the reads, or
+ // dominate all the reads except one read, which was used to 'check' the
+ // value at entry, like this:
+ //
+ // t1 = HLocalGet(param);
+ // t2 = check(t1); // replace t1 with param
+ // HLocalSet(param, t2);
+ // ....
+ // t3 = HLocalGet(param);
+ // ... t3 ... // replace t3 with t2
+ //
+ HLocalSet assignment;
+ for (HInstruction user in node.usedBy) {
+ if (user is HLocalSet) {
+ assert(user.local == node);
+ if (assignment != null) return node; // Two or more assignments.
+ assignment = user;
+ continue;
+ }
+ if (user is HLocalGet) continue;
+ // There should not really be anything else but there are Phis which
+ // have not been cleaned up.
+ return node;
+ }
+ HLocalGet checkedLoad;
+ HInstruction value = node;
+ if (assignment != null) {
+ value = assignment.value;
+ HInstruction source = value.nonCheck();
+ if (source is HLocalGet && source.local == node) {
+ if (source.usedBy.length != 1) return node;
+ checkedLoad = source;
+ }
+ }
+ // If there is a single assignment it will dominate all other uses.
+ List<HLocalGet> loads = [];
+ for (HInstruction user in node.usedBy) {
+ if (user == assignment) continue;
+ if (user == checkedLoad) continue;
+ assert(user is HLocalGet && user.local == node);
+ if (assignment != null && !assignment.dominates(user)) return node;
+ loads.add(user);
+ }
+
+ for (HLocalGet user in loads) {
+ user.block.rewrite(user, value);
user.block.remove(user);
}
+ if (checkedLoad != null) {
+ checkedLoad.block.rewrite(checkedLoad, node);
+ checkedLoad.block.remove(checkedLoad);
+ }
+ if (assignment != null) {
+ assignment.block.remove(assignment);
+ }
}
propagateConstantValueToUses(node);
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index 1c7f7ae..ac9cfc9 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -288,14 +288,14 @@
@override
String visitLocalGet(HLocalGet node) {
String localName = node.variable.name;
- return 'LocalGet: ${temporaryId(node.local)}.$localName';
+ return 'LocalGet: ${temporaryId(node.receiver)}.$localName';
}
@override
String visitLocalSet(HLocalSet node) {
String valueId = temporaryId(node.value);
String localName = node.variable.name;
- return 'LocalSet: ${temporaryId(node.local)}.$localName to $valueId';
+ return 'LocalSet: ${temporaryId(node.receiver)}.$localName to $valueId';
}
@override
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index 6d3201c..5da0917 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -231,12 +231,8 @@
// JavaScript. Many checks are compiled to a function call expression that
// returns the checked result, so the check can be generated as a
// subexpression rather than a separate statement.
- //
- // Do not replace local accesses, since the local must be a HLocalValue,
- // not a HTypeConversion.
- if (!(input is HParameterValue && input.usedAsVariable())) {
- input.replaceAllUsersDominatedBy(instruction.next, instruction);
- }
+ assert(!(input is HParameterValue && input.usedAsVariable()));
+ input.replaceAllUsersDominatedBy(instruction.next, instruction);
}
return outputType;
}
@@ -289,12 +285,8 @@
if (inputType != outputType) {
// Replace dominated uses of input with uses of this HPrimitiveCheck so
// the uses benefit from the stronger type.
- //
- // Do not replace local variable accesses, since the local must be a
- // HLocalValue, not another kind of instruction.
- if (!(input is HParameterValue && input.usedAsVariable())) {
- input.replaceAllUsersDominatedBy(instruction.next, instruction);
- }
+ assert(!(input is HParameterValue && input.usedAsVariable()));
+ input.replaceAllUsersDominatedBy(instruction.next, instruction);
}
return outputType;
}
@@ -508,12 +500,8 @@
if (inputType != outputType) {
// Replace dominated uses of input with uses of this check so the uses
// benefit from the stronger type.
- //
- // Do not replace local accesses, since the local must be a HLocalValue,
- // not a HNullCheck.
- if (!(input is HParameterValue && input.usedAsVariable())) {
- input.replaceAllUsersDominatedBy(instruction.next, instruction);
- }
+ assert(!(input is HParameterValue && input.usedAsVariable()));
+ input.replaceAllUsersDominatedBy(instruction.next, instruction);
}
return outputType;
}
@@ -539,12 +527,8 @@
if (inputType != outputType) {
// Replace dominated uses of input with uses of this check so the uses
// benefit from the stronger type.
- //
- // Do not replace local accesses, since the local must be a HLocalValue,
- // not a HAsCheck.
- if (!(input is HParameterValue && input.usedAsVariable())) {
- input.replaceAllUsersDominatedBy(instruction.next, instruction);
- }
+ assert(!(input is HParameterValue && input.usedAsVariable()));
+ input.replaceAllUsersDominatedBy(instruction.next, instruction);
}
return outputType;
}
diff --git a/pkg/compiler/lib/src/ssa/validate.dart b/pkg/compiler/lib/src/ssa/validate.dart
index f53f94f..6bce627 100644
--- a/pkg/compiler/lib/src/ssa/validate.dart
+++ b/pkg/compiler/lib/src/ssa/validate.dart
@@ -14,7 +14,7 @@
}
void markInvalid(String reason) {
- print(reason);
+ print('Invalid: $reason');
isValid = false;
}
@@ -208,5 +208,15 @@
if (!hasCorrectUses()) {
markInvalid("Incorrect uses");
}
+
+ if (instruction is HLocalGet) {
+ if (instruction.inputs.length != 1) {
+ markInvalid('HLocalGet has one input');
+ }
+ HInstruction input = instruction.inputs.first;
+ if (input is! HLocalValue) {
+ markInvalid('Incorrect input ${input.runtimeType} to HLocalGet');
+ }
+ }
}
}
diff --git a/pkg/compiler/test/end_to_end/all_native_test.dart b/pkg/compiler/test/end_to_end/all_native_test.dart
index 3917078..c8e7619 100644
--- a/pkg/compiler/test/end_to_end/all_native_test.dart
+++ b/pkg/compiler/test/end_to_end/all_native_test.dart
@@ -18,7 +18,7 @@
test(List<String> options) async {
DiagnosticCollector collector = new DiagnosticCollector();
- String fileName = 'sdk/tests/compiler/dart2js_native/main.dart';
+ String fileName = 'sdk/tests/dart2js_2/native/main.dart';
Uri entryPoint = Uri.parse('memory:$fileName');
await runCompiler(
entryPoint: entryPoint,
diff --git a/pkg/compiler/test/equivalence/id_equivalence_helper.dart b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
index d6da685..f77a9ff 100644
--- a/pkg/compiler/test/equivalence/id_equivalence_helper.dart
+++ b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
@@ -481,7 +481,7 @@
Uri createUriForFileName(String fileName) {
// Pretend this is a dart2js_native test to allow use of 'native'
// keyword and import of private libraries.
- return Uri.parse('memory:sdk/tests/compiler/dart2js_native/$fileName');
+ return Uri.parse('memory:sdk/tests/dart2js_2/native/$fileName');
}
Future<TestResult<T>> runTestForConfiguration<T>(TestConfig testConfiguration,
diff --git a/pkg/compiler/test/js/js_constant_test.dart b/pkg/compiler/test/js/js_constant_test.dart
index 872c58b..70a654e 100644
--- a/pkg/compiler/test/js/js_constant_test.dart
+++ b/pkg/compiler/test/js/js_constant_test.dart
@@ -24,7 +24,7 @@
check(String test) async {
// Pretend this is a dart2js_native test to allow use of 'native' keyword
// and import of private libraries.
- String main = 'sdk/tests/compiler/dart2js_native/main.dart';
+ String main = 'sdk/tests/dart2js_2/native/main.dart';
Uri entryPoint = Uri.parse('memory:$main');
var result = await runCompiler(
entryPoint: entryPoint, memorySourceFiles: {main: test});
diff --git a/pkg/compiler/test/js/js_spec_optimization_test.dart b/pkg/compiler/test/js/js_spec_optimization_test.dart
index c7c928d..aaf56ed 100644
--- a/pkg/compiler/test/js/js_spec_optimization_test.dart
+++ b/pkg/compiler/test/js/js_spec_optimization_test.dart
@@ -91,7 +91,7 @@
runTests() async {
check(String test) async {
var checker = checkerForAbsentPresent(test);
- String main = 'sdk/tests/compiler/dart2js_native/main.dart';
+ String main = 'sdk/tests/dart2js_2/native/main.dart';
Uri entryPoint = Uri.parse('memory:$main');
var result = await runCompiler(
entryPoint: entryPoint, memorySourceFiles: {main: test});
diff --git a/pkg/compiler/test/model/cfe_annotations_test.dart b/pkg/compiler/test/model/cfe_annotations_test.dart
index 3c5dbd4..20e0c2b 100644
--- a/pkg/compiler/test/model/cfe_annotations_test.dart
+++ b/pkg/compiler/test/model/cfe_annotations_test.dart
@@ -19,7 +19,7 @@
import '../helpers/args_helper.dart';
import '../helpers/memory_compiler.dart';
-const String pathPrefix = 'sdk/tests/compiler/dart2js_native/';
+const String pathPrefix = 'sdk/tests/dart2js_2/native/';
const Map<String, String> source = {
'$pathPrefix/main.dart': '''
diff --git a/pkg/compiler/test/model/native_test.dart b/pkg/compiler/test/model/native_test.dart
index e085842..88d5340 100644
--- a/pkg/compiler/test/model/native_test.dart
+++ b/pkg/compiler/test/model/native_test.dart
@@ -138,8 +138,8 @@
'54',
]);
- await runTest('tests/compiler/dart2js_native/native_test.dart',
- 'tests/compiler/dart2js_native/', {
+ await runTest('tests/dart2js_2/native/native_test.dart',
+ 'tests/dart2js_2/native/', {
'Class': Kind.regular,
'NativeClass': Kind.native,
'topLevelField': Kind.regular,
diff --git a/pkg/compiler/test/model/strong_mode_closed_world_test.dart b/pkg/compiler/test/model/strong_mode_closed_world_test.dart
index 6ee0535..55c1743 100644
--- a/pkg/compiler/test/model/strong_mode_closed_world_test.dart
+++ b/pkg/compiler/test/model/strong_mode_closed_world_test.dart
@@ -21,7 +21,7 @@
runTest() async {
// Pretend this is a dart2js_native test to allow use of 'native' keyword
// and import of private libraries.
- String main = 'sdk/tests/compiler/dart2js_native/main.dart';
+ String main = 'sdk/tests/dart2js_2/native/main.dart';
Uri entryPoint = Uri.parse('memory:$main');
CompilationResult result =
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index cbca683..cf51e41 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -3268,7 +3268,8 @@
for (var t in typeFormals) {
if (t.isGenericCovariantImpl && !_types.isTop(t.bound)) {
body.add(runtimeStatement('checkTypeBound(#, #, #)', [
- _emitType(TypeParameterType(t, Nullability.legacy)),
+ _emitTypeParameterType(TypeParameterType(t, Nullability.undetermined),
+ emitNullability: false),
_emitType(t.bound),
propertyName(t.name)
]));
diff --git a/pkg/dev_compiler/tool/ddb b/pkg/dev_compiler/tool/ddb
index 71de3eb..642d148 100755
--- a/pkg/dev_compiler/tool/ddb
+++ b/pkg/dev_compiler/tool/ddb
@@ -208,18 +208,23 @@
}
String ddcSdk;
+ String sdkJsPath;
+ String requirePath;
+ var suffix = isNnbdStrong ? p.join('sound', mod) : p.join('kernel', mod);
if (debug) {
var sdkRoot = p.dirname(p.dirname(ddcPath));
- var buildDir = p.join(sdkRoot, Platform.isMacOS ? 'xcodebuild' : 'out');
- dartSdk = p.join(buildDir, 'ReleaseX64', 'dart-sdk');
- ddcSdk = p.join(buildDir, 'ReleaseX64',
- isNnbdStrong ? 'ddc_outline_sound.dill' : 'ddc_outline.dill');
+ var buildDir =
+ p.join(sdkRoot, Platform.isMacOS ? 'xcodebuild' : 'out', 'ReleaseX64');
+ dartSdk = p.join(buildDir, 'dart-sdk');
+ ddcSdk = p.join(
+ buildDir, isNnbdStrong ? 'ddc_outline_sound.dill' : 'ddc_outline.dill');
+ sdkJsPath = p.join(buildDir, 'gen', 'utils', 'dartdevc', suffix);
+ requirePath = p.join(sdkRoot, 'third_party', 'requirejs');
} else {
ddcSdk = p.join(dartSdk, 'lib', '_internal', 'ddc_sdk.dill');
+ sdkJsPath = p.join(dartSdk, 'lib', 'dev_compiler', suffix);
+ requirePath = sdkJsPath;
}
- var suffix = p.join('kernel', mod);
- var sdkJsPath = p.join(dartSdk, 'lib', 'dev_compiler', suffix);
- var requirePath = sdkJsPath;
// Print an initial empty line to separate the invocation from the output.
print('');
diff --git a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
index a5fe70a..c49c884 100644
--- a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
@@ -140,6 +140,11 @@
Uri libraryUri,
[String className,
bool isStatic = false]);
+
+ /// Sets experimental features.
+ ///
+ /// This is currently only meant for testing purposes.
+ void setExperimentalFeaturesForTesting(Set<String> features);
}
bool isLegalIdentifier(String identifier) {
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index a898f25..b61112d 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -191,9 +191,9 @@
this.initializedForExpressionCompilationOnly = true {
enableExperimentsBasedOnEnvironment();
}
- void enableExperimentsBasedOnEnvironment() {
+ void enableExperimentsBasedOnEnvironment({Set<String> enabledExperiments}) {
// Note that these are all experimental. Use at your own risk.
- Set<String> enabledExperiments = getExperimentEnvironment();
+ enabledExperiments ??= getExperimentEnvironment();
if (enabledExperiments.contains(enableExperimentKeyInvalidation)) {
useExperimentalInvalidation = true;
}
@@ -206,6 +206,11 @@
}
@override
+ void setExperimentalFeaturesForTesting(Set<String> features) {
+ enableExperimentsBasedOnEnvironment(enabledExperiments: features);
+ }
+
+ @override
Future<Component> computeDelta(
{List<Uri> entryPoints, bool fullComponent: false}) async {
ticker.reset();
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 02645e8..2d1f0a2 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -1306,6 +1306,7 @@
@override
Expression parseSingleExpression(
Parser parser, Token token, FunctionNode parameters) {
+ assert(redirectingFactoryInvocations.isEmpty);
int fileOffset = offsetForToken(token);
List<TypeVariableBuilder> typeParameterBuilders;
for (TypeParameter typeParameter in parameters.typeParameters) {
@@ -1351,6 +1352,8 @@
fakeReturn == inferredStatement,
"Previously implicit assumption about inferFunctionBody "
"not returning anything different.");
+
+ resolveRedirectingFactoryTargets();
libraryBuilder.loader.transformPostInference(fakeReturn,
transformSetLiterals, transformCollections, libraryBuilder.library);
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 f36c534..98fea49 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
@@ -424,7 +424,6 @@
static const List<String> optOutTestPaths = [
'co19_2/',
- 'compiler/dart2js_native/',
'corelib_2/',
'dart2js_2/',
'ffi_2',
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_39033.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_39033.crash_dart.intertwined.expect
index cbcdcbf..836daaf 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_39033.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_39033.crash_dart.intertwined.expect
@@ -10,7 +10,8 @@
parseTopLevelKeywordModifiers(, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(F, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(F, typedefDeclaration)
listener: beginTypeVariables(<)
parseMetadataStar(<)
listener: beginMetadataStar(Glib)
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.expect
index 4aee1df..5aa54f3 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.expect
@@ -1,53 +1,21 @@
Problems reported:
-parser/error_recovery/keyword_named_typedefs:1:14: Can't use 'abstract' as a name here.
+parser/error_recovery/keyword_named_typedefs:1:14: Expected an identifier, but got 'abstract'.
typedef void abstract();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:2:9: Can't use 'abstract' as a name here.
+parser/error_recovery/keyword_named_typedefs:2:9: Expected an identifier, but got 'abstract'.
typedef abstract = void Function();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:2:18: A typedef needs an explicit list of parameters.
-typedef abstract = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:2:18: Expected ';' after this.
-typedef abstract = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:2:18: Expected a declaration, but got '='.
-typedef abstract = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:2:35: Expected a function body or '=>'.
-typedef abstract = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:3:14: Can't use 'as' as a name here.
+parser/error_recovery/keyword_named_typedefs:3:14: Expected an identifier, but got 'as'.
typedef void as();
^^
-parser/error_recovery/keyword_named_typedefs:4:9: Can't use 'as' as a name here.
+parser/error_recovery/keyword_named_typedefs:4:9: Expected an identifier, but got 'as'.
typedef as = void Function();
^^
-parser/error_recovery/keyword_named_typedefs:4:12: A typedef needs an explicit list of parameters.
-typedef as = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:4:12: Expected ';' after this.
-typedef as = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:4:12: Expected a declaration, but got '='.
-typedef as = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:4:29: Expected a function body or '=>'.
-typedef as = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:5:14: Expected an identifier, but got 'assert'.
typedef void assert();
^^^^^^
@@ -56,22 +24,6 @@
typedef assert = void Function();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:6:16: A typedef needs an explicit list of parameters.
-typedef assert = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:6:16: Expected ';' after this.
-typedef assert = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:6:16: Expected a declaration, but got '='.
-typedef assert = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:6:33: Expected a function body or '=>'.
-typedef assert = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:11:14: Expected an identifier, but got 'break'.
typedef void break();
^^^^^
@@ -80,22 +32,6 @@
typedef break = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:12:15: A typedef needs an explicit list of parameters.
-typedef break = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:12:15: Expected ';' after this.
-typedef break = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:12:15: Expected a declaration, but got '='.
-typedef break = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:12:32: Expected a function body or '=>'.
-typedef break = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:13:14: Expected an identifier, but got 'case'.
typedef void case();
^^^^
@@ -104,22 +40,6 @@
typedef case = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:14:14: A typedef needs an explicit list of parameters.
-typedef case = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:14:14: Expected ';' after this.
-typedef case = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:14:14: Expected a declaration, but got '='.
-typedef case = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:14:31: Expected a function body or '=>'.
-typedef case = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:15:14: Expected an identifier, but got 'catch'.
typedef void catch();
^^^^^
@@ -128,126 +48,22 @@
typedef catch = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:16:15: A typedef needs an explicit list of parameters.
-typedef catch = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:16:15: Expected ';' after this.
-typedef catch = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:16:15: Expected a declaration, but got '='.
-typedef catch = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:16:32: Expected a function body or '=>'.
-typedef catch = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:17:14: Expected an identifier, but got 'class'.
typedef void class();
^^^^^
-parser/error_recovery/keyword_named_typedefs:17:14: A typedef needs an explicit list of parameters.
-typedef void class();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:17:14: Expected ';' after this.
-typedef void class();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:17:19: Expected an identifier, but got '('.
-typedef void class();
- ^
-
-parser/error_recovery/keyword_named_typedefs:17:20: A class declaration must have a body, even if it is empty.
-typedef void class();
- ^
-
-parser/error_recovery/keyword_named_typedefs:17:20: Expected a declaration, but got ')'.
-typedef void class();
- ^
-
-parser/error_recovery/keyword_named_typedefs:17:21: Unexpected token ';'.
-typedef void class();
- ^
-
parser/error_recovery/keyword_named_typedefs:18:9: Expected an identifier, but got 'class'.
typedef class = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:18:9: A typedef needs an explicit list of parameters.
-typedef class = void Function();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:18:9: Expected ';' after this.
-typedef class = void Function();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:18:15: Expected an identifier, but got '='.
-typedef class = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:18:17: A class declaration must have a body, even if it is empty.
-typedef class = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:18:32: Expected a function body or '=>'.
-typedef class = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:19:14: Expected an identifier, but got 'const'.
typedef void const();
^^^^^
-parser/error_recovery/keyword_named_typedefs:19:14: A typedef needs an explicit list of parameters.
-typedef void const();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:19:14: Expected ';' after this.
-typedef void const();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:19:19: Expected an identifier, but got '('.
-typedef void const();
- ^
-
-parser/error_recovery/keyword_named_typedefs:19:14: Can't have modifier 'const' here.
-typedef void const();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:19:21: Expected a function body or '=>'.
-typedef void const();
- ^
-
parser/error_recovery/keyword_named_typedefs:20:9: Expected an identifier, but got 'const'.
typedef const = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:20:9: A typedef needs an explicit list of parameters.
-typedef const = void Function();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:20:9: Expected ';' after this.
-typedef const = void Function();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:20:15: Expected an identifier, but got '='.
-typedef const = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:20:17: Expected an identifier, but got 'void'.
-typedef const = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:20:17: Expected ';' after this.
-typedef const = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:20:32: Expected a function body or '=>'.
-typedef const = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:21:14: Expected an identifier, but got 'continue'.
typedef void continue();
^^^^^^^^
@@ -256,46 +72,14 @@
typedef continue = void Function();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:22:18: A typedef needs an explicit list of parameters.
-typedef continue = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:22:18: Expected ';' after this.
-typedef continue = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:22:18: Expected a declaration, but got '='.
-typedef continue = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:22:35: Expected a function body or '=>'.
-typedef continue = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:23:14: Can't use 'covariant' as a name here.
+parser/error_recovery/keyword_named_typedefs:23:14: Expected an identifier, but got 'covariant'.
typedef void covariant();
^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:24:9: Can't use 'covariant' as a name here.
+parser/error_recovery/keyword_named_typedefs:24:9: Expected an identifier, but got 'covariant'.
typedef covariant = void Function();
^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:24:19: A typedef needs an explicit list of parameters.
-typedef covariant = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:24:19: Expected ';' after this.
-typedef covariant = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:24:19: Expected a declaration, but got '='.
-typedef covariant = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:24:36: Expected a function body or '=>'.
-typedef covariant = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:25:14: Expected an identifier, but got 'default'.
typedef void default();
^^^^^^^
@@ -304,46 +88,14 @@
typedef default = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:26:17: A typedef needs an explicit list of parameters.
-typedef default = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:26:17: Expected ';' after this.
-typedef default = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:26:17: Expected a declaration, but got '='.
-typedef default = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:26:34: Expected a function body or '=>'.
-typedef default = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:27:14: Can't use 'deferred' as a name here.
+parser/error_recovery/keyword_named_typedefs:27:14: Expected an identifier, but got 'deferred'.
typedef void deferred();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:28:9: Can't use 'deferred' as a name here.
+parser/error_recovery/keyword_named_typedefs:28:9: Expected an identifier, but got 'deferred'.
typedef deferred = void Function();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:28:18: A typedef needs an explicit list of parameters.
-typedef deferred = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:28:18: Expected ';' after this.
-typedef deferred = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:28:18: Expected a declaration, but got '='.
-typedef deferred = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:28:35: Expected a function body or '=>'.
-typedef deferred = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:29:14: Expected an identifier, but got 'do'.
typedef void do();
^^
@@ -352,46 +104,14 @@
typedef do = void Function();
^^
-parser/error_recovery/keyword_named_typedefs:30:12: A typedef needs an explicit list of parameters.
-typedef do = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:30:12: Expected ';' after this.
-typedef do = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:30:12: Expected a declaration, but got '='.
-typedef do = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:30:29: Expected a function body or '=>'.
-typedef do = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:31:14: Can't use 'dynamic' as a name here.
+parser/error_recovery/keyword_named_typedefs:31:14: Expected an identifier, but got 'dynamic'.
typedef void dynamic();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:32:9: Can't use 'dynamic' as a name here.
+parser/error_recovery/keyword_named_typedefs:32:9: Expected an identifier, but got 'dynamic'.
typedef dynamic = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:32:17: A typedef needs an explicit list of parameters.
-typedef dynamic = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:32:17: Expected ';' after this.
-typedef dynamic = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:32:17: Expected a declaration, but got '='.
-typedef dynamic = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:32:34: Expected a function body or '=>'.
-typedef dynamic = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:33:14: Expected an identifier, but got 'else'.
typedef void else();
^^^^
@@ -400,98 +120,22 @@
typedef else = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:34:14: A typedef needs an explicit list of parameters.
-typedef else = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:34:14: Expected ';' after this.
-typedef else = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:34:14: Expected a declaration, but got '='.
-typedef else = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:34:31: Expected a function body or '=>'.
-typedef else = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:35:14: Expected an identifier, but got 'enum'.
typedef void enum();
^^^^
-parser/error_recovery/keyword_named_typedefs:35:14: A typedef needs an explicit list of parameters.
-typedef void enum();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:35:14: Expected ';' after this.
-typedef void enum();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:35:18: Expected an identifier, but got '('.
-typedef void enum();
- ^
-
-parser/error_recovery/keyword_named_typedefs:35:19: Expected a enum body, but got ')'.
-typedef void enum();
- ^
-
-parser/error_recovery/keyword_named_typedefs:35:19: Expected a declaration, but got ')'.
-typedef void enum();
- ^
-
-parser/error_recovery/keyword_named_typedefs:35:20: Unexpected token ';'.
-typedef void enum();
- ^
-
parser/error_recovery/keyword_named_typedefs:36:9: Expected an identifier, but got 'enum'.
typedef enum = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:36:9: A typedef needs an explicit list of parameters.
-typedef enum = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:36:9: Expected ';' after this.
-typedef enum = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:36:14: Expected an identifier, but got '='.
-typedef enum = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:36:16: Expected a enum body, but got 'void'.
-typedef enum = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:36:31: Expected a function body or '=>'.
-typedef enum = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:37:14: Can't use 'export' as a name here.
+parser/error_recovery/keyword_named_typedefs:37:14: Expected an identifier, but got 'export'.
typedef void export();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:38:9: Can't use 'export' as a name here.
+parser/error_recovery/keyword_named_typedefs:38:9: Expected an identifier, but got 'export'.
typedef export = void Function();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:38:16: A typedef needs an explicit list of parameters.
-typedef export = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:38:16: Expected ';' after this.
-typedef export = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:38:16: Expected a declaration, but got '='.
-typedef export = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:38:33: Expected a function body or '=>'.
-typedef export = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:39:14: Expected an identifier, but got 'extends'.
typedef void extends();
^^^^^^^
@@ -500,94 +144,30 @@
typedef extends = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:40:17: A typedef needs an explicit list of parameters.
-typedef extends = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:40:17: Expected ';' after this.
-typedef extends = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:40:17: Expected a declaration, but got '='.
-typedef extends = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:40:34: Expected a function body or '=>'.
-typedef extends = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:41:14: Can't use 'extension' as a name here.
+parser/error_recovery/keyword_named_typedefs:41:14: Expected an identifier, but got 'extension'.
typedef void extension();
^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:42:9: Can't use 'extension' as a name here.
+parser/error_recovery/keyword_named_typedefs:42:9: Expected an identifier, but got 'extension'.
typedef extension = void Function();
^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:42:19: A typedef needs an explicit list of parameters.
-typedef extension = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:42:19: Expected ';' after this.
-typedef extension = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:42:19: Expected a declaration, but got '='.
-typedef extension = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:42:36: Expected a function body or '=>'.
-typedef extension = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:43:14: Can't use 'external' as a name here.
+parser/error_recovery/keyword_named_typedefs:43:14: Expected an identifier, but got 'external'.
typedef void external();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:44:9: Can't use 'external' as a name here.
+parser/error_recovery/keyword_named_typedefs:44:9: Expected an identifier, but got 'external'.
typedef external = void Function();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:44:18: A typedef needs an explicit list of parameters.
-typedef external = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:44:18: Expected ';' after this.
-typedef external = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:44:18: Expected a declaration, but got '='.
-typedef external = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:44:35: Expected a function body or '=>'.
-typedef external = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:45:14: Can't use 'factory' as a name here.
+parser/error_recovery/keyword_named_typedefs:45:14: Expected an identifier, but got 'factory'.
typedef void factory();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:46:9: Can't use 'factory' as a name here.
+parser/error_recovery/keyword_named_typedefs:46:9: Expected an identifier, but got 'factory'.
typedef factory = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:46:17: A typedef needs an explicit list of parameters.
-typedef factory = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:46:17: Expected ';' after this.
-typedef factory = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:46:17: Expected a declaration, but got '='.
-typedef factory = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:46:34: Expected a function body or '=>'.
-typedef factory = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:47:14: Expected an identifier, but got 'false'.
typedef void false();
^^^^^
@@ -596,74 +176,14 @@
typedef false = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:48:15: A typedef needs an explicit list of parameters.
-typedef false = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:48:15: Expected ';' after this.
-typedef false = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:48:15: Expected a declaration, but got '='.
-typedef false = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:48:32: Expected a function body or '=>'.
-typedef false = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:49:14: Expected an identifier, but got 'final'.
typedef void final();
^^^^^
-parser/error_recovery/keyword_named_typedefs:49:14: A typedef needs an explicit list of parameters.
-typedef void final();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:49:14: Expected ';' after this.
-typedef void final();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:49:19: Expected an identifier, but got '('.
-typedef void final();
- ^
-
-parser/error_recovery/keyword_named_typedefs:49:14: Can't have modifier 'final' here.
-typedef void final();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:49:21: Expected a function body or '=>'.
-typedef void final();
- ^
-
parser/error_recovery/keyword_named_typedefs:50:9: Expected an identifier, but got 'final'.
typedef final = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:50:9: A typedef needs an explicit list of parameters.
-typedef final = void Function();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:50:9: Expected ';' after this.
-typedef final = void Function();
- ^^^^^
-
-parser/error_recovery/keyword_named_typedefs:50:15: Expected an identifier, but got '='.
-typedef final = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:50:17: Expected an identifier, but got 'void'.
-typedef final = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:50:17: Expected ';' after this.
-typedef final = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:50:32: Expected a function body or '=>'.
-typedef final = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:51:14: Expected an identifier, but got 'finally'.
typedef void finally();
^^^^^^^
@@ -672,22 +192,6 @@
typedef finally = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:52:17: A typedef needs an explicit list of parameters.
-typedef finally = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:52:17: Expected ';' after this.
-typedef finally = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:52:17: Expected a declaration, but got '='.
-typedef finally = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:52:34: Expected a function body or '=>'.
-typedef finally = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:53:14: Expected an identifier, but got 'for'.
typedef void for();
^^^
@@ -696,50 +200,22 @@
typedef for = void Function();
^^^
-parser/error_recovery/keyword_named_typedefs:54:13: A typedef needs an explicit list of parameters.
-typedef for = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:54:13: Expected ';' after this.
-typedef for = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:54:13: Expected a declaration, but got '='.
-typedef for = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:54:30: Expected a function body or '=>'.
-typedef for = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:55:14: Expected an identifier, but got 'Function'.
typedef void Function();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:57:14: Can't use 'get' as a name here.
+parser/error_recovery/keyword_named_typedefs:56:9: Expected an identifier, but got 'Function'.
+typedef Function = void Function();
+ ^^^^^^^^
+
+parser/error_recovery/keyword_named_typedefs:57:14: Expected an identifier, but got 'get'.
typedef void get();
^^^
-parser/error_recovery/keyword_named_typedefs:58:9: Can't use 'get' as a name here.
+parser/error_recovery/keyword_named_typedefs:58:9: Expected an identifier, but got 'get'.
typedef get = void Function();
^^^
-parser/error_recovery/keyword_named_typedefs:58:13: A typedef needs an explicit list of parameters.
-typedef get = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:58:13: Expected ';' after this.
-typedef get = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:58:13: Expected a declaration, but got '='.
-typedef get = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:58:30: Expected a function body or '=>'.
-typedef get = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:61:14: Expected an identifier, but got 'if'.
typedef void if();
^^
@@ -748,70 +224,22 @@
typedef if = void Function();
^^
-parser/error_recovery/keyword_named_typedefs:62:12: A typedef needs an explicit list of parameters.
-typedef if = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:62:12: Expected ';' after this.
-typedef if = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:62:12: Expected a declaration, but got '='.
-typedef if = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:62:29: Expected a function body or '=>'.
-typedef if = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:63:14: Can't use 'implements' as a name here.
+parser/error_recovery/keyword_named_typedefs:63:14: Expected an identifier, but got 'implements'.
typedef void implements();
^^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:64:9: Can't use 'implements' as a name here.
+parser/error_recovery/keyword_named_typedefs:64:9: Expected an identifier, but got 'implements'.
typedef implements = void Function();
^^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:64:20: A typedef needs an explicit list of parameters.
-typedef implements = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:64:20: Expected ';' after this.
-typedef implements = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:64:20: Expected a declaration, but got '='.
-typedef implements = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:64:37: Expected a function body or '=>'.
-typedef implements = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:65:14: Can't use 'import' as a name here.
+parser/error_recovery/keyword_named_typedefs:65:14: Expected an identifier, but got 'import'.
typedef void import();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:66:9: Can't use 'import' as a name here.
+parser/error_recovery/keyword_named_typedefs:66:9: Expected an identifier, but got 'import'.
typedef import = void Function();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:66:16: A typedef needs an explicit list of parameters.
-typedef import = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:66:16: Expected ';' after this.
-typedef import = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:66:16: Expected a declaration, but got '='.
-typedef import = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:66:33: Expected a function body or '=>'.
-typedef import = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:67:14: Expected an identifier, but got 'in'.
typedef void in();
^^
@@ -820,46 +248,14 @@
typedef in = void Function();
^^
-parser/error_recovery/keyword_named_typedefs:68:12: A typedef needs an explicit list of parameters.
-typedef in = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:68:12: Expected ';' after this.
-typedef in = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:68:12: Expected a declaration, but got '='.
-typedef in = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:68:29: Expected a function body or '=>'.
-typedef in = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:71:14: Can't use 'interface' as a name here.
+parser/error_recovery/keyword_named_typedefs:71:14: Expected an identifier, but got 'interface'.
typedef void interface();
^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:72:9: Can't use 'interface' as a name here.
+parser/error_recovery/keyword_named_typedefs:72:9: Expected an identifier, but got 'interface'.
typedef interface = void Function();
^^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:72:19: A typedef needs an explicit list of parameters.
-typedef interface = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:72:19: Expected ';' after this.
-typedef interface = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:72:19: Expected a declaration, but got '='.
-typedef interface = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:72:36: Expected a function body or '=>'.
-typedef interface = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:73:14: Expected an identifier, but got 'is'.
typedef void is();
^^
@@ -868,94 +264,30 @@
typedef is = void Function();
^^
-parser/error_recovery/keyword_named_typedefs:74:12: A typedef needs an explicit list of parameters.
-typedef is = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:74:12: Expected ';' after this.
-typedef is = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:74:12: Expected a declaration, but got '='.
-typedef is = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:74:29: Expected a function body or '=>'.
-typedef is = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:75:14: Can't use 'late' as a name here.
+parser/error_recovery/keyword_named_typedefs:75:14: Expected an identifier, but got 'late'.
typedef void late();
^^^^
-parser/error_recovery/keyword_named_typedefs:76:9: Can't use 'late' as a name here.
+parser/error_recovery/keyword_named_typedefs:76:9: Expected an identifier, but got 'late'.
typedef late = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:76:14: A typedef needs an explicit list of parameters.
-typedef late = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:76:14: Expected ';' after this.
-typedef late = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:76:14: Expected a declaration, but got '='.
-typedef late = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:76:31: Expected a function body or '=>'.
-typedef late = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:77:14: Can't use 'library' as a name here.
+parser/error_recovery/keyword_named_typedefs:77:14: Expected an identifier, but got 'library'.
typedef void library();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:78:9: Can't use 'library' as a name here.
+parser/error_recovery/keyword_named_typedefs:78:9: Expected an identifier, but got 'library'.
typedef library = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:78:17: A typedef needs an explicit list of parameters.
-typedef library = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:78:17: Expected ';' after this.
-typedef library = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:78:17: Expected a declaration, but got '='.
-typedef library = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:78:34: Expected a function body or '=>'.
-typedef library = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:79:14: Can't use 'mixin' as a name here.
+parser/error_recovery/keyword_named_typedefs:79:14: Expected an identifier, but got 'mixin'.
typedef void mixin();
^^^^^
-parser/error_recovery/keyword_named_typedefs:80:9: Can't use 'mixin' as a name here.
+parser/error_recovery/keyword_named_typedefs:80:9: Expected an identifier, but got 'mixin'.
typedef mixin = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:80:15: A typedef needs an explicit list of parameters.
-typedef mixin = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:80:15: Expected ';' after this.
-typedef mixin = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:80:15: Expected a declaration, but got '='.
-typedef mixin = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:80:32: Expected a function body or '=>'.
-typedef mixin = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:83:14: Expected an identifier, but got 'new'.
typedef void new();
^^^
@@ -964,22 +296,6 @@
typedef new = void Function();
^^^
-parser/error_recovery/keyword_named_typedefs:84:13: A typedef needs an explicit list of parameters.
-typedef new = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:84:13: Expected ';' after this.
-typedef new = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:84:13: Expected a declaration, but got '='.
-typedef new = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:84:30: Expected a function body or '=>'.
-typedef new = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:85:14: Expected an identifier, but got 'null'.
typedef void null();
^^^^
@@ -988,94 +304,30 @@
typedef null = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:86:14: A typedef needs an explicit list of parameters.
-typedef null = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:86:14: Expected ';' after this.
-typedef null = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:86:14: Expected a declaration, but got '='.
-typedef null = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:86:31: Expected a function body or '=>'.
-typedef null = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:91:14: Can't use 'operator' as a name here.
+parser/error_recovery/keyword_named_typedefs:91:14: Expected an identifier, but got 'operator'.
typedef void operator();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:92:9: Can't use 'operator' as a name here.
+parser/error_recovery/keyword_named_typedefs:92:9: Expected an identifier, but got 'operator'.
typedef operator = void Function();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:92:18: A typedef needs an explicit list of parameters.
-typedef operator = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:92:18: Expected ';' after this.
-typedef operator = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:92:18: Expected a declaration, but got '='.
-typedef operator = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:92:35: Expected a function body or '=>'.
-typedef operator = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:95:14: Can't use 'part' as a name here.
+parser/error_recovery/keyword_named_typedefs:95:14: Expected an identifier, but got 'part'.
typedef void part();
^^^^
-parser/error_recovery/keyword_named_typedefs:96:9: Can't use 'part' as a name here.
+parser/error_recovery/keyword_named_typedefs:96:9: Expected an identifier, but got 'part'.
typedef part = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:96:14: A typedef needs an explicit list of parameters.
-typedef part = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:96:14: Expected ';' after this.
-typedef part = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:96:14: Expected a declaration, but got '='.
-typedef part = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:96:31: Expected a function body or '=>'.
-typedef part = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:99:14: Can't use 'required' as a name here.
+parser/error_recovery/keyword_named_typedefs:99:14: Expected an identifier, but got 'required'.
typedef void required();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:100:9: Can't use 'required' as a name here.
+parser/error_recovery/keyword_named_typedefs:100:9: Expected an identifier, but got 'required'.
typedef required = void Function();
^^^^^^^^
-parser/error_recovery/keyword_named_typedefs:100:18: A typedef needs an explicit list of parameters.
-typedef required = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:100:18: Expected ';' after this.
-typedef required = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:100:18: Expected a declaration, but got '='.
-typedef required = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:100:35: Expected a function body or '=>'.
-typedef required = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:101:14: Expected an identifier, but got 'rethrow'.
typedef void rethrow();
^^^^^^^
@@ -1084,22 +336,6 @@
typedef rethrow = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:102:17: A typedef needs an explicit list of parameters.
-typedef rethrow = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:102:17: Expected ';' after this.
-typedef rethrow = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:102:17: Expected a declaration, but got '='.
-typedef rethrow = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:102:34: Expected a function body or '=>'.
-typedef rethrow = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:103:14: Expected an identifier, but got 'return'.
typedef void return();
^^^^^^
@@ -1108,70 +344,22 @@
typedef return = void Function();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:104:16: A typedef needs an explicit list of parameters.
-typedef return = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:104:16: Expected ';' after this.
-typedef return = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:104:16: Expected a declaration, but got '='.
-typedef return = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:104:33: Expected a function body or '=>'.
-typedef return = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:105:14: Can't use 'set' as a name here.
+parser/error_recovery/keyword_named_typedefs:105:14: Expected an identifier, but got 'set'.
typedef void set();
^^^
-parser/error_recovery/keyword_named_typedefs:106:9: Can't use 'set' as a name here.
+parser/error_recovery/keyword_named_typedefs:106:9: Expected an identifier, but got 'set'.
typedef set = void Function();
^^^
-parser/error_recovery/keyword_named_typedefs:106:13: A typedef needs an explicit list of parameters.
-typedef set = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:106:13: Expected ';' after this.
-typedef set = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:106:13: Expected a declaration, but got '='.
-typedef set = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:106:30: Expected a function body or '=>'.
-typedef set = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:111:14: Can't use 'static' as a name here.
+parser/error_recovery/keyword_named_typedefs:111:14: Expected an identifier, but got 'static'.
typedef void static();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:112:9: Can't use 'static' as a name here.
+parser/error_recovery/keyword_named_typedefs:112:9: Expected an identifier, but got 'static'.
typedef static = void Function();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:112:16: A typedef needs an explicit list of parameters.
-typedef static = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:112:16: Expected ';' after this.
-typedef static = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:112:16: Expected a declaration, but got '='.
-typedef static = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:112:33: Expected a function body or '=>'.
-typedef static = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:113:14: Expected an identifier, but got 'super'.
typedef void super();
^^^^^
@@ -1180,22 +368,6 @@
typedef super = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:114:15: A typedef needs an explicit list of parameters.
-typedef super = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:114:15: Expected ';' after this.
-typedef super = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:114:15: Expected a declaration, but got '='.
-typedef super = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:114:32: Expected a function body or '=>'.
-typedef super = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:115:14: Expected an identifier, but got 'switch'.
typedef void switch();
^^^^^^
@@ -1204,22 +376,6 @@
typedef switch = void Function();
^^^^^^
-parser/error_recovery/keyword_named_typedefs:116:16: A typedef needs an explicit list of parameters.
-typedef switch = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:116:16: Expected ';' after this.
-typedef switch = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:116:16: Expected a declaration, but got '='.
-typedef switch = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:116:33: Expected a function body or '=>'.
-typedef switch = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:119:14: Expected an identifier, but got 'this'.
typedef void this();
^^^^
@@ -1228,22 +384,6 @@
typedef this = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:120:14: A typedef needs an explicit list of parameters.
-typedef this = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:120:14: Expected ';' after this.
-typedef this = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:120:14: Expected a declaration, but got '='.
-typedef this = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:120:31: Expected a function body or '=>'.
-typedef this = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:121:14: Expected an identifier, but got 'throw'.
typedef void throw();
^^^^^
@@ -1252,22 +392,6 @@
typedef throw = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:122:15: A typedef needs an explicit list of parameters.
-typedef throw = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:122:15: Expected ';' after this.
-typedef throw = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:122:15: Expected a declaration, but got '='.
-typedef throw = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:122:32: Expected a function body or '=>'.
-typedef throw = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:123:14: Expected an identifier, but got 'true'.
typedef void true();
^^^^
@@ -1276,22 +400,6 @@
typedef true = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:124:14: A typedef needs an explicit list of parameters.
-typedef true = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:124:14: Expected ';' after this.
-typedef true = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:124:14: Expected a declaration, but got '='.
-typedef true = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:124:31: Expected a function body or '=>'.
-typedef true = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:125:14: Expected an identifier, but got 'try'.
typedef void try();
^^^
@@ -1300,118 +408,26 @@
typedef try = void Function();
^^^
-parser/error_recovery/keyword_named_typedefs:126:13: A typedef needs an explicit list of parameters.
-typedef try = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:126:13: Expected ';' after this.
-typedef try = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:126:13: Expected a declaration, but got '='.
-typedef try = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:126:30: Expected a function body or '=>'.
-typedef try = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:127:14: Can't use 'typedef' as a name here.
+parser/error_recovery/keyword_named_typedefs:127:14: Expected an identifier, but got 'typedef'.
typedef void typedef();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:128:9: Can't use 'typedef' as a name here.
+parser/error_recovery/keyword_named_typedefs:128:9: Expected an identifier, but got 'typedef'.
typedef typedef = void Function();
^^^^^^^
-parser/error_recovery/keyword_named_typedefs:128:17: A typedef needs an explicit list of parameters.
-typedef typedef = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:128:17: Expected ';' after this.
-typedef typedef = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:128:17: Expected a declaration, but got '='.
-typedef typedef = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:128:34: Expected a function body or '=>'.
-typedef typedef = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:129:14: Expected an identifier, but got 'var'.
typedef void var();
^^^
-parser/error_recovery/keyword_named_typedefs:129:14: A typedef needs an explicit list of parameters.
-typedef void var();
- ^^^
-
-parser/error_recovery/keyword_named_typedefs:129:14: Expected ';' after this.
-typedef void var();
- ^^^
-
-parser/error_recovery/keyword_named_typedefs:129:17: Expected an identifier, but got '('.
-typedef void var();
- ^
-
-parser/error_recovery/keyword_named_typedefs:129:14: The return type can't be 'var'.
-typedef void var();
- ^^^
-
-parser/error_recovery/keyword_named_typedefs:129:19: Expected a function body or '=>'.
-typedef void var();
- ^
-
parser/error_recovery/keyword_named_typedefs:130:9: Expected an identifier, but got 'var'.
typedef var = void Function();
^^^
-parser/error_recovery/keyword_named_typedefs:130:9: A typedef needs an explicit list of parameters.
-typedef var = void Function();
- ^^^
-
-parser/error_recovery/keyword_named_typedefs:130:9: Expected ';' after this.
-typedef var = void Function();
- ^^^
-
-parser/error_recovery/keyword_named_typedefs:130:13: Expected an identifier, but got '='.
-typedef var = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:130:15: Expected an identifier, but got 'void'.
-typedef var = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:130:15: Expected ';' after this.
-typedef var = void Function();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:130:30: Expected a function body or '=>'.
-typedef var = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:131:14: Expected an identifier, but got 'void'.
typedef void void();
^^^^
-parser/error_recovery/keyword_named_typedefs:131:14: A typedef needs an explicit list of parameters.
-typedef void void();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:131:14: Expected ';' after this.
-typedef void void();
- ^^^^
-
-parser/error_recovery/keyword_named_typedefs:131:18: Expected an identifier, but got '('.
-typedef void void();
- ^
-
-parser/error_recovery/keyword_named_typedefs:131:20: Expected a function body or '=>'.
-typedef void void();
- ^
-
parser/error_recovery/keyword_named_typedefs:132:14: Expected an identifier, but got '='.
typedef void = void Function();
^
@@ -1440,22 +456,6 @@
typedef while = void Function();
^^^^^
-parser/error_recovery/keyword_named_typedefs:134:15: A typedef needs an explicit list of parameters.
-typedef while = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:134:15: Expected ';' after this.
-typedef while = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:134:15: Expected a declaration, but got '='.
-typedef while = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:134:32: Expected a function body or '=>'.
-typedef while = void Function();
- ^
-
parser/error_recovery/keyword_named_typedefs:135:14: Expected an identifier, but got 'with'.
typedef void with();
^^^^
@@ -1464,28 +464,12 @@
typedef with = void Function();
^^^^
-parser/error_recovery/keyword_named_typedefs:136:14: A typedef needs an explicit list of parameters.
-typedef with = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:136:14: Expected ';' after this.
-typedef with = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:136:14: Expected a declaration, but got '='.
-typedef with = void Function();
- ^
-
-parser/error_recovery/keyword_named_typedefs:136:31: Expected a function body or '=>'.
-typedef with = void Function();
- ^
-
beginCompilationUnit(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
- handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'abstract' as a name here., null, {token: abstract}], abstract, abstract)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'abstract'., null, {token: abstract}], abstract, abstract)
handleIdentifier(abstract, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -1495,41 +479,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
- handleNoType(typedef)
- handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'abstract' as a name here., null, {token: abstract}], abstract, abstract)
+ handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'abstract'., null, {token: abstract}], abstract, abstract)
handleIdentifier(abstract, typedefDeclaration)
handleNoTypeVariables(=)
- handleRecoverableError(MissingTypedefParameters, =, =)
- beginFormalParameters((, MemberKind.FunctionTypeAlias)
- endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
- handleVoidKeyword(void)
- handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
- beginFormalParameters((, MemberKind.TopLevelMethod)
- endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- handleAsyncModifier(null, null)
- handleRecoverableError(ExpectedBody, ;, ;)
- handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+ beginFunctionType(void)
+ handleVoidKeyword(void)
+ beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'as' as a name here., null, {token: as}], as, as)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'as'., null, {token: as}], as, as)
handleIdentifier(as, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -1539,35 +504,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'as' as a name here., null, {token: as}], as, as)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'as'., null, {token: as}], as, as)
handleIdentifier(as, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -1583,35 +529,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'assert'., null, {token: assert}], assert, assert)
handleIdentifier(assert, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -1673,35 +600,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'break'., null, {token: break}], break, break)
handleIdentifier(break, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -1717,35 +625,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'case'., null, {token: case}], case, case)
handleIdentifier(case, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -1761,203 +650,66 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'catch'., null, {token: catch}], catch, catch)
handleIdentifier(catch, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], class, class)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(class)
-handleRecoverableError(MissingTypedefParameters, class, class)
+handleIdentifier(class, typedefDeclaration)
+handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], class, class)
endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(class)
-beginMetadataStar(class)
-endMetadataStar(0)
-beginClassOrNamedMixinApplicationPrelude(class)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
-handleIdentifier(, classOrMixinDeclaration)
-handleNoTypeVariables())
-beginClassDeclaration(class, null, )
-handleNoType()
-handleClassExtends(null)
-handleClassNoWithClause()
-handleClassOrMixinImplements(null, 0)
-handleClassHeader(class, class, null)
-handleNoType()
-handleClassExtends(null)
-handleClassNoWithClause()
-handleClassOrMixinImplements(null, 0)
-handleRecoverClassHeader()
-handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], ), ))
-beginClassOrMixinBody(DeclarationKind.Class, {)
-endClassOrMixinBody(DeclarationKind.Class, 0, {, })
-endClassDeclaration(class, })
-endTopLevelDeclaration())
-beginMetadataStar())
-endMetadataStar(0)
-beginTopLevelMember())
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got ')'., null, {token: )}], ), ))
-handleInvalidTopLevelDeclaration())
-endTopLevelDeclaration(;)
-beginMetadataStar(;)
-endMetadataStar(0)
-beginTopLevelMember(;)
-handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {token: ;}], ;, ;)
-handleInvalidTopLevelDeclaration(;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], class, class)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(class)
-handleRecoverableError(MissingTypedefParameters, class, class)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], class, class)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(class)
-beginMetadataStar(class)
-endMetadataStar(0)
-beginClassOrNamedMixinApplicationPrelude(class)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
-handleIdentifier(, classOrMixinDeclaration)
-handleNoTypeVariables(void)
-beginClassDeclaration(class, null, )
-handleNoType()
-handleClassExtends(null)
-handleClassNoWithClause()
-handleClassOrMixinImplements(null, 0)
-handleClassHeader(class, class, null)
-handleNoType()
-handleClassExtends(null)
-handleClassNoWithClause()
-handleClassOrMixinImplements(null, 0)
-handleRecoverClassHeader()
-handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], void, void)
-beginClassOrMixinBody(DeclarationKind.Class, {)
-endClassOrMixinBody(DeclarationKind.Class, 0, {, })
-endClassDeclaration(class, })
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(}, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
+handleIdentifier(class, typedefDeclaration)
+handleNoTypeVariables(=)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], const, const)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(const)
-handleRecoverableError(MissingTypedefParameters, const, const)
+handleIdentifier(const, typedefDeclaration)
+handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], const, const)
endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(const)
-beginMetadataStar(const)
-endMetadataStar(0)
-beginTopLevelMember(const)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
-handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'const' here., Try removing 'const'., {token: const}], const, const)
-beginTopLevelMethod(;, null)
-handleNoType(const)
-handleIdentifier(, topLevelFunctionDeclaration)
-handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(const, null, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], const, const)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(const)
-handleRecoverableError(MissingTypedefParameters, const, const)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], const, const)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(const)
-beginMetadataStar(const)
-endMetadataStar(0)
-beginTopLevelMember(const)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
-handleNoType(const)
-handleIdentifier(, topLevelVariableDeclaration)
-beginFieldInitializer(=)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
-handleIdentifier(, expression)
-handleNoTypeArguments(void)
-handleNoArguments(void)
-handleSend(, void)
-endFieldInitializer(=, void)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
-endTopLevelFields(null, null, null, const, 1, const, ;)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(;, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
+handleIdentifier(const, typedefDeclaration)
+handleNoTypeVariables(=)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -1973,41 +725,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'continue'., null, {token: continue}], continue, continue)
handleIdentifier(continue, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'covariant' as a name here., null, {token: covariant}], covariant, covariant)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'covariant'., null, {token: covariant}], covariant, covariant)
handleIdentifier(covariant, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2017,35 +750,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'covariant' as a name here., null, {token: covariant}], covariant, covariant)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'covariant'., null, {token: covariant}], covariant, covariant)
handleIdentifier(covariant, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2061,41 +775,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'default'., null, {token: default}], default, default)
handleIdentifier(default, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'deferred' as a name here., null, {token: deferred}], deferred, deferred)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'deferred'., null, {token: deferred}], deferred, deferred)
handleIdentifier(deferred, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2105,35 +800,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'deferred' as a name here., null, {token: deferred}], deferred, deferred)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'deferred'., null, {token: deferred}], deferred, deferred)
handleIdentifier(deferred, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2149,41 +825,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'do'., null, {token: do}], do, do)
handleIdentifier(do, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'dynamic' as a name here., null, {token: dynamic}], dynamic, dynamic)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'dynamic'., null, {token: dynamic}], dynamic, dynamic)
handleIdentifier(dynamic, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2193,35 +850,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'dynamic' as a name here., null, {token: dynamic}], dynamic, dynamic)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'dynamic'., null, {token: dynamic}], dynamic, dynamic)
handleIdentifier(dynamic, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2237,109 +875,47 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'else'., null, {token: else}], else, else)
handleIdentifier(else, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], enum, enum)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(enum)
-handleRecoverableError(MissingTypedefParameters, enum, enum)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], enum, enum)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(enum)
-beginMetadataStar(enum)
-endMetadataStar(0)
-beginEnum(enum)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
-handleIdentifier(, enumDeclaration)
-handleRecoverableError(Message[ExpectedEnumBody, Expected a enum body, but got ')'., An enum definition must have a body with at least one constant name., {token: )}], ), ))
-endEnum(enum, {, 0)
-endTopLevelDeclaration())
-beginMetadataStar())
-endMetadataStar(0)
-beginTopLevelMember())
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got ')'., null, {token: )}], ), ))
-handleInvalidTopLevelDeclaration())
-endTopLevelDeclaration(;)
-beginMetadataStar(;)
-endMetadataStar(0)
-beginTopLevelMember(;)
-handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {token: ;}], ;, ;)
-handleInvalidTopLevelDeclaration(;)
-endTopLevelDeclaration(typedef)
-beginMetadataStar(typedef)
-endMetadataStar(0)
-beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], enum, enum)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(enum)
-handleRecoverableError(MissingTypedefParameters, enum, enum)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], enum, enum)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(enum)
-beginMetadataStar(enum)
-endMetadataStar(0)
-beginEnum(enum)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
-handleIdentifier(, enumDeclaration)
-handleRecoverableError(Message[ExpectedEnumBody, Expected a enum body, but got 'void'., An enum definition must have a body with at least one constant name., {token: void}], void, void)
-endEnum(enum, {, 0)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(}, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
+handleIdentifier(enum, typedefDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFormalParameters((, MemberKind.FunctionTypeAlias)
+endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
+endFunctionTypeAlias(typedef, null, ;)
+endTopLevelDeclaration(typedef)
+beginMetadataStar(typedef)
+endMetadataStar(0)
+beginFunctionTypeAlias(typedef)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], enum, enum)
+handleIdentifier(enum, typedefDeclaration)
+handleNoTypeVariables(=)
+handleNoTypeVariables(()
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'export' as a name here., null, {token: export}], export, export)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'export'., null, {token: export}], export, export)
handleIdentifier(export, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2349,35 +925,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'export' as a name here., null, {token: export}], export, export)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'export'., null, {token: export}], export, export)
handleIdentifier(export, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2393,41 +950,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'extends'., null, {token: extends}], extends, extends)
handleIdentifier(extends, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'extension' as a name here., null, {token: extension}], extension, extension)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'extension'., null, {token: extension}], extension, extension)
handleIdentifier(extension, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2437,41 +975,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'extension' as a name here., null, {token: extension}], extension, extension)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'extension'., null, {token: extension}], extension, extension)
handleIdentifier(extension, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'external' as a name here., null, {token: external}], external, external)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'external'., null, {token: external}], external, external)
handleIdentifier(external, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2481,41 +1000,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'external' as a name here., null, {token: external}], external, external)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'external'., null, {token: external}], external, external)
handleIdentifier(external, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'factory' as a name here., null, {token: factory}], factory, factory)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'factory'., null, {token: factory}], factory, factory)
handleIdentifier(factory, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2525,35 +1025,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'factory' as a name here., null, {token: factory}], factory, factory)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'factory'., null, {token: factory}], factory, factory)
handleIdentifier(factory, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2569,107 +1050,41 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'false'., null, {token: false}], false, false)
handleIdentifier(false, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], final, final)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(final)
-handleRecoverableError(MissingTypedefParameters, final, final)
+handleIdentifier(final, typedefDeclaration)
+handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], final, final)
endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(final)
-beginMetadataStar(final)
-endMetadataStar(0)
-beginTopLevelMember(final)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
-handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'final' here., Try removing 'final'., {token: final}], final, final)
-beginTopLevelMethod(;, null)
-handleNoType(final)
-handleIdentifier(, topLevelFunctionDeclaration)
-handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(final, null, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], final, final)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(final)
-handleRecoverableError(MissingTypedefParameters, final, final)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], final, final)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(final)
-beginMetadataStar(final)
-endMetadataStar(0)
-beginTopLevelMember(final)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
-handleNoType(final)
-handleIdentifier(, topLevelVariableDeclaration)
-beginFieldInitializer(=)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
-handleIdentifier(, expression)
-handleNoTypeArguments(void)
-handleNoArguments(void)
-handleSend(, void)
-endFieldInitializer(=, void)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
-endTopLevelFields(null, null, null, final, 1, final, ;)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(;, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
+handleIdentifier(final, typedefDeclaration)
+handleNoTypeVariables(=)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2685,35 +1100,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'finally'., null, {token: finally}], finally, finally)
handleIdentifier(finally, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2729,35 +1125,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'for'., null, {token: for}], for, for)
handleIdentifier(for, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2773,6 +1150,7 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'Function'., null, {token: Function}], Function, Function)
handleIdentifier(Function, typedefDeclaration)
handleNoTypeVariables(=)
handleNoTypeVariables(()
@@ -2787,7 +1165,7 @@
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'get' as a name here., null, {token: get}], get, get)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'get'., null, {token: get}], get, get)
handleIdentifier(get, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2797,35 +1175,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'get' as a name here., null, {token: get}], get, get)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'get'., null, {token: get}], get, get)
handleIdentifier(get, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2864,41 +1223,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'if'., null, {token: if}], if, if)
handleIdentifier(if, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'implements' as a name here., null, {token: implements}], implements, implements)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'implements'., null, {token: implements}], implements, implements)
handleIdentifier(implements, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2908,41 +1248,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'implements' as a name here., null, {token: implements}], implements, implements)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'implements'., null, {token: implements}], implements, implements)
handleIdentifier(implements, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'import' as a name here., null, {token: import}], import, import)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'import'., null, {token: import}], import, import)
handleIdentifier(import, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -2952,35 +1273,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'import' as a name here., null, {token: import}], import, import)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'import'., null, {token: import}], import, import)
handleIdentifier(import, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -2996,35 +1298,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'in'., null, {token: in}], in, in)
handleIdentifier(in, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3053,7 +1336,7 @@
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'interface' as a name here., null, {token: interface}], interface, interface)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'interface'., null, {token: interface}], interface, interface)
handleIdentifier(interface, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3063,35 +1346,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'interface' as a name here., null, {token: interface}], interface, interface)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'interface'., null, {token: interface}], interface, interface)
handleIdentifier(interface, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3107,41 +1371,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'is'., null, {token: is}], is, is)
handleIdentifier(is, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'late' as a name here., null, {token: late}], late, late)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'late'., null, {token: late}], late, late)
handleIdentifier(late, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3151,41 +1396,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'late' as a name here., null, {token: late}], late, late)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'late'., null, {token: late}], late, late)
handleIdentifier(late, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'library' as a name here., null, {token: library}], library, library)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'library'., null, {token: library}], library, library)
handleIdentifier(library, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3195,41 +1421,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'library' as a name here., null, {token: library}], library, library)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'library'., null, {token: library}], library, library)
handleIdentifier(library, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'mixin' as a name here., null, {token: mixin}], mixin, mixin)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'mixin'., null, {token: mixin}], mixin, mixin)
handleIdentifier(mixin, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3239,35 +1446,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'mixin' as a name here., null, {token: mixin}], mixin, mixin)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'mixin'., null, {token: mixin}], mixin, mixin)
handleIdentifier(mixin, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3306,35 +1494,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'new'., null, {token: new}], new, new)
handleIdentifier(new, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3350,35 +1519,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'null'., null, {token: null}], null, null)
handleIdentifier(null, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3430,7 +1580,7 @@
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'operator' as a name here., null, {token: operator}], operator, operator)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'operator'., null, {token: operator}], operator, operator)
handleIdentifier(operator, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3440,35 +1590,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'operator' as a name here., null, {token: operator}], operator, operator)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'operator'., null, {token: operator}], operator, operator)
handleIdentifier(operator, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3497,7 +1628,7 @@
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'part' as a name here., null, {token: part}], part, part)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'part'., null, {token: part}], part, part)
handleIdentifier(part, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3507,35 +1638,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'part' as a name here., null, {token: part}], part, part)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'part'., null, {token: part}], part, part)
handleIdentifier(part, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3564,7 +1676,7 @@
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'required' as a name here., null, {token: required}], required, required)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'required'., null, {token: required}], required, required)
handleIdentifier(required, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3574,35 +1686,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'required' as a name here., null, {token: required}], required, required)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'required'., null, {token: required}], required, required)
handleIdentifier(required, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3618,35 +1711,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'rethrow'., null, {token: rethrow}], rethrow, rethrow)
handleIdentifier(rethrow, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3662,41 +1736,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'return'., null, {token: return}], return, return)
handleIdentifier(return, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'set' as a name here., null, {token: set}], set, set)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'set'., null, {token: set}], set, set)
handleIdentifier(set, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3706,35 +1761,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'set' as a name here., null, {token: set}], set, set)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'set'., null, {token: set}], set, set)
handleIdentifier(set, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3786,7 +1822,7 @@
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'static' as a name here., null, {token: static}], static, static)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'static'., null, {token: static}], static, static)
handleIdentifier(static, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -3796,35 +1832,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'static' as a name here., null, {token: static}], static, static)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'static'., null, {token: static}], static, static)
handleIdentifier(static, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3840,35 +1857,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'super'., null, {token: super}], super, super)
handleIdentifier(super, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3884,35 +1882,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'switch'., null, {token: switch}], switch, switch)
handleIdentifier(switch, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3951,35 +1930,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'this'., null, {token: this}], this, this)
handleIdentifier(this, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -3995,35 +1955,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'throw'., null, {token: throw}], throw, throw)
handleIdentifier(throw, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -4039,35 +1980,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'true'., null, {token: true}], true, true)
handleIdentifier(true, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -4083,41 +2005,22 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'try'., null, {token: try}], try, try)
handleIdentifier(try, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'typedef' as a name here., null, {token: typedef}], typedef, typedef)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'typedef'., null, {token: typedef}], typedef, typedef)
handleIdentifier(typedef, typedefDeclaration)
handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
@@ -4127,135 +2030,52 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
-handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'typedef' as a name here., null, {token: typedef}], typedef, typedef)
+handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'typedef'., null, {token: typedef}], typedef, typedef)
handleIdentifier(typedef, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], var, var)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(var)
-handleRecoverableError(MissingTypedefParameters, var, var)
+handleIdentifier(var, typedefDeclaration)
+handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], var, var)
endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(var)
-beginMetadataStar(var)
-endMetadataStar(0)
-beginTopLevelMember(var)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
-handleRecoverableError(VarReturnType, var, var)
-beginTopLevelMethod(;, null)
-handleNoType(var)
-handleIdentifier(, topLevelFunctionDeclaration)
-handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(var, null, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], var, var)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(var)
-handleRecoverableError(MissingTypedefParameters, var, var)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], var, var)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(var)
-beginMetadataStar(var)
-endMetadataStar(0)
-beginTopLevelMember(var)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
-handleNoType(var)
-handleIdentifier(, topLevelVariableDeclaration)
-beginFieldInitializer(=)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
-handleIdentifier(, expression)
-handleNoTypeArguments(void)
-handleNoArguments(void)
-handleSend(, void)
-endFieldInitializer(=, void)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
-endTopLevelFields(null, null, null, var, 1, var, ;)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(;, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
+handleIdentifier(var, typedefDeclaration)
+handleNoTypeVariables(=)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
handleVoidKeyword(void)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
-handleIdentifier(, typedefDeclaration)
-handleNoTypeVariables(void)
-handleRecoverableError(MissingTypedefParameters, void, void)
+handleIdentifier(void, typedefDeclaration)
+handleNoTypeVariables(()
beginFormalParameters((, MemberKind.FunctionTypeAlias)
endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
-beginTopLevelMethod(;, null)
-handleVoidKeyword(void)
-handleIdentifier(, topLevelFunctionDeclaration)
-handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -4304,35 +2124,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'while'., null, {token: while}], while, while)
handleIdentifier(while, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -4348,35 +2149,16 @@
beginMetadataStar(typedef)
endMetadataStar(0)
beginFunctionTypeAlias(typedef)
-handleNoType(typedef)
handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'with'., null, {token: with}], with, with)
handleIdentifier(with, typedefDeclaration)
handleNoTypeVariables(=)
-handleRecoverableError(MissingTypedefParameters, =, =)
-beginFormalParameters((, MemberKind.FunctionTypeAlias)
-endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
-handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
-endFunctionTypeAlias(typedef, null, ;)
-endTopLevelDeclaration(=)
-beginMetadataStar(=)
-endMetadataStar(0)
-beginTopLevelMember(=)
-handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
-handleInvalidTopLevelDeclaration(=)
-endTopLevelDeclaration(void)
-beginMetadataStar(void)
-endMetadataStar(0)
-beginTopLevelMember(void)
-beginTopLevelMethod(=, null)
-handleVoidKeyword(void)
-handleIdentifier(Function, topLevelFunctionDeclaration)
handleNoTypeVariables(()
-beginFormalParameters((, MemberKind.TopLevelMethod)
-endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-handleAsyncModifier(null, null)
-handleRecoverableError(ExpectedBody, ;, ;)
-handleEmptyFunctionBody(;)
-endTopLevelMethod(void, null, ;)
+beginFunctionType(void)
+handleVoidKeyword(void)
+beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+endFunctionType(Function, null)
+endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration(typedef)
beginMetadataStar(typedef)
endMetadataStar(0)
@@ -4401,4 +2183,4 @@
endFunctionType(Function, null)
endFunctionTypeAlias(typedef, =, ;)
endTopLevelDeclaration()
-endCompilationUnit(258, )
+endCompilationUnit(140, )
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.intertwined.expect
index a112c82..eea917a 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.intertwined.expect
@@ -11,9 +11,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(abstract, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'abstract' as a name here., null, {token: abstract}], abstract, abstract)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'abstract'., null, {token: abstract}], abstract, abstract)
listener: handleIdentifier(abstract, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(abstract, MemberKind.FunctionTypeAlias)
@@ -31,62 +31,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(abstract, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'abstract' as a name here., null, {token: abstract}], abstract, abstract)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'abstract'., null, {token: abstract}], abstract, abstract)
listener: handleIdentifier(abstract, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(abstract, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -97,9 +56,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(as, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'as' as a name here., null, {token: as}], as, as)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'as'., null, {token: as}], as, as)
listener: handleIdentifier(as, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(as, MemberKind.FunctionTypeAlias)
@@ -117,62 +76,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(as, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'as' as a name here., null, {token: as}], as, as)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'as'., null, {token: as}], as, as)
listener: handleIdentifier(as, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(as, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -183,7 +101,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(assert, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'assert'., null, {token: assert}], assert, assert)
listener: handleIdentifier(assert, typedefDeclaration)
@@ -203,62 +121,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(assert, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'assert'., null, {token: assert}], assert, assert)
listener: handleIdentifier(assert, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(assert, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -269,7 +146,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(async, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(async, MemberKind.FunctionTypeAlias)
@@ -287,7 +164,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(async, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(async, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -309,7 +187,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(await, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(await, MemberKind.FunctionTypeAlias)
@@ -327,7 +205,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(await, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(await, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -349,7 +228,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(break, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'break'., null, {token: break}], break, break)
listener: handleIdentifier(break, typedefDeclaration)
@@ -369,62 +248,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(break, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'break'., null, {token: break}], break, break)
listener: handleIdentifier(break, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(break, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -435,7 +273,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(case, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'case'., null, {token: case}], case, case)
listener: handleIdentifier(case, typedefDeclaration)
@@ -455,62 +293,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(case, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'case'., null, {token: case}], case, case)
listener: handleIdentifier(case, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(case, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -521,7 +318,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(catch, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'catch'., null, {token: catch}], catch, catch)
listener: handleIdentifier(catch, typedefDeclaration)
@@ -541,62 +338,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(catch, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'catch'., null, {token: catch}], catch, catch)
listener: handleIdentifier(catch, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(catch, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -607,97 +363,17 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
- insertSyntheticIdentifier(void, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], messageOnToken: null)
- reportRecoverableError(class, Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], class, class)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(class)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(class, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, class, class)
- rewriter()
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(class, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], class, class)
+ listener: handleIdentifier(class, typedefDeclaration)
+ listener: handleNoTypeVariables(()
+ parseFormalParametersRequiredOpt(class, MemberKind.FunctionTypeAlias)
parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], class, class)
- rewriter()
listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(class)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(class)
- listener: endMetadataStar(0)
- parseTopLevelKeywordDeclaration(;, class, Instance of 'DirectiveContext')
- parseClassDeclarationModifiers(;, class)
- parseClassOrNamedMixinApplication(null, class)
- listener: beginClassOrNamedMixinApplicationPrelude(class)
- ensureIdentifier(class, classOrMixinDeclaration)
- reportRecoverableErrorWithToken((, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
- rewriter()
- listener: handleIdentifier(, classOrMixinDeclaration)
- listener: handleNoTypeVariables())
- listener: beginClassDeclaration(class, null, )
- parseClass(, class, class, )
- parseClassHeaderOpt(, class, class)
- parseClassExtendsOpt()
- listener: handleNoType()
- listener: handleClassExtends(null)
- parseWithClauseOpt()
- listener: handleClassNoWithClause()
- parseClassOrMixinImplementsOpt()
- listener: handleClassOrMixinImplements(null, 0)
- listener: handleClassHeader(class, class, null)
- parseClassHeaderRecovery(, class, class)
- parseClassHeaderOpt(, class, class)
- parseClassExtendsOpt()
- parseWithClauseOpt()
- parseClassOrMixinImplementsOpt()
- skipUnexpectedTokenOpt(, [extends, with, implements, {])
- parseClassExtendsOpt()
- listener: handleNoType()
- listener: handleClassExtends(null)
- parseWithClauseOpt()
- listener: handleClassNoWithClause()
- parseClassOrMixinImplementsOpt()
- listener: handleClassOrMixinImplements(null, 0)
- listener: handleRecoverClassHeader()
- ensureBlock(, null, class declaration)
- reportRecoverableError(, Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}])
- listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], ), ))
- insertBlock()
- rewriter()
- rewriter()
- parseClassOrMixinOrExtensionBody(, DeclarationKind.Class, )
- listener: beginClassOrMixinBody(DeclarationKind.Class, {)
- notEofOrValue(}, })
- listener: endClassOrMixinBody(DeclarationKind.Class, 0, {, })
- listener: endClassDeclaration(class, })
- listener: endTopLevelDeclaration())
- parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
- parseMetadataStar(})
- listener: beginMetadataStar())
- listener: endMetadataStar(0)
- listener: beginTopLevelMember())
- parseInvalidTopLevelDeclaration(})
- reportRecoverableErrorWithToken(), Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got ')'., null, {token: )}], ), ))
- listener: handleInvalidTopLevelDeclaration())
- listener: endTopLevelDeclaration(;)
- parseTopLevelDeclarationImpl(), Instance of 'DirectiveContext')
- parseMetadataStar())
- listener: beginMetadataStar(;)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(;)
- parseInvalidTopLevelDeclaration())
- reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {token: ;}], ;, ;)
- listener: handleInvalidTopLevelDeclaration(;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -707,105 +383,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
- insertSyntheticIdentifier(typedef, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], messageOnToken: null)
- reportRecoverableError(class, Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], class, class)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(class)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(class, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, class, class)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], class, class)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(class)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(class)
- listener: endMetadataStar(0)
- parseTopLevelKeywordDeclaration(;, class, Instance of 'DirectiveContext')
- parseClassDeclarationModifiers(;, class)
- parseClassOrNamedMixinApplication(null, class)
- listener: beginClassOrNamedMixinApplicationPrelude(class)
- ensureIdentifier(class, classOrMixinDeclaration)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
- rewriter()
- listener: handleIdentifier(, classOrMixinDeclaration)
- listener: handleNoTypeVariables(void)
- listener: beginClassDeclaration(class, null, )
- parseClass(, class, class, )
- parseClassHeaderOpt(, class, class)
- parseClassExtendsOpt()
- listener: handleNoType()
- listener: handleClassExtends(null)
- parseWithClauseOpt()
- listener: handleClassNoWithClause()
- parseClassOrMixinImplementsOpt()
- listener: handleClassOrMixinImplements(null, 0)
- listener: handleClassHeader(class, class, null)
- parseClassHeaderRecovery(, class, class)
- parseClassHeaderOpt(, class, class)
- parseClassExtendsOpt()
- parseWithClauseOpt()
- parseClassOrMixinImplementsOpt()
- skipUnexpectedTokenOpt(, [extends, with, implements, {])
- parseClassExtendsOpt()
- listener: handleNoType()
- listener: handleClassExtends(null)
- parseWithClauseOpt()
- listener: handleClassNoWithClause()
- parseClassOrMixinImplementsOpt()
- listener: handleClassOrMixinImplements(null, 0)
- listener: handleRecoverClassHeader()
- ensureBlock(, null, class declaration)
- reportRecoverableError(, Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}])
- listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], void, void)
- insertBlock()
- rewriter()
- rewriter()
- parseClassOrMixinOrExtensionBody(, DeclarationKind.Class, )
- listener: beginClassOrMixinBody(DeclarationKind.Class, {)
- notEofOrValue(}, })
- listener: endClassOrMixinBody(DeclarationKind.Class, 0, {, })
- listener: endClassDeclaration(class, })
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
- parseMetadataStar(})
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(})
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(}, null, }, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(}, null)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(class, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'class'., null, {token: class}], class, class)
+ listener: handleIdentifier(class, typedefDeclaration)
+ listener: handleNoTypeVariables(=)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -816,59 +408,17 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
- insertSyntheticIdentifier(void, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], messageOnToken: null)
- reportRecoverableError(const, Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], const, const)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(const)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(const, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, const, const)
- rewriter()
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(const, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], const, const)
+ listener: handleIdentifier(const, typedefDeclaration)
+ listener: handleNoTypeVariables(()
+ parseFormalParametersRequiredOpt(const, MemberKind.FunctionTypeAlias)
parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], const, const)
- rewriter()
listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(const)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(const)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(const)
- insertSyntheticIdentifier(const, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
- rewriter()
- reportRecoverableErrorWithToken(const, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'const' here., Try removing 'const'., {token: const}], const, const)
- parseTopLevelMethod(;, null, const, Instance of 'NoType', null, , false)
- listener: beginTopLevelMethod(;, null)
- listener: handleNoType(const)
- ensureIdentifierPotentiallyRecovered(const, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(, topLevelFunctionDeclaration)
- parseMethodTypeVar()
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(, , false, MemberKind.TopLevelMethod)
- parseFormalParameters(, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(const, null, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -878,93 +428,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
- insertSyntheticIdentifier(typedef, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], messageOnToken: null)
- reportRecoverableError(const, Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], const, const)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(const)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(const, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, const, const)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], const, const)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(const)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(const)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(const)
- insertSyntheticIdentifier(const, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError(=, Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
- rewriter()
- parseFields(;, null, null, null, null, const, const, Instance of 'NoType', , DeclarationKind.TopLevel, null, false)
- listener: handleNoType(const)
- ensureIdentifierPotentiallyRecovered(const, topLevelVariableDeclaration, false)
- listener: handleIdentifier(, topLevelVariableDeclaration)
- parseFieldInitializerOpt(, , null, const, DeclarationKind.TopLevel, null)
- listener: beginFieldInitializer(=)
- parseExpression(=)
- parsePrecedenceExpression(=, 1, true)
- parseUnaryExpression(=, true)
- parsePrimary(=, expression)
- parseSendOrFunctionLiteral(=, expression)
- looksLikeFunctionBody(;)
- parseSend(=, expression)
- ensureIdentifier(=, expression)
- reportRecoverableErrorWithToken(void, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
- rewriter()
- listener: handleIdentifier(, expression)
- listener: handleNoTypeArguments(void)
- parseArgumentsOpt()
- listener: handleNoArguments(void)
- listener: handleSend(, void)
- listener: endFieldInitializer(=, void)
- ensureSemicolon()
- reportRecoverableError(, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
- rewriter()
- listener: endTopLevelFields(null, null, null, const, 1, const, ;)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(;, null, ;, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(;, null)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(const, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'const'., null, {token: const}], const, const)
+ listener: handleIdentifier(const, typedefDeclaration)
+ listener: handleNoTypeVariables(=)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -975,7 +453,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(continue, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'continue'., null, {token: continue}], continue, continue)
listener: handleIdentifier(continue, typedefDeclaration)
@@ -995,62 +473,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(continue, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'continue'., null, {token: continue}], continue, continue)
listener: handleIdentifier(continue, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(continue, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1061,9 +498,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(covariant, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'covariant' as a name here., null, {token: covariant}], covariant, covariant)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'covariant'., null, {token: covariant}], covariant, covariant)
listener: handleIdentifier(covariant, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(covariant, MemberKind.FunctionTypeAlias)
@@ -1081,62 +518,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(covariant, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'covariant' as a name here., null, {token: covariant}], covariant, covariant)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'covariant'., null, {token: covariant}], covariant, covariant)
listener: handleIdentifier(covariant, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(covariant, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1147,7 +543,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(default, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'default'., null, {token: default}], default, default)
listener: handleIdentifier(default, typedefDeclaration)
@@ -1167,62 +563,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(default, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'default'., null, {token: default}], default, default)
listener: handleIdentifier(default, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(default, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1233,9 +588,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(deferred, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'deferred' as a name here., null, {token: deferred}], deferred, deferred)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'deferred'., null, {token: deferred}], deferred, deferred)
listener: handleIdentifier(deferred, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(deferred, MemberKind.FunctionTypeAlias)
@@ -1253,62 +608,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(deferred, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'deferred' as a name here., null, {token: deferred}], deferred, deferred)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'deferred'., null, {token: deferred}], deferred, deferred)
listener: handleIdentifier(deferred, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(deferred, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1319,7 +633,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(do, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'do'., null, {token: do}], do, do)
listener: handleIdentifier(do, typedefDeclaration)
@@ -1339,62 +653,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(do, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'do'., null, {token: do}], do, do)
listener: handleIdentifier(do, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(do, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1405,9 +678,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(dynamic, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'dynamic' as a name here., null, {token: dynamic}], dynamic, dynamic)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'dynamic'., null, {token: dynamic}], dynamic, dynamic)
listener: handleIdentifier(dynamic, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(dynamic, MemberKind.FunctionTypeAlias)
@@ -1425,62 +698,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(dynamic, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'dynamic' as a name here., null, {token: dynamic}], dynamic, dynamic)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'dynamic'., null, {token: dynamic}], dynamic, dynamic)
listener: handleIdentifier(dynamic, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(dynamic, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1491,7 +723,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(else, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'else'., null, {token: else}], else, else)
listener: handleIdentifier(else, typedefDeclaration)
@@ -1511,62 +743,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(else, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'else'., null, {token: else}], else, else)
listener: handleIdentifier(else, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(else, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1577,67 +768,17 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
- insertSyntheticIdentifier(void, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], messageOnToken: null)
- reportRecoverableError(enum, Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], enum, enum)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(enum)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(enum, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, enum, enum)
- rewriter()
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(enum, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], enum, enum)
+ listener: handleIdentifier(enum, typedefDeclaration)
+ listener: handleNoTypeVariables(()
+ parseFormalParametersRequiredOpt(enum, MemberKind.FunctionTypeAlias)
parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], enum, enum)
- rewriter()
listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(enum)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(enum)
- listener: endMetadataStar(0)
- parseTopLevelKeywordDeclaration(;, enum, Instance of 'DirectiveContext')
- parseTopLevelKeywordModifiers(;, enum)
- parseEnum(enum)
- listener: beginEnum(enum)
- ensureIdentifier(enum, enumDeclaration)
- reportRecoverableErrorWithToken((, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
- rewriter()
- listener: handleIdentifier(, enumDeclaration)
- ensureBlock(, Instance of 'Template<(Token) => Message>', null)
- reportRecoverableError(), Message[ExpectedEnumBody, Expected a enum body, but got ')'., An enum definition must have a body with at least one constant name., {token: )}])
- listener: handleRecoverableError(Message[ExpectedEnumBody, Expected a enum body, but got ')'., An enum definition must have a body with at least one constant name., {token: )}], ), ))
- insertBlock()
- rewriter()
- rewriter()
- listener: endEnum(enum, {, 0)
- listener: endTopLevelDeclaration())
- parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
- parseMetadataStar(})
- listener: beginMetadataStar())
- listener: endMetadataStar(0)
- listener: beginTopLevelMember())
- parseInvalidTopLevelDeclaration(})
- reportRecoverableErrorWithToken(), Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got ')'., null, {token: )}], ), ))
- listener: handleInvalidTopLevelDeclaration())
- listener: endTopLevelDeclaration(;)
- parseTopLevelDeclarationImpl(), Instance of 'DirectiveContext')
- parseMetadataStar())
- listener: beginMetadataStar(;)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(;)
- parseInvalidTopLevelDeclaration())
- reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {token: ;}], ;, ;)
- listener: handleInvalidTopLevelDeclaration(;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1647,75 +788,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
- insertSyntheticIdentifier(typedef, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], messageOnToken: null)
- reportRecoverableError(enum, Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], enum, enum)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(enum)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(enum, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, enum, enum)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], enum, enum)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(enum)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(enum)
- listener: endMetadataStar(0)
- parseTopLevelKeywordDeclaration(;, enum, Instance of 'DirectiveContext')
- parseTopLevelKeywordModifiers(;, enum)
- parseEnum(enum)
- listener: beginEnum(enum)
- ensureIdentifier(enum, enumDeclaration)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
- rewriter()
- listener: handleIdentifier(, enumDeclaration)
- ensureBlock(, Instance of 'Template<(Token) => Message>', null)
- reportRecoverableError(void, Message[ExpectedEnumBody, Expected a enum body, but got 'void'., An enum definition must have a body with at least one constant name., {token: void}])
- listener: handleRecoverableError(Message[ExpectedEnumBody, Expected a enum body, but got 'void'., An enum definition must have a body with at least one constant name., {token: void}], void, void)
- insertBlock()
- rewriter()
- rewriter()
- listener: endEnum(enum, {, 0)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
- parseMetadataStar(})
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(})
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(}, null, }, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(}, null)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(enum, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'enum'., null, {token: enum}], enum, enum)
+ listener: handleIdentifier(enum, typedefDeclaration)
+ listener: handleNoTypeVariables(=)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1726,9 +813,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(export, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'export' as a name here., null, {token: export}], export, export)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'export'., null, {token: export}], export, export)
listener: handleIdentifier(export, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(export, MemberKind.FunctionTypeAlias)
@@ -1746,62 +833,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(export, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'export' as a name here., null, {token: export}], export, export)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'export'., null, {token: export}], export, export)
listener: handleIdentifier(export, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(export, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1812,7 +858,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'extends'., null, {token: extends}], extends, extends)
listener: handleIdentifier(extends, typedefDeclaration)
@@ -1832,62 +878,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'extends'., null, {token: extends}], extends, extends)
listener: handleIdentifier(extends, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(extends, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1898,9 +903,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(extension, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'extension' as a name here., null, {token: extension}], extension, extension)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'extension'., null, {token: extension}], extension, extension)
listener: handleIdentifier(extension, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(extension, MemberKind.FunctionTypeAlias)
@@ -1918,62 +923,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(extension, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'extension' as a name here., null, {token: extension}], extension, extension)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'extension'., null, {token: extension}], extension, extension)
listener: handleIdentifier(extension, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(extension, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -1984,9 +948,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(external, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'external' as a name here., null, {token: external}], external, external)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'external'., null, {token: external}], external, external)
listener: handleIdentifier(external, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(external, MemberKind.FunctionTypeAlias)
@@ -2004,62 +968,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(external, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'external' as a name here., null, {token: external}], external, external)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'external'., null, {token: external}], external, external)
listener: handleIdentifier(external, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(external, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2070,9 +993,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(factory, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'factory' as a name here., null, {token: factory}], factory, factory)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'factory'., null, {token: factory}], factory, factory)
listener: handleIdentifier(factory, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(factory, MemberKind.FunctionTypeAlias)
@@ -2090,62 +1013,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(factory, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'factory' as a name here., null, {token: factory}], factory, factory)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'factory'., null, {token: factory}], factory, factory)
listener: handleIdentifier(factory, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(factory, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2156,7 +1038,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(false, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'false'., null, {token: false}], false, false)
listener: handleIdentifier(false, typedefDeclaration)
@@ -2176,62 +1058,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(false, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'false'., null, {token: false}], false, false)
listener: handleIdentifier(false, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(false, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2242,59 +1083,17 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
- insertSyntheticIdentifier(void, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], messageOnToken: null)
- reportRecoverableError(final, Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], final, final)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(final)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(final, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, final, final)
- rewriter()
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(final, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], final, final)
+ listener: handleIdentifier(final, typedefDeclaration)
+ listener: handleNoTypeVariables(()
+ parseFormalParametersRequiredOpt(final, MemberKind.FunctionTypeAlias)
parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], final, final)
- rewriter()
listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(final)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(final)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(final)
- insertSyntheticIdentifier(final, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
- rewriter()
- reportRecoverableErrorWithToken(final, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExtraneousModifier, Can't have modifier 'final' here., Try removing 'final'., {token: final}], final, final)
- parseTopLevelMethod(;, null, final, Instance of 'NoType', null, , false)
- listener: beginTopLevelMethod(;, null)
- listener: handleNoType(final)
- ensureIdentifierPotentiallyRecovered(final, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(, topLevelFunctionDeclaration)
- parseMethodTypeVar()
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(, , false, MemberKind.TopLevelMethod)
- parseFormalParameters(, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(final, null, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2304,93 +1103,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
- insertSyntheticIdentifier(typedef, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], messageOnToken: null)
- reportRecoverableError(final, Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], final, final)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(final)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(final, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, final, final)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], final, final)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(final)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(final)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(final)
- insertSyntheticIdentifier(final, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError(=, Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
- rewriter()
- parseFields(;, null, null, null, null, final, final, Instance of 'NoType', , DeclarationKind.TopLevel, null, false)
- listener: handleNoType(final)
- ensureIdentifierPotentiallyRecovered(final, topLevelVariableDeclaration, false)
- listener: handleIdentifier(, topLevelVariableDeclaration)
- parseFieldInitializerOpt(, , null, final, DeclarationKind.TopLevel, null)
- listener: beginFieldInitializer(=)
- parseExpression(=)
- parsePrecedenceExpression(=, 1, true)
- parseUnaryExpression(=, true)
- parsePrimary(=, expression)
- parseSendOrFunctionLiteral(=, expression)
- looksLikeFunctionBody(;)
- parseSend(=, expression)
- ensureIdentifier(=, expression)
- reportRecoverableErrorWithToken(void, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
- rewriter()
- listener: handleIdentifier(, expression)
- listener: handleNoTypeArguments(void)
- parseArgumentsOpt()
- listener: handleNoArguments(void)
- listener: handleSend(, void)
- listener: endFieldInitializer(=, void)
- ensureSemicolon()
- reportRecoverableError(, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
- rewriter()
- listener: endTopLevelFields(null, null, null, final, 1, final, ;)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(;, null, ;, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(;, null)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(final, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'final'., null, {token: final}], final, final)
+ listener: handleIdentifier(final, typedefDeclaration)
+ listener: handleNoTypeVariables(=)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2401,7 +1128,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(finally, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'finally'., null, {token: finally}], finally, finally)
listener: handleIdentifier(finally, typedefDeclaration)
@@ -2421,62 +1148,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(finally, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'finally'., null, {token: finally}], finally, finally)
listener: handleIdentifier(finally, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(finally, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2487,7 +1173,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(for, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'for'., null, {token: for}], for, for)
listener: handleIdentifier(for, typedefDeclaration)
@@ -2507,62 +1193,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(for, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'for'., null, {token: for}], for, for)
listener: handleIdentifier(for, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(for, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2573,7 +1218,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(Function, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'Function'., null, {token: Function}], Function, Function)
listener: handleIdentifier(Function, typedefDeclaration)
@@ -2593,7 +1238,10 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(Function, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(Function, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'Function'., null, {token: Function}], Function, Function)
+ listener: handleIdentifier(Function, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -2615,9 +1263,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(get, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'get' as a name here., null, {token: get}], get, get)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'get'., null, {token: get}], get, get)
listener: handleIdentifier(get, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(get, MemberKind.FunctionTypeAlias)
@@ -2635,62 +1283,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(get, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'get' as a name here., null, {token: get}], get, get)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'get'., null, {token: get}], get, get)
listener: handleIdentifier(get, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(get, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2701,7 +1308,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(hide, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(hide, MemberKind.FunctionTypeAlias)
@@ -2719,7 +1326,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(hide, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(hide, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -2741,7 +1349,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(if, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'if'., null, {token: if}], if, if)
listener: handleIdentifier(if, typedefDeclaration)
@@ -2761,62 +1369,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(if, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'if'., null, {token: if}], if, if)
listener: handleIdentifier(if, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(if, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2827,9 +1394,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(implements, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'implements' as a name here., null, {token: implements}], implements, implements)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'implements'., null, {token: implements}], implements, implements)
listener: handleIdentifier(implements, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(implements, MemberKind.FunctionTypeAlias)
@@ -2847,62 +1414,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(implements, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'implements' as a name here., null, {token: implements}], implements, implements)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'implements'., null, {token: implements}], implements, implements)
listener: handleIdentifier(implements, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(implements, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2913,9 +1439,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(import, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'import' as a name here., null, {token: import}], import, import)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'import'., null, {token: import}], import, import)
listener: handleIdentifier(import, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(import, MemberKind.FunctionTypeAlias)
@@ -2933,62 +1459,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(import, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'import' as a name here., null, {token: import}], import, import)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'import'., null, {token: import}], import, import)
listener: handleIdentifier(import, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(import, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -2999,7 +1484,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(in, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'in'., null, {token: in}], in, in)
listener: handleIdentifier(in, typedefDeclaration)
@@ -3019,62 +1504,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(in, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'in'., null, {token: in}], in, in)
listener: handleIdentifier(in, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(in, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3085,7 +1529,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(inout, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(inout, MemberKind.FunctionTypeAlias)
@@ -3103,7 +1547,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(inout, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(inout, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -3125,9 +1570,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(interface, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'interface' as a name here., null, {token: interface}], interface, interface)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'interface'., null, {token: interface}], interface, interface)
listener: handleIdentifier(interface, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(interface, MemberKind.FunctionTypeAlias)
@@ -3145,62 +1590,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(interface, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'interface' as a name here., null, {token: interface}], interface, interface)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'interface'., null, {token: interface}], interface, interface)
listener: handleIdentifier(interface, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(interface, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3211,7 +1615,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(is, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'is'., null, {token: is}], is, is)
listener: handleIdentifier(is, typedefDeclaration)
@@ -3231,62 +1635,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(is, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'is'., null, {token: is}], is, is)
listener: handleIdentifier(is, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(is, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3297,9 +1660,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(late, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'late' as a name here., null, {token: late}], late, late)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'late'., null, {token: late}], late, late)
listener: handleIdentifier(late, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(late, MemberKind.FunctionTypeAlias)
@@ -3317,62 +1680,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(late, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'late' as a name here., null, {token: late}], late, late)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'late'., null, {token: late}], late, late)
listener: handleIdentifier(late, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(late, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3383,9 +1705,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(library, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'library' as a name here., null, {token: library}], library, library)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'library'., null, {token: library}], library, library)
listener: handleIdentifier(library, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(library, MemberKind.FunctionTypeAlias)
@@ -3403,62 +1725,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(library, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'library' as a name here., null, {token: library}], library, library)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'library'., null, {token: library}], library, library)
listener: handleIdentifier(library, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(library, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3469,9 +1750,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(mixin, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'mixin' as a name here., null, {token: mixin}], mixin, mixin)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'mixin'., null, {token: mixin}], mixin, mixin)
listener: handleIdentifier(mixin, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(mixin, MemberKind.FunctionTypeAlias)
@@ -3489,62 +1770,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(mixin, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'mixin' as a name here., null, {token: mixin}], mixin, mixin)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'mixin'., null, {token: mixin}], mixin, mixin)
listener: handleIdentifier(mixin, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(mixin, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3555,7 +1795,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(native, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(native, MemberKind.FunctionTypeAlias)
@@ -3573,7 +1813,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(native, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(native, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -3595,7 +1836,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'new'., null, {token: new}], new, new)
listener: handleIdentifier(new, typedefDeclaration)
@@ -3615,62 +1856,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(new, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'new'., null, {token: new}], new, new)
listener: handleIdentifier(new, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(new, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3681,7 +1881,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(null, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'null'., null, {token: null}], null, null)
listener: handleIdentifier(null, typedefDeclaration)
@@ -3701,62 +1901,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(null, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'null'., null, {token: null}], null, null)
listener: handleIdentifier(null, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(null, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3767,7 +1926,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(of, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(of, MemberKind.FunctionTypeAlias)
@@ -3785,7 +1944,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(of, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(of, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -3807,7 +1967,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(on, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(on, MemberKind.FunctionTypeAlias)
@@ -3825,7 +1985,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(on, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(on, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -3847,9 +2008,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(operator, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'operator' as a name here., null, {token: operator}], operator, operator)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'operator'., null, {token: operator}], operator, operator)
listener: handleIdentifier(operator, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(operator, MemberKind.FunctionTypeAlias)
@@ -3867,62 +2028,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(operator, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'operator' as a name here., null, {token: operator}], operator, operator)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'operator'., null, {token: operator}], operator, operator)
listener: handleIdentifier(operator, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(operator, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -3933,7 +2053,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(out, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(out, MemberKind.FunctionTypeAlias)
@@ -3951,7 +2071,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(out, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(out, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -3973,9 +2094,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(part, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'part' as a name here., null, {token: part}], part, part)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'part'., null, {token: part}], part, part)
listener: handleIdentifier(part, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(part, MemberKind.FunctionTypeAlias)
@@ -3993,62 +2114,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(part, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'part' as a name here., null, {token: part}], part, part)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'part'., null, {token: part}], part, part)
listener: handleIdentifier(part, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(part, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4059,7 +2139,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(patch, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(patch, MemberKind.FunctionTypeAlias)
@@ -4077,7 +2157,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(patch, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(patch, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -4099,9 +2180,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(required, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'required' as a name here., null, {token: required}], required, required)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'required'., null, {token: required}], required, required)
listener: handleIdentifier(required, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(required, MemberKind.FunctionTypeAlias)
@@ -4119,62 +2200,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(required, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'required' as a name here., null, {token: required}], required, required)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'required'., null, {token: required}], required, required)
listener: handleIdentifier(required, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(required, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4185,7 +2225,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(rethrow, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'rethrow'., null, {token: rethrow}], rethrow, rethrow)
listener: handleIdentifier(rethrow, typedefDeclaration)
@@ -4205,62 +2245,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(rethrow, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'rethrow'., null, {token: rethrow}], rethrow, rethrow)
listener: handleIdentifier(rethrow, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(rethrow, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4271,7 +2270,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(return, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'return'., null, {token: return}], return, return)
listener: handleIdentifier(return, typedefDeclaration)
@@ -4291,62 +2290,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(return, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'return'., null, {token: return}], return, return)
listener: handleIdentifier(return, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(return, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4357,9 +2315,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'set' as a name here., null, {token: set}], set, set)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'set'., null, {token: set}], set, set)
listener: handleIdentifier(set, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(set, MemberKind.FunctionTypeAlias)
@@ -4377,62 +2335,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(set, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'set' as a name here., null, {token: set}], set, set)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'set'., null, {token: set}], set, set)
listener: handleIdentifier(set, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(set, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4443,7 +2360,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(show, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(show, MemberKind.FunctionTypeAlias)
@@ -4461,7 +2378,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(show, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(show, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -4483,7 +2401,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(source, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(source, MemberKind.FunctionTypeAlias)
@@ -4501,7 +2419,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(source, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(source, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -4523,9 +2442,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(static, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'static' as a name here., null, {token: static}], static, static)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'static'., null, {token: static}], static, static)
listener: handleIdentifier(static, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(static, MemberKind.FunctionTypeAlias)
@@ -4543,62 +2462,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(static, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'static' as a name here., null, {token: static}], static, static)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'static'., null, {token: static}], static, static)
listener: handleIdentifier(static, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(static, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4609,7 +2487,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'super'., null, {token: super}], super, super)
listener: handleIdentifier(super, typedefDeclaration)
@@ -4629,62 +2507,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(super, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'super'., null, {token: super}], super, super)
listener: handleIdentifier(super, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(super, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4695,7 +2532,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(switch, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'switch'., null, {token: switch}], switch, switch)
listener: handleIdentifier(switch, typedefDeclaration)
@@ -4715,62 +2552,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(switch, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'switch'., null, {token: switch}], switch, switch)
listener: handleIdentifier(switch, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(switch, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4781,7 +2577,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(sync, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(sync, MemberKind.FunctionTypeAlias)
@@ -4799,7 +2595,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(sync, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(sync, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -4821,7 +2618,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(this, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'this'., null, {token: this}], this, this)
listener: handleIdentifier(this, typedefDeclaration)
@@ -4841,62 +2638,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(this, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'this'., null, {token: this}], this, this)
listener: handleIdentifier(this, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(this, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4907,7 +2663,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(throw, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'throw'., null, {token: throw}], throw, throw)
listener: handleIdentifier(throw, typedefDeclaration)
@@ -4927,62 +2683,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(throw, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'throw'., null, {token: throw}], throw, throw)
listener: handleIdentifier(throw, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(throw, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -4993,7 +2708,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(true, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'true'., null, {token: true}], true, true)
listener: handleIdentifier(true, typedefDeclaration)
@@ -5013,62 +2728,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(true, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'true'., null, {token: true}], true, true)
listener: handleIdentifier(true, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(true, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5079,7 +2753,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(try, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'try'., null, {token: try}], try, try)
listener: handleIdentifier(try, typedefDeclaration)
@@ -5099,62 +2773,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(try, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'try'., null, {token: try}], try, try)
listener: handleIdentifier(try, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(try, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5165,9 +2798,9 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(typedef, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'typedef' as a name here., null, {token: typedef}], typedef, typedef)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'typedef'., null, {token: typedef}], typedef, typedef)
listener: handleIdentifier(typedef, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(typedef, MemberKind.FunctionTypeAlias)
@@ -5185,62 +2818,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(typedef, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'typedef' as a name here., null, {token: typedef}], typedef, typedef)
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'typedef'., null, {token: typedef}], typedef, typedef)
listener: handleIdentifier(typedef, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(typedef, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5251,59 +2843,17 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
- insertSyntheticIdentifier(void, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], messageOnToken: null)
- reportRecoverableError(var, Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], var, var)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(var)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(var, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, var, var)
- rewriter()
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(var, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], var, var)
+ listener: handleIdentifier(var, typedefDeclaration)
+ listener: handleNoTypeVariables(()
+ parseFormalParametersRequiredOpt(var, MemberKind.FunctionTypeAlias)
parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], var, var)
- rewriter()
listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(var)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(var)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(var)
- insertSyntheticIdentifier(var, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
- rewriter()
- reportRecoverableError(var, VarReturnType)
- listener: handleRecoverableError(VarReturnType, var, var)
- parseTopLevelMethod(;, null, var, Instance of 'NoType', null, , false)
- listener: beginTopLevelMethod(;, null)
- listener: handleNoType(var)
- ensureIdentifierPotentiallyRecovered(var, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(, topLevelFunctionDeclaration)
- parseMethodTypeVar()
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(, , false, MemberKind.TopLevelMethod)
- parseFormalParameters(, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(var, null, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5313,93 +2863,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
- insertSyntheticIdentifier(typedef, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], messageOnToken: null)
- reportRecoverableError(var, Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], var, var)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(var)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(var, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, var, var)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], var, var)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(var)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(var)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(var)
- insertSyntheticIdentifier(var, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError(=, Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
- rewriter()
- parseFields(;, null, null, null, null, var, var, Instance of 'NoType', , DeclarationKind.TopLevel, null, false)
- listener: handleNoType(var)
- ensureIdentifierPotentiallyRecovered(var, topLevelVariableDeclaration, false)
- listener: handleIdentifier(, topLevelVariableDeclaration)
- parseFieldInitializerOpt(, , null, var, DeclarationKind.TopLevel, null)
- listener: beginFieldInitializer(=)
- parseExpression(=)
- parsePrecedenceExpression(=, 1, true)
- parseUnaryExpression(=, true)
- parsePrimary(=, expression)
- parseSendOrFunctionLiteral(=, expression)
- looksLikeFunctionBody(;)
- parseSend(=, expression)
- ensureIdentifier(=, expression)
- reportRecoverableErrorWithToken(void, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
- rewriter()
- listener: handleIdentifier(, expression)
- listener: handleNoTypeArguments(void)
- parseArgumentsOpt()
- listener: handleNoArguments(void)
- listener: handleSend(, void)
- listener: endFieldInitializer(=, void)
- ensureSemicolon()
- reportRecoverableError(, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
- rewriter()
- listener: endTopLevelFields(null, null, null, var, 1, var, ;)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(;, null, ;, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(;, null)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(var, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'var'., null, {token: var}], var, var)
+ listener: handleIdentifier(var, typedefDeclaration)
+ listener: handleNoTypeVariables(=)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5410,57 +2888,17 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
- insertSyntheticIdentifier(void, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], messageOnToken: null)
- reportRecoverableError(void, Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
- rewriter()
- listener: handleIdentifier(, typedefDeclaration)
- listener: handleNoTypeVariables(void)
- parseFormalParametersRequiredOpt(, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(void, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, void, void)
- rewriter()
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
+ reportRecoverableErrorWithToken(void, Instance of 'Template<(Token) => Message>')
+ listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'void'., null, {token: void}], void, void)
+ listener: handleIdentifier(void, typedefDeclaration)
+ listener: handleNoTypeVariables(()
+ parseFormalParametersRequiredOpt(void, MemberKind.FunctionTypeAlias)
parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], void, void)
- rewriter()
listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(;)
- listener: beginTopLevelMember(void)
- insertSyntheticIdentifier(void, methodDeclaration, message: null, messageOnToken: null)
- reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}])
- listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., null, {token: (}], (, ()
- rewriter()
- parseTopLevelMethod(;, null, ;, Instance of 'VoidType', null, , false)
- listener: beginTopLevelMethod(;, null)
- listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(, topLevelFunctionDeclaration)
- parseMethodTypeVar()
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(, , false, MemberKind.TopLevelMethod)
- parseFormalParameters(, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5471,7 +2909,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, false)
insertSyntheticIdentifier(void, typedefDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], messageOnToken: null)
reportRecoverableError(=, Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}])
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '='., null, {token: =}], =, =)
@@ -5538,7 +2976,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(while, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'while'., null, {token: while}], while, while)
listener: handleIdentifier(while, typedefDeclaration)
@@ -5558,62 +2996,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(while, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'while'., null, {token: while}], while, while)
listener: handleIdentifier(while, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(while, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5624,7 +3021,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'with'., null, {token: with}], with, with)
listener: handleIdentifier(with, typedefDeclaration)
@@ -5644,62 +3041,21 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleNoType(typedef)
- ensureIdentifier(typedef, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got 'with'., null, {token: with}], with, with)
listener: handleIdentifier(with, typedefDeclaration)
listener: handleNoTypeVariables(=)
- parseFormalParametersRequiredOpt(with, MemberKind.FunctionTypeAlias)
- missingParameterMessage(MemberKind.FunctionTypeAlias)
- reportRecoverableError(=, MissingTypedefParameters)
- listener: handleRecoverableError(MissingTypedefParameters, =, =)
- rewriter()
- parseFormalParametersRest((, MemberKind.FunctionTypeAlias)
- listener: beginFormalParameters((, MemberKind.FunctionTypeAlias)
- listener: endFormalParameters(0, (, ), MemberKind.FunctionTypeAlias)
- ensureSemicolon())
- reportRecoverableError((, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
- listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], =, =)
- rewriter()
- listener: endFunctionTypeAlias(typedef, null, ;)
- listener: endTopLevelDeclaration(=)
- parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
- parseMetadataStar(;)
- listener: beginMetadataStar(=)
- listener: endMetadataStar(0)
- listener: beginTopLevelMember(=)
- parseInvalidTopLevelDeclaration(;)
- reportRecoverableErrorWithToken(=, Instance of 'Template<(Token) => Message>')
- listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '='., null, {token: =}], =, =)
- listener: handleInvalidTopLevelDeclaration(=)
- listener: endTopLevelDeclaration(void)
- parseTopLevelDeclarationImpl(=, Instance of 'DirectiveContext')
- parseMetadataStar(=)
- listener: beginMetadataStar(void)
- listener: endMetadataStar(0)
- parseTopLevelMemberImpl(=)
- listener: beginTopLevelMember(void)
- parseTopLevelMethod(=, null, =, Instance of 'VoidType', null, Function, false)
- listener: beginTopLevelMethod(=, null)
+ listener: handleNoTypeVariables(()
+ listener: beginFunctionType(void)
listener: handleVoidKeyword(void)
- ensureIdentifierPotentiallyRecovered(void, topLevelFunctionDeclaration, false)
- listener: handleIdentifier(Function, topLevelFunctionDeclaration)
- parseMethodTypeVar(Function)
- listener: handleNoTypeVariables(()
- parseGetterOrFormalParameters(Function, Function, false, MemberKind.TopLevelMethod)
- parseFormalParameters(Function, MemberKind.TopLevelMethod)
- parseFormalParametersRest((, MemberKind.TopLevelMethod)
- listener: beginFormalParameters((, MemberKind.TopLevelMethod)
- listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
- parseAsyncModifierOpt())
- listener: handleAsyncModifier(null, null)
- inPlainSync()
- parseFunctionBody(), false, false)
- reportRecoverableError(;, ExpectedBody)
- listener: handleRecoverableError(ExpectedBody, ;, ;)
- listener: handleEmptyFunctionBody(;)
- listener: endTopLevelMethod(void, null, ;)
+ parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+ parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+ listener: beginFormalParameters((, MemberKind.GeneralizedFunctionType)
+ listener: endFormalParameters(0, (, ), MemberKind.GeneralizedFunctionType)
+ listener: endFunctionType(Function, null)
+ ensureSemicolon())
+ listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration(typedef)
parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
parseMetadataStar(;)
@@ -5710,7 +3066,7 @@
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
listener: handleVoidKeyword(void)
- ensureIdentifier(void, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(void, typedefDeclaration, true)
listener: handleIdentifier(yield, typedefDeclaration)
listener: handleNoTypeVariables(()
parseFormalParametersRequiredOpt(yield, MemberKind.FunctionTypeAlias)
@@ -5728,7 +3084,8 @@
parseTopLevelKeywordModifiers(;, typedef)
parseTypedef(typedef)
listener: beginFunctionTypeAlias(typedef)
- listener: handleIdentifier(yield, typedefDeclaration)
+ ensureIdentifierPotentiallyRecovered(typedef, typedefDeclaration, true)
+ listener: handleIdentifier(yield, typedefDeclaration)
listener: handleNoTypeVariables(=)
listener: handleNoTypeVariables(()
listener: beginFunctionType(void)
@@ -5742,4 +3099,4 @@
listener: endFunctionTypeAlias(typedef, =, ;)
listener: endTopLevelDeclaration()
reportAllErrorTokens(typedef)
- listener: endCompilationUnit(258, )
+ listener: endCompilationUnit(140, )
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.parser.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.parser.expect
index eb2551e..2727ab4 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_typedefs.dart.parser.expect
@@ -1,281 +1,281 @@
NOTICE: Stream was rewritten by parser!
typedef void abstract();
-typedef abstract ();= void Function();
+typedef abstract = void Function();
typedef void as();
-typedef as ();= void Function();
+typedef as = void Function();
typedef void assert();
-typedef assert ();= void Function();
+typedef assert = void Function();
typedef void async();
typedef async = void Function();
typedef void await();
typedef await = void Function();
typedef void break();
-typedef break ();= void Function();
+typedef break = void Function();
typedef void case();
-typedef case ();= void Function();
+typedef case = void Function();
typedef void catch();
-typedef catch ();= void Function();
-typedef void ();class({});
-typedef ();class = {}void Function();
-typedef void ();const();
-typedef ();const = ;void Function();
+typedef catch = void Function();
+typedef void class();
+typedef class = void Function();
+typedef void const();
+typedef const = void Function();
typedef void continue();
-typedef continue ();= void Function();
+typedef continue = void Function();
typedef void covariant();
-typedef covariant ();= void Function();
+typedef covariant = void Function();
typedef void default();
-typedef default ();= void Function();
+typedef default = void Function();
typedef void deferred();
-typedef deferred ();= void Function();
+typedef deferred = void Function();
typedef void do();
-typedef do ();= void Function();
+typedef do = void Function();
typedef void dynamic();
-typedef dynamic ();= void Function();
+typedef dynamic = void Function();
typedef void else();
-typedef else ();= void Function();
-typedef void ();enum({});
-typedef ();enum = {}void Function();
+typedef else = void Function();
+typedef void enum();
+typedef enum = void Function();
typedef void export();
-typedef export ();= void Function();
+typedef export = void Function();
typedef void extends();
-typedef extends ();= void Function();
+typedef extends = void Function();
typedef void extension();
-typedef extension ();= void Function();
+typedef extension = void Function();
typedef void external();
-typedef external ();= void Function();
+typedef external = void Function();
typedef void factory();
-typedef factory ();= void Function();
+typedef factory = void Function();
typedef void false();
-typedef false ();= void Function();
-typedef void ();final();
-typedef ();final = ;void Function();
+typedef false = void Function();
+typedef void final();
+typedef final = void Function();
typedef void finally();
-typedef finally ();= void Function();
+typedef finally = void Function();
typedef void for();
-typedef for ();= void Function();
+typedef for = void Function();
typedef void Function();
typedef Function = void Function();
typedef void get();
-typedef get ();= void Function();
+typedef get = void Function();
typedef void hide();
typedef hide = void Function();
typedef void if();
-typedef if ();= void Function();
+typedef if = void Function();
typedef void implements();
-typedef implements ();= void Function();
+typedef implements = void Function();
typedef void import();
-typedef import ();= void Function();
+typedef import = void Function();
typedef void in();
-typedef in ();= void Function();
+typedef in = void Function();
typedef void inout();
typedef inout = void Function();
typedef void interface();
-typedef interface ();= void Function();
+typedef interface = void Function();
typedef void is();
-typedef is ();= void Function();
+typedef is = void Function();
typedef void late();
-typedef late ();= void Function();
+typedef late = void Function();
typedef void library();
-typedef library ();= void Function();
+typedef library = void Function();
typedef void mixin();
-typedef mixin ();= void Function();
+typedef mixin = void Function();
typedef void native();
typedef native = void Function();
typedef void new();
-typedef new ();= void Function();
+typedef new = void Function();
typedef void null();
-typedef null ();= void Function();
+typedef null = void Function();
typedef void of();
typedef of = void Function();
typedef void on();
typedef on = void Function();
typedef void operator();
-typedef operator ();= void Function();
+typedef operator = void Function();
typedef void out();
typedef out = void Function();
typedef void part();
-typedef part ();= void Function();
+typedef part = void Function();
typedef void patch();
typedef patch = void Function();
typedef void required();
-typedef required ();= void Function();
+typedef required = void Function();
typedef void rethrow();
-typedef rethrow ();= void Function();
+typedef rethrow = void Function();
typedef void return();
-typedef return ();= void Function();
+typedef return = void Function();
typedef void set();
-typedef set ();= void Function();
+typedef set = void Function();
typedef void show();
typedef show = void Function();
typedef void source();
typedef source = void Function();
typedef void static();
-typedef static ();= void Function();
+typedef static = void Function();
typedef void super();
-typedef super ();= void Function();
+typedef super = void Function();
typedef void switch();
-typedef switch ();= void Function();
+typedef switch = void Function();
typedef void sync();
typedef sync = void Function();
typedef void this();
-typedef this ();= void Function();
+typedef this = void Function();
typedef void throw();
-typedef throw ();= void Function();
+typedef throw = void Function();
typedef void true();
-typedef true ();= void Function();
+typedef true = void Function();
typedef void try();
-typedef try ();= void Function();
+typedef try = void Function();
typedef void typedef();
-typedef typedef ();= void Function();
-typedef void ();var();
-typedef ();var = ;void Function();
-typedef void ();void();
+typedef typedef = void Function();
+typedef void var();
+typedef var = void Function();
+typedef void void();
typedef void ();= void Function();
typedef void while();
-typedef while ();= void Function();
+typedef while = void Function();
typedef void with();
-typedef with ();= void Function();
+typedef with = void Function();
typedef void yield();
typedef yield = void Function();
typedef[KeywordToken] void[KeywordToken] abstract[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] abstract[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] abstract[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] as[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] as[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] as[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] assert[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] assert[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] assert[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] async[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] async[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] await[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] await[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] break[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] break[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] break[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] case[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] case[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] case[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] catch[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] catch[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] void[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]class[KeywordToken]([BeginToken][SyntheticStringToken]{[SyntheticBeginToken]}[SyntheticToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]class[KeywordToken] =[SimpleToken] [SyntheticStringToken]{[SyntheticBeginToken]}[SyntheticToken]void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] void[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]const[KeywordToken][SyntheticStringToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]const[KeywordToken] [SyntheticStringToken]=[SimpleToken] [SyntheticStringToken];[SyntheticToken]void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] catch[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] void[KeywordToken] class[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] class[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] void[KeywordToken] const[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] const[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] continue[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] continue[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] continue[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] covariant[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] covariant[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] covariant[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] default[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] default[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] default[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] deferred[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] deferred[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] deferred[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] do[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] do[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] do[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] dynamic[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] dynamic[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] dynamic[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] else[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] else[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] void[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]enum[KeywordToken]([BeginToken][SyntheticStringToken]{[SyntheticBeginToken]}[SyntheticToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]enum[KeywordToken] =[SimpleToken] [SyntheticStringToken]{[SyntheticBeginToken]}[SyntheticToken]void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] else[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] void[KeywordToken] enum[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] enum[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] export[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] export[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] export[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] extends[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] extends[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] extends[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] extension[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] extension[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] extension[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] external[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] external[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] external[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] factory[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] factory[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] factory[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] false[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] false[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] void[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]final[KeywordToken][SyntheticStringToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]final[KeywordToken] [SyntheticStringToken]=[SimpleToken] [SyntheticStringToken];[SyntheticToken]void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] false[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] void[KeywordToken] final[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] final[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] finally[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] finally[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] finally[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] for[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] for[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] for[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] Function[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] get[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] get[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] get[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] hide[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] hide[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] if[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] if[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] if[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] implements[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] implements[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] implements[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] import[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] import[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] import[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] in[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] in[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] in[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] inout[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] inout[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] interface[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] interface[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] interface[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] is[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] is[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] is[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] late[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] late[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] late[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] library[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] library[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] library[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] mixin[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] mixin[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] mixin[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] native[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] native[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] new[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] new[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] new[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] null[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] null[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] null[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] of[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] of[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] on[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] on[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] operator[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] operator[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] operator[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] out[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] out[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] part[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] part[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] part[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] patch[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] patch[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] required[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] required[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] required[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] rethrow[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] rethrow[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] rethrow[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] return[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] return[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] return[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] set[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] set[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] set[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] show[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] show[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] source[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] source[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] static[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] static[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] static[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] super[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] super[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] super[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] switch[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] switch[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] switch[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] sync[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] sync[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] this[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] this[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] this[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] throw[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] throw[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] throw[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] true[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] true[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] true[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] try[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] try[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] try[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] typedef[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] typedef[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] void[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]var[KeywordToken][SyntheticStringToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]var[KeywordToken] [SyntheticStringToken]=[SimpleToken] [SyntheticStringToken];[SyntheticToken]void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] void[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]void[KeywordToken][SyntheticStringToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] typedef[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] void[KeywordToken] var[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] var[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] void[KeywordToken] void[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] [SyntheticStringToken]([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] while[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] while[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] while[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] with[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
-typedef[KeywordToken] with[KeywordToken] ([SyntheticBeginToken])[SyntheticToken];[SyntheticToken]=[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
+typedef[KeywordToken] with[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] void[KeywordToken] yield[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
typedef[KeywordToken] yield[KeywordToken] =[SimpleToken] void[KeywordToken] Function[KeywordToken]([BeginToken])[SimpleToken];[SimpleToken]
[SimpleToken]
diff --git a/pkg/front_end/test/fasta/parser/parser.status b/pkg/front_end/test/fasta/parser/parser.status
index 07063b9..3dd8e24 100644
--- a/pkg/front_end/test/fasta/parser/parser.status
+++ b/pkg/front_end/test/fasta/parser/parser.status
@@ -1540,101 +1540,6 @@
tests/co19/src/WebPlatformTest/dom/nodes/Document-createElement_t01: Fail
tests/co19/src/WebPlatformTest/dom/nodes/DOMImplementation-createHTMLDocument_t01: Fail
tests/co19/src/WebPlatformTest/dom/nodes/Element-childElementCount-nochild_t01: Fail
-tests/compiler/dart2js_native/abstract_class_test: Fail
-tests/compiler/dart2js_native/bound_closure_test: Fail
-tests/compiler/dart2js_native/browser_compat_1_prepatched_test: Fail
-tests/compiler/dart2js_native/browser_compat_1_unpatched_test: Fail
-tests/compiler/dart2js_native/browser_compat_2_test: Fail
-tests/compiler/dart2js_native/core_type_check_native_test: Fail
-tests/compiler/dart2js_native/dispatch_property_initialization_test: Fail
-tests/compiler/dart2js_native/downcast_test: Fail
-tests/compiler/dart2js_native/error_safeToString_test: Fail
-tests/compiler/dart2js_native/event_loop_test: Fail
-tests/compiler/dart2js_native/fake_thing_2_test: Fail
-tests/compiler/dart2js_native/fake_thing_test: Fail
-tests/compiler/dart2js_native/field_type_test: Fail
-tests/compiler/dart2js_native/field_type2_test: Fail
-tests/compiler/dart2js_native/fixup_get_tag_test: Fail
-tests/compiler/dart2js_native/hash_code_test: Fail
-tests/compiler/dart2js_native/issue9182_test: Fail
-tests/compiler/dart2js_native/jsobject_test: Fail
-tests/compiler/dart2js_native/native_call_arity1_frog_test: Fail
-tests/compiler/dart2js_native/native_call_arity2_frog_test: Fail
-tests/compiler/dart2js_native/native_call_arity3_frog_test: Fail
-tests/compiler/dart2js_native/native_checked_arguments1_frog_test: Fail
-tests/compiler/dart2js_native/native_checked_fields_frog_test: Fail
-tests/compiler/dart2js_native/native_class_avoids_hidden_name_frog_test: Fail
-tests/compiler/dart2js_native/native_class_fields_2_test: Fail
-tests/compiler/dart2js_native/native_class_fields_3_test: Fail
-tests/compiler/dart2js_native/native_class_fields_test: Fail
-tests/compiler/dart2js_native/native_class_inheritance1_frog_test: Fail
-tests/compiler/dart2js_native/native_class_inheritance2_frog_test: Fail
-tests/compiler/dart2js_native/native_class_inheritance3_frog_test: Fail
-tests/compiler/dart2js_native/native_class_inheritance4_frog_test: Fail
-tests/compiler/dart2js_native/native_class_is_check1_frog_test: Fail
-tests/compiler/dart2js_native/native_class_is_check3_frog_test: Fail
-tests/compiler/dart2js_native/native_class_with_dart_methods_frog_test: Fail
-tests/compiler/dart2js_native/native_closure_identity_frog_test: Fail
-tests/compiler/dart2js_native/native_constructor_name_test: Fail
-tests/compiler/dart2js_native/native_equals_frog_test: Fail
-tests/compiler/dart2js_native/native_exception2_test: Fail
-tests/compiler/dart2js_native/native_exceptions1_frog_test: Fail
-tests/compiler/dart2js_native/native_field_invocation_test: Fail
-tests/compiler/dart2js_native/native_field_invocation2_test: Fail
-tests/compiler/dart2js_native/native_field_invocation3_test: Fail
-tests/compiler/dart2js_native/native_field_invocation4_test: Fail
-tests/compiler/dart2js_native/native_field_invocation5_test: Fail
-tests/compiler/dart2js_native/native_field_invocation6_test: Fail
-tests/compiler/dart2js_native/native_field_name_test: Fail
-tests/compiler/dart2js_native/native_field_optimization_test: Fail
-tests/compiler/dart2js_native/native_field_rename_1_frog_test: Fail
-tests/compiler/dart2js_native/native_field_rename_2_frog_test: Fail
-tests/compiler/dart2js_native/native_library_same_name_used_frog_test: Fail
-tests/compiler/dart2js_native/native_library_same_name_used_lib2: Fail
-tests/compiler/dart2js_native/native_method_inlining_test: Fail
-tests/compiler/dart2js_native/native_method_rename1_frog_test: Fail
-tests/compiler/dart2js_native/native_method_rename2_frog_test: Fail
-tests/compiler/dart2js_native/native_method_rename3_frog_test: Fail
-tests/compiler/dart2js_native/native_method_with_keyword_name_test: Fail
-tests/compiler/dart2js_native/native_missing_method1_frog_test: Fail
-tests/compiler/dart2js_native/native_missing_method2_frog_test: Fail
-tests/compiler/dart2js_native/native_mixin_field_test: Fail
-tests/compiler/dart2js_native/native_mixin_multiple_test: Fail
-tests/compiler/dart2js_native/native_mixin_multiple2_test: Fail
-tests/compiler/dart2js_native/native_mixin_multiple3_test: Fail
-tests/compiler/dart2js_native/native_mixin_test: Fail
-tests/compiler/dart2js_native/native_mixin_with_plain_test: Fail
-tests/compiler/dart2js_native/native_named_constructors2_frog_test: Fail
-tests/compiler/dart2js_native/native_named_constructors3_frog_test: Fail
-tests/compiler/dart2js_native/native_no_such_method_exception_frog_test: Fail
-tests/compiler/dart2js_native/native_no_such_method_exception2_frog_test: Fail
-tests/compiler/dart2js_native/native_no_such_method_exception3_frog_test: Fail
-tests/compiler/dart2js_native/native_no_such_method_exception4_frog_test: Fail
-tests/compiler/dart2js_native/native_no_such_method_exception5_frog_test: Fail
-tests/compiler/dart2js_native/native_novel_html_test: Fail
-tests/compiler/dart2js_native/native_null_closure_frog_test: Fail
-tests/compiler/dart2js_native/native_null_frog_test: Fail
-tests/compiler/dart2js_native/native_property_frog_test: Fail
-tests/compiler/dart2js_native/native_testing: Fail
-tests/compiler/dart2js_native/native_to_string_frog_test: Fail
-tests/compiler/dart2js_native/native_use_native_name_in_table_frog_test: Fail
-tests/compiler/dart2js_native/native_wrapping_function_frog_test: Fail
-tests/compiler/dart2js_native/native_wrapping_function3_frog_test: Fail
-tests/compiler/dart2js_native/oddly_named_fields_test: Fail
-tests/compiler/dart2js_native/runtimetype_test: Fail
-tests/compiler/dart2js_native/static_methods_test: Fail
-tests/compiler/dart2js_native/subclassing_1_test: Fail
-tests/compiler/dart2js_native/subclassing_2_test: Fail
-tests/compiler/dart2js_native/subclassing_3_test: Fail
-tests/compiler/dart2js_native/subclassing_4_test: Fail
-tests/compiler/dart2js_native/subclassing_5_test: Fail
-tests/compiler/dart2js_native/subclassing_constructor_1_test: Fail
-tests/compiler/dart2js_native/subclassing_super_call_test: Fail
-tests/compiler/dart2js_native/subclassing_super_field_1_test: Fail
-tests/compiler/dart2js_native/subclassing_super_field_2_test: Fail
-tests/compiler/dart2js_native/subclassing_type_test: Fail
-tests/compiler/dart2js_native/super_call_test: Fail
-tests/compiler/dart2js_native/super_property_test: Fail
tests/corelib_strong/from_environment_const_type_test: Fail
tests/corelib_strong/from_environment_const_type_undefined_test: Fail
tests/corelib_strong/symbol_reserved_word_test: Fail
@@ -1650,6 +1555,104 @@
tests/dart2js_2/switch_test: Fail
tests/dart2js_2/timer_negative_test: Fail
tests/dart2js_2/typed_locals_test: Fail
+tests/dart2js_2/native/abstract_class_test: Fail
+tests/dart2js_2/native/bound_closure_test: Fail
+tests/dart2js_2/native/browser_compat_1_prepatched_test: Fail
+tests/dart2js_2/native/browser_compat_1_unpatched_test: Fail
+tests/dart2js_2/native/browser_compat_2_test: Fail
+tests/dart2js_2/native/core_type_check_native_test: Fail
+tests/dart2js_2/native/dispatch_property_initialization_test: Fail
+tests/dart2js_2/native/downcast_test: Fail
+tests/dart2js_2/native/error_safeToString_test: Fail
+tests/dart2js_2/native/event_loop_test: Fail
+tests/dart2js_2/native/fake_thing_2_test: Fail
+tests/dart2js_2/native/fake_thing_test: Fail
+tests/dart2js_2/native/field_type_test: Fail
+tests/dart2js_2/native/field_type2_test: Fail
+tests/dart2js_2/native/fixup_get_tag_test: Fail
+tests/dart2js_2/native/hash_code_test: Fail
+tests/dart2js_2/native/issue9182_test: Fail
+tests/dart2js_2/native/jsobject_test: Fail
+tests/dart2js_2/native/native_call_arity1_frog_test: Fail
+tests/dart2js_2/native/native_call_arity2_frog_test: Fail
+tests/dart2js_2/native/native_call_arity3_frog_test: Fail
+tests/dart2js_2/native/native_checked_arguments1_frog_test: Fail
+tests/dart2js_2/native/native_checked_fields_frog_test: Fail
+tests/dart2js_2/native/native_class_avoids_hidden_name_frog_test: Fail
+tests/dart2js_2/native/native_class_fields_2_test: Fail
+tests/dart2js_2/native/native_class_fields_3_test: Fail
+tests/dart2js_2/native/native_class_fields_test: Fail
+tests/dart2js_2/native/native_class_inheritance1_frog_test: Fail
+tests/dart2js_2/native/native_class_inheritance2_frog_test: Fail
+tests/dart2js_2/native/native_class_inheritance3_frog_test: Fail
+tests/dart2js_2/native/native_class_inheritance4_frog_test: Fail
+tests/dart2js_2/native/native_class_is_check1_frog_test: Fail
+tests/dart2js_2/native/native_class_is_check3_frog_test: Fail
+tests/dart2js_2/native/native_class_with_dart_methods_frog_test: Fail
+tests/dart2js_2/native/native_closure_identity_frog_test: Fail
+tests/dart2js_2/native/native_constructor_name_test: Fail
+tests/dart2js_2/native/native_equals_frog_test: Fail
+tests/dart2js_2/native/native_exception2_test: Fail
+tests/dart2js_2/native/native_exceptions1_frog_test: Fail
+tests/dart2js_2/native/native_field_invocation_test: Fail
+tests/dart2js_2/native/native_field_invocation2_test: Fail
+tests/dart2js_2/native/native_field_invocation3_test: Fail
+tests/dart2js_2/native/native_field_invocation4_test: Fail
+tests/dart2js_2/native/native_field_invocation5_test: Fail
+tests/dart2js_2/native/native_field_invocation6_test: Fail
+tests/dart2js_2/native/native_field_name_test: Fail
+tests/dart2js_2/native/native_field_optimization_test: Fail
+tests/dart2js_2/native/native_field_rename_1_frog_test: Fail
+tests/dart2js_2/native/native_field_rename_2_frog_test: Fail
+tests/dart2js_2/native/native_library_same_name_used_frog_test: Fail
+tests/dart2js_2/native/native_library_same_name_used_lib2: Fail
+tests/dart2js_2/native/native_method_inlining_test: Fail
+tests/dart2js_2/native/native_method_rename1_frog_test: Fail
+tests/dart2js_2/native/native_method_rename2_frog_test: Fail
+tests/dart2js_2/native/native_method_rename3_frog_test: Fail
+tests/dart2js_2/native/native_method_with_keyword_name_test: Fail
+tests/dart2js_2/native/native_missing_method1_frog_test: Fail
+tests/dart2js_2/native/native_missing_method2_frog_test: Fail
+tests/dart2js_2/native/native_mixin_field_test: Fail
+tests/dart2js_2/native/native_mixin_multiple_test: Fail
+tests/dart2js_2/native/native_mixin_multiple2_test: Fail
+tests/dart2js_2/native/native_mixin_multiple3_test: Fail
+tests/dart2js_2/native/native_mixin_test: Fail
+tests/dart2js_2/native/native_mixin_with_plain_test: Fail
+tests/dart2js_2/native/native_named_constructors2_frog_test: Fail
+tests/dart2js_2/native/native_named_constructors3_frog_test: Fail
+tests/dart2js_2/native/native_no_such_method_exception_frog_test: Fail
+tests/dart2js_2/native/native_no_such_method_exception2_frog_test: Fail
+tests/dart2js_2/native/native_no_such_method_exception3_frog_test: Fail
+tests/dart2js_2/native/native_no_such_method_exception4_frog_test: Fail
+tests/dart2js_2/native/native_no_such_method_exception5_frog_test: Fail
+tests/dart2js_2/native/native_novel_html_test: Fail
+tests/dart2js_2/native/native_null_closure_frog_test: Fail
+tests/dart2js_2/native/native_null_frog_test: Fail
+tests/dart2js_2/native/native_property_frog_test: Fail
+tests/dart2js_2/native/native_testing: Fail
+tests/dart2js_2/native/native_to_string_frog_test: Fail
+tests/dart2js_2/native/native_use_native_name_in_table_frog_test: Fail
+tests/dart2js_2/native/native_wrapping_function_frog_test: Fail
+tests/dart2js_2/native/native_wrapping_function3_frog_test: Fail
+tests/dart2js_2/native/oddly_named_fields_test: Fail
+tests/dart2js_2/native/runtimetype_test: Fail
+tests/dart2js_2/native/static_methods_test: Fail
+tests/dart2js_2/native/subclassing_1_test: Fail
+tests/dart2js_2/native/subclassing_2_test: Fail
+tests/dart2js_2/native/subclassing_3_test: Fail
+tests/dart2js_2/native/subclassing_4_test: Fail
+tests/dart2js_2/native/subclassing_5_test: Fail
+tests/dart2js_2/native/subclassing_constructor_1_test: Fail
+tests/dart2js_2/native/subclassing_super_call_test: Fail
+tests/dart2js_2/native/subclassing_super_field_1_test: Fail
+tests/dart2js_2/native/subclassing_super_field_2_test: Fail
+tests/dart2js_2/native/subclassing_type_test: Fail
+tests/dart2js_2/native/super_call_test: Fail
+tests/dart2js_2/native/super_property_test: Fail
+tests/dart2js_2/switch_test: Fail
+tests/dart2js_2/timer_negative_test: Fail
+tests/dart2js_2/typed_locals_test: Fail
tests/language_2/abstract_syntax_test: Fail
tests/language_2/arg_param_trailing_comma_test: Fail
tests/language_strong/argument_definition_test: Fail
diff --git a/pkg/front_end/test/incremental_load_from_dill_suite.dart b/pkg/front_end/test/incremental_load_from_dill_suite.dart
index 015e3d5..902cdd4 100644
--- a/pkg/front_end/test/incremental_load_from_dill_suite.dart
+++ b/pkg/front_end/test/incremental_load_from_dill_suite.dart
@@ -62,12 +62,13 @@
Member,
Name,
Procedure,
- Supertype;
+ Supertype,
+ TreeNode;
import 'package:kernel/target/targets.dart'
show NoneTarget, Target, TargetFlags;
-import 'package:kernel/text/ast_to_text.dart' show componentToString;
+import 'package:kernel/text/ast_to_text.dart' show Printer, componentToString;
import "package:testing/testing.dart"
show Chain, ChainContext, Result, Step, TestDescription, runMe;
@@ -643,7 +644,7 @@
}
}
- checkExpectFile(data, worldNum, context, actualSerialized);
+ checkExpectFile(data, worldNum, "", context, actualSerialized);
checkClassHierarchy(compiler, component, data, worldNum, context);
int nonSyntheticLibraries = countNonSyntheticLibraries(component);
@@ -777,13 +778,15 @@
} else {
compilations = [world["expressionCompilation"]];
}
+ int expressionCompilationNum = 0;
for (Map compilation in compilations) {
+ expressionCompilationNum++;
clearPrevErrorsEtc();
bool expectErrors = compilation["errors"] ?? false;
bool expectWarnings = compilation["warnings"] ?? false;
Uri uri = base.resolve(compilation["uri"]);
String expression = compilation["expression"];
- await compiler.compileExpression(
+ Procedure procedure = await compiler.compileExpression(
expression, {}, [], "debugExpr", uri);
if (gotError && !expectErrors) {
throw "Got error(s) on expression compilation: ${formattedErrors}.";
@@ -796,6 +799,12 @@
} else if (!gotWarning && expectWarnings) {
throw "Didn't get any warnings.";
}
+ checkExpectFile(
+ data,
+ worldNum,
+ ".expression.$expressionCompilationNum",
+ context,
+ nodeToString(procedure));
}
}
@@ -876,10 +885,10 @@
}
}
-void checkExpectFile(
- TestData data, int worldNum, Context context, String actualSerialized) {
- Uri uri = data.loadedFrom
- .resolve(data.loadedFrom.pathSegments.last + ".world.$worldNum.expect");
+void checkExpectFile(TestData data, int worldNum, String extraUriString,
+ Context context, String actualSerialized) {
+ Uri uri = data.loadedFrom.resolve(data.loadedFrom.pathSegments.last +
+ ".world.$worldNum${extraUriString}.expect");
String expected;
File file = new File.fromUri(uri);
if (file.existsSync()) {
@@ -1274,6 +1283,12 @@
}
}
+String nodeToString(TreeNode node) {
+ StringBuffer buffer = new StringBuffer();
+ new Printer(buffer, syntheticNames: new NameSystem()).writeNode(node);
+ return '$buffer';
+}
+
String componentToStringSdkFiltered(Component node) {
Component c = new Component();
List<Uri> dartUris = new List<Uri>();
diff --git a/pkg/front_end/test/spell_checking_list_common.txt b/pkg/front_end/test/spell_checking_list_common.txt
index 25a39e4..4a1e4e1 100644
--- a/pkg/front_end/test/spell_checking_list_common.txt
+++ b/pkg/front_end/test/spell_checking_list_common.txt
@@ -510,6 +510,7 @@
commonly
compact
comparable
+comparator
compare
comparing
comparison
@@ -997,6 +998,7 @@
equal
equality
equals
+equate
equivalence
equivalent
equivalents
@@ -2268,6 +2270,7 @@
properly
properties
property
+proposition
prototype
proves
provide
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/expression_calculation_with_error.yaml.world.1.expression.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/expression_calculation_with_error.yaml.world.1.expression.1.expect
new file mode 100644
index 0000000..9772cff
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/expression_calculation_with_error.yaml.world.1.expression.1.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return invalid-expression "org-dartlang-debug:synthetic_debug_expression:1:1: Error: Method not found: 'foo'.\nfoo()\n^^^";
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_expression_compilation_usage.yaml.world.1.expression.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_expression_compilation_usage.yaml.world.1.expression.1.expect
new file mode 100644
index 0000000..8b090f5
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_expression_compilation_usage.yaml.world.1.expression.1.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::NumberParsing|parseInt("1234"));
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.1.expect
new file mode 100644
index 0000000..8b090f5
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.1.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::NumberParsing|parseInt("1234"));
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.2.expect
new file mode 100644
index 0000000..a4440be
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.2.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(invalid-expression "org-dartlang-debug:synthetic_debug_expression:1:14: Error: The method 'parseInt' isn't defined for the class 'String'.\nTry correcting the name to the name of an existing method, or defining a method named 'parseInt'.\nprint(\"1234\".parseInt())\n ^^^^^^^^");
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.3.expect
new file mode 100644
index 0000000..a4440be
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.3.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(invalid-expression "org-dartlang-debug:synthetic_debug_expression:1:14: Error: The method 'parseInt' isn't defined for the class 'String'.\nTry correcting the name to the name of an existing method, or defining a method named 'parseInt'.\nprint(\"1234\".parseInt())\n ^^^^^^^^");
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.4.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.4.expect
new file mode 100644
index 0000000..8b090f5
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.4.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::NumberParsing|parseInt("1234"));
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.5.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.5.expect
new file mode 100644
index 0000000..aae336e4
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.1.expression.5.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::DuplicateName|fooMe1("1234"));
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.1.expect
new file mode 100644
index 0000000..8b090f5
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.1.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::NumberParsing|parseInt("1234"));
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.2.expect
new file mode 100644
index 0000000..a4440be
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.2.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(invalid-expression "org-dartlang-debug:synthetic_debug_expression:1:14: Error: The method 'parseInt' isn't defined for the class 'String'.\nTry correcting the name to the name of an existing method, or defining a method named 'parseInt'.\nprint(\"1234\".parseInt())\n ^^^^^^^^");
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.3.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.3.expect
new file mode 100644
index 0000000..a4440be
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.3.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(invalid-expression "org-dartlang-debug:synthetic_debug_expression:1:14: Error: The method 'parseInt' isn't defined for the class 'String'.\nTry correcting the name to the name of an existing method, or defining a method named 'parseInt'.\nprint(\"1234\".parseInt())\n ^^^^^^^^");
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.4.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.4.expect
new file mode 100644
index 0000000..8b090f5
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.4.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::NumberParsing|parseInt("1234"));
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.5.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.5.expect
new file mode 100644
index 0000000..aae336e4
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/extension_usage_from_dill.yaml.world.2.expression.5.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::DuplicateName|fooMe1("1234"));
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/ffi_02.yaml.world.1.expression.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/ffi_02.yaml.world.1.expression.1.expect
new file mode 100644
index 0000000..35a37c6
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/ffi_02.yaml.world.1.expression.1.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return dart.core::print(#lib1::coordinate.{#lib2::Coordinate::x});
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml
new file mode 100644
index 0000000..d8e31e8
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml
@@ -0,0 +1,38 @@
+# Copyright (c) 2020, 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.
+
+# https://github.com/dart-lang/sdk/issues/41976
+
+type: newworld
+worlds:
+ - entry: foo.dart
+ sources:
+ foo.dart: |
+ abstract class Key {
+ const factory Key(String value) = ValueKey;
+ const Key.empty();
+ }
+
+ abstract class LocalKey extends Key {
+ const LocalKey() : super.empty();
+ }
+
+ class ValueKey implements LocalKey {
+ const ValueKey(this.value);
+ final String value;
+ }
+
+ void main() {
+ var k = Key('t');
+ /* breakpoint here */
+ print('$k');
+ }
+ expectedLibraryCount: 1
+ expressionCompilation:
+ - uri: foo.dart
+ expression: Key('t')
+ errors: false
+ - uri: foo.dart
+ expression: () { var x = new Key('t'); return x.hashCode; }()
+ errors: false
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expect
new file mode 100644
index 0000000..086c622
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expect
@@ -0,0 +1,47 @@
+main = <No Member>;
+library from "org-dartlang-test:///foo.dart" as foo {
+
+ abstract class Key extends dart.core::Object /*hasConstConstructor*/ {
+ static field dynamic _redirecting# = <dynamic>[foo::Key::•];
+ const constructor empty() → foo::Key*
+ : super dart.core::Object::•()
+ ;
+ static factory •(dart.core::String* value) → foo::Key*
+ let dynamic #redirecting_factory = foo::ValueKey::• in invalid-expression;
+ abstract member-signature get _identityHashCode() → dart.core::int*;
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*;
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*;
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*;
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*;
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*;
+ abstract member-signature get hashCode() → dart.core::int*;
+ abstract member-signature method toString() → dart.core::String*;
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic;
+ abstract member-signature get runtimeType() → dart.core::Type*;
+ }
+ abstract class LocalKey extends foo::Key /*hasConstConstructor*/ {
+ const constructor •() → foo::LocalKey*
+ : super foo::Key::empty()
+ ;
+ }
+ class ValueKey extends dart.core::Object implements foo::LocalKey /*hasConstConstructor*/ {
+ final field dart.core::String* value;
+ const constructor •(dart.core::String* value) → foo::ValueKey*
+ : foo::ValueKey::value = value, super dart.core::Object::•()
+ ;
+ abstract member-signature get _identityHashCode() → dart.core::int*;
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → dart.core::bool*;
+ abstract member-signature method _simpleInstanceOf(dynamic type) → dart.core::bool*;
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → dart.core::bool*;
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → dart.core::bool*;
+ abstract member-signature operator ==(dynamic other) → dart.core::bool*;
+ abstract member-signature get hashCode() → dart.core::int*;
+ abstract member-signature method toString() → dart.core::String*;
+ abstract member-signature method noSuchMethod(dart.core::Invocation* invocation) → dynamic;
+ abstract member-signature get runtimeType() → dart.core::Type*;
+ }
+ static method main() → void {
+ foo::Key* k = new foo::ValueKey::•("t");
+ dart.core::print("${k}");
+ }
+}
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expression.1.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expression.1.expect
new file mode 100644
index 0000000..28537d1
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expression.1.expect
@@ -0,0 +1,2 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return new #lib1::ValueKey::•("t");
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expression.2.expect b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expression.2.expect
new file mode 100644
index 0000000..97a108c
--- /dev/null
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/issue_41976.yaml.world.1.expression.2.expect
@@ -0,0 +1,5 @@
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return (() → dart.core::int* {
+ #lib1::Key* x = new #lib1::ValueKey::•("t");
+ return x.{#lib1::Key::hashCode};
+ }).call();
diff --git a/pkg/front_end/testing.json b/pkg/front_end/testing.json
index 84ef1b0..794af63 100644
--- a/pkg/front_end/testing.json
+++ b/pkg/front_end/testing.json
@@ -409,7 +409,7 @@
"command-lines": [
"--checked dart2js",
"-cdart2js -rd8 --exclude-suite=observatory_ui",
- "-cdart2js -rd8 dart2js_2 dart2js_native"
+ "-cdart2js -rd8 dart2js_2"
]
},
{
@@ -436,7 +436,7 @@
"-t240 --checked pkg/(kernel|front_end|fasta) dart2js",
"-cdartk -rvm",
"-cdart2js -rd8 --exclude-suite=observatory_ui",
- "-cdart2js -rd8 dart2js_2 dart2js_native"
+ "-cdart2js -rd8 dart2js_2"
]
},
{
@@ -447,7 +447,7 @@
"mode": "release",
"common": "--dart2js-batch --time -pcolor --report -ax64 -mrelease --write-result-log",
"command-lines": [
- "-cdart2js -rd8 --use-sdk --minified language language_2 dart2js_2 dart2js_native corelib corelib_2"
+ "-cdart2js -rd8 --use-sdk --minified language language_2 dart2js_2 corelib corelib_2"
]
}
],
diff --git a/pkg/frontend_server/lib/frontend_server.dart b/pkg/frontend_server/lib/frontend_server.dart
index b60277f..714708d 100644
--- a/pkg/frontend_server/lib/frontend_server.dart
+++ b/pkg/frontend_server/lib/frontend_server.dart
@@ -75,6 +75,9 @@
defaultsTo: true)
..addOption('import-dill',
help: 'Import libraries from existing dill file', defaultsTo: null)
+ ..addOption('from-dill',
+ help: 'Read existing dill file instead of compiling from sources',
+ defaultsTo: null)
..addOption('output-dill',
help: 'Output path for the generated dill', defaultsTo: null)
..addOption('output-incremental-dill',
@@ -452,6 +455,13 @@
}
}
+ if (options['incremental']) {
+ if (options['from-dill'] != null) {
+ print('Error: --from-dill option cannot be used with --incremental');
+ return false;
+ }
+ }
+
if (options['null-safety'] == null &&
compilerOptions.experimentalFlags[ExperimentalFlag.nonNullable]) {
await autoDetectNullSafetyMode(_mainSource, compilerOptions);
@@ -533,7 +543,8 @@
enableAsserts: options['enable-asserts'],
useProtobufTreeShaker: options['protobuf-tree-shaker'],
minimalKernel: options['minimal-kernel'],
- treeShakeWriteOnlyFields: options['tree-shake-write-only-fields']));
+ treeShakeWriteOnlyFields: options['tree-shake-write-only-fields'],
+ fromDillFile: options['from-dill']));
}
if (results.component != null) {
transformer?.transform(results.component);
diff --git a/pkg/js/CHANGELOG.md b/pkg/js/CHANGELOG.md
index 62b21c3..800418a 100644
--- a/pkg/js/CHANGELOG.md
+++ b/pkg/js/CHANGELOG.md
@@ -1,6 +1,5 @@
-## 0.6.2-dev
+## 0.6.2
-* Opt in to null safety.
* Improved documentation.
## 0.6.1+1
diff --git a/pkg/js/lib/js.dart b/pkg/js/lib/js.dart
index 2880c21..2ee0598 100644
--- a/pkg/js/lib/js.dart
+++ b/pkg/js/lib/js.dart
@@ -32,4 +32,4 @@
/// with no positional arguments, only named arguments. Invoking the constructor
/// desugars to creating a JavaScript object literal with name-value pairs
/// corresponding to the parameter names and values.
-const _Anonymous anonymous = const _Anonymous();
+const _Anonymous anonymous = _Anonymous();
diff --git a/pkg/js/lib/src/varargs.dart b/pkg/js/lib/src/varargs.dart
index 84180f1..c3a4ec0 100644
--- a/pkg/js/lib/src/varargs.dart
+++ b/pkg/js/lib/src/varargs.dart
@@ -34,7 +34,7 @@
/// ...
/// }
///
-const _Rest rest = const _Rest();
+const _Rest rest = _Rest();
/// Intrinsic function that maps to the ES6 spread operator
/// (https://goo.gl/NedHKr).
@@ -58,6 +58,6 @@
/// foo.apply(null, [a, b].concat(others))
///
dynamic spread(args) {
- throw new StateError('The spread function cannot be called, '
+ throw StateError('The spread function cannot be called, '
'it should be compiled away.');
}
diff --git a/pkg/js/pubspec.yaml b/pkg/js/pubspec.yaml
index 307f362..f3e47e1 100644
--- a/pkg/js/pubspec.yaml
+++ b/pkg/js/pubspec.yaml
@@ -1,7 +1,7 @@
name: js
-version: 0.6.2-dev
-description: Annotations to create Dart interfaces for JavaScript APIs.
+version: 0.6.2
+description: Annotations to create static Dart interfaces for JavaScript APIs.
homepage: https://github.com/dart-lang/sdk/tree/master/pkg/js
environment:
- sdk: '>=2.9.0 <3.0.0'
+ sdk: '>=2.0.0 <3.0.0'
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index ac11efd0..a7b7311 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -572,7 +572,6 @@
/// named node.
void relink() {
_relinkNode();
- assert(canonicalName != null);
for (int i = 0; i < typedefs.length; ++i) {
Typedef typedef_ = typedefs[i];
typedef_._relinkNode();
diff --git a/pkg/kernel/lib/src/dart_type_equivalence.dart b/pkg/kernel/lib/src/dart_type_equivalence.dart
new file mode 100644
index 0000000..731a5fe
--- /dev/null
+++ b/pkg/kernel/lib/src/dart_type_equivalence.dart
@@ -0,0 +1,281 @@
+// Copyright (c) 2020, 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 '../ast.dart';
+import '../core_types.dart';
+import '../visitor.dart';
+
+class DartTypeEquivalence implements DartTypeVisitor1<bool, DartType> {
+ final CoreTypes coreTypes;
+ final bool equateTopTypes;
+ final bool ignoreAllNullabilities;
+ final bool ignoreTopLevelNullability;
+
+ bool _atTopLevel = true;
+ List<Map<TypeParameter, TypeParameter>> _alphaRenamingStack = [];
+
+ DartTypeEquivalence(this.coreTypes,
+ {this.equateTopTypes = false,
+ this.ignoreAllNullabilities = false,
+ this.ignoreTopLevelNullability = false});
+
+ bool areEqual(DartType type1, DartType type2) {
+ _alphaRenamingStack.clear();
+ _atTopLevel = true;
+ return type1.accept1(this, type2);
+ }
+
+ @override
+ bool defaultDartType(DartType node, DartType other) {
+ throw new UnsupportedError("${node.runtimeType}");
+ }
+
+ @override
+ bool visitBottomType(BottomType node, DartType other) {
+ return other is BottomType;
+ }
+
+ @override
+ bool visitDynamicType(DynamicType node, DartType other) {
+ return equateTopTypes ? coreTypes.isTop(other) : other is DynamicType;
+ }
+
+ @override
+ bool visitFunctionType(FunctionType node, DartType other) {
+ if (other is FunctionType) {
+ if (!_checkAndRegisterNullabilities(
+ node.declaredNullability, other.declaredNullability)) {
+ return false;
+ }
+
+ // If the two types are un-aliased typedef instantiations, check that
+ // those instantiations are equal as well.
+ bool nodeIsUnaliased = node.typedefType != null;
+ bool otherIsUnaliased = other.typedefType != null;
+ if (nodeIsUnaliased != otherIsUnaliased) {
+ return false;
+ }
+ if (node.typedefType != null) {
+ // The assert below checks the implication: if the typedef types are
+ // equal, their un-aliased types are equal as well. The reverse is not
+ // true due to possibly unused type parameters F<int> and F<String> may
+ // be equal when un-aliased if the type parameter of typedef F isn't
+ // used on the right-hand side of the definition of F. The checked
+ // proposition in the assert allows to skip checking the function types
+ // themselves if the typedef types are equal.
+ assert(() {
+ DartTypeEquivalence copy = this.copy();
+ if (!copy.areEqual(node.typedefType, other.typedefType)) {
+ return true;
+ }
+ FunctionType nodeWithoutTypedefType = new FunctionType(
+ node.positionalParameters,
+ node.returnType,
+ node.declaredNullability,
+ namedParameters: node.namedParameters,
+ typeParameters: node.typeParameters,
+ requiredParameterCount: node.requiredParameterCount,
+ typedefType: null);
+ FunctionType otherWithoutTypedefType = new FunctionType(
+ other.positionalParameters,
+ other.returnType,
+ other.declaredNullability,
+ namedParameters: other.namedParameters,
+ typeParameters: other.typeParameters,
+ requiredParameterCount: other.requiredParameterCount,
+ typedefType: null);
+ return copy.areEqual(nodeWithoutTypedefType, otherWithoutTypedefType);
+ }());
+ return node.typedefType.accept1(this, other.typedefType);
+ }
+
+ // Perform simple number checks before the checks on parts.
+ if (node.typeParameters.length != other.typeParameters.length) {
+ return false;
+ }
+ if (node.positionalParameters.length !=
+ other.positionalParameters.length) {
+ return false;
+ }
+ if (node.requiredParameterCount != other.requiredParameterCount) {
+ return false;
+ }
+ if (node.namedParameters.length != other.namedParameters.length) {
+ return false;
+ }
+
+ // Enter new static scope. The scope must be exited before a return. To
+ // void multiple returns, the [result] variable is used below.
+ _pushTypeParameters(node.typeParameters, other.typeParameters);
+ bool result = true;
+
+ for (int i = 0; result && i < node.typeParameters.length; ++i) {
+ if (!node.typeParameters[i].bound
+ .accept1(this, other.typeParameters[i].bound)) {
+ result = false;
+ }
+ // Don't check defaultTypes: they are a convenience mechanism.
+ }
+ for (int i = 0; result && i < node.positionalParameters.length; ++i) {
+ if (!node.positionalParameters[i]
+ .accept1(this, other.positionalParameters[i])) {
+ result = false;
+ }
+ }
+ Map<String, DartType> nodeNamedParameters = {};
+ for (int i = 0; i < node.namedParameters.length; ++i) {
+ nodeNamedParameters[node.namedParameters[i].name] =
+ node.namedParameters[i].type;
+ }
+ for (int i = 0; result && i < other.namedParameters.length; ++i) {
+ String otherName = other.namedParameters[i].name;
+ DartType otherType = other.namedParameters[i].type;
+ if (!nodeNamedParameters.containsKey(otherName) ||
+ !nodeNamedParameters[otherName].accept1(this, otherType)) {
+ result = false;
+ }
+ }
+ if (!node.returnType.accept1(this, other.returnType)) {
+ result = false;
+ }
+
+ _dropTypeParameters();
+ return result;
+ }
+ return false;
+ }
+
+ @override
+ bool visitInterfaceType(InterfaceType node, DartType other) {
+ // First, check Object*, FutureOr<Object?>, etc.
+ if (equateTopTypes && coreTypes.isTop(node)) {
+ return coreTypes.isTop(other);
+ }
+
+ if (other is InterfaceType) {
+ if (!_checkAndRegisterNullabilities(
+ node.declaredNullability, other.declaredNullability)) {
+ return false;
+ }
+ if (node.classNode != other.classNode) {
+ return false;
+ }
+ assert(node.typeArguments.length == other.typeArguments.length);
+ for (int i = 0; i < node.typeArguments.length; ++i) {
+ if (!node.typeArguments[i].accept1(this, other.typeArguments[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @override
+ bool visitInvalidType(InvalidType node, DartType other) {
+ return other is InvalidType;
+ }
+
+ @override
+ bool visitNeverType(NeverType node, DartType other) {
+ if (other is NeverType) {
+ return _checkAndRegisterNullabilities(
+ node.declaredNullability, other.declaredNullability);
+ }
+ return false;
+ }
+
+ @override
+ bool visitTypeParameterType(TypeParameterType node, DartType other) {
+ if (other is TypeParameterType) {
+ bool nodeIsIntersection = node.promotedBound != null;
+ bool otherIsIntersection = other.promotedBound != null;
+ if (nodeIsIntersection != otherIsIntersection) {
+ return false;
+ }
+ if (!_checkAndRegisterNullabilities(
+ node.declaredNullability, other.declaredNullability)) {
+ return false;
+ }
+ if (!identical(_lookup(node.parameter), other.parameter)) {
+ return false;
+ }
+ return nodeIsIntersection
+ ? node.promotedBound.accept1(this, other.promotedBound)
+ : true;
+ }
+ return false;
+ }
+
+ @override
+ bool visitTypedefType(TypedefType node, DartType other) {
+ if (other is TypedefType) {
+ if (!_checkAndRegisterNullabilities(
+ node.declaredNullability, other.declaredNullability)) {
+ return false;
+ }
+ if (node.typedefNode != other.typedefNode) {
+ return false;
+ }
+ assert(node.typeArguments.length == other.typeArguments.length);
+ for (int i = 0; i < node.typeArguments.length; ++i) {
+ if (!node.typeArguments[i].accept1(this, node.typeArguments[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @override
+ bool visitVoidType(VoidType node, DartType other) {
+ return equateTopTypes ? coreTypes.isTop(other) : other is VoidType;
+ }
+
+ bool _checkAndRegisterNullabilities(
+ Nullability nodeNullability, Nullability otherNullability) {
+ bool result;
+ if (nodeNullability == otherNullability ||
+ ignoreAllNullabilities ||
+ ignoreTopLevelNullability && _atTopLevel) {
+ result = true;
+ } else {
+ result = false;
+ }
+ _atTopLevel = false;
+ return result;
+ }
+
+ void _pushTypeParameters(
+ List<TypeParameter> keys, List<TypeParameter> values) {
+ assert(keys.length == values.length);
+ Map<TypeParameter, TypeParameter> parameters =
+ new Map<TypeParameter, TypeParameter>.identity();
+ for (int i = 0; i < keys.length; ++i) {
+ parameters[keys[i]] = values[i];
+ }
+ _alphaRenamingStack.add(parameters);
+ }
+
+ void _dropTypeParameters() {
+ _alphaRenamingStack.removeLast();
+ }
+
+ TypeParameter _lookup(TypeParameter parameter) {
+ for (int i = _alphaRenamingStack.length - 1; i >= 0; --i) {
+ if (_alphaRenamingStack[i].containsKey(parameter)) {
+ return _alphaRenamingStack[i][parameter];
+ }
+ }
+ return parameter;
+ }
+
+ DartTypeEquivalence copy() {
+ return new DartTypeEquivalence(coreTypes,
+ equateTopTypes: equateTopTypes,
+ ignoreAllNullabilities: ignoreAllNullabilities,
+ ignoreTopLevelNullability: ignoreTopLevelNullability);
+ }
+}
diff --git a/pkg/kernel/test/dart_type_equivalence_test.dart b/pkg/kernel/test/dart_type_equivalence_test.dart
new file mode 100644
index 0000000..4ec0895
--- /dev/null
+++ b/pkg/kernel/test/dart_type_equivalence_test.dart
@@ -0,0 +1,228 @@
+// Copyright (c) 2020, 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" show Expect;
+
+import 'package:kernel/ast.dart' hide MapEntry;
+import 'package:kernel/src/dart_type_equivalence.dart';
+import 'package:kernel/testing/type_parser_environment.dart';
+
+run() {
+ // Simple types.
+ areEqual("int", "int");
+ notEqual("int", "String");
+
+ // Simple types with nullabilities.
+ areEqual("int?", "int?");
+ notEqual("int", "int?");
+ notEqual("int?", "String?");
+
+ areEqual("int?", "int?", ignoreAllNullabilities: true);
+ areEqual("int", "int?", ignoreAllNullabilities: true);
+ notEqual("int?", "String?", ignoreAllNullabilities: true);
+
+ areEqual("int?", "int?", ignoreTopLevelNullability: true);
+ areEqual("int", "int?", ignoreTopLevelNullability: true);
+ notEqual("int?", "String?", ignoreTopLevelNullability: true);
+
+ // 1-level deep types.
+ areEqual("List<int?>?", "List<int?>?");
+ notEqual("List<int?>?", "List<int?>");
+ notEqual("List<int?>?", "List<int>?");
+ notEqual("List<int?>?", "List<int>");
+
+ areEqual("List<int?>?", "List<int?>?", ignoreAllNullabilities: true);
+ areEqual("List<int?>?", "List<int?>", ignoreAllNullabilities: true);
+ areEqual("List<int?>?", "List<int>?", ignoreAllNullabilities: true);
+ areEqual("List<int?>?", "List<int>", ignoreAllNullabilities: true);
+
+ areEqual("List<int?>?", "List<int?>?", ignoreTopLevelNullability: true);
+ areEqual("List<int?>?", "List<int?>", ignoreTopLevelNullability: true);
+ notEqual("List<int?>?", "List<int>?", ignoreTopLevelNullability: true);
+ notEqual("List<int?>?", "List<int>", ignoreTopLevelNullability: true);
+
+ // Top types.
+ areEqual("dynamic", "dynamic");
+ notEqual("dynamic", "Object?");
+ notEqual("dynamic", "Object*");
+ notEqual("dynamic", "void");
+ areEqual("Object?", "Object?");
+ notEqual("Object?", "Object*");
+ notEqual("Object?", "void");
+ areEqual("Object*", "Object*");
+ notEqual("Object*", "void");
+ areEqual("void", "void");
+ notEqual("FutureOr<dynamic>", "void");
+ notEqual("FutureOr<FutureOr<Object?>>", "Object*");
+ notEqual("FutureOr<FutureOr<FutureOr<Object*>?>>?", "dynamic");
+ notEqual("FutureOr<Object?>", "FutureOr<Object?>?");
+ notEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<Object?>?>?");
+ notEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<dynamic>?>?");
+
+ areEqual("dynamic", "Object?", equateTopTypes: true);
+ areEqual("dynamic", "Object*", equateTopTypes: true);
+ areEqual("dynamic", "void", equateTopTypes: true);
+ areEqual("Object?", "Object*", equateTopTypes: true);
+ areEqual("Object?", "void", equateTopTypes: true);
+ areEqual("Object*", "void", equateTopTypes: true);
+ areEqual("FutureOr<dynamic>", "void", equateTopTypes: true);
+ areEqual("FutureOr<FutureOr<Object?>>", "Object*", equateTopTypes: true);
+ areEqual("FutureOr<FutureOr<FutureOr<Object*>?>>?", "dynamic",
+ equateTopTypes: true);
+ areEqual("FutureOr<Object?>", "FutureOr<Object?>?", equateTopTypes: true);
+ areEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<Object?>?>?",
+ equateTopTypes: true);
+ areEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<dynamic>?>?",
+ equateTopTypes: true);
+
+ areEqual("Object?", "Object*", ignoreAllNullabilities: true);
+ areEqual("FutureOr<Object?>", "FutureOr<Object?>?",
+ ignoreAllNullabilities: true);
+ areEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<Object?>?>?",
+ ignoreAllNullabilities: true);
+ notEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<dynamic>?>?",
+ ignoreAllNullabilities: true);
+
+ areEqual("FutureOr<Object?>", "FutureOr<Object?>?",
+ ignoreTopLevelNullability: true);
+ notEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<Object?>?>?",
+ ignoreTopLevelNullability: true);
+ notEqual("FutureOr<FutureOr<Object?>>", "FutureOr<FutureOr<dynamic>?>?",
+ ignoreTopLevelNullability: true);
+
+ // Generic function types.
+ notEqual("<T extends dynamic>() ->? int", "<T extends Object?>() -> int?");
+ notEqual("<T extends dynamic>() ->? int", "<T extends Object?>() -> int?",
+ equateTopTypes: true);
+ notEqual("<T extends dynamic>() ->? int", "<T extends Object?>() -> int?",
+ ignoreAllNullabilities: true);
+ notEqual("<T extends dynamic>() ->? int", "<T extends Object?>() -> int?",
+ ignoreTopLevelNullability: true);
+ notEqual("<T extends dynamic>() ->? int", "<T extends Object?>() -> int?",
+ equateTopTypes: true, ignoreTopLevelNullability: true);
+ areEqual("<T extends dynamic>() ->? int", "<T extends Object?>() -> int?",
+ equateTopTypes: true, ignoreAllNullabilities: true);
+
+ notEqual("<T extends dynamic>() -> T?", "<S extends Object?>() -> S?");
+ areEqual("<T extends dynamic>() -> T?", "<S extends Object?>() -> S?",
+ equateTopTypes: true);
+
+ notEqual("<T extends dynamic>() -> T", "<S extends FutureOr<void>>() -> S?");
+ notEqual("<T extends dynamic>() -> T", "<S extends FutureOr<void>>() -> S?",
+ equateTopTypes: true);
+ notEqual("<T extends dynamic>() -> T", "<S extends FutureOr<void>>() -> S?",
+ ignoreAllNullabilities: true);
+ areEqual("<T extends dynamic>() -> T", "<S extends FutureOr<void>>() -> S?",
+ equateTopTypes: true, ignoreAllNullabilities: true);
+
+ areEqual("<T>(<S>() -> void) -> void", "<X>(<Y>() -> void) -> void");
+
+ notEqual("<T>(<S extends void>() -> void) -> void",
+ "<X>(<Y extends Object?>() -> void) -> void");
+ notEqual("<T>(<S extends void>() -> void) -> void",
+ "<X>(<Y extends Object?>() -> void) -> void",
+ ignoreAllNullabilities: true);
+
+ // Free type variables.
+ areEqual("T", "T", typeParameters: "T");
+ notEqual("T?", "T", typeParameters: "T");
+
+ notEqual("T", "S",
+ typeParameters: "T, S",
+ equateTopTypes: true,
+ ignoreAllNullabilities: true);
+
+ notEqual("T & int?", "T & int", typeParameters: "T");
+ notEqual("T & int?", "T & int",
+ typeParameters: "T", ignoreTopLevelNullability: true);
+ areEqual("T & int?", "T & int",
+ typeParameters: "T", ignoreAllNullabilities: true);
+
+ // Check that normalization is out of the scope of the equivalence, even with
+ // the most permissive flags.
+ notEqual("Never?", "Null",
+ equateTopTypes: true, ignoreAllNullabilities: true);
+ notEqual("FutureOr<Never>", "Future<Never>",
+ equateTopTypes: true, ignoreAllNullabilities: true);
+ notEqual("FutureOr<Object>", "Object",
+ equateTopTypes: true, ignoreAllNullabilities: true);
+}
+
+areEqual(String type1, String type2,
+ {String typeParameters = '',
+ bool equateTopTypes = false,
+ bool ignoreAllNullabilities = false,
+ bool ignoreTopLevelNullability = false}) {
+ Env env = new Env('')..extendWithTypeParameters(typeParameters);
+ DartType t1 = env.parseType(type1);
+ DartType t2 = env.parseType(type2);
+
+ List<String> flagNamesForDebug = [
+ if (equateTopTypes) "equateTopTypes",
+ if (ignoreAllNullabilities) "ignoreAllNullabilities",
+ if (ignoreTopLevelNullability) "ignoreTopLevelNullability",
+ ];
+
+ print("areEqual(${type1}, ${type2}"
+ "${flagNamesForDebug.map((f) => ", $f").join()})");
+ Expect.isTrue(
+ new DartTypeEquivalence(env.coreTypes,
+ equateTopTypes: equateTopTypes,
+ ignoreAllNullabilities: ignoreAllNullabilities,
+ ignoreTopLevelNullability: ignoreTopLevelNullability)
+ .areEqual(t1, t2),
+ "Expected '${type1}' and '${type2}' to be equal "
+ "with flags ${flagNamesForDebug.map((f) => "'$f'").join(", ")}.");
+
+ print("areEqual(${type2}, ${type1}"
+ "${flagNamesForDebug.map((f) => ", $f").join()})");
+ Expect.isTrue(
+ new DartTypeEquivalence(env.coreTypes,
+ equateTopTypes: equateTopTypes,
+ ignoreAllNullabilities: ignoreAllNullabilities,
+ ignoreTopLevelNullability: ignoreTopLevelNullability)
+ .areEqual(t2, t1),
+ "Expected '${type2}' and '${type1}' to be equal "
+ "with flags ${flagNamesForDebug.map((f) => "'$f'").join(", ")}.");
+}
+
+notEqual(String type1, String type2,
+ {String typeParameters = '',
+ bool equateTopTypes = false,
+ bool ignoreAllNullabilities = false,
+ bool ignoreTopLevelNullability = false}) {
+ Env env = new Env('')..extendWithTypeParameters(typeParameters);
+ DartType t1 = env.parseType(type1);
+ DartType t2 = env.parseType(type2);
+
+ List<String> flagNamesForDebug = [
+ if (equateTopTypes) "equateTopTypes",
+ if (ignoreAllNullabilities) "ignoreAllNullabilities",
+ if (ignoreTopLevelNullability) "ignoreTopLevelNullability",
+ ];
+
+ print("notEqual(${type1}, ${type2}"
+ "${flagNamesForDebug.map((f) => ", $f").join()})");
+ Expect.isFalse(
+ new DartTypeEquivalence(env.coreTypes,
+ equateTopTypes: equateTopTypes,
+ ignoreAllNullabilities: ignoreAllNullabilities,
+ ignoreTopLevelNullability: ignoreTopLevelNullability)
+ .areEqual(t1, t2),
+ "Expected '${type1}' and '${type2}' to be not equal "
+ "with flags ${flagNamesForDebug.map((f) => "'$f'").join(", ")}.");
+
+ print("notEqual(${type2}, ${type1}"
+ "${flagNamesForDebug.map((f) => ", $f").join()})");
+ Expect.isFalse(
+ new DartTypeEquivalence(env.coreTypes,
+ equateTopTypes: equateTopTypes,
+ ignoreAllNullabilities: ignoreAllNullabilities,
+ ignoreTopLevelNullability: ignoreTopLevelNullability)
+ .areEqual(t2, t1),
+ "Expected '${type2}' and '${type1}' to be not equal "
+ "with flags ${flagNamesForDebug.map((f) => "'$f'").join(", ")}.");
+}
+
+main() => run();
diff --git a/pkg/nnbd_migration/lib/migration_cli.dart b/pkg/nnbd_migration/lib/migration_cli.dart
index 3a0a4af..c87c188 100644
--- a/pkg/nnbd_migration/lib/migration_cli.dart
+++ b/pkg/nnbd_migration/lib/migration_cli.dart
@@ -6,6 +6,7 @@
import 'dart:convert' show jsonDecode;
import 'dart:io' hide File;
+import 'package:analyzer/dart/analysis/analysis_context_collection.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/diagnostic/diagnostic.dart';
import 'package:analyzer/error/error.dart';
@@ -155,8 +156,8 @@
_logger.stderr('Visit https://dart.dev/tools/pub/cmd/pub-outdated for '
'more information.');
_logger.stderr('');
- _logger.stderr('Force migration with '
- '--${CommandLineOptions.skipPubOutdatedFlag} (not recommended)');
+ _logger.stderr('You can force migration with '
+ "'--${CommandLineOptions.skipPubOutdatedFlag}' (not recommended).");
return false;
}
return true;
@@ -235,6 +236,8 @@
_FixCodeProcessor _fixCodeProcessor;
+ AnalysisContextCollection _contextCollection;
+
MigrationCli(
{@required this.binaryName,
@visibleForTesting this.loggerFactory = _defaultLoggerFactory,
@@ -245,8 +248,33 @@
resourceProvider =
resourceProvider ?? PhysicalResourceProvider.INSTANCE;
+ @visibleForTesting
+ DriverBasedAnalysisContext get analysisContext {
+ // Handle the case of more than one analysis context being found (typically,
+ // the current directory and one or more sub-directories).
+ if (hasMultipleAnalysisContext) {
+ return contextCollection.contextFor(options.directory)
+ as DriverBasedAnalysisContext;
+ } else {
+ return contextCollection.contexts.single as DriverBasedAnalysisContext;
+ }
+ }
+
Ansi get ansi => logger.ansi;
+ AnalysisContextCollection get contextCollection {
+ _contextCollection ??= AnalysisContextCollectionImpl(
+ includedPaths: [options.directory],
+ resourceProvider: resourceProvider,
+ sdkPath: pathContext.normalize(options.sdkPath));
+ return _contextCollection;
+ }
+
+ @visibleForTesting
+ bool get hasMultipleAnalysisContext {
+ return contextCollection.contexts.length > 1;
+ }
+
Context get pathContext => resourceProvider.pathContext;
/// Blocks until an interrupt signal (control-C) is received. Tests may
@@ -257,6 +285,19 @@
return stream.first;
}
+ NonNullableFix createNonNullableFix(DartFixListener listener,
+ ResourceProvider resourceProvider, LineInfo getLineInfo(String path),
+ {List<String> included = const <String>[],
+ int preferredPort,
+ bool enablePreview = true,
+ String summaryPath}) {
+ return NonNullableFix(listener, resourceProvider, getLineInfo,
+ included: included,
+ preferredPort: preferredPort,
+ enablePreview: enablePreview,
+ summaryPath: summaryPath);
+ }
+
/// Parses and validates command-line arguments, and stores the results in
/// [options].
///
@@ -316,6 +357,7 @@
argResults[CommandLineOptions.skipPubOutdatedFlag] as bool,
summary: argResults[CommandLineOptions.summaryOption] as String,
webPreview: webPreview);
+
if (isVerbose) {
logger = loggerFactory(true);
}
@@ -352,20 +394,23 @@
logger.stdout('Migrating ${options.directory}');
logger.stdout('');
+ if (hasMultipleAnalysisContext) {
+ logger.stdout(
+ 'Note: more than one project found; migrating the top-level project.');
+ logger.stdout('');
+ }
+
+ DriverBasedAnalysisContext context = analysisContext;
+
List<String> previewUrls;
NonNullableFix nonNullableFix;
+
await _withProgress(
'${ansi.emphasized('Generating migration suggestions')}', () async {
- var contextCollection = AnalysisContextCollectionImpl(
- includedPaths: [options.directory],
- resourceProvider: resourceProvider,
- sdkPath: options.sdkPath);
- DriverBasedAnalysisContext context =
- contextCollection.contexts.single as DriverBasedAnalysisContext;
_fixCodeProcessor = _FixCodeProcessor(context, this);
_dartFixListener =
DartFixListener(DriverProviderImpl(resourceProvider, context));
- nonNullableFix = NonNullableFix(
+ nonNullableFix = createNonNullableFix(
_dartFixListener, resourceProvider, _fixCodeProcessor.getLineInfo,
included: [options.directory],
preferredPort: options.previewPort,
@@ -376,6 +421,8 @@
_fixCodeProcessor.nonNullableFixTask = nonNullableFix;
try {
+ // TODO(devoncarew): The progress written by the fix processor conflicts
+ // with the progress written by the ansi logger above.
await _fixCodeProcessor.runFirstPhase();
_fixCodeProcessor._progressBar.clear();
_checkForErrors();
diff --git a/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart b/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
index f034fd8..3f3c9e6 100644
--- a/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
+++ b/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
@@ -8,6 +8,7 @@
import 'package:analyzer/dart/element/type_provider.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/generated/element_type_provider.dart';
import 'package:nnbd_migration/src/decorated_type.dart';
import 'package:nnbd_migration/src/edge_origin.dart';
import 'package:nnbd_migration/src/nullability_node.dart';
@@ -106,7 +107,7 @@
allSupertypes.add(supertype);
}
allSupertypes.addAll(class_.superclassConstraints);
- allSupertypes.addAll(class_.interfaces);
+ allSupertypes.addAll(class_.preMigrationInterfaces);
allSupertypes.addAll(class_.mixins);
var type = class_.thisType;
if (type.isDartAsyncFuture) {
@@ -119,3 +120,15 @@
];
}
}
+
+extension on ClassElement {
+ List<InterfaceType> get preMigrationInterfaces {
+ var previousElementTypeProvider = ElementTypeProvider.current;
+ try {
+ ElementTypeProvider.current = const ElementTypeProvider();
+ return interfaces;
+ } finally {
+ ElementTypeProvider.current = previousElementTypeProvider;
+ }
+ }
+}
diff --git a/pkg/nnbd_migration/lib/src/fix_builder.dart b/pkg/nnbd_migration/lib/src/fix_builder.dart
index 96c8338..99bf8fc 100644
--- a/pkg/nnbd_migration/lib/src/fix_builder.dart
+++ b/pkg/nnbd_migration/lib/src/fix_builder.dart
@@ -82,6 +82,8 @@
/// actually make the changes; it simply reports what changes are necessary
/// through abstract methods.
class FixBuilder {
+ final DecoratedClassHierarchy _decoratedClassHierarchy;
+
/// The type provider providing non-nullable types.
final TypeProvider typeProvider;
@@ -145,7 +147,7 @@
}
FixBuilder._(
- DecoratedClassHierarchy decoratedClassHierarchy,
+ this._decoratedClassHierarchy,
this._typeSystem,
this._variables,
this.source,
@@ -157,7 +159,6 @@
this._graph)
: typeProvider = _typeSystem.typeProvider {
migrationResolutionHooks._fixBuilder = this;
- // TODO(paulberry): make use of decoratedClassHierarchy
assert(_typeSystem.isNonNullableByDefault);
assert((typeProvider as TypeProviderImpl).isNonNullableByDefault);
var inheritanceManager = InheritanceManager3();
@@ -313,6 +314,17 @@
}
@override
+ List<InterfaceType> getClassInterfaces(ClassElementImpl element) {
+ return _wrapExceptions(
+ _fixBuilder.unit,
+ () => element.interfacesInternal,
+ () => [
+ for (var interface in element.interfacesInternal)
+ _getClassInterface(element, interface.element)
+ ]);
+ }
+
+ @override
bool getConditionalKnownValue(AstNode node) =>
_wrapExceptions(node, () => null, () {
// TODO(paulberry): handle conditional expressions.
@@ -423,6 +435,12 @@
}
@override
+ bool isLibraryNonNullableByDefault(LibraryElementImpl element) {
+ return _fixBuilder._graph.isBeingMigrated(element.source) ||
+ element.isNonNullableByDefaultInternal;
+ }
+
+ @override
bool isMethodInvocationNullAware(MethodInvocation node) {
return node.isNullAware &&
(_shouldStayNullAware[node] ??= _fixBuilder._shouldStayNullAware(node));
@@ -521,6 +539,14 @@
}
}
+ InterfaceType _getClassInterface(
+ ClassElement class_, ClassElement superclass) {
+ var decoratedSupertype = _fixBuilder._decoratedClassHierarchy
+ .getDecoratedSupertype(class_, superclass);
+ var finalType = _fixBuilder._variables.toFinalType(decoratedSupertype);
+ return finalType as InterfaceType;
+ }
+
DartType _modifyRValueType(Expression node, DartType type,
{DartType context}) {
var hint =
diff --git a/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart b/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
index 001ee1f..ed37a85 100644
--- a/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
@@ -26,9 +26,8 @@
/// and determines whether the associated variable or parameter can be null
/// then adds or removes a '?' trailing the named type as appropriate.
class NonNullableFix {
- /// TODO(paulberry): stop using permissive mode once the migration logic is
- /// mature enough.
- static const bool _usePermissiveMode = true;
+ /// TODO(paulberry): allow this to be controlled by a command-line parameter.
+ static const bool _usePermissiveMode = false;
// TODO(srawlins): Refactor to use
// `Feature.non_nullable.firstSupportedVersion` when this becomes non-null.
@@ -101,6 +100,10 @@
int get numPhases => 3;
+ InstrumentationListener createInstrumentationListener(
+ {MigrationSummary migrationSummary}) =>
+ InstrumentationListener(migrationSummary: migrationSummary);
+
Future<void> finish() async {
migration.finish();
final state = MigrationState(
@@ -188,7 +191,7 @@
}
void reset() {
- instrumentationListener = InstrumentationListener(
+ instrumentationListener = createInstrumentationListener(
migrationSummary: summaryPath == null
? null
: MigrationSummary(summaryPath, resourceProvider, includedRoot));
diff --git a/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart b/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
index 077d9e2..5028a7a 100644
--- a/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
+++ b/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
@@ -5,6 +5,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/dart/analysis/session.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -112,6 +113,10 @@
var compilationUnit = unit.declaredElement;
var library = compilationUnit.library;
var source = compilationUnit.source;
+ // Hierarchies were created assuming the libraries being migrated are opted
+ // out, but the FixBuilder will analyze assuming they're opted in. So we
+ // need to clear the hierarchies before we continue.
+ (result.session as AnalysisSessionImpl).clearHierarchies();
var fixBuilder = FixBuilder(
source,
_decoratedClassHierarchy,
diff --git a/pkg/nnbd_migration/pubspec.yaml b/pkg/nnbd_migration/pubspec.yaml
index 1c84a36..ec7cff3 100644
--- a/pkg/nnbd_migration/pubspec.yaml
+++ b/pkg/nnbd_migration/pubspec.yaml
@@ -6,7 +6,7 @@
sdk: '>=2.6.0 <3.0.0'
dependencies:
_fe_analyzer_shared: ^4.0.0
- analyzer: ^0.39.9
+ analyzer: ^0.39.11-dev
analyzer_plugin: ^0.2.4
args: ^1.4.4
charcode: ^1.1.2
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index 5522a28..70c1d2d 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -380,6 +380,44 @@
await _checkSingleFileChanges(content, expected);
}
+ Future<void> test_call_migrated_base_class_method_non_nullable() async {
+ var content = '''
+abstract class M<V> implements Map<String, V> {}
+void f(bool b, M<int> m, int i) {
+ if (b) {
+ m['x'] = i;
+ }
+}
+void g(bool b, M<int> m) {
+ f(b, m, null);
+}
+''';
+ var expected = '''
+abstract class M<V> implements Map<String, V> {}
+void f(bool b, M<int?> m, int? i) {
+ if (b) {
+ m['x'] = i;
+ }
+}
+void g(bool b, M<int?> m) {
+ f(b, m, null);
+}
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
+ Future<void> test_call_migrated_base_class_method_nullable() async {
+ var content = '''
+abstract class M<V> implements Map<String, V> {}
+int f(M<int> m) => m['x'];
+''';
+ var expected = '''
+abstract class M<V> implements Map<String, V> {}
+int? f(M<int> m) => m['x'];
+''';
+ await _checkSingleFileChanges(content, expected);
+ }
+
Future<void> test_catch_simple() async {
var content = '''
void f() {
@@ -6391,6 +6429,6 @@
@override
void _betweenStages() {
- driver.resetUriResolution();
+ driver.clearLibraryContext();
}
}
diff --git a/pkg/nnbd_migration/test/fix_builder_test.dart b/pkg/nnbd_migration/test/fix_builder_test.dart
index b151462..b4e888d 100644
--- a/pkg/nnbd_migration/test/fix_builder_test.dart
+++ b/pkg/nnbd_migration/test/fix_builder_test.dart
@@ -2730,7 +2730,6 @@
visitSubexpression(findNode.propertyAccess('c?.hashCode'), 'int?');
}
- @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/40475')
Future<void> test_propertyAccess_nullAware_object_tearoff() async {
await analyze('''
class _C {}
diff --git a/pkg/nnbd_migration/test/migration_cli_test.dart b/pkg/nnbd_migration/test/migration_cli_test.dart
index f86b9a9..2e521ee 100644
--- a/pkg/nnbd_migration/test/migration_cli_test.dart
+++ b/pkg/nnbd_migration/test/migration_cli_test.dart
@@ -6,14 +6,21 @@
import 'dart:convert';
import 'dart:io';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/file_system/file_system.dart' show ResourceProvider;
import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/test_utilities/mock_sdk.dart' as mock_sdk;
import 'package:args/args.dart';
import 'package:cli_util/cli_logging.dart';
import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
+import 'package:nnbd_migration/instrumentation.dart';
import 'package:nnbd_migration/migration_cli.dart';
+import 'package:nnbd_migration/src/front_end/dartfix_listener.dart';
+import 'package:nnbd_migration/src/front_end/instrumentation_listener.dart';
+import 'package:nnbd_migration/src/front_end/migration_summary.dart';
import 'package:nnbd_migration/src/front_end/non_nullable_fix.dart';
import 'package:nnbd_migration/src/front_end/web/edit_details.dart';
import 'package:nnbd_migration/src/front_end/web/file_details.dart';
@@ -29,10 +36,54 @@
});
}
+/// Specialization of [InstrumentationListener] that generates artificial
+/// exceptions, so that we can test they are properly propagated to top level.
+class _ExceptionGeneratingInstrumentationListener
+ extends InstrumentationListener {
+ _ExceptionGeneratingInstrumentationListener(
+ {MigrationSummary migrationSummary})
+ : super(migrationSummary: migrationSummary);
+
+ @override
+ void externalDecoratedType(Element element, DecoratedTypeInfo decoratedType) {
+ if (element.name == 'print') {
+ throw StateError('Artificial exception triggered');
+ }
+ super.externalDecoratedType(element, decoratedType);
+ }
+}
+
+/// Specialization of [NonNullableFix] that generates artificial exceptions, so
+/// that we can test they are properly propagated to top level.
+class _ExceptionGeneratingNonNullableFix extends NonNullableFix {
+ _ExceptionGeneratingNonNullableFix(DartFixListener listener,
+ ResourceProvider resourceProvider, LineInfo Function(String) getLineInfo,
+ {List<String> included = const <String>[],
+ int preferredPort,
+ bool enablePreview = true,
+ String summaryPath})
+ : super(listener, resourceProvider, getLineInfo,
+ included: included,
+ preferredPort: preferredPort,
+ enablePreview: enablePreview,
+ summaryPath: summaryPath);
+
+ @override
+ InstrumentationListener createInstrumentationListener(
+ {MigrationSummary migrationSummary}) =>
+ _ExceptionGeneratingInstrumentationListener(
+ migrationSummary: migrationSummary);
+}
+
class _MigrationCli extends MigrationCli {
+ /// If `true`, then an artifical exception should be generated when migration
+ /// encounters a reference to the `print` function.
+ final bool injectArtificialException;
+
Future<void> Function() _runWhilePreviewServerActive;
- _MigrationCli(_MigrationCliTestBase test)
+ _MigrationCli(_MigrationCliTestBase test,
+ {this.injectArtificialException = false})
: super(
binaryName: 'nnbd_migration',
loggerFactory: (isVerbose) => test.logger = _TestLogger(isVerbose),
@@ -50,6 +101,29 @@
_runWhilePreviewServerActive = null;
}
+ @override
+ NonNullableFix createNonNullableFix(DartFixListener listener,
+ ResourceProvider resourceProvider, LineInfo getLineInfo(String path),
+ {List<String> included = const <String>[],
+ int preferredPort,
+ bool enablePreview = true,
+ String summaryPath}) {
+ if (injectArtificialException) {
+ return _ExceptionGeneratingNonNullableFix(
+ listener, resourceProvider, getLineInfo,
+ included: included,
+ preferredPort: preferredPort,
+ enablePreview: enablePreview,
+ summaryPath: summaryPath);
+ } else {
+ return super.createNonNullableFix(listener, resourceProvider, getLineInfo,
+ included: included,
+ preferredPort: preferredPort,
+ enablePreview: enablePreview,
+ summaryPath: summaryPath);
+ }
+ }
+
Future<void> runWithPreviewServer(
ArgResults argResults, Future<void> callback()) async {
_runWhilePreviewServerActive = callback;
@@ -362,6 +436,49 @@
assertProjectContents(projectDir, simpleProject(migrated: true));
}
+ test_lifecycle_contextdiscovery_handles_multiple() async {
+ var projectContents = simpleProject();
+ var subProject = simpleProject();
+ for (var filePath in subProject.keys) {
+ projectContents['example/$filePath'] = subProject[filePath];
+ }
+ projectContents['example/analysis_options.yaml'] = '''
+analyzer:
+ strong-mode:
+ implicit-casts: false
+linter:
+ rules:
+ - empty_constructor_bodies
+''';
+
+ var projectDir = await createProjectDir(projectContents);
+ var cli = _createCli();
+ await cli.run(_parseArgs(['--no-web-preview', projectDir]));
+ expect(cli.hasMultipleAnalysisContext, true);
+ expect(cli.analysisContext, isNotNull);
+ var output = logger.stdoutBuffer.toString();
+ expect(output, contains('more than one project found'));
+ }
+
+ test_lifecycle_contextdiscovery_handles_single() async {
+ var projectContents = simpleProject();
+ var projectDir = await createProjectDir(projectContents);
+ var cli = _createCli();
+ await cli.run(_parseArgs(['--no-web-preview', projectDir]));
+ expect(cli.hasMultipleAnalysisContext, false);
+ expect(cli.analysisContext, isNotNull);
+ }
+
+ test_lifecycle_exception_handling() async {
+ var projectContents = simpleProject(sourceText: 'main() { print(0); }');
+ var projectDir = await createProjectDir(projectContents);
+ var cli = _createCli(injectArtificialException: true);
+ expect(
+ () async => runWithPreviewServer(cli, [projectDir], (url) async {}),
+ throwsA(TypeMatcher<Error>().having((e) => e.toString(), 'toString',
+ contains('Artificial exception triggered'))));
+ }
+
test_lifecycle_ignore_errors_disable() async {
var projectContents = simpleProject(sourceText: '''
int f() => null
@@ -950,7 +1067,7 @@
}
test_migrate_path_normalized() {
- expect(assertParseArgsSuccess(['..']).directory, isNot(contains('..')));
+ expect(assertParseArgsSuccess(['foo/..']).directory, isNot(contains('..')));
}
test_migrate_path_one() {
@@ -992,7 +1109,7 @@
var cli = MigrationCli(binaryName: 'nnbd_migration');
cli.decodeCommandLineArgs(_parseArgs([]));
expect(
- File(path.join(cli.options.sdkPath, 'version')).existsSync(), isTrue);
+ Directory(path.join(cli.options.sdkPath, 'bin')).existsSync(), isTrue);
}
test_option_sdk_hidden() async {
@@ -1334,9 +1451,10 @@
headers: {'Content-Type': 'application/json; charset=UTF-8'});
}
- _MigrationCli _createCli() {
+ _MigrationCli _createCli({bool injectArtificialException = false}) {
mock_sdk.MockSdk(resourceProvider: resourceProvider);
- return _MigrationCli(this);
+ return _MigrationCli(this,
+ injectArtificialException: injectArtificialException);
}
Future<String> _getHelpText({@required bool verbose}) async {
diff --git a/pkg/test_runner/lib/src/test_case.dart b/pkg/test_runner/lib/src/test_case.dart
index 264d73d..fb4a908 100644
--- a/pkg/test_runner/lib/src/test_case.dart
+++ b/pkg/test_runner/lib/src/test_case.dart
@@ -331,7 +331,6 @@
"$maxStdioDelayPassedMessage (command: $command)");
await stdout.cancel();
await stderr.cancel();
- _commandComplete(exitCode);
return null;
}).then((_) {
if (stdout is FileOutputLog) {
diff --git a/pkg/test_runner/lib/src/test_configurations.dart b/pkg/test_runner/lib/src/test_configurations.dart
index 4107748..7eac32a 100644
--- a/pkg/test_runner/lib/src/test_configurations.dart
+++ b/pkg/test_runner/lib/src/test_configurations.dart
@@ -32,7 +32,6 @@
Path('runtime/observatory/tests/observatory_ui'),
Path('samples'),
Path('samples-dev'),
- Path('tests/compiler/dart2js_native'),
Path('tests/compiler/dartdevc_native'),
Path('tests/corelib'),
Path('tests/corelib_2'),
diff --git a/pkg/vm/lib/incremental_compiler.dart b/pkg/vm/lib/incremental_compiler.dart
index a169532..f2f483f 100644
--- a/pkg/vm/lib/incremental_compiler.dart
+++ b/pkg/vm/lib/incremental_compiler.dart
@@ -156,6 +156,14 @@
if (incrementalSerializer != null) {
incrementalSerializer = new IncrementalSerializer();
}
+ // Make sure the last known good component is linked to itself, i.e. if the
+ // rejected delta was an "advanced incremental recompilation" that updated
+ // old libraries to point to a new library (that we're now rejecting), make
+ // sure it's "updated back".
+ // Note that if accept was never called [_lastKnownGood] is null (and
+ // loading from it below is basically nonsense, it will just start over).
+ _lastKnownGood?.relink();
+
_generator = new IncrementalKernelGenerator.fromComponent(_compilerOptions,
_entryPoint, _lastKnownGood, false, incrementalSerializer);
await _generator.computeDelta(entryPoints: [_entryPoint]);
diff --git a/pkg/vm/lib/kernel_front_end.dart b/pkg/vm/lib/kernel_front_end.dart
index 044478e..afb12fc 100644
--- a/pkg/vm/lib/kernel_front_end.dart
+++ b/pkg/vm/lib/kernel_front_end.dart
@@ -44,6 +44,7 @@
import 'package:kernel/ast.dart' show Component, Library, Reference;
import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
import 'package:kernel/core_types.dart' show CoreTypes;
+import 'package:kernel/kernel.dart' show loadComponentFromBinary;
import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
import 'bytecode/bytecode_serialization.dart' show BytecodeSizeStatistics;
@@ -80,6 +81,9 @@
'Produce kernel file for AOT compilation (enables global transformations).',
defaultsTo: false);
args.addOption('depfile', help: 'Path to output Ninja depfile');
+ args.addOption('from-dill',
+ help: 'Read existing dill file instead of compiling from sources',
+ defaultsTo: null);
args.addFlag('link-platform',
help: 'Include platform into resulting kernel file.', defaultsTo: true);
args.addFlag('minimal-kernel',
@@ -165,6 +169,7 @@
final String targetName = options['target'];
final String fileSystemScheme = options['filesystem-scheme'];
final String depfile = options['depfile'];
+ final String fromDillFile = options['from-dill'];
final List<String> fileSystemRoots = options['filesystem-root'];
final bool aot = options['aot'];
final bool tfa = options['tfa'];
@@ -260,7 +265,8 @@
dropAST: dropAST && !splitOutputByPackages,
useProtobufTreeShaker: useProtobufTreeShaker,
minimalKernel: minimalKernel,
- treeShakeWriteOnlyFields: treeShakeWriteOnlyFields);
+ treeShakeWriteOnlyFields: treeShakeWriteOnlyFields,
+ fromDillFile: fromDillFile);
errorPrinter.printCompilationMessages();
@@ -335,7 +341,8 @@
bool dropAST: false,
bool useProtobufTreeShaker: false,
bool minimalKernel: false,
- bool treeShakeWriteOnlyFields: false}) async {
+ bool treeShakeWriteOnlyFields: false,
+ String fromDillFile: null}) async {
// Replace error handler to detect if there are compilation errors.
final errorDetector =
new ErrorDetector(previousErrorHandler: options.onDiagnostic);
@@ -344,7 +351,13 @@
options.environmentDefines =
options.target.updateEnvironmentDefines(environmentDefines);
- CompilerResult compilerResult = await kernelForProgram(source, options);
+ CompilerResult compilerResult;
+ if (fromDillFile != null) {
+ compilerResult =
+ await loadKernel(options.fileSystem, resolveInputUri(fromDillFile));
+ } else {
+ compilerResult = await kernelForProgram(source, options);
+ }
Component component = compilerResult?.component;
Iterable<Uri> compiledSources = component?.uriToSource?.keys;
@@ -859,5 +872,25 @@
await packageManifest.close();
}
+class CompilerResultLoadedFromKernel implements CompilerResult {
+ final Component component;
+ final Component sdkComponent = Component();
+
+ CompilerResultLoadedFromKernel(this.component);
+
+ List<int> get summary => null;
+ List<Component> get loadedComponents => const <Component>[];
+ List<Uri> get deps => const <Uri>[];
+ CoreTypes get coreTypes => null;
+ ClassHierarchy get classHierarchy => null;
+}
+
+Future<CompilerResult> loadKernel(
+ FileSystem fileSystem, Uri dillFileUri) async {
+ final component = loadComponentFromBinary(
+ (await asFileUri(fileSystem, dillFileUri)).toFilePath());
+ return CompilerResultLoadedFromKernel(component);
+}
+
// Used by kernel_front_end_test.dart
main() {}
diff --git a/pkg/vm/test/incremental_compiler_test.dart b/pkg/vm/test/incremental_compiler_test.dart
index 65cec8a..5611b3d 100644
--- a/pkg/vm/test/incremental_compiler_test.dart
+++ b/pkg/vm/test/incremental_compiler_test.dart
@@ -785,6 +785,111 @@
expect(procedure, isNotNull);
}
});
+
+ /// This test basicaly verifies that components `relink` method is correctly
+ /// called when rejecting (i.e. logically going back in time to before a
+ /// rejected compilation).
+ test('check links after reject', () async {
+ final Uri fooUri = Uri.file('${mytest.path}/foo.dart');
+ new File.fromUri(fooUri).writeAsStringSync("""
+ import 'bar.dart';
+ main() {
+ A a = new A();
+ print(a.b());
+ print(A.a);
+ }
+ """);
+
+ final Uri barUri = Uri.file('${mytest.path}/bar.dart');
+ new File.fromUri(barUri).writeAsStringSync("""
+ class A {
+ static int a;
+ int b() { return 42; }
+ }
+ """);
+
+ final IncrementalCompiler compiler =
+ new IncrementalCompiler(options, fooUri);
+ // These are copies of the ones in
+ // pkg/front_end/lib/src/fasta/util/experiment_environment_getter.dart
+ compiler.generator.setExperimentalFeaturesForTesting({
+ "DART_CFE_ENABLE_EXPERIMENTAL_INVALIDATION",
+ "DART_CFE_ENABLE_EXPERIMENTAL_INVALIDATION_SERIALIZATION"
+ });
+ Library fooLib;
+ Library barLib;
+ {
+ final Component component = await compiler.compile(entryPoint: fooUri);
+ expect(component.libraries.length, equals(2));
+ fooLib = component.libraries.firstWhere((lib) => lib.fileUri == fooUri);
+ barLib = component.libraries.firstWhere((lib) => lib.fileUri == barUri);
+ // Verify that foo only has links to this bar.
+ final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
+ fooLib.accept(lrc);
+ expect(lrc.librariesReferenced, equals(<Library>{barLib}));
+ }
+ compiler.accept();
+ {
+ final Procedure procedure = await compiler.compileExpression(
+ 'a', <String>[], <String>[], barUri.toString(), 'A', true);
+ expect(procedure, isNotNull);
+ // Verify that the expression only has links to the only bar we know
+ // about.
+ final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
+ procedure.accept(lrc);
+ expect(lrc.librariesReferenced, equals(<Library>{barLib}));
+ }
+
+ new File.fromUri(barUri).writeAsStringSync("""
+ class A {
+ static int a;
+ int b() { return 84; }
+ }
+ """);
+ compiler.invalidate(barUri);
+ {
+ final Component component = await compiler.compile(entryPoint: fooUri);
+ final Library fooLib2 = component.libraries
+ .firstWhere((lib) => lib.fileUri == fooUri, orElse: () => null);
+ expect(fooLib2, isNull);
+ final Library barLib2 =
+ component.libraries.firstWhere((lib) => lib.fileUri == barUri);
+ // Verify that the fooLib (we only have the original one) only has
+ // links to the newly compiled bar.
+ final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
+ fooLib.accept(lrc);
+ expect(lrc.librariesReferenced, equals(<Library>{barLib2}));
+ }
+ await compiler.reject();
+ // Re-enable the experiments as reject creates a new generator.
+ compiler.generator.setExperimentalFeaturesForTesting({
+ "DART_CFE_ENABLE_EXPERIMENTAL_INVALIDATION",
+ "DART_CFE_ENABLE_EXPERIMENTAL_INVALIDATION_SERIALIZATION"
+ });
+ {
+ // Verify that the original foo library only has links to the original
+ // compiled bar.
+ final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
+ fooLib.accept(lrc);
+ expect(lrc.librariesReferenced, equals(<Library>{barLib}));
+ }
+ {
+ // Verify that the saved "last known good" compnent only contains links
+ // to the original 'foo' and 'bar' libraries.
+ final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
+ compiler.lastKnownGoodComponent.accept(lrc);
+ expect(lrc.librariesReferenced, equals(<Library>{fooLib, barLib}));
+ }
+ {
+ final Procedure procedure = await compiler.compileExpression(
+ 'a', <String>[], <String>[], barUri.toString(), 'A', true);
+ expect(procedure, isNotNull);
+ // Verify that the expression only has links to the original bar.
+ final LibraryReferenceCollector lrc = new LibraryReferenceCollector();
+ procedure.accept(lrc);
+ expect(lrc.librariesReferenced, equals(<Library>{barLib}));
+ }
+ });
});
group('expression evaluation', () {
@@ -1261,6 +1366,18 @@
await sink.close();
}
+class LibraryReferenceCollector extends RecursiveVisitor<void> {
+ Set<Library> librariesReferenced = {};
+
+ void defaultMemberReference(Member node) {
+ Library lib = node.enclosingLibrary;
+ if (lib.importUri.scheme != "dart") {
+ librariesReferenced.add(lib);
+ }
+ return super.defaultMemberReference(node);
+ }
+}
+
/// APIs to communicate with a remote VM via the VM's service protocol.
///
/// Only supports APIs to resume the program execution (when isolates are paused
diff --git a/pkg/vm/test/snapshot/instruction_sizes_test.dart b/pkg/vm/test/snapshot/instruction_sizes_test.dart
index 0ed14f0..0a66a9a 100644
--- a/pkg/vm/test/snapshot/instruction_sizes_test.dart
+++ b/pkg/vm/test/snapshot/instruction_sizes_test.dart
@@ -55,6 +55,12 @@
}
}
+class C {
+ static dynamic tornOff() async {
+ return true;
+ }
+}
+
@pragma('vm:never-inline')
Function tearOff(dynamic o) {
return o.tornOff;
@@ -65,6 +71,7 @@
print(cl());
}
print(tearOff(args.isEmpty ? A() : B()));
+ print(C.tornOff);
}
""");
@@ -140,6 +147,10 @@
expect(inputDartSymbolNames, contains('[tear-off] B.tornOff'));
expect(inputDartSymbolNames,
contains('[tear-off-extractor] B.get:tornOff'));
+
+ // Presence of async modifier should not cause tear-off name to end
+ // with {body}.
+ expect(inputDartSymbolNames, contains('[tear-off] C.tornOff'));
});
});
});
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index ff32a17..d5d6529 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -17,6 +17,7 @@
#include <sys/utime.h> // NOLINT
#include "bin/builtin.h"
+#include "bin/crypto.h"
#include "bin/directory.h"
#include "bin/namespace.h"
#include "bin/utils.h"
@@ -503,6 +504,85 @@
return (move_status != 0);
}
+static wchar_t* CopyToDartScopeString(wchar_t* string) {
+ wchar_t* wide_path = reinterpret_cast<wchar_t*>(
+ Dart_ScopeAllocate(MAX_PATH * sizeof(wchar_t) + 1));
+ wcscpy(wide_path, string);
+ return wide_path;
+}
+
+static wchar_t* CopyIntoTempFile(const char* src, const char* dest) {
+ // This function will copy the file to a temp file in the destination
+ // directory and return the path of temp file.
+ // Creating temp file name has the same logic as Directory::CreateTemp(),
+ // which tries with the rng and falls back to a uuid if it failed.
+ const char* last_backslash = strrchr(dest, '\\');
+ if (last_backslash == NULL) {
+ return NULL;
+ }
+ int length_of_parent_dir = last_backslash - dest + 1;
+ if (length_of_parent_dir + 8 > MAX_PATH) {
+ return NULL;
+ }
+ uint32_t suffix_bytes = 0;
+ const int kSuffixSize = sizeof(suffix_bytes);
+ if (Crypto::GetRandomBytes(kSuffixSize,
+ reinterpret_cast<uint8_t*>(&suffix_bytes))) {
+ PathBuffer buffer;
+ char* dir = reinterpret_cast<char*>(
+ Dart_ScopeAllocate(1 + sizeof(char) * length_of_parent_dir));
+ memmove(dir, dest, length_of_parent_dir);
+ dir[length_of_parent_dir] = '\0';
+ if (!buffer.Add(dir)) {
+ return NULL;
+ }
+
+ char suffix[8 + 1];
+ Utils::SNPrint(suffix, sizeof(suffix), "%x", suffix_bytes);
+ Utf8ToWideScope source_path(src);
+ if (!buffer.Add(suffix)) {
+ return NULL;
+ }
+ if (CopyFileExW(source_path.wide(), buffer.AsStringW(), NULL, NULL, NULL,
+ 0) != 0) {
+ return CopyToDartScopeString(buffer.AsStringW());
+ }
+ }
+ // UUID has a total of 36 characters in the form of
+ // xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx.
+ if (length_of_parent_dir + 36 > MAX_PATH) {
+ return NULL;
+ }
+ UUID uuid;
+ RPC_STATUS status = UuidCreateSequential(&uuid);
+ if ((status != RPC_S_OK) && (status != RPC_S_UUID_LOCAL_ONLY)) {
+ return NULL;
+ }
+ RPC_WSTR uuid_string;
+ status = UuidToStringW(&uuid, &uuid_string);
+ if (status != RPC_S_OK) {
+ return NULL;
+ }
+ PathBuffer buffer;
+ char* dir = reinterpret_cast<char*>(
+ Dart_ScopeAllocate(1 + sizeof(char) * length_of_parent_dir));
+ memmove(dir, dest, length_of_parent_dir);
+ dir[length_of_parent_dir] = '\0';
+ Utf8ToWideScope dest_path(dir);
+ if (!buffer.AddW(dest_path.wide()) ||
+ !buffer.AddW(reinterpret_cast<wchar_t*>(uuid_string))) {
+ return NULL;
+ }
+
+ RpcStringFreeW(&uuid_string);
+ Utf8ToWideScope source_path(src);
+ if (CopyFileExW(source_path.wide(), buffer.AsStringW(), NULL, NULL, NULL,
+ 0) != 0) {
+ return CopyToDartScopeString(buffer.AsStringW());
+ }
+ return NULL;
+}
+
bool File::Copy(Namespace* namespc,
const char* old_path,
const char* new_path) {
@@ -511,11 +591,23 @@
SetLastError(ERROR_FILE_NOT_FOUND);
return false;
}
- Utf8ToWideScope system_old_path(old_path);
- Utf8ToWideScope system_new_path(new_path);
- bool success = CopyFileExW(system_old_path.wide(), system_new_path.wide(),
- NULL, NULL, NULL, 0) != 0;
- return success;
+
+ wchar_t* temp_file = CopyIntoTempFile(old_path, new_path);
+ if (temp_file == NULL) {
+ return false;
+ }
+ Utf8ToWideScope system_new_dest(new_path);
+
+ // Remove the existing file. Otherwise, renaming will fail.
+ if (Exists(namespc, new_path)) {
+ DeleteFileW(system_new_dest.wide());
+ }
+
+ if (!MoveFileW(temp_file, system_new_dest.wide())) {
+ DeleteFileW(temp_file);
+ return false;
+ }
+ return true;
}
int64_t File::LengthFromPath(Namespace* namespc, const char* name) {
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 23aab21..a733d90 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -24,13 +24,13 @@
static const int kSocketIdNativeField = 0;
-ListeningSocketRegistry* globalTcpListeningSocketRegistry = NULL;
+ListeningSocketRegistry* globalTcpListeningSocketRegistry = nullptr;
bool Socket::short_socket_read_ = false;
bool Socket::short_socket_write_ = false;
void ListeningSocketRegistry::Initialize() {
- ASSERT(globalTcpListeningSocketRegistry == NULL);
+ ASSERT(globalTcpListeningSocketRegistry == nullptr);
globalTcpListeningSocketRegistry = new ListeningSocketRegistry();
}
@@ -40,15 +40,15 @@
void ListeningSocketRegistry::Cleanup() {
delete globalTcpListeningSocketRegistry;
- globalTcpListeningSocketRegistry = NULL;
+ globalTcpListeningSocketRegistry = nullptr;
}
ListeningSocketRegistry::OSSocket* ListeningSocketRegistry::LookupByPort(
intptr_t port) {
SimpleHashMap::Entry* entry = sockets_by_port_.Lookup(
GetHashmapKeyFromIntptr(port), GetHashmapHashFromIntptr(port), false);
- if (entry == NULL) {
- return NULL;
+ if (entry == nullptr) {
+ return nullptr;
}
return reinterpret_cast<OSSocket*>(entry->value);
}
@@ -56,7 +56,7 @@
void ListeningSocketRegistry::InsertByPort(intptr_t port, OSSocket* socket) {
SimpleHashMap::Entry* entry = sockets_by_port_.Lookup(
GetHashmapKeyFromIntptr(port), GetHashmapHashFromIntptr(port), true);
- ASSERT(entry != NULL);
+ ASSERT(entry != nullptr);
entry->value = reinterpret_cast<void*>(socket);
}
@@ -70,8 +70,8 @@
SimpleHashMap::Entry* entry = sockets_by_fd_.Lookup(
GetHashmapKeyFromIntptr(reinterpret_cast<intptr_t>(fd)),
GetHashmapHashFromIntptr(reinterpret_cast<intptr_t>(fd)), false);
- if (entry == NULL) {
- return NULL;
+ if (entry == nullptr) {
+ return nullptr;
}
return reinterpret_cast<OSSocket*>(entry->value);
}
@@ -80,7 +80,7 @@
SimpleHashMap::Entry* entry = sockets_by_fd_.Lookup(
GetHashmapKeyFromIntptr(reinterpret_cast<intptr_t>(fd)),
GetHashmapHashFromIntptr(reinterpret_cast<intptr_t>(fd)), true);
- ASSERT(entry != NULL);
+ ASSERT(entry != nullptr);
entry->value = reinterpret_cast<void*>(socket);
}
@@ -97,18 +97,18 @@
bool shared) {
MutexLocker ml(&mutex_);
- OSSocket* first_os_socket = NULL;
+ OSSocket* first_os_socket = nullptr;
intptr_t port = SocketAddress::GetAddrPort(addr);
if (port > 0) {
first_os_socket = LookupByPort(port);
- if (first_os_socket != NULL) {
+ if (first_os_socket != nullptr) {
// There is already a socket listening on this port. We need to ensure
// that if there is one also listening on the same address, it was created
// with `shared = true`, ...
OSSocket* os_socket = first_os_socket;
OSSocket* os_socket_same_addr = FindOSSocketWithAddress(os_socket, addr);
- if (os_socket_same_addr != NULL) {
+ if (os_socket_same_addr != nullptr) {
if (!os_socket_same_addr->shared || !shared) {
OSError os_error(-1,
"The shared flag to bind() needs to be `true` if "
@@ -179,7 +179,7 @@
Socket* socketfd = new Socket(fd);
OSSocket* os_socket =
- new OSSocket(addr, allocated_port, v6_only, shared, socketfd, NULL);
+ new OSSocket(addr, allocated_port, v6_only, shared, socketfd, nullptr);
os_socket->ref_count = 1;
os_socket->next = first_os_socket;
@@ -208,40 +208,48 @@
return result;
}
- if (unix_domain_sockets_ != NULL &&
#if defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
- // Abstract unix domain socket doesn't exist in file system.
- path[0] != '@' &&
+ // Abstract unix domain socket doesn't exist in file system.
+ if (File::Exists(namespc, addr.un.sun_path) && path[0] != '@') {
+#else
+ if (File::Exists(namespc, addr.un.sun_path)) {
#endif // defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
- File::Exists(namespc, addr.un.sun_path)) {
- // If there is a socket listening on this file. Ensure
- // that it was created with `shared` mode and current `shared`
- // is also true.
- OSSocket* os_socket = unix_domain_sockets_;
- OSSocket* os_socket_same_addr =
- FindOSSocketWithPath(os_socket, namespc, addr.un.sun_path);
- if (os_socket_same_addr != NULL) {
- if (!os_socket_same_addr->shared || !shared) {
- OSError os_error(-1,
- "The shared flag to bind() needs to be `true` if "
- "binding multiple times on the same path.",
- OSError::kUnknown);
- return DartUtils::NewDartOSError(&os_error);
- }
+ if (unix_domain_sockets_ != nullptr) {
+ // If there is a socket listening on this file. Ensure
+ // that it was created with `shared` mode and current `shared`
+ // is also true.
+ OSSocket* os_socket = unix_domain_sockets_;
+ OSSocket* os_socket_same_addr =
+ FindOSSocketWithPath(os_socket, namespc, addr.un.sun_path);
+ if (os_socket_same_addr != nullptr) {
+ if (!os_socket_same_addr->shared || !shared) {
+ OSError os_error(-1,
+ "The shared flag to bind() needs to be `true` if "
+ "binding multiple times on the same path.",
+ OSError::kUnknown);
+ return DartUtils::NewDartOSError(&os_error);
+ }
- // This socket creation is the exact same as the one which originally
- // created the socket. Feed the same fd and store it into the native field
- // of dart socket_object. Sockets here will share same fd but contain a
- // different port() through EventHandler_SendData.
- Socket* socketfd = new Socket(os_socket->fd);
- os_socket->ref_count++;
- // We set as a side-effect the file descriptor on the dart
- // socket_object.
- Socket::ReuseSocketIdNativeField(socket_object, socketfd,
- Socket::kFinalizerListening);
- InsertByFd(socketfd, os_socket);
- return Dart_True();
+ // This socket creation is the exact same as the one which originally
+ // created the socket. Feed the same fd and store it into the native
+ // field of dart socket_object. Sockets here will share same fd but
+ // contain a different port() through EventHandler_SendData.
+ Socket* socketfd = new Socket(os_socket->fd);
+ os_socket->ref_count++;
+ // We set as a side-effect the file descriptor on the dart
+ // socket_object.
+ Socket::ReuseSocketIdNativeField(socket_object, socketfd,
+ Socket::kFinalizerListening);
+ InsertByFd(socketfd, os_socket);
+ return Dart_True();
+ }
}
+ // Unix domain socket by default doesn't allow binding to an existing file.
+ // An error (EADDRINUSE) will be returned back. However, hanging is noticed
+ // on Android so we throw an exception for all platforms.
+ OSError os_error(-1, "File exists with given unix domain address",
+ OSError::kUnknown);
+ return DartUtils::NewDartOSError(&os_error);
}
// There is no socket listening on that path, so we create new one.
@@ -268,7 +276,7 @@
bool ListeningSocketRegistry::CloseOneSafe(OSSocket* os_socket,
Socket* socket) {
ASSERT(!mutex_.TryLock());
- ASSERT(os_socket != NULL);
+ ASSERT(os_socket != nullptr);
ASSERT(os_socket->ref_count > 0);
os_socket->ref_count--;
RemoveByFd(socket);
@@ -286,21 +294,36 @@
#else
unlink(os_socket->address.un.sun_path);
#endif // defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)
+ // Remove os_socket from unix_domain_sockets_ list.
+ OSSocket* prev = nullptr;
+ OSSocket* current = unix_domain_sockets_;
+ while (current != nullptr) {
+ if (current == os_socket) {
+ if (prev == nullptr) {
+ unix_domain_sockets_ = unix_domain_sockets_->next;
+ } else {
+ prev->next = current->next;
+ }
+ break;
+ }
+ prev = current;
+ current = current->next;
+ }
delete os_socket;
return true;
}
- OSSocket* prev = NULL;
+ OSSocket* prev = nullptr;
OSSocket* current = LookupByPort(os_socket->port);
while (current != os_socket) {
- ASSERT(current != NULL);
+ ASSERT(current != nullptr);
prev = current;
current = current->next;
}
- if ((prev == NULL) && (current->next == NULL)) {
+ if ((prev == nullptr) && (current->next == nullptr)) {
// Remove last element from the list.
RemoveByPort(os_socket->port);
- } else if (prev == NULL) {
+ } else if (prev == nullptr) {
// Remove first element of the list.
InsertByPort(os_socket->port, current->next);
} else {
@@ -315,10 +338,10 @@
void ListeningSocketRegistry::CloseAllSafe() {
MutexLocker ml(&mutex_);
- for (SimpleHashMap::Entry* cursor = sockets_by_fd_.Start(); cursor != NULL;
+ for (SimpleHashMap::Entry* cursor = sockets_by_fd_.Start(); cursor != nullptr;
cursor = sockets_by_fd_.Next(cursor)) {
OSSocket* os_socket = reinterpret_cast<OSSocket*>(cursor->value);
- ASSERT(os_socket != NULL);
+ ASSERT(os_socket != nullptr);
delete os_socket;
}
}
@@ -326,7 +349,7 @@
bool ListeningSocketRegistry::CloseSafe(Socket* socketfd) {
ASSERT(!mutex_.TryLock());
OSSocket* os_socket = LookupByFd(socketfd);
- if (os_socket != NULL) {
+ if (os_socket != nullptr) {
return CloseOneSafe(os_socket, socketfd);
} else {
// A finalizer may direct the event handler to close a listening socket
@@ -502,7 +525,7 @@
if (Socket::short_socket_read()) {
length = (length + 1) / 2;
}
- uint8_t* buffer = NULL;
+ uint8_t* buffer = nullptr;
Dart_Handle result = IOBuffer::Allocate(length, &buffer);
if (Dart_IsNull(result)) {
Dart_ThrowException(DartUtils::NewDartOSError());
@@ -510,13 +533,13 @@
if (Dart_IsError(result)) {
Dart_PropagateError(result);
}
- ASSERT(buffer != NULL);
+ ASSERT(buffer != nullptr);
intptr_t bytes_read =
SocketBase::Read(socket->fd(), buffer, length, SocketBase::kAsync);
if (bytes_read == length) {
Dart_SetReturnValue(args, result);
} else if (bytes_read > 0) {
- uint8_t* new_buffer = NULL;
+ uint8_t* new_buffer = nullptr;
Dart_Handle new_result = IOBuffer::Allocate(bytes_read, &new_buffer);
if (Dart_IsNull(new_result)) {
Dart_ThrowException(DartUtils::NewDartOSError());
@@ -524,7 +547,7 @@
if (Dart_IsError(new_result)) {
Dart_PropagateError(new_result);
}
- ASSERT(new_buffer != NULL);
+ ASSERT(new_buffer != nullptr);
memmove(new_buffer, buffer, bytes_read);
Dart_SetReturnValue(args, new_result);
} else if (bytes_read == 0) {
@@ -549,9 +572,9 @@
Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
// Ensure that a receive buffer for the UDP socket exists.
- ASSERT(socket != NULL);
+ ASSERT(socket != nullptr);
uint8_t* recv_buffer = socket->udp_receive_buffer();
- if (recv_buffer == NULL) {
+ if (recv_buffer == nullptr) {
recv_buffer = reinterpret_cast<uint8_t*>(malloc(kReceiveBufferLen));
socket->set_udp_receive_buffer(recv_buffer);
}
@@ -571,7 +594,7 @@
// Datagram data read. Copy into buffer of the exact size,
ASSERT(bytes_read >= 0);
- uint8_t* data_buffer = NULL;
+ uint8_t* data_buffer = nullptr;
Dart_Handle data = IOBuffer::Allocate(bytes_read, &data_buffer);
if (Dart_IsNull(data)) {
Dart_ThrowException(DartUtils::NewDartOSError());
@@ -579,7 +602,7 @@
if (Dart_IsError(data)) {
Dart_PropagateError(data);
}
- ASSERT(data_buffer != NULL);
+ ASSERT(data_buffer != nullptr);
memmove(data_buffer, recv_buffer, bytes_read);
// Memory Sanitizer complains addr not being initialized, which is done
@@ -644,7 +667,7 @@
length = (length + 1) / 2;
}
Dart_TypedData_Type type;
- uint8_t* buffer = NULL;
+ uint8_t* buffer = nullptr;
intptr_t len;
Dart_Handle result = Dart_TypedDataAcquireData(
buffer_obj, &type, reinterpret_cast<void**>(&buffer), &len);
@@ -690,7 +713,7 @@
Dart_GetNativeArgument(args, 5), 0, 65535);
SocketAddress::SetAddrPort(&addr, port);
Dart_TypedData_Type type;
- uint8_t* buffer = NULL;
+ uint8_t* buffer = nullptr;
intptr_t len;
Dart_Handle result = Dart_TypedDataAcquireData(
buffer_obj, &type, reinterpret_cast<void**>(&buffer), &len);
@@ -732,7 +755,7 @@
Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
intptr_t port = 0;
SocketAddress* addr = SocketBase::GetRemotePeer(socket->fd(), &port);
- if (addr != NULL) {
+ if (addr != nullptr) {
Dart_Handle list = Dart_NewList(2);
int type = addr->GetType();
Dart_Handle entry;
@@ -872,11 +895,11 @@
request[1]->IsInt32()) {
CObjectString host(request[0]);
CObjectInt32 type(request[1]);
- CObject* result = NULL;
- OSError* os_error = NULL;
+ CObject* result = nullptr;
+ OSError* os_error = nullptr;
AddressList<SocketAddress>* addresses =
SocketBase::LookupAddress(host.CString(), type.Value(), &os_error);
- if (addresses != NULL) {
+ if (addresses != nullptr) {
CObjectArray* array =
new CObjectArray(CObject::NewArray(addresses->count() + 1));
array->SetAt(0, new CObjectInt32(CObject::NewInt32(0)));
@@ -930,7 +953,7 @@
addr_object.Buffer(), len);
}
- OSError* os_error = NULL;
+ OSError* os_error = nullptr;
const intptr_t kMaxHostLength = 1025;
char host[kMaxHostLength];
if (SocketBase::ReverseLookup(addr, host, kMaxHostLength, &os_error)) {
@@ -947,11 +970,11 @@
CObject* Socket::ListInterfacesRequest(const CObjectArray& request) {
if ((request.Length() == 1) && request[0]->IsInt32()) {
CObjectInt32 type(request[0]);
- CObject* result = NULL;
- OSError* os_error = NULL;
+ CObject* result = nullptr;
+ OSError* os_error = nullptr;
AddressList<InterfaceSocketAddress>* addresses =
SocketBase::ListInterfaces(type.Value(), &os_error);
- if (addresses != NULL) {
+ if (addresses != nullptr) {
CObjectArray* array =
new CObjectArray(CObject::NewArray(addresses->count() + 1));
array->SetAt(0, new CObjectInt32(CObject::NewInt32(0)));
@@ -1096,7 +1119,7 @@
int64_t option = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
Dart_Handle data_obj = Dart_GetNativeArgument(args, 3);
ASSERT(Dart_IsList(data_obj));
- char* data = NULL;
+ char* data = nullptr;
intptr_t length;
Dart_TypedData_Type type;
Dart_Handle data_result = Dart_TypedDataAcquireData(
@@ -1123,7 +1146,7 @@
int64_t option = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
Dart_Handle data_obj = Dart_GetNativeArgument(args, 3);
ASSERT(Dart_IsList(data_obj));
- char* data = NULL;
+ char* data = nullptr;
intptr_t length;
Dart_TypedData_Type type;
Dart_Handle data_result = Dart_TypedDataAcquireData(
@@ -1222,7 +1245,7 @@
const int kReceiveBufferLen = 1;
Socket* socket =
Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0));
- ASSERT(socket != NULL);
+ ASSERT(socket != nullptr);
// Ensure that a receive buffer for peeking the UDP socket exists.
uint8_t recv_buffer[kReceiveBufferLen];
bool available = SocketBase::AvailableDatagram(socket->fd(), recv_buffer,
@@ -1329,7 +1352,7 @@
Dart_PropagateError(err);
}
Socket* socket = reinterpret_cast<Socket*>(id);
- if (socket == NULL) {
+ if (socket == nullptr) {
Dart_PropagateError(Dart_NewUnhandledExceptionError(
DartUtils::NewInternalError("No native peer")));
}
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 9f2dfe5..c5a0f55 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -713,7 +713,7 @@
instantiator_type_args = instantiator.arguments();
}
AbstractType& result = AbstractType::Handle(type.InstantiateFrom(
- instantiator_type_args, Object::null_type_arguments(), kAllFree, NULL,
+ instantiator_type_args, Object::null_type_arguments(), kAllFree,
Heap::kOld));
ASSERT(result.IsFinalized());
return result.Canonicalize();
@@ -1483,8 +1483,7 @@
// type arguments of the type reflected by the class mirror.
ASSERT(redirect_type.IsInstantiated(kFunctions));
redirect_type ^= redirect_type.InstantiateFrom(
- type_arguments, Object::null_type_arguments(), kNoneFree, NULL,
- Heap::kOld);
+ type_arguments, Object::null_type_arguments(), kNoneFree, Heap::kOld);
redirect_type ^= redirect_type.Canonicalize();
}
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index 4aee1fd..6cb94cc 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -244,7 +244,7 @@
if (!cur_interface_type_args.IsNull() &&
!cur_interface_type_args.IsInstantiated()) {
cur_interface_type_args = cur_interface_type_args.InstantiateFrom(
- instance_type_args, Object::null_type_arguments(), kNoneFree, NULL,
+ instance_type_args, Object::null_type_arguments(), kNoneFree,
Heap::kNew);
}
if (ExtractInterfaceTypeArgs(zone, cur_interface_cls,
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index 4c78a05..6b9bb3b 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -442,6 +442,18 @@
}
}
+ // Run dds tests.
+ if (ddsTests != null) {
+ int testIndex = 1;
+ final totalTests = ddsTests.length;
+ for (var test in ddsTests) {
+ vm.verbose = verbose_vm;
+ print('Running $name [$testIndex/$totalTests]');
+ testIndex++;
+ await test(vm, dds);
+ }
+ }
+
// Run isolate tests.
if (isolateTests != null) {
final isolate = await getFirstIsolate(vm);
diff --git a/runtime/observatory/tests/service/vm_service_dds_test.dart b/runtime/observatory/tests/service/vm_service_dds_test.dart
index 457245d..c17cc6f 100644
--- a/runtime/observatory/tests/service/vm_service_dds_test.dart
+++ b/runtime/observatory/tests/service/vm_service_dds_test.dart
@@ -15,15 +15,20 @@
dds.remoteVmServiceWsUri.toString(),
),
);
- expect(client.wasOrIsConnected, false);
- try {
- await client.load();
- fail(
- 'When DDS is connected, direct connections to the VM service should fail.');
- } on NetworkRpcException catch (e) {
- expect(e.message, 'WebSocket closed due to error');
+ final result = await client.invokeRpcNoUpgrade('getSupportedProtocols', {});
+ final protocols = result['protocols'];
+ expect(protocols.length, 2);
+ bool supportsVmProtocol = false;
+ bool supportsDdsProtocol = false;
+ for (final protocol in protocols) {
+ if (protocol['protocolName'] == 'VM Service') {
+ supportsVmProtocol = true;
+ } else if (protocol['protocolName'] == 'DDS') {
+ supportsDdsProtocol = true;
+ }
}
- expect(client.wasOrIsConnected, false);
+ expect(supportsVmProtocol, true);
+ expect(supportsDdsProtocol, true);
}
];
diff --git a/runtime/tests/vm/dart/split_aot_compilation_test.dart b/runtime/tests/vm/dart/split_aot_compilation_test.dart
new file mode 100644
index 0000000..7cba27e
--- /dev/null
+++ b/runtime/tests/vm/dart/split_aot_compilation_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2020, 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.
+
+// OtherResources=splay_test.dart
+
+// Tests AOT compilation split into 2 steps using '--from-dill' option.
+
+import 'dart:io' show Platform;
+
+import 'package:path/path.dart' as path;
+import 'snapshot_test_helper.dart';
+
+main() async {
+ final testScriptUri = Platform.script.resolve('splay_test.dart');
+
+ await withTempDir((String temp) async {
+ final intermediateDillPath = path.join(temp, 'intermediate.dill');
+ final outputDillPath = path.join(temp, 'output.dill');
+ final snapshotPath = path.join(temp, 'aot.snapshot');
+
+ final extraGenKernelOptions = Platform.executableArguments
+ .where((arg) =>
+ arg.startsWith('--enable-experiment=') ||
+ arg == '--null-safety' ||
+ arg == '--no-null-safety')
+ .toList();
+
+ await runGenKernel('BUILD INTERMEDIATE DILL FILE', [
+ ...extraGenKernelOptions,
+ '--no-aot',
+ '--link-platform',
+ '--output=$intermediateDillPath',
+ testScriptUri.toFilePath(),
+ ]);
+
+ await runGenKernel('BUILD FINAL DILL FILE', [
+ ...extraGenKernelOptions,
+ '--aot',
+ '--from-dill=$intermediateDillPath',
+ '--link-platform',
+ '--output=$outputDillPath',
+ testScriptUri.toFilePath(),
+ ]);
+
+ await runGenSnapshot('GENERATE SNAPSHOT', [
+ '--snapshot-kind=app-aot-elf',
+ '--elf=$snapshotPath',
+ outputDillPath,
+ ]);
+
+ await runBinary('RUN SNAPSHOT', dartPrecompiledRuntime, [snapshotPath]);
+ });
+}
diff --git a/runtime/tests/vm/dart_2/split_aot_compilation_test.dart b/runtime/tests/vm/dart_2/split_aot_compilation_test.dart
new file mode 100644
index 0000000..7cba27e
--- /dev/null
+++ b/runtime/tests/vm/dart_2/split_aot_compilation_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2020, 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.
+
+// OtherResources=splay_test.dart
+
+// Tests AOT compilation split into 2 steps using '--from-dill' option.
+
+import 'dart:io' show Platform;
+
+import 'package:path/path.dart' as path;
+import 'snapshot_test_helper.dart';
+
+main() async {
+ final testScriptUri = Platform.script.resolve('splay_test.dart');
+
+ await withTempDir((String temp) async {
+ final intermediateDillPath = path.join(temp, 'intermediate.dill');
+ final outputDillPath = path.join(temp, 'output.dill');
+ final snapshotPath = path.join(temp, 'aot.snapshot');
+
+ final extraGenKernelOptions = Platform.executableArguments
+ .where((arg) =>
+ arg.startsWith('--enable-experiment=') ||
+ arg == '--null-safety' ||
+ arg == '--no-null-safety')
+ .toList();
+
+ await runGenKernel('BUILD INTERMEDIATE DILL FILE', [
+ ...extraGenKernelOptions,
+ '--no-aot',
+ '--link-platform',
+ '--output=$intermediateDillPath',
+ testScriptUri.toFilePath(),
+ ]);
+
+ await runGenKernel('BUILD FINAL DILL FILE', [
+ ...extraGenKernelOptions,
+ '--aot',
+ '--from-dill=$intermediateDillPath',
+ '--link-platform',
+ '--output=$outputDillPath',
+ testScriptUri.toFilePath(),
+ ]);
+
+ await runGenSnapshot('GENERATE SNAPSHOT', [
+ '--snapshot-kind=app-aot-elf',
+ '--elf=$snapshotPath',
+ outputDillPath,
+ ]);
+
+ await runBinary('RUN SNAPSHOT', dartPrecompiledRuntime, [snapshotPath]);
+ });
+}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 96f6b1a..0643940 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -76,8 +76,10 @@
[ $builder_tag == crossword || $builder_tag == crossword_ast ]
dart/emit_aot_size_info_flag_test: SkipByDesign # The test itself cannot determine the location of gen_snapshot (only tools/test.py knows where it is).
dart/bytecode_with_ast_in_aot_test: SkipByDesign # The test doesn't know location of cross-platform gen_snapshot
+dart/split_aot_compilation_test: SkipByDesign # The test doesn't know location of cross-platform gen_snapshot
dart_2/emit_aot_size_info_flag_test: SkipByDesign # The test itself cannot determine the location of gen_snapshot (only tools/test.py knows where it is).
dart_2/bytecode_with_ast_in_aot_test: SkipByDesign # The test doesn't know location of cross-platform gen_snapshot
+dart_2/split_aot_compilation_test: SkipByDesign # The test doesn't know location of cross-platform gen_snapshot
[ $builder_tag == obfuscated ]
dart/causal_stacks/async_throws_stack_lazy_test: SkipByDesign # Asserts exact stacktrace output.
@@ -396,9 +398,11 @@
dart/emit_aot_size_info_flag_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
dart/use_bare_instructions_flag_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
dart/bytecode_with_ast_in_aot_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
+dart/split_aot_compilation_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
dart_2/emit_aot_size_info_flag_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
dart_2/use_bare_instructions_flag_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
dart_2/bytecode_with_ast_in_aot_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
+dart_2/split_aot_compilation_test: SkipByDesign # This test is for VM AOT only and is quite slow (so we don't run it in debug mode).
# It makes no sense to run any test that uses spawnURI under the simulator
# as that would involve running CFE (the front end) in simulator mode
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 56d9a7c..395b15f 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -58,9 +58,6 @@
if (!is_android) {
libs += [ "pthread" ]
}
- if (is_linux) {
- libs += [ "rt" ]
- }
}
}
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index 0e26873..324c51c 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -392,12 +392,12 @@
const TypeArguments& instantiated_arguments = TypeArguments::Handle(
zone, arguments.InstantiateFrom(Object::null_type_arguments(),
Object::null_type_arguments(),
- kNoneFree, NULL, Heap::kNew));
+ kNoneFree, Heap::kNew));
const TypeArguments& instantiated_pending_arguments =
TypeArguments::Handle(zone, pending_arguments.InstantiateFrom(
Object::null_type_arguments(),
Object::null_type_arguments(),
- kNoneFree, NULL, Heap::kNew));
+ kNoneFree, Heap::kNew));
// By using TypeEquality::kInSubtypeTest, we throw a wider net than
// using canonical or syntactical equality and may reject more
// problematic declarations.
@@ -499,9 +499,9 @@
}
}
if (offset > 0) {
- TrailPtr instantiation_trail = new Trail(zone, 4);
+ TrailPtr trail = new Trail(zone, 4);
FinalizeTypeArguments(type_class, full_arguments, offset, pending_types,
- instantiation_trail);
+ trail);
}
if (full_arguments.IsRaw(0, num_type_arguments)) {
// The parameterized_type is raw. Set its argument vector to null, which
@@ -556,7 +556,7 @@
const TypeArguments& arguments,
intptr_t num_uninitialized_arguments,
PendingTypes* pending_types,
- TrailPtr instantiation_trail) {
+ TrailPtr trail) {
ASSERT(arguments.Length() >= cls.NumTypeArguments());
if (!cls.is_type_finalized()) {
FinalizeTypeParameters(cls, pending_types);
@@ -623,8 +623,8 @@
continue;
}
super_type_arg = super_type_arg.InstantiateFrom(
- arguments, Object::null_type_arguments(), kNoneFree,
- instantiation_trail, Heap::kOld);
+ arguments, Object::null_type_arguments(), kNoneFree, Heap::kOld,
+ trail);
if (super_type_arg.IsBeingFinalized()) {
// The super_type_arg was instantiated from a type being finalized.
// We need to finish finalizing its type arguments.
@@ -652,7 +652,7 @@
FinalizeTypeArguments(
super_cls, super_args,
super_cls.NumTypeArguments() - super_cls.NumTypeParameters(),
- pending_types, instantiation_trail);
+ pending_types, trail);
if (FLAG_trace_type_finalization) {
THR_Print("Finalized instantiated TypeRef '%s': '%s'\n",
String::Handle(super_type_arg.Name()).ToCString(),
@@ -664,7 +664,7 @@
arguments.SetTypeAt(i, super_type_arg);
}
FinalizeTypeArguments(super_class, arguments, super_offset, pending_types,
- instantiation_trail);
+ trail);
}
}
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.cc b/runtime/vm/compiler/assembler/assembler_ia32.cc
index cd735a8..6043f7f 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.cc
+++ b/runtime/vm/compiler/assembler/assembler_ia32.cc
@@ -1003,6 +1003,14 @@
EmitXmmRegisterOperand(dst, src);
}
+void Assembler::pmovmskb(Register dst, XmmRegister src) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ EmitUint8(0x66);
+ EmitUint8(0x0F);
+ EmitUint8(0xD7);
+ EmitXmmRegisterOperand(dst, src);
+}
+
void Assembler::sqrtsd(XmmRegister dst, XmmRegister src) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitUint8(0xF2);
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.h b/runtime/vm/compiler/assembler/assembler_ia32.h
index 28296be..01cc4eb 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.h
+++ b/runtime/vm/compiler/assembler/assembler_ia32.h
@@ -402,6 +402,7 @@
void movmskpd(Register dst, XmmRegister src);
void movmskps(Register dst, XmmRegister src);
+ void pmovmskb(Register dst, XmmRegister src);
void sqrtsd(XmmRegister dst, XmmRegister src);
void sqrtss(XmmRegister dst, XmmRegister src);
diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h
index 643b0bd..386f9c0 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.h
+++ b/runtime/vm/compiler/assembler/assembler_x64.h
@@ -514,6 +514,9 @@
EmitL(dst, src, 0x50, 0x0F, 0x66);
}
void movmskps(Register dst, XmmRegister src) { EmitL(dst, src, 0x50, 0x0F); }
+ void pmovmskb(Register dst, XmmRegister src) {
+ EmitL(dst, src, 0xD7, 0x0F, 0x66);
+ }
void btl(Register dst, Register src) { EmitL(src, dst, 0xA3, 0x0F); }
void btq(Register dst, Register src) { EmitQ(src, dst, 0xA3, 0x0F); }
diff --git a/runtime/vm/compiler/assembler/disassembler_x86.cc b/runtime/vm/compiler/assembler/disassembler_x86.cc
index 78c9458..53fdd69 100644
--- a/runtime/vm/compiler/assembler/disassembler_x86.cc
+++ b/runtime/vm/compiler/assembler/disassembler_x86.cc
@@ -1329,6 +1329,9 @@
} else if (opcode == 0x50) {
Print("movmskpd %s,", NameOfCPURegister(regop));
current += PrintRightXMMOperand(current);
+ } else if (opcode == 0xD7) {
+ Print("pmovmskb %s,", NameOfCPURegister(regop));
+ current += PrintRightXMMOperand(current);
} else {
const char* mnemonic = "?";
if (opcode == 0x5A) {
diff --git a/runtime/vm/compiler/backend/constant_propagator.cc b/runtime/vm/compiler/backend/constant_propagator.cc
index 28f5aa5..7d78825 100644
--- a/runtime/vm/compiler/backend/constant_propagator.cc
+++ b/runtime/vm/compiler/backend/constant_propagator.cc
@@ -770,6 +770,10 @@
SetValue(instr, non_constant_);
}
+void ConstantPropagator::VisitUtf8Scan(Utf8ScanInstr* instr) {
+ SetValue(instr, non_constant_);
+}
+
void ConstantPropagator::VisitLoadIndexed(LoadIndexedInstr* instr) {
const Object& array_obj = instr->array()->definition()->constant_value();
const Object& index_obj = instr->index()->definition()->constant_value();
@@ -1000,9 +1004,8 @@
}
}
AbstractType& result = AbstractType::Handle(
- Z,
- instr->type().InstantiateFrom(instantiator_type_args, function_type_args,
- kAllFree, nullptr, Heap::kOld));
+ Z, instr->type().InstantiateFrom(
+ instantiator_type_args, function_type_args, kAllFree, Heap::kOld));
ASSERT(result.IsInstantiated());
result = result.Canonicalize();
SetValue(instr, result);
@@ -1050,10 +1053,9 @@
return;
}
}
- TypeArguments& result =
- TypeArguments::Handle(Z, instr->type_arguments().InstantiateFrom(
- instantiator_type_args, function_type_args,
- kAllFree, nullptr, Heap::kOld));
+ TypeArguments& result = TypeArguments::Handle(
+ Z, instr->type_arguments().InstantiateFrom(
+ instantiator_type_args, function_type_args, kAllFree, Heap::kOld));
ASSERT(result.IsInstantiated());
result = result.Canonicalize();
SetValue(instr, result);
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index cad054f..1112b9b 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -2913,9 +2913,8 @@
if ((instantiator_type_args != nullptr) && (function_type_args != nullptr)) {
AbstractType& new_dst_type = AbstractType::Handle(
- Z,
- abs_type.InstantiateFrom(*instantiator_type_args, *function_type_args,
- kAllFree, nullptr, Heap::kOld));
+ Z, abs_type.InstantiateFrom(*instantiator_type_args,
+ *function_type_args, kAllFree, Heap::kOld));
if (new_dst_type.IsNull()) {
// Failed instantiation in dead code.
return this;
@@ -4092,13 +4091,13 @@
ASSERT(locs()->out(0).reg() == InitInstanceFieldABI::kResultReg);
ASSERT(slot().IsDartField());
const Field& field = slot().field();
+ const Field& original_field = Field::ZoneHandle(field.Original());
compiler::Label no_call;
__ CompareObject(InitInstanceFieldABI::kResultReg, Object::sentinel());
__ BranchIf(NOT_EQUAL, &no_call);
- __ LoadObject(InitInstanceFieldABI::kFieldReg,
- Field::ZoneHandle(field.Original()));
+ __ LoadObject(InitInstanceFieldABI::kFieldReg, original_field);
auto object_store = compiler->isolate()->object_store();
auto& stub = Code::ZoneHandle(compiler->zone());
@@ -4111,7 +4110,7 @@
} else {
// Stubs for late field initialization call initializer
// function directly, so make sure one is created.
- field.EnsureInitializerFunction();
+ original_field.EnsureInitializerFunction();
if (field.is_final()) {
stub = object_store->init_late_final_instance_field_stub();
@@ -5732,6 +5731,10 @@
SetInputAt(kValuePos, value);
}
+bool Utf8ScanInstr::IsScanFlagsUnboxed() const {
+ return FlowGraphCompiler::IsUnboxedField(scan_flags_field_.field());
+}
+
InvokeMathCFunctionInstr::InvokeMathCFunctionInstr(
ZoneGrowableArray<Value*>* inputs,
intptr_t deopt_id,
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 7e04032..78d7b5f 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -468,6 +468,7 @@
M(StringToCharCode, kNoGC) \
M(OneByteStringFromCharCode, kNoGC) \
M(StringInterpolate, _) \
+ M(Utf8Scan, kNoGC) \
M(InvokeMathCFunction, _) \
M(TruncDivMod, kNoGC) \
/*We could be more precise about when these 2 instructions can trigger GC.*/ \
@@ -5560,6 +5561,76 @@
DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr);
};
+// Scanning instruction to compute the result size and decoding parameters
+// for the UTF-8 decoder. Equivalent to:
+//
+// int _scan(Uint8List bytes, int start, int end, _OneByteString table,
+// _Utf8Decoder decoder) {
+// int size = 0;
+// int flags = 0;
+// for (int i = start; i < end; i++) {
+// int t = table.codeUnitAt(bytes[i]);
+// size += t & sizeMask;
+// flags |= t;
+// }
+// decoder._scanFlags |= flags & flagsMask;
+// return size;
+// }
+//
+// under these assumptions:
+// - The start and end inputs are within the bounds of bytes and in smi range.
+// - The decoder._scanFlags field is unboxed or contains a smi.
+// - The first 128 entries of the table have the value 1.
+class Utf8ScanInstr : public TemplateDefinition<5, NoThrow> {
+ public:
+ Utf8ScanInstr(Value* decoder,
+ Value* bytes,
+ Value* start,
+ Value* end,
+ Value* table,
+ const Slot& decoder_scan_flags_field)
+ : scan_flags_field_(decoder_scan_flags_field) {
+ SetInputAt(0, decoder);
+ SetInputAt(1, bytes);
+ SetInputAt(2, start);
+ SetInputAt(3, end);
+ SetInputAt(4, table);
+ }
+
+ DECLARE_INSTRUCTION(Utf8Scan)
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ ASSERT(idx >= 0 || idx <= 4);
+ // The start and end inputs are unboxed, but in smi range.
+ if (idx == 2 || idx == 3) return kUnboxedIntPtr;
+ return kTagged;
+ }
+
+ virtual Representation representation() const { return kUnboxedIntPtr; }
+
+ virtual CompileType ComputeType() const { return CompileType::Int(); }
+ virtual bool HasUnknownSideEffects() const { return true; }
+ virtual bool ComputeCanDeoptimize() const { return false; }
+ virtual intptr_t DeoptimizationTarget() const { return DeoptId::kNone; }
+
+ virtual SpeculativeMode SpeculativeModeOfInput(intptr_t index) const {
+ return kNotSpeculative;
+ }
+
+ virtual bool AttributesEqual(Instruction* other) const {
+ return scan_flags_field_.Equals(&other->AsUtf8Scan()->scan_flags_field_);
+ }
+
+ bool IsScanFlagsUnboxed() const;
+
+ PRINT_TO_SUPPORT
+
+ private:
+ const Slot& scan_flags_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(Utf8ScanInstr);
+};
+
class StoreIndexedInstr : public TemplateInstruction<3, NoThrow> {
public:
StoreIndexedInstr(Value* array,
diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc
index f5ddae7..90414b2 100644
--- a/runtime/vm/compiler/backend/il_arm.cc
+++ b/runtime/vm/compiler/backend/il_arm.cc
@@ -1496,6 +1496,96 @@
ASSERT(locs()->out(0).reg() == R0);
}
+LocationSummary* Utf8ScanInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 5;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary = new (zone)
+ LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::Any()); // decoder
+ summary->set_in(1, Location::WritableRegister()); // bytes
+ summary->set_in(2, Location::WritableRegister()); // start
+ summary->set_in(3, Location::WritableRegister()); // end
+ summary->set_in(4, Location::WritableRegister()); // table
+ summary->set_out(0, Location::RequiresRegister());
+ return summary;
+}
+
+void Utf8ScanInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const Register bytes_reg = locs()->in(1).reg();
+ const Register start_reg = locs()->in(2).reg();
+ const Register end_reg = locs()->in(3).reg();
+ const Register table_reg = locs()->in(4).reg();
+ const Register size_reg = locs()->out(0).reg();
+
+ const Register bytes_ptr_reg = start_reg;
+ const Register bytes_end_reg = end_reg;
+ const Register flags_reg = bytes_reg;
+ const Register temp_reg = TMP;
+ const Register decoder_temp_reg = start_reg;
+ const Register flags_temp_reg = end_reg;
+
+ static const intptr_t kSizeMask = 0x03;
+ static const intptr_t kFlagsMask = 0x3C;
+
+ compiler::Label loop, loop_in;
+
+ // Address of input bytes.
+ __ LoadFieldFromOffset(kWord, bytes_reg, bytes_reg,
+ compiler::target::TypedDataBase::data_field_offset());
+
+ // Table.
+ __ AddImmediate(
+ table_reg, table_reg,
+ compiler::target::OneByteString::data_offset() - kHeapObjectTag);
+
+ // Pointers to start and end.
+ __ add(bytes_ptr_reg, bytes_reg, compiler::Operand(start_reg));
+ __ add(bytes_end_reg, bytes_reg, compiler::Operand(end_reg));
+
+ // Initialize size and flags.
+ __ LoadImmediate(size_reg, 0);
+ __ LoadImmediate(flags_reg, 0);
+
+ __ b(&loop_in);
+ __ Bind(&loop);
+
+ // Read byte and increment pointer.
+ __ ldrb(temp_reg,
+ compiler::Address(bytes_ptr_reg, 1, compiler::Address::PostIndex));
+
+ // Update size and flags based on byte value.
+ __ ldrb(temp_reg, compiler::Address(table_reg, temp_reg));
+ __ orr(flags_reg, flags_reg, compiler::Operand(temp_reg));
+ __ and_(temp_reg, temp_reg, compiler::Operand(kSizeMask));
+ __ add(size_reg, size_reg, compiler::Operand(temp_reg));
+
+ // Stop if end is reached.
+ __ Bind(&loop_in);
+ __ cmp(bytes_ptr_reg, compiler::Operand(bytes_end_reg));
+ __ b(&loop, UNSIGNED_LESS);
+
+ // Write flags to field.
+ __ AndImmediate(flags_reg, flags_reg, kFlagsMask);
+ if (!IsScanFlagsUnboxed()) {
+ __ SmiTag(flags_reg);
+ }
+ Register decoder_reg;
+ const Location decoder_location = locs()->in(0);
+ if (decoder_location.IsStackSlot()) {
+ __ ldr(decoder_temp_reg, LocationToStackSlotAddress(decoder_location));
+ decoder_reg = decoder_temp_reg;
+ } else {
+ decoder_reg = decoder_location.reg();
+ }
+ const auto scan_flags_field_offset = scan_flags_field_.offset_in_bytes();
+ __ LoadFieldFromOffset(kWord, flags_temp_reg, decoder_reg,
+ scan_flags_field_offset);
+ __ orr(flags_temp_reg, flags_temp_reg, compiler::Operand(flags_reg));
+ __ StoreFieldToOffset(kWord, flags_temp_reg, decoder_reg,
+ scan_flags_field_offset);
+}
+
LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc
index 044db73..f39a4f6 100644
--- a/runtime/vm/compiler/backend/il_arm64.cc
+++ b/runtime/vm/compiler/backend/il_arm64.cc
@@ -1320,6 +1320,95 @@
ASSERT(locs()->out(0).reg() == R0);
}
+LocationSummary* Utf8ScanInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 5;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary = new (zone)
+ LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::Any()); // decoder
+ summary->set_in(1, Location::WritableRegister()); // bytes
+ summary->set_in(2, Location::WritableRegister()); // start
+ summary->set_in(3, Location::WritableRegister()); // end
+ summary->set_in(4, Location::WritableRegister()); // table
+ summary->set_out(0, Location::RequiresRegister());
+ return summary;
+}
+
+void Utf8ScanInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const Register bytes_reg = locs()->in(1).reg();
+ const Register start_reg = locs()->in(2).reg();
+ const Register end_reg = locs()->in(3).reg();
+ const Register table_reg = locs()->in(4).reg();
+ const Register size_reg = locs()->out(0).reg();
+
+ const Register bytes_ptr_reg = start_reg;
+ const Register bytes_end_reg = end_reg;
+ const Register flags_reg = bytes_reg;
+ const Register temp_reg = TMP;
+ const Register decoder_temp_reg = start_reg;
+ const Register flags_temp_reg = end_reg;
+
+ static const intptr_t kSizeMask = 0x03;
+ static const intptr_t kFlagsMask = 0x3C;
+
+ compiler::Label loop, loop_in;
+
+ // Address of input bytes.
+ __ LoadFieldFromOffset(bytes_reg, bytes_reg,
+ compiler::target::TypedDataBase::data_field_offset());
+
+ // Table.
+ __ AddImmediate(
+ table_reg, table_reg,
+ compiler::target::OneByteString::data_offset() - kHeapObjectTag);
+
+ // Pointers to start and end.
+ __ add(bytes_ptr_reg, bytes_reg, compiler::Operand(start_reg));
+ __ add(bytes_end_reg, bytes_reg, compiler::Operand(end_reg));
+
+ // Initialize size and flags.
+ __ mov(size_reg, ZR);
+ __ mov(flags_reg, ZR);
+
+ __ b(&loop_in);
+ __ Bind(&loop);
+
+ // Read byte and increment pointer.
+ __ ldr(temp_reg,
+ compiler::Address(bytes_ptr_reg, 1, compiler::Address::PostIndex),
+ kUnsignedByte);
+
+ // Update size and flags based on byte value.
+ __ ldr(temp_reg, compiler::Address(table_reg, temp_reg), kUnsignedByte);
+ __ orr(flags_reg, flags_reg, compiler::Operand(temp_reg));
+ __ andi(temp_reg, temp_reg, compiler::Immediate(kSizeMask));
+ __ add(size_reg, size_reg, compiler::Operand(temp_reg));
+
+ // Stop if end is reached.
+ __ Bind(&loop_in);
+ __ cmp(bytes_ptr_reg, compiler::Operand(bytes_end_reg));
+ __ b(&loop, UNSIGNED_LESS);
+
+ // Write flags to field.
+ __ AndImmediate(flags_reg, flags_reg, kFlagsMask);
+ if (!IsScanFlagsUnboxed()) {
+ __ SmiTag(flags_reg);
+ }
+ Register decoder_reg;
+ const Location decoder_location = locs()->in(0);
+ if (decoder_location.IsStackSlot()) {
+ __ ldr(decoder_temp_reg, LocationToStackSlotAddress(decoder_location));
+ decoder_reg = decoder_temp_reg;
+ } else {
+ decoder_reg = decoder_location.reg();
+ }
+ const auto scan_flags_field_offset = scan_flags_field_.offset_in_bytes();
+ __ LoadFieldFromOffset(flags_temp_reg, decoder_reg, scan_flags_field_offset);
+ __ orr(flags_temp_reg, flags_temp_reg, compiler::Operand(flags_reg));
+ __ StoreFieldToOffset(flags_temp_reg, decoder_reg, scan_flags_field_offset);
+}
+
LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/backend/il_ia32.cc b/runtime/vm/compiler/backend/il_ia32.cc
index 7c35e2e..5141efc 100644
--- a/runtime/vm/compiler/backend/il_ia32.cc
+++ b/runtime/vm/compiler/backend/il_ia32.cc
@@ -1113,6 +1113,164 @@
ASSERT(locs()->out(0).reg() == EAX);
}
+LocationSummary* Utf8ScanInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 5;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary = new (zone)
+ LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::Any()); // decoder
+ summary->set_in(1, Location::WritableRegister()); // bytes
+ summary->set_in(2, Location::WritableRegister()); // start
+ summary->set_in(3, Location::WritableRegister()); // end
+ summary->set_in(4, Location::RequiresRegister()); // table
+ summary->set_out(0, Location::RequiresRegister());
+ return summary;
+}
+
+void Utf8ScanInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const Register bytes_reg = locs()->in(1).reg();
+ const Register start_reg = locs()->in(2).reg();
+ const Register end_reg = locs()->in(3).reg();
+ const Register table_reg = locs()->in(4).reg();
+ const Register size_reg = locs()->out(0).reg();
+
+ const Register bytes_ptr_reg = start_reg;
+ const Register flags_reg = end_reg;
+ const Register temp_reg = bytes_reg;
+ const XmmRegister vector_reg = FpuTMP;
+
+ static const intptr_t kBytesEndTempOffset = 1 * compiler::target::kWordSize;
+ static const intptr_t kBytesEndMinus16TempOffset =
+ 0 * compiler::target::kWordSize;
+
+ static const intptr_t kSizeMask = 0x03;
+ static const intptr_t kFlagsMask = 0x3C;
+
+ compiler::Label scan_ascii, ascii_loop, ascii_loop_in, nonascii_loop;
+ compiler::Label rest, rest_loop, rest_loop_in, done;
+
+ // Address of input bytes.
+ __ movl(bytes_reg,
+ compiler::FieldAddress(
+ bytes_reg, compiler::target::TypedDataBase::data_field_offset()));
+
+ // Pointers to start, end and end-16.
+ __ leal(bytes_ptr_reg, compiler::Address(bytes_reg, start_reg, TIMES_1, 0));
+ __ leal(temp_reg, compiler::Address(bytes_reg, end_reg, TIMES_1, 0));
+ __ pushl(temp_reg);
+ __ leal(temp_reg, compiler::Address(temp_reg, -16));
+ __ pushl(temp_reg);
+
+ // Initialize size and flags.
+ __ xorl(size_reg, size_reg);
+ __ xorl(flags_reg, flags_reg);
+
+ __ jmp(&scan_ascii, compiler::Assembler::kNearJump);
+
+ // Loop scanning through ASCII bytes one 16-byte vector at a time.
+ // While scanning, the size register contains the size as it was at the start
+ // of the current block of ASCII bytes, minus the address of the start of the
+ // block. After the block, the end address of the block is added to update the
+ // size to include the bytes in the block.
+ __ Bind(&ascii_loop);
+ __ addl(bytes_ptr_reg, compiler::Immediate(16));
+ __ Bind(&ascii_loop_in);
+
+ // Exit vectorized loop when there are less than 16 bytes left.
+ __ cmpl(bytes_ptr_reg, compiler::Address(ESP, kBytesEndMinus16TempOffset));
+ __ j(UNSIGNED_GREATER, &rest, compiler::Assembler::kNearJump);
+
+ // Find next non-ASCII byte within the next 16 bytes.
+ // Note: In principle, we should use MOVDQU here, since the loaded value is
+ // used as input to an integer instruction. In practice, according to Agner
+ // Fog, there is no penalty for using the wrong kind of load.
+ __ movups(vector_reg, compiler::Address(bytes_ptr_reg, 0));
+ __ pmovmskb(temp_reg, vector_reg);
+ __ bsfl(temp_reg, temp_reg);
+ __ j(EQUAL, &ascii_loop, compiler::Assembler::kNearJump);
+
+ // Point to non-ASCII byte and update size.
+ __ addl(bytes_ptr_reg, temp_reg);
+ __ addl(size_reg, bytes_ptr_reg);
+
+ // Read first non-ASCII byte.
+ __ movzxb(temp_reg, compiler::Address(bytes_ptr_reg, 0));
+
+ // Loop over block of non-ASCII bytes.
+ __ Bind(&nonascii_loop);
+ __ addl(bytes_ptr_reg, compiler::Immediate(1));
+
+ // Update size and flags based on byte value.
+ __ movzxb(temp_reg, compiler::FieldAddress(
+ table_reg, temp_reg, TIMES_1,
+ compiler::target::OneByteString::data_offset()));
+ __ orl(flags_reg, temp_reg);
+ __ andl(temp_reg, compiler::Immediate(kSizeMask));
+ __ addl(size_reg, temp_reg);
+
+ // Stop if end is reached.
+ __ cmpl(bytes_ptr_reg, compiler::Address(ESP, kBytesEndTempOffset));
+ __ j(UNSIGNED_GREATER_EQUAL, &done, compiler::Assembler::kNearJump);
+
+ // Go to ASCII scan if next byte is ASCII, otherwise loop.
+ __ movzxb(temp_reg, compiler::Address(bytes_ptr_reg, 0));
+ __ testl(temp_reg, compiler::Immediate(0x80));
+ __ j(NOT_EQUAL, &nonascii_loop, compiler::Assembler::kNearJump);
+
+ // Enter the ASCII scanning loop.
+ __ Bind(&scan_ascii);
+ __ subl(size_reg, bytes_ptr_reg);
+ __ jmp(&ascii_loop_in);
+
+ // Less than 16 bytes left. Process the remaining bytes individually.
+ __ Bind(&rest);
+
+ // Update size after ASCII scanning loop.
+ __ addl(size_reg, bytes_ptr_reg);
+ __ jmp(&rest_loop_in, compiler::Assembler::kNearJump);
+
+ __ Bind(&rest_loop);
+
+ // Read byte and increment pointer.
+ __ movzxb(temp_reg, compiler::Address(bytes_ptr_reg, 0));
+ __ addl(bytes_ptr_reg, compiler::Immediate(1));
+
+ // Update size and flags based on byte value.
+ __ movzxb(temp_reg, compiler::FieldAddress(
+ table_reg, temp_reg, TIMES_1,
+ compiler::target::OneByteString::data_offset()));
+ __ orl(flags_reg, temp_reg);
+ __ andl(temp_reg, compiler::Immediate(kSizeMask));
+ __ addl(size_reg, temp_reg);
+
+ // Stop if end is reached.
+ __ Bind(&rest_loop_in);
+ __ cmpl(bytes_ptr_reg, compiler::Address(ESP, kBytesEndTempOffset));
+ __ j(UNSIGNED_LESS, &rest_loop, compiler::Assembler::kNearJump);
+ __ Bind(&done);
+
+ // Pop temporaries.
+ __ addl(ESP, compiler::Immediate(2 * compiler::target::kWordSize));
+
+ // Write flags to field.
+ __ andl(flags_reg, compiler::Immediate(kFlagsMask));
+ if (!IsScanFlagsUnboxed()) {
+ __ SmiTag(flags_reg);
+ }
+ Register decoder_reg;
+ const Location decoder_location = locs()->in(0);
+ if (decoder_location.IsStackSlot()) {
+ __ movl(temp_reg, LocationToStackSlotAddress(decoder_location));
+ decoder_reg = temp_reg;
+ } else {
+ decoder_reg = decoder_location.reg();
+ }
+ const auto scan_flags_field_offset = scan_flags_field_.offset_in_bytes();
+ __ orl(compiler::FieldAddress(decoder_reg, scan_flags_field_offset),
+ flags_reg);
+}
+
LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc
index 0f2c71c..320538f 100644
--- a/runtime/vm/compiler/backend/il_printer.cc
+++ b/runtime/vm/compiler/backend/il_printer.cc
@@ -1161,6 +1161,11 @@
}
}
+void Utf8ScanInstr::PrintTo(BufferFormatter* f) const {
+ Definition::PrintTo(f);
+ f->Print(" [%s]", scan_flags_field_.Name());
+}
+
void Environment::PrintTo(BufferFormatter* f) const {
f->Print(" env={ ");
int arg_count = 0;
diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc
index 69ed80b9..6093b65 100644
--- a/runtime/vm/compiler/backend/il_x64.cc
+++ b/runtime/vm/compiler/backend/il_x64.cc
@@ -1229,6 +1229,158 @@
ASSERT(locs()->out(0).reg() == RAX);
}
+LocationSummary* Utf8ScanInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ const intptr_t kNumInputs = 5;
+ const intptr_t kNumTemps = 1;
+ LocationSummary* summary = new (zone)
+ LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ summary->set_in(0, Location::Any()); // decoder
+ summary->set_in(1, Location::WritableRegister()); // bytes
+ summary->set_in(2, Location::WritableRegister()); // start
+ summary->set_in(3, Location::WritableRegister()); // end
+ summary->set_in(4, Location::RequiresRegister()); // table
+ summary->set_temp(0, Location::RequiresRegister());
+ summary->set_out(0, Location::RequiresRegister());
+ return summary;
+}
+
+void Utf8ScanInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const Register bytes_reg = locs()->in(1).reg();
+ const Register start_reg = locs()->in(2).reg();
+ const Register end_reg = locs()->in(3).reg();
+ const Register table_reg = locs()->in(4).reg();
+ const Register size_reg = locs()->out(0).reg();
+
+ const Register bytes_ptr_reg = start_reg;
+ const Register bytes_end_reg = end_reg;
+ const Register bytes_end_minus_16_reg = bytes_reg;
+ const Register flags_reg = locs()->temp(0).reg();
+ const Register temp_reg = TMP;
+ const XmmRegister vector_reg = FpuTMP;
+
+ static const intptr_t kSizeMask = 0x03;
+ static const intptr_t kFlagsMask = 0x3C;
+
+ compiler::Label scan_ascii, ascii_loop, ascii_loop_in, nonascii_loop;
+ compiler::Label rest, rest_loop, rest_loop_in, done;
+
+ // Address of input bytes.
+ __ movq(bytes_reg,
+ compiler::FieldAddress(
+ bytes_reg, compiler::target::TypedDataBase::data_field_offset()));
+
+ // Pointers to start, end and end-16.
+ __ leaq(bytes_ptr_reg, compiler::Address(bytes_reg, start_reg, TIMES_1, 0));
+ __ leaq(bytes_end_reg, compiler::Address(bytes_reg, end_reg, TIMES_1, 0));
+ __ leaq(bytes_end_minus_16_reg, compiler::Address(bytes_end_reg, -16));
+
+ // Initialize size and flags.
+ __ xorq(size_reg, size_reg);
+ __ xorq(flags_reg, flags_reg);
+
+ __ jmp(&scan_ascii, compiler::Assembler::kNearJump);
+
+ // Loop scanning through ASCII bytes one 16-byte vector at a time.
+ // While scanning, the size register contains the size as it was at the start
+ // of the current block of ASCII bytes, minus the address of the start of the
+ // block. After the block, the end address of the block is added to update the
+ // size to include the bytes in the block.
+ __ Bind(&ascii_loop);
+ __ addq(bytes_ptr_reg, compiler::Immediate(16));
+ __ Bind(&ascii_loop_in);
+
+ // Exit vectorized loop when there are less than 16 bytes left.
+ __ cmpq(bytes_ptr_reg, bytes_end_minus_16_reg);
+ __ j(UNSIGNED_GREATER, &rest, compiler::Assembler::kNearJump);
+
+ // Find next non-ASCII byte within the next 16 bytes.
+ // Note: In principle, we should use MOVDQU here, since the loaded value is
+ // used as input to an integer instruction. In practice, according to Agner
+ // Fog, there is no penalty for using the wrong kind of load.
+ __ movups(vector_reg, compiler::Address(bytes_ptr_reg, 0));
+ __ pmovmskb(temp_reg, vector_reg);
+ __ bsfq(temp_reg, temp_reg);
+ __ j(EQUAL, &ascii_loop, compiler::Assembler::kNearJump);
+
+ // Point to non-ASCII byte and update size.
+ __ addq(bytes_ptr_reg, temp_reg);
+ __ addq(size_reg, bytes_ptr_reg);
+
+ // Read first non-ASCII byte.
+ __ movzxb(temp_reg, compiler::Address(bytes_ptr_reg, 0));
+
+ // Loop over block of non-ASCII bytes.
+ __ Bind(&nonascii_loop);
+ __ addq(bytes_ptr_reg, compiler::Immediate(1));
+
+ // Update size and flags based on byte value.
+ __ movzxb(temp_reg, compiler::FieldAddress(
+ table_reg, temp_reg, TIMES_1,
+ compiler::target::OneByteString::data_offset()));
+ __ orq(flags_reg, temp_reg);
+ __ andq(temp_reg, compiler::Immediate(kSizeMask));
+ __ addq(size_reg, temp_reg);
+
+ // Stop if end is reached.
+ __ cmpq(bytes_ptr_reg, bytes_end_reg);
+ __ j(UNSIGNED_GREATER_EQUAL, &done, compiler::Assembler::kNearJump);
+
+ // Go to ASCII scan if next byte is ASCII, otherwise loop.
+ __ movzxb(temp_reg, compiler::Address(bytes_ptr_reg, 0));
+ __ testq(temp_reg, compiler::Immediate(0x80));
+ __ j(NOT_EQUAL, &nonascii_loop, compiler::Assembler::kNearJump);
+
+ // Enter the ASCII scanning loop.
+ __ Bind(&scan_ascii);
+ __ subq(size_reg, bytes_ptr_reg);
+ __ jmp(&ascii_loop_in);
+
+ // Less than 16 bytes left. Process the remaining bytes individually.
+ __ Bind(&rest);
+
+ // Update size after ASCII scanning loop.
+ __ addq(size_reg, bytes_ptr_reg);
+ __ jmp(&rest_loop_in, compiler::Assembler::kNearJump);
+
+ __ Bind(&rest_loop);
+
+ // Read byte and increment pointer.
+ __ movzxb(temp_reg, compiler::Address(bytes_ptr_reg, 0));
+ __ addq(bytes_ptr_reg, compiler::Immediate(1));
+
+ // Update size and flags based on byte value.
+ __ movzxb(temp_reg, compiler::FieldAddress(
+ table_reg, temp_reg, TIMES_1,
+ compiler::target::OneByteString::data_offset()));
+ __ orq(flags_reg, temp_reg);
+ __ andq(temp_reg, compiler::Immediate(kSizeMask));
+ __ addq(size_reg, temp_reg);
+
+ // Stop if end is reached.
+ __ Bind(&rest_loop_in);
+ __ cmpq(bytes_ptr_reg, bytes_end_reg);
+ __ j(UNSIGNED_LESS, &rest_loop, compiler::Assembler::kNearJump);
+ __ Bind(&done);
+
+ // Write flags to field.
+ __ andq(flags_reg, compiler::Immediate(kFlagsMask));
+ if (!IsScanFlagsUnboxed()) {
+ __ SmiTag(flags_reg);
+ }
+ Register decoder_reg;
+ const Location decoder_location = locs()->in(0);
+ if (decoder_location.IsStackSlot()) {
+ __ movq(temp_reg, LocationToStackSlotAddress(decoder_location));
+ decoder_reg = temp_reg;
+ } else {
+ decoder_reg = decoder_location.reg();
+ }
+ const auto scan_flags_field_offset = scan_flags_field_.offset_in_bytes();
+ __ orq(compiler::FieldAddress(decoder_reg, scan_flags_field_offset),
+ flags_reg);
+}
+
LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/ffi/native_calling_convention.cc b/runtime/vm/compiler/ffi/native_calling_convention.cc
index 56e4690..d753abb 100644
--- a/runtime/vm/compiler/ffi/native_calling_convention.cc
+++ b/runtime/vm/compiler/ffi/native_calling_convention.cc
@@ -105,9 +105,10 @@
cpu_regs_used += cpu_regs_used % 2;
}
if (cpu_regs_used + 2 <= CallingConventions::kNumArgRegs) {
+ const Register register_1 = AllocateCpuRegister();
+ const Register register_2 = AllocateCpuRegister();
return *new (zone_) NativeRegistersLocation(
- payload_type, container_type, AllocateCpuRegister(),
- AllocateCpuRegister());
+ payload_type, container_type, register_1, register_2);
}
} else {
ASSERT(payload_type.SizeInBytes() <= target::kWordSize);
diff --git a/runtime/vm/compiler/frontend/base_flow_graph_builder.cc b/runtime/vm/compiler/frontend/base_flow_graph_builder.cc
index 4deaede..bf31d84 100644
--- a/runtime/vm/compiler/frontend/base_flow_graph_builder.cc
+++ b/runtime/vm/compiler/frontend/base_flow_graph_builder.cc
@@ -565,6 +565,21 @@
return instructions;
}
+Fragment BaseFlowGraphBuilder::Utf8Scan() {
+ Value* table = Pop();
+ Value* end = Pop();
+ Value* start = Pop();
+ Value* bytes = Pop();
+ Value* decoder = Pop();
+ const Field& scan_flags_field =
+ compiler::LookupConvertUtf8DecoderScanFlagsField();
+ auto scan = new (Z) Utf8ScanInstr(
+ decoder, bytes, start, end, table,
+ Slot::Get(MayCloneField(scan_flags_field), parsed_function_));
+ Push(scan);
+ return Fragment(scan);
+}
+
Fragment BaseFlowGraphBuilder::StoreStaticField(TokenPosition position,
const Field& field) {
return Fragment(
diff --git a/runtime/vm/compiler/frontend/base_flow_graph_builder.h b/runtime/vm/compiler/frontend/base_flow_graph_builder.h
index b40e7db..1efa882 100644
--- a/runtime/vm/compiler/frontend/base_flow_graph_builder.h
+++ b/runtime/vm/compiler/frontend/base_flow_graph_builder.h
@@ -286,6 +286,7 @@
intptr_t loop_depth);
Fragment CheckStackOverflowInPrologue(TokenPosition position);
Fragment TailCall(const Code& code);
+ Fragment Utf8Scan();
intptr_t GetNextDeoptId() {
intptr_t deopt_id = thread_->compiler_state().GetNextDeoptId();
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index 08c0227..3ca275c 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -843,6 +843,7 @@
case MethodRecognizer::kLinkedHashMap_setDeletedKeys:
case MethodRecognizer::kFfiAbi:
case MethodRecognizer::kReachabilityFence:
+ case MethodRecognizer::kUtf8DecoderScan:
return true;
case MethodRecognizer::kAsyncStackTraceHelper:
return !FLAG_causal_async_stacks;
@@ -1126,6 +1127,22 @@
ASSERT(!FLAG_causal_async_stacks);
body += NullConstant();
break;
+ case MethodRecognizer::kUtf8DecoderScan:
+ ASSERT(function.NumParameters() == 5);
+ body += LoadLocal(parsed_function_->RawParameterVariable(0)); // decoder
+ body += LoadLocal(parsed_function_->RawParameterVariable(1)); // bytes
+ body += LoadLocal(parsed_function_->RawParameterVariable(2)); // start
+ body += CheckNullOptimized(TokenPosition::kNoSource,
+ String::ZoneHandle(Z, function.name()));
+ body += UnboxTruncate(kUnboxedIntPtr);
+ body += LoadLocal(parsed_function_->RawParameterVariable(3)); // end
+ body += CheckNullOptimized(TokenPosition::kNoSource,
+ String::ZoneHandle(Z, function.name()));
+ body += UnboxTruncate(kUnboxedIntPtr);
+ body += LoadLocal(parsed_function_->RawParameterVariable(4)); // table
+ body += Utf8Scan();
+ body += Box(kUnboxedIntPtr);
+ break;
case MethodRecognizer::kReachabilityFence:
ASSERT(function.NumParameters() == 1);
body += LoadLocal(parsed_function_->RawParameterVariable(0));
diff --git a/runtime/vm/compiler/method_recognizer.cc b/runtime/vm/compiler/method_recognizer.cc
index ba5f065..98a4a34 100644
--- a/runtime/vm/compiler/method_recognizer.cc
+++ b/runtime/vm/compiler/method_recognizer.cc
@@ -251,6 +251,7 @@
libs->Add(&Library::ZoneHandle(Library::CollectionLibrary()));
libs->Add(&Library::ZoneHandle(Library::MathLibrary()));
libs->Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
+ libs->Add(&Library::ZoneHandle(Library::ConvertLibrary()));
libs->Add(&Library::ZoneHandle(Library::InternalLibrary()));
libs->Add(&Library::ZoneHandle(Library::DeveloperLibrary()));
libs->Add(&Library::ZoneHandle(Library::AsyncLibrary()));
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index c57f806..1c6ffb1 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -174,6 +174,7 @@
V(::, _fromAddress, FfiFromAddress, 0x612a64d5) \
V(Pointer, get:address, FfiGetAddress, 0x29a505a1) \
V(::, reachabilityFence, ReachabilityFence, 0x0) \
+ V(_Utf8Decoder, _scan, Utf8DecoderScan, 0x78f44c3c) \
// List of intrinsics:
// (class-name, function-name, intrinsification method, fingerprint).
diff --git a/runtime/vm/compiler/runtime_api.cc b/runtime/vm/compiler/runtime_api.cc
index 916bfaf..bc48403 100644
--- a/runtime/vm/compiler/runtime_api.cc
+++ b/runtime/vm/compiler/runtime_api.cc
@@ -224,6 +224,19 @@
return state_field;
}
+const Field& LookupConvertUtf8DecoderScanFlagsField() {
+ const auto& convert_lib =
+ dart::Library::Handle(dart::Library::ConvertLibrary());
+ ASSERT(!convert_lib.IsNull());
+ const auto& _utf8decoder_class = dart::Class::Handle(
+ convert_lib.LookupClassAllowPrivate(dart::Symbols::_Utf8Decoder()));
+ ASSERT(!_utf8decoder_class.IsNull());
+ const auto& scan_flags_field = dart::Field::ZoneHandle(
+ _utf8decoder_class.LookupInstanceFieldAllowPrivate(
+ dart::Symbols::_scanFlags()));
+ return scan_flags_field;
+}
+
word LookupFieldOffsetInBytes(const Field& field) {
return field.TargetOffset();
}
diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h
index ae21caf..d16b3cc 100644
--- a/runtime/vm/compiler/runtime_api.h
+++ b/runtime/vm/compiler/runtime_api.h
@@ -184,6 +184,9 @@
// Looks up the dart:math's _Random._A field.
const Field& LookupMathRandomStateFieldOffset();
+// Looks up the dart:convert's _Utf8Decoder._scanFlags field.
+const Field& LookupConvertUtf8DecoderScanFlagsField();
+
// Returns the offset in bytes of [field].
word LookupFieldOffsetInBytes(const Field& field);
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 75e22e7..eb13f6c 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -4312,8 +4312,7 @@
// We do not support generic constructors.
ASSERT(redirect_type.IsInstantiated(kFunctions));
redirect_type ^= redirect_type.InstantiateFrom(
- type_arguments, Object::null_type_arguments(), kNoneFree, NULL,
- Heap::kNew);
+ type_arguments, Object::null_type_arguments(), kNoneFree, Heap::kNew);
redirect_type ^= redirect_type.Canonicalize();
}
diff --git a/runtime/vm/dwarf.cc b/runtime/vm/dwarf.cc
index 5d356a4..97880d8 100644
--- a/runtime/vm/dwarf.cc
+++ b/runtime/vm/dwarf.cc
@@ -367,34 +367,34 @@
string("Dart VM"); // DW_AT_producer
string(""); // DW_AT_comp_dir
- // DW_AT_low_pc
- // The lowest instruction address in this object file that is part of our
- // compilation unit. Dwarf consumers use this to quickly decide which
- // compilation unit DIE to consult for a given pc.
+ // DW_AT_low_pc and DW_AT_high_pc
+ // The lowest and highest instruction addresses in this object file that are
+ // part of our compilation unit. Dwarf consumers use this to quickly decide
+ // which compilation unit DIE to consult for a given pc.
+ //
+ // Currently, we only write DWARF information for Dart code and only the
+ // isolate contains instructions compiled from Dart code. If we ever add Dart
+ // code to the VM snapshot, this will need to be adjusted.
if (asm_stream_ != nullptr) {
+ // DW_AT_low_pc
PrintNamedAddress(kIsolateSnapshotInstructionsAsmSymbol);
- }
- if (elf_ != nullptr) {
- intptr_t offset;
- if (!elf_->FindDynamicSymbol(kIsolateSnapshotInstructionsAsmSymbol, &offset,
- nullptr)) {
- UNREACHABLE();
- }
- addr(offset);
- }
-
- // DW_AT_high_pc
- // The highest instruction address in this object file that is part of our
- // compilation unit. Dwarf consumers use this to quickly decide which
- // compilation unit DIE to consult for a given pc.
- if (asm_stream_ != nullptr) {
+ // DW_AT_high_pc
intptr_t last_code_index = codes_.length() - 1;
const Code& last_code = *(codes_[last_code_index]);
PrintNamedAddressWithOffset(
namer.SnapshotNameFor(last_code_index, last_code), last_code.Size());
}
if (elf_ != nullptr) {
- addr(elf_->NextMemoryOffset());
+ intptr_t offset;
+ intptr_t size;
+ if (!elf_->FindDynamicSymbol(kIsolateSnapshotInstructionsAsmSymbol, &offset,
+ &size)) {
+ UNREACHABLE();
+ }
+ // DW_AT_low_pc
+ addr(offset);
+ // DW_AT_high_pc
+ addr(offset + size);
}
// DW_AT_stmt_list (offset into .debug_line)
diff --git a/runtime/vm/heap/heap.cc b/runtime/vm/heap/heap.cc
index 28a36fe..e677b0c 100644
--- a/runtime/vm/heap/heap.cc
+++ b/runtime/vm/heap/heap.cc
@@ -176,7 +176,7 @@
old_space_.AllocatedExternal(size);
}
- if (old_space_.NeedsGarbageCollection()) {
+ if (old_space_.ReachedHardThreshold()) {
CollectGarbage(kMarkSweep, kExternal);
} else {
CheckStartConcurrentMarking(Thread::Current(), kExternal);
@@ -428,7 +428,7 @@
TIMELINE_FUNCTION_GC_DURATION(thread, "IdleGC");
StartConcurrentMarking(thread);
}
- } else if (old_space_.NeedsGarbageCollection()) {
+ } else if (old_space_.ReachedHardThreshold()) {
// Even though the following GC may exceed our idle deadline, we need to
// ensure than that promotions during idle scavenges do not lead to
// unbounded growth of old space. If a program is allocating only in new
@@ -490,7 +490,7 @@
EndNewSpaceGC();
}
if (reason == kNewSpace) {
- if (old_space_.NeedsGarbageCollection()) {
+ if (old_space_.ReachedHardThreshold()) {
CollectOldSpaceGarbage(thread, kMarkSweep, kPromotion);
} else {
CheckStartConcurrentMarking(thread, kPromotion);
@@ -592,7 +592,7 @@
}
}
- if (old_space_.AlmostNeedsGarbageCollection()) {
+ if (old_space_.ReachedSoftThreshold()) {
// New-space objects are roots during old-space GC. This means that even
// unreachable new-space objects prevent old-space objects they reference
// from being collected during an old-space GC. Normally this is not an
diff --git a/runtime/vm/heap/heap.h b/runtime/vm/heap/heap.h
index ac74209..92dda0a 100644
--- a/runtime/vm/heap/heap.h
+++ b/runtime/vm/heap/heap.h
@@ -140,10 +140,6 @@
// those in inter-generational cycles or stored during incremental marking.
void CollectAllGarbage(GCReason reason = kFull);
- bool NeedsGarbageCollection() const {
- return old_space_.NeedsGarbageCollection();
- }
-
void CheckStartConcurrentMarking(Thread* thread, GCReason reason);
void StartConcurrentMarking(Thread* thread);
void CheckFinishConcurrentMarking(Thread* thread);
diff --git a/runtime/vm/heap/pages.cc b/runtime/vm/heap/pages.cc
index 4a7c0bb..42d2bb1 100644
--- a/runtime/vm/heap/pages.cc
+++ b/runtime/vm/heap/pages.cc
@@ -477,7 +477,7 @@
// Can we grow by one page?
after_allocation.capacity_in_words += kOldPageSizeInWords;
if (growth_policy == kForceGrowth ||
- !page_space_controller_.NeedsGarbageCollection(after_allocation)) {
+ !page_space_controller_.ReachedHardThreshold(after_allocation)) {
OldPage* page = AllocatePage(type);
if (page == NULL) {
return 0;
@@ -518,7 +518,7 @@
after_allocation.used_in_words += size >> kWordSizeLog2;
after_allocation.capacity_in_words += page_size_in_words;
if (growth_policy == kForceGrowth ||
- !page_space_controller_.NeedsGarbageCollection(after_allocation)) {
+ !page_space_controller_.ReachedHardThreshold(after_allocation)) {
OldPage* page = AllocateLargePage(size, type);
if (page != NULL) {
result = page->object_start();
@@ -958,7 +958,7 @@
// middle of deciding whether to perform an idle GC.
NoSafepointScope no_safepoint;
- if (!page_space_controller_.NeedsIdleGarbageCollection(usage_)) {
+ if (!page_space_controller_.ReachedIdleThreshold(usage_)) {
return false;
}
@@ -993,8 +993,7 @@
static_cast<double>(usage_.capacity_in_words);
const bool fragmented = excess_ratio > 0.05;
- if (!fragmented &&
- !page_space_controller_.NeedsIdleGarbageCollection(usage_)) {
+ if (!fragmented && !page_space_controller_.ReachedIdleThreshold(usage_)) {
return false;
}
@@ -1505,7 +1504,7 @@
PageSpaceController::~PageSpaceController() {}
-bool PageSpaceController::NeedsGarbageCollection(SpaceUsage after) const {
+bool PageSpaceController::ReachedHardThreshold(SpaceUsage after) const {
if (!is_enabled_) {
return false;
}
@@ -1515,7 +1514,7 @@
return after.CombinedUsedInWords() > hard_gc_threshold_in_words_;
}
-bool PageSpaceController::AlmostNeedsGarbageCollection(SpaceUsage after) const {
+bool PageSpaceController::ReachedSoftThreshold(SpaceUsage after) const {
if (!is_enabled_) {
return false;
}
@@ -1525,7 +1524,7 @@
return after.CombinedUsedInWords() > soft_gc_threshold_in_words_;
}
-bool PageSpaceController::NeedsIdleGarbageCollection(SpaceUsage current) const {
+bool PageSpaceController::ReachedIdleThreshold(SpaceUsage current) const {
if (!is_enabled_) {
return false;
}
diff --git a/runtime/vm/heap/pages.h b/runtime/vm/heap/pages.h
index 3e789ea..6235d1e 100644
--- a/runtime/vm/heap/pages.h
+++ b/runtime/vm/heap/pages.h
@@ -216,11 +216,11 @@
// Returns whether growing to 'after' should trigger a GC.
// This method can be called before allocation (e.g., pretenuring) or after
// (e.g., promotion), as it does not change the state of the controller.
- bool NeedsGarbageCollection(SpaceUsage after) const;
- bool AlmostNeedsGarbageCollection(SpaceUsage after) const;
+ bool ReachedHardThreshold(SpaceUsage after) const;
+ bool ReachedSoftThreshold(SpaceUsage after) const;
// Returns whether an idle GC is worthwhile.
- bool NeedsIdleGarbageCollection(SpaceUsage current) const;
+ bool ReachedIdleThreshold(SpaceUsage current) const;
// Should be called after each collection to update the controller state.
void EvaluateGarbageCollection(SpaceUsage before,
@@ -306,11 +306,14 @@
is_protected, is_locked);
}
- bool NeedsGarbageCollection() const {
- return page_space_controller_.NeedsGarbageCollection(usage_);
+ bool ReachedHardThreshold() const {
+ return page_space_controller_.ReachedHardThreshold(usage_);
}
- bool AlmostNeedsGarbageCollection() const {
- return page_space_controller_.AlmostNeedsGarbageCollection(usage_);
+ bool ReachedSoftThreshold() const {
+ return page_space_controller_.ReachedSoftThreshold(usage_);
+ }
+ bool ReachedIdleThreshold() const {
+ return page_space_controller_.ReachedIdleThreshold(usage_);
}
void EvaluateAfterLoading() {
page_space_controller_.EvaluateAfterLoading(usage_);
diff --git a/runtime/vm/heap/safepoint.cc b/runtime/vm/heap/safepoint.cc
index 2773fe8..4366a6c 100644
--- a/runtime/vm/heap/safepoint.cc
+++ b/runtime/vm/heap/safepoint.cc
@@ -72,7 +72,7 @@
if (current_growth_controller_state_) {
ASSERT(T->CanCollectGarbage());
// Check if we passed the growth limit during the scope.
- if (heap->old_space()->NeedsGarbageCollection()) {
+ if (heap->old_space()->ReachedHardThreshold()) {
heap->CollectGarbage(Heap::kMarkSweep, Heap::kOldSpace);
} else {
heap->CheckStartConcurrentMarking(T, Heap::kOldSpace);
diff --git a/runtime/vm/heap/scavenger.cc b/runtime/vm/heap/scavenger.cc
index dcd9f18..ee42db2 100644
--- a/runtime/vm/heap/scavenger.cc
+++ b/runtime/vm/heap/scavenger.cc
@@ -932,9 +932,23 @@
// TODO(rmacnak): Investigate collecting a history of idle period durations.
intptr_t used_in_words = UsedInWords();
- if (used_in_words < idle_scavenge_threshold_in_words_) {
+ // Normal reason: new space is getting full.
+ bool for_new_space = used_in_words >= idle_scavenge_threshold_in_words_;
+ // New-space objects are roots during old-space GC. This means that even
+ // unreachable new-space objects prevent old-space objects they reference
+ // from being collected during an old-space GC. Normally this is not an
+ // issue because new-space GCs run much more frequently than old-space GCs.
+ // If new-space allocation is low and direct old-space allocation is high,
+ // which can happen in a program that allocates large objects and little
+ // else, old-space can fill up with unreachable objects until the next
+ // new-space GC. This check is the idle equivalent to the
+ // new-space GC before synchronous-marking in CollectMostGarbage.
+ bool for_old_space = heap_->last_gc_was_old_space_ &&
+ heap_->old_space()->ReachedIdleThreshold();
+ if (!for_new_space && !for_old_space) {
return false;
}
+
int64_t estimated_scavenge_completion =
OS::GetCurrentMonotonicMicros() +
used_in_words / scavenge_words_per_micro_;
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 2ae1e0d..dbf4a43 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -370,6 +370,10 @@
}
Mutex* subtype_test_cache_mutex() { return &subtype_test_cache_mutex_; }
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ Mutex* initializer_functions_mutex() { return &initializer_functions_mutex_; }
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
static inline IsolateGroup* Current() {
Thread* thread = Thread::Current();
return thread == nullptr ? nullptr : thread->isolate_group();
@@ -642,6 +646,10 @@
Mutex type_arguments_canonicalization_mutex_;
Mutex subtype_test_cache_mutex_;
+#if !defined(DART_PRECOMPILED_RUNTIME)
+ Mutex initializer_functions_mutex_;
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+
// Allow us to ensure the number of active mutators is limited by a maximum.
std::unique_ptr<Monitor> active_mutators_monitor_;
intptr_t active_mutators_ = 0;
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
index 9fe4c5f..3803fbf 100644
--- a/runtime/vm/kernel_isolate.cc
+++ b/runtime/vm/kernel_isolate.cc
@@ -232,6 +232,15 @@
}
bool KernelIsolate::Start() {
+ if (create_group_callback_ == nullptr) {
+ if (FLAG_trace_kernel) {
+ OS::PrintErr(DART_KERNEL_ISOLATE_NAME
+ ": Attempted to start kernel isolate without setting "
+ "Dart_InitializeParams property 'start_kernel_isolate' "
+ "to true\n");
+ }
+ return false;
+ }
bool start_task = false;
{
MonitorLocker ml(monitor_);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index ae9746d..5e8185c 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3740,11 +3740,11 @@
const TypeArguments& function_type_args) {
if (!subtype->IsInstantiated()) {
*subtype = subtype->InstantiateFrom(
- instantiator_type_args, function_type_args, kAllFree, NULL, Heap::kOld);
+ instantiator_type_args, function_type_args, kAllFree, Heap::kOld);
}
if (!supertype->IsInstantiated()) {
*supertype = supertype->InstantiateFrom(
- instantiator_type_args, function_type_args, kAllFree, NULL, Heap::kOld);
+ instantiator_type_args, function_type_args, kAllFree, Heap::kOld);
}
return subtype->IsSubtypeOf(*supertype, Heap::kOld);
}
@@ -4270,6 +4270,10 @@
#define ADD_SET_FIELD(clazz) {"cid" #clazz, kTypedData##clazz##Cid},
CLASS_LIST_TYPED_DATA(ADD_SET_FIELD)
#undef ADD_SET_FIELD
+#define ADD_SET_FIELD(clazz) \
+ {"cidExternal" #clazz, kExternalTypedData##clazz##Cid},
+ CLASS_LIST_TYPED_DATA(ADD_SET_FIELD)
+#undef ADD_SET_FIELD
#undef CLASS_LIST_WITH_NULL
};
@@ -4939,7 +4943,8 @@
const TypeArguments& type_arguments,
Nullability nullability,
const AbstractType& other,
- Heap::Space space) {
+ Heap::Space space,
+ TrailPtr trail) {
// This function does not support Null, Never, dynamic, or void as type T0.
classid_t this_cid = cls.id();
ASSERT(this_cid != kNullCid && this_cid != kNeverCid &&
@@ -4983,11 +4988,11 @@
this_class.NumTypeParameters() == 1);
ASSERT(type_arguments.IsNull() || type_arguments.Length() >= 1);
if (Class::IsSubtypeOf(future_class, type_arguments,
- Nullability::kNonNullable, other, space)) {
+ Nullability::kNonNullable, other, space, trail)) {
// Check S0 <: T1.
const AbstractType& type_arg =
AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
- if (type_arg.IsSubtypeOf(other, space)) {
+ if (type_arg.IsSubtypeOf(other, space, trail)) {
return verified_nullability;
}
}
@@ -5011,7 +5016,7 @@
const AbstractType& type_arg =
AbstractType::Handle(zone, type_arguments.TypeAtNullSafe(0));
// If T0 is Future<S0>, then T0 <: Future<S1>, iff S0 <: S1.
- if (type_arg.IsSubtypeOf(other_type_arg, space)) {
+ if (type_arg.IsSubtypeOf(other_type_arg, space, trail)) {
if (verified_nullability) {
return true;
}
@@ -5021,7 +5026,7 @@
// Check T0 <: S1.
if (other_type_arg.HasTypeClass() &&
Class::IsSubtypeOf(this_class, type_arguments, nullability,
- other_type_arg, space)) {
+ other_type_arg, space, trail)) {
return true;
}
}
@@ -5053,7 +5058,7 @@
type = type_arguments.TypeAtNullSafe(from_index + i);
other_type = other_type_arguments.TypeAt(from_index + i);
ASSERT(!type.IsNull() && !other_type.IsNull());
- if (!type.IsSubtypeOf(other_type, space)) {
+ if (!type.IsSubtypeOf(other_type, space, trail)) {
return false;
}
}
@@ -5080,14 +5085,14 @@
// after the type arguments of the super type of this type.
// The index of the type parameters is adjusted upon finalization.
interface_args = interface_args.InstantiateFrom(
- type_arguments, Object::null_type_arguments(), kNoneFree, NULL,
- space);
+ type_arguments, Object::null_type_arguments(), kNoneFree, space);
}
// In Dart 2, implementing Function has no meaning.
// TODO(regis): Can we encounter and skip Object as well?
if (interface_class.IsDartFunctionClass()) {
continue;
}
+ // No need to pass the trail as cycles are not possible via interfaces.
if (Class::IsSubtypeOf(interface_class, interface_args,
Nullability::kNonNullable, other, space)) {
return true;
@@ -6179,8 +6184,8 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const {
+ Heap::Space space,
+ TrailPtr trail) const {
ASSERT(!IsInstantiated(kAny, num_free_fun_type_params));
if ((instantiator_type_arguments.IsNull() ||
instantiator_type_arguments.Length() == Length()) &&
@@ -6201,9 +6206,9 @@
// type before A is marked as finalized.
if (!type.IsNull() &&
!type.IsInstantiated(kAny, num_free_fun_type_params)) {
- type = type.InstantiateFrom(
- instantiator_type_arguments, function_type_arguments,
- num_free_fun_type_params, instantiation_trail, space);
+ type = type.InstantiateFrom(instantiator_type_arguments,
+ function_type_arguments,
+ num_free_fun_type_params, space, trail);
// A returned null type indicates a failed instantiation in dead code that
// must be propagated up to the caller, the optimizing compiler.
if (type.IsNull()) {
@@ -6255,7 +6260,7 @@
// Cache lookup failed. Instantiate the type arguments.
TypeArguments& result = TypeArguments::Handle(zone);
result = InstantiateFrom(instantiator_type_arguments, function_type_arguments,
- kAllFree, NULL, Heap::kOld);
+ kAllFree, Heap::kOld);
// Canonicalize type arguments.
result = result.Canonicalize();
// InstantiateAndCanonicalizeFrom is not reentrant. It cannot have been called
@@ -7919,7 +7924,7 @@
if (!type.IsInstantiated(kAny, num_free_fun_type_params)) {
type = type.InstantiateFrom(instantiator_type_arguments,
function_type_arguments,
- num_free_fun_type_params, NULL, space);
+ num_free_fun_type_params, space);
// A returned null type indicates a failed instantiation in dead code
// that must be propagated up to the caller, the optimizing compiler.
if (type.IsNull()) {
@@ -7955,7 +7960,7 @@
if (!type.IsInstantiated(kAny, num_free_fun_type_params)) {
type = type.InstantiateFrom(instantiator_type_arguments,
function_type_arguments,
- num_free_fun_type_params, NULL, space);
+ num_free_fun_type_params, space);
// A returned null type indicates a failed instantiation in dead code that
// must be propagated up to the caller, the optimizing compiler.
if (type.IsNull()) {
@@ -7973,7 +7978,7 @@
if (!type.IsInstantiated(kAny, num_free_fun_type_params)) {
type = type.InstantiateFrom(instantiator_type_arguments,
function_type_arguments,
- num_free_fun_type_params, NULL, space);
+ num_free_fun_type_params, space);
// A returned null type indicates a failed instantiation in dead code that
// must be propagated up to the caller, the optimizing compiler.
if (type.IsNull()) {
@@ -8866,7 +8871,7 @@
}
}
- if (fun.IsClosureFunction()) {
+ if (fun.IsNonImplicitClosureFunction()) {
// Sniff the parent function.
fun = fun.parent_function();
ASSERT(!fun.IsNull());
@@ -9957,6 +9962,7 @@
FunctionPtr Field::EnsureInitializerFunction() const {
ASSERT(has_nontrivial_initializer());
+ ASSERT(IsOriginal());
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
Function& initializer = Function::Handle(zone, InitializerFunction());
@@ -9964,16 +9970,32 @@
#if defined(DART_PRECOMPILED_RUNTIME)
UNREACHABLE();
#else
- initializer = kernel::CreateFieldInitializerFunction(thread, zone, *this);
- SetInitializerFunction(initializer);
+ SafepointMutexLocker ml(
+ thread->isolate()->group()->initializer_functions_mutex());
+ // Double check after grabbing the lock.
+ initializer = InitializerFunction();
+ if (initializer.IsNull()) {
+ initializer = kernel::CreateFieldInitializerFunction(thread, zone, *this);
+ }
#endif
}
return initializer.raw();
}
void Field::SetInitializerFunction(const Function& initializer) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ UNREACHABLE();
+#else
ASSERT(IsOriginal());
- StorePointer(&raw_ptr()->initializer_function_, initializer.raw());
+ ASSERT(IsolateGroup::Current()
+ ->initializer_functions_mutex()
+ ->IsOwnedByCurrentThread());
+ // We have to ensure that all stores into the initializer function object
+ // happen before releasing the pointer to the initializer as it may be
+ // accessed without grabbing the lock.
+ StorePointer<FunctionPtr, std::memory_order_release>(
+ &raw_ptr()->initializer_function_, initializer.raw());
+#endif
}
bool Field::HasInitializerFunction() const {
@@ -10336,8 +10358,7 @@
i--) {
args = path[i]->arguments();
type = type.InstantiateFrom(args, TypeArguments::null_type_arguments(),
- kAllFree,
- /*instantiation_trail=*/nullptr, Heap::kNew);
+ kAllFree, Heap::kNew);
}
if (type.IsInstantiated()) {
@@ -13491,6 +13512,7 @@
all_libs.Add(&Library::ZoneHandle(Library::MathLibrary()));
all_libs.Add(&Library::ZoneHandle(Library::TypedDataLibrary()));
all_libs.Add(&Library::ZoneHandle(Library::CollectionLibrary()));
+ all_libs.Add(&Library::ZoneHandle(Library::ConvertLibrary()));
all_libs.Add(&Library::ZoneHandle(Library::InternalLibrary()));
all_libs.Add(&Library::ZoneHandle(Library::FfiLibrary()));
ASYNC_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS2);
@@ -17991,7 +18013,7 @@
if (other.IsTypeParameter()) {
auto& type = AbstractType::Handle(other.InstantiateFrom(
other_instantiator_type_arguments, other_function_type_arguments,
- kAllFree, NULL, Heap::kOld));
+ kAllFree, Heap::kOld));
if (type.IsTypeRef()) {
type = TypeRef::Cast(type).type();
}
@@ -18051,7 +18073,7 @@
if (!other.IsInstantiated()) {
instantiated_other = other.InstantiateFrom(
other_instantiator_type_arguments, other_function_type_arguments,
- kAllFree, NULL, Heap::kOld);
+ kAllFree, Heap::kOld);
if (instantiated_other.IsTypeRef()) {
instantiated_other = TypeRef::Cast(instantiated_other).type();
}
@@ -18091,7 +18113,7 @@
if (!other.IsInstantiated()) {
instantiated_other = other.InstantiateFrom(
other_instantiator_type_arguments, other_function_type_arguments,
- kAllFree, NULL, Heap::kOld);
+ kAllFree, Heap::kOld);
if (instantiated_other.IsTypeRef()) {
instantiated_other = TypeRef::Cast(instantiated_other).type();
}
@@ -18531,8 +18553,8 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const {
+ Heap::Space space,
+ TrailPtr trail) const {
// AbstractType is an abstract class.
UNREACHABLE();
return NULL;
@@ -18924,7 +18946,8 @@
}
bool AbstractType::IsSubtypeOf(const AbstractType& other,
- Heap::Space space) const {
+ Heap::Space space,
+ TrailPtr trail) const {
ASSERT(IsFinalized());
ASSERT(other.IsFinalized());
// Reflexivity.
@@ -18978,11 +19001,15 @@
}
const AbstractType& bound = AbstractType::Handle(zone, type_param.bound());
ASSERT(bound.IsFinalized());
- if (bound.IsSubtypeOf(other, space)) {
+ // Avoid cycles with F-bounded types.
+ if (TestAndAddBuddyToTrail(&trail, other)) {
+ return true;
+ }
+ if (bound.IsSubtypeOf(other, space, trail)) {
return true;
}
// Apply additional subtyping rules if 'other' is 'FutureOr'.
- if (IsSubtypeOfFutureOr(zone, other, space)) {
+ if (IsSubtypeOfFutureOr(zone, other, space, trail)) {
return true;
}
return false;
@@ -19024,18 +19051,19 @@
}
if (IsFunctionType()) {
// Apply additional subtyping rules if 'other' is 'FutureOr'.
- if (IsSubtypeOfFutureOr(zone, other, space)) {
+ if (IsSubtypeOfFutureOr(zone, other, space, trail)) {
return true;
}
return false;
}
return Class::IsSubtypeOf(type_cls, TypeArguments::Handle(zone, arguments()),
- nullability(), other, space);
+ nullability(), other, space, trail);
}
bool AbstractType::IsSubtypeOfFutureOr(Zone* zone,
const AbstractType& other,
- Heap::Space space) const {
+ Heap::Space space,
+ TrailPtr trail) const {
if (other.IsFutureOrType()) {
// This function is only called with a receiver that is either a function
// type or an uninstantiated type parameter, therefore, it cannot be of
@@ -19049,7 +19077,7 @@
return true;
}
// Retry the IsSubtypeOf check after unwrapping type arg of FutureOr.
- if (IsSubtypeOf(other_type_arg, space)) {
+ if (IsSubtypeOf(other_type_arg, space, trail)) {
return true;
}
}
@@ -19308,8 +19336,8 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const {
+ Heap::Space space,
+ TrailPtr trail) const {
Zone* zone = Thread::Current()->zone();
ASSERT(IsFinalized() || IsBeingFinalized());
ASSERT(!IsInstantiated());
@@ -19328,7 +19356,7 @@
ASSERT(type_arguments.Length() == cls.NumTypeArguments());
type_arguments = type_arguments.InstantiateFrom(
instantiator_type_arguments, function_type_arguments,
- num_free_fun_type_params, instantiation_trail, space);
+ num_free_fun_type_params, space, trail);
// A returned empty_type_arguments indicates a failed instantiation in dead
// code that must be propagated up to the caller, the optimizing compiler.
if (type_arguments.raw() == Object::empty_type_arguments().raw()) {
@@ -19942,22 +19970,22 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const {
+ Heap::Space space,
+ TrailPtr trail) const {
TypeRef& instantiated_type_ref = TypeRef::Handle();
- instantiated_type_ref ^= OnlyBuddyInTrail(instantiation_trail);
+ instantiated_type_ref ^= OnlyBuddyInTrail(trail);
if (!instantiated_type_ref.IsNull()) {
return instantiated_type_ref.raw();
}
instantiated_type_ref = TypeRef::New();
- AddOnlyBuddyToTrail(&instantiation_trail, instantiated_type_ref);
+ AddOnlyBuddyToTrail(&trail, instantiated_type_ref);
AbstractType& ref_type = AbstractType::Handle(type());
ASSERT(!ref_type.IsNull() && !ref_type.IsTypeRef());
AbstractType& instantiated_ref_type = AbstractType::Handle();
instantiated_ref_type = ref_type.InstantiateFrom(
instantiator_type_arguments, function_type_arguments,
- num_free_fun_type_params, instantiation_trail, space);
+ num_free_fun_type_params, space, trail);
// A returned null type indicates a failed instantiation in dead code that
// must be propagated up to the caller, the optimizing compiler.
if (instantiated_ref_type.IsNull()) {
@@ -20234,8 +20262,8 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const {
+ Heap::Space space,
+ TrailPtr trail) const {
ASSERT(IsFinalized());
if (IsFunctionTypeParameter()) {
if (index() >= num_free_fun_type_params) {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 903f471..d3eeb49 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1257,7 +1257,8 @@
const TypeArguments& type_arguments,
Nullability nullability,
const AbstractType& other,
- Heap::Space space);
+ Heap::Space space,
+ TrailPtr trail = nullptr);
// Check if this is the top level class.
bool IsTopLevel() const;
@@ -2518,7 +2519,7 @@
// generic functions or class type parameters.
bool HasInstantiatedSignature(Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
ClassPtr Owner() const;
void set_owner(const Object& value) const;
@@ -3054,14 +3055,9 @@
// dependencies. It will be compiled into optimized code immediately when it's
// run.
bool ForceOptimize() const {
- if (IsFfiTrampoline()) {
- return true;
- }
- if (IsTypedDataViewFactory() || IsFfiLoad() || IsFfiStore() ||
- IsFfiFromAddress() || IsFfiGetAddress()) {
- return true;
- }
- return false;
+ return IsFfiFromAddress() || IsFfiGetAddress() || IsFfiLoad() ||
+ IsFfiStore() || IsFfiTrampoline() || IsTypedDataViewFactory() ||
+ IsUtf8Scan();
}
bool CanBeInlined() const;
@@ -3350,6 +3346,11 @@
return kind == MethodRecognizer::kFfiGetAddress;
}
+ bool IsUtf8Scan() const {
+ const auto kind = recognized_kind();
+ return kind == MethodRecognizer::kUtf8DecoderScan;
+ }
+
bool IsAsyncFunction() const { return modifier() == FunctionLayout::kAsync; }
bool IsAsyncClosure() const {
@@ -4256,6 +4257,8 @@
FunctionPtr EnsureInitializerFunction() const;
FunctionPtr InitializerFunction() const {
+ // We rely on the fact that any loads from the initializer function
+ // are dependent loads and avoid the load-acquire barrier here.
return raw_ptr()->initializer_function_;
}
void SetInitializerFunction(const Function& initializer) const;
@@ -5022,7 +5025,7 @@
bool HidesName(const String& name) const;
ObjectPtr Lookup(const String& name,
- ZoneGrowableArray<intptr_t>* trail = NULL) const;
+ ZoneGrowableArray<intptr_t>* trail = nullptr) const;
static NamespacePtr New(const Library& library,
const Array& show_names,
@@ -7443,7 +7446,7 @@
bool IsEquivalent(const TypeArguments& other,
TypeEquality kind,
- TrailPtr trail = NULL) const {
+ TrailPtr trail = nullptr) const {
return IsSubvectorEquivalent(other, 0, IsNull() ? 0 : Length(), kind,
trail);
}
@@ -7451,12 +7454,12 @@
intptr_t from_index,
intptr_t len,
TypeEquality kind,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
// Check if the vector is instantiated (it must not be null).
bool IsInstantiated(Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
- TrailPtr trail = NULL) const {
+ TrailPtr trail = nullptr) const {
return IsSubvectorInstantiated(0, Length(), genericity,
num_free_fun_type_params, trail);
}
@@ -7464,7 +7467,7 @@
intptr_t len,
Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
bool IsUninstantiatedIdentity() const;
// Determine whether this uninstantiated type argument vector can share its
@@ -7492,7 +7495,7 @@
}
// Canonicalize only if instantiated, otherwise returns 'this'.
- TypeArgumentsPtr Canonicalize(TrailPtr trail = NULL) const;
+ TypeArgumentsPtr Canonicalize(TrailPtr trail = nullptr) const;
// Add the class name and URI of each type argument of this vector to the uris
// list and mark ambiguous triplets to be printed.
@@ -7507,8 +7510,8 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const;
+ Heap::Space space,
+ TrailPtr trail = nullptr) const;
// Runtime instantiation with canonicalization. Not to be used during type
// finalization at compile time.
@@ -7644,7 +7647,7 @@
virtual TokenPosition token_pos() const;
virtual bool IsInstantiated(Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool CanonicalizeEquals(const Instance& other) const {
return Equals(other);
}
@@ -7654,7 +7657,7 @@
}
virtual bool IsEquivalent(const Instance& other,
TypeEquality kind,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool IsRecursive() const;
// Check if this type represents a function type.
@@ -7675,8 +7678,8 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const;
+ Heap::Space space,
+ TrailPtr trail = nullptr) const;
virtual InstancePtr CheckAndCanonicalize(Thread* thread,
const char** error_str) const {
@@ -7684,7 +7687,7 @@
}
// Return the canonical version of this type.
- virtual AbstractTypePtr Canonicalize(TrailPtr trail = NULL) const;
+ virtual AbstractTypePtr Canonicalize(TrailPtr trail = nullptr) const;
#if defined(DEBUG)
// Check if abstract type is canonical.
@@ -7822,7 +7825,9 @@
AbstractTypePtr UnwrapFutureOr() const;
// Check the subtype relationship.
- bool IsSubtypeOf(const AbstractType& other, Heap::Space space) const;
+ bool IsSubtypeOf(const AbstractType& other,
+ Heap::Space space,
+ TrailPtr trail = nullptr) const;
// Returns true iff subtype is a subtype of supertype, false otherwise or if
// an error occurred.
@@ -7848,7 +7853,8 @@
// Returns false if other type is not a FutureOr.
bool IsSubtypeOfFutureOr(Zone* zone,
const AbstractType& other,
- Heap::Space space) const;
+ Heap::Space space,
+ TrailPtr trail = nullptr) const;
protected:
HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance);
@@ -7904,10 +7910,10 @@
virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
virtual bool IsInstantiated(Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool IsEquivalent(const Instance& other,
TypeEquality kind,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool IsRecursive() const;
// Return true if this type can be used as the declaration type of cls after
@@ -7931,9 +7937,9 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const;
- virtual AbstractTypePtr Canonicalize(TrailPtr trail = NULL) const;
+ Heap::Space space,
+ TrailPtr trail = nullptr) const;
+ virtual AbstractTypePtr Canonicalize(TrailPtr trail = nullptr) const;
#if defined(DEBUG)
// Check if type is canonical.
virtual bool CheckIsCanonical(Thread* thread) const;
@@ -8075,10 +8081,10 @@
}
virtual bool IsInstantiated(Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool IsEquivalent(const Instance& other,
TypeEquality kind,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool IsRecursive() const { return true; }
virtual bool IsFunctionType() const {
const AbstractType& ref_type = AbstractType::Handle(type());
@@ -8088,9 +8094,9 @@
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const;
- virtual AbstractTypePtr Canonicalize(TrailPtr trail = NULL) const;
+ Heap::Space space,
+ TrailPtr trail = nullptr) const;
+ virtual AbstractTypePtr Canonicalize(TrailPtr trail = nullptr) const;
#if defined(DEBUG)
// Check if typeref is canonical.
virtual bool CheckIsCanonical(Thread* thread) const;
@@ -8159,18 +8165,18 @@
virtual TokenPosition token_pos() const { return raw_ptr()->token_pos_; }
virtual bool IsInstantiated(Genericity genericity = kAny,
intptr_t num_free_fun_type_params = kAllFree,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool IsEquivalent(const Instance& other,
TypeEquality kind,
- TrailPtr trail = NULL) const;
+ TrailPtr trail = nullptr) const;
virtual bool IsRecursive() const { return false; }
virtual AbstractTypePtr InstantiateFrom(
const TypeArguments& instantiator_type_arguments,
const TypeArguments& function_type_arguments,
intptr_t num_free_fun_type_params,
- TrailPtr instantiation_trail,
- Heap::Space space) const;
- virtual AbstractTypePtr Canonicalize(TrailPtr trail = NULL) const {
+ Heap::Space space,
+ TrailPtr trail = nullptr) const;
+ virtual AbstractTypePtr Canonicalize(TrailPtr trail = nullptr) const {
return raw();
}
#if defined(DEBUG)
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index 31276e9..fd3f60f 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -393,9 +393,8 @@
instantiator_type_arguments.IsInstantiated());
ASSERT(function_type_arguments.IsNull() ||
function_type_arguments.IsInstantiated());
- type =
- type.InstantiateFrom(instantiator_type_arguments, function_type_arguments,
- kAllFree, NULL, Heap::kOld);
+ type = type.InstantiateFrom(instantiator_type_arguments,
+ function_type_arguments, kAllFree, Heap::kOld);
if (type.IsTypeRef()) {
type = TypeRef::Cast(type).type();
ASSERT(!type.IsTypeRef());
@@ -581,10 +580,9 @@
Class::Handle(type.type_class()).id(), caller_frame->pc());
} else {
// Instantiate type before printing.
- const AbstractType& instantiated_type =
- AbstractType::Handle(type.InstantiateFrom(instantiator_type_arguments,
- function_type_arguments,
- kAllFree, NULL, Heap::kOld));
+ const AbstractType& instantiated_type = AbstractType::Handle(
+ type.InstantiateFrom(instantiator_type_arguments,
+ function_type_arguments, kAllFree, Heap::kOld));
OS::PrintErr("%s: '%s' %s '%s' instantiated from '%s' (pc: %#" Px ").\n",
message, String::Handle(instance_type.Name()).ToCString(),
(result.raw() == Bool::True().raw()) ? "is" : "is !",
@@ -702,9 +700,9 @@
if (FLAG_trace_type_checks) {
AbstractType& test_type = AbstractType::Handle(zone, type.raw());
if (!test_type.IsInstantiated()) {
- test_type = type.InstantiateFrom(instantiator_type_arguments,
- function_type_arguments, kAllFree,
- NULL, Heap::kNew);
+ test_type =
+ type.InstantiateFrom(instantiator_type_arguments,
+ function_type_arguments, kAllFree, Heap::kNew);
}
const auto& type_class = Class::Handle(zone, test_type.type_class());
const auto& instance_class_name =
@@ -833,7 +831,7 @@
// Instantiate dst_type before reporting the error.
dst_type = dst_type.InstantiateFrom(instantiator_type_arguments,
function_type_arguments, kAllFree,
- NULL, Heap::kNew);
+ Heap::kNew);
}
if (dst_name.IsNull()) {
#if !defined(TARGET_ARCH_IA32)
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 93d7f36..0144fd8 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -2809,14 +2809,10 @@
}
if (!KernelIsolate::IsRunning() && !KernelIsolate::Start()) {
- // Assume we are in dart1 mode where separate compilation is not required.
- // 0-length kernelBytes signals that we should evaluate expression in dart1
- // mode.
- // TODO(aam): When dart1 is no longer supported we need to return error
- // here.
- JSONObject report(js);
- const uint8_t kernel_bytes[] = {0};
- report.AddPropertyBase64("kernelBytes", kernel_bytes, 0);
+ js->PrintError(
+ kExpressionCompilationError,
+ "%s: No compilation service available; cannot evaluate from source.",
+ js->method());
return true;
}
diff --git a/runtime/vm/service/service.md b/runtime/vm/service/service.md
index 1eed739..fea5883 100644
--- a/runtime/vm/service/service.md
+++ b/runtime/vm/service/service.md
@@ -418,9 +418,9 @@
document to the true VM service.
When DDS connects to the VM service, the VM service enters single client
-mode and will no longer accept incoming web socket connections. If DDS
-disconnects from the VM service, the VM service will once again start accepting
-incoming web socket connections.
+mode and will no longer accept incoming web socket connections, instead forwarding
+the web socket connection request to DDS. If DDS disconnects from the VM service,
+the VM service will once again start accepting incoming web socket connections.
### Protocol Extensions
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 4667869..e5dc028 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -425,6 +425,7 @@
V(_Uint8ClampedList, "_Uint8ClampedList") \
V(_Uint8List, "_Uint8List") \
V(_UserTag, "_UserTag") \
+ V(_Utf8Decoder, "_Utf8Decoder") \
V(_VariableMirror, "_VariableMirror") \
V(_WeakProperty, "_WeakProperty") \
V(_classRangeCheck, "_classRangeCheck") \
@@ -441,6 +442,7 @@
V(_resultOrListeners, "_resultOrListeners") \
V(_runExtension, "_runExtension") \
V(_runPendingImmediateCallback, "_runPendingImmediateCallback") \
+ V(_scanFlags, "_scanFlags") \
V(_setLength, "_setLength") \
V(_simpleInstanceOf, "_simpleInstanceOf") \
V(_simpleInstanceOfFalse, "_simpleInstanceOfFalse") \
diff --git a/sdk/lib/_internal/vm/bin/vmservice_server.dart b/sdk/lib/_internal/vm/bin/vmservice_server.dart
index 26111d0..efc87eb 100644
--- a/sdk/lib/_internal/vm/bin/vmservice_server.dart
+++ b/sdk/lib/_internal/vm/bin/vmservice_server.dart
@@ -347,7 +347,6 @@
// Redirect to the same URI with the trailing '/' to correctly serve
// index.html.
request.response.redirect(result as Uri);
- request.response.close();
return;
}
@@ -360,11 +359,8 @@
new WebSocketClient(webSocket, _service);
});
} else {
- request.response.statusCode = HttpStatus.forbidden;
- request.response.write('Cannot connect directly to the VM service as '
- 'a Dart Development Service (DDS) instance has taken control and '
- 'can be found at ${_service.ddsUri}.');
- request.response.close();
+ // Forward the websocket connection request to DDS.
+ request.response.redirect(_service.ddsUri);
}
return;
}
diff --git a/sdk/lib/_internal/vm/lib/class_id_fasta.dart b/sdk/lib/_internal/vm/lib/class_id_fasta.dart
index e7e94ad..8b7064e 100644
--- a/sdk/lib/_internal/vm/lib/class_id_fasta.dart
+++ b/sdk/lib/_internal/vm/lib/class_id_fasta.dart
@@ -29,5 +29,15 @@
@pragma("vm:entry-point")
static final int cidUint8Array = 0;
@pragma("vm:entry-point")
+ static final int cidInt8ArrayView = 0;
+ @pragma("vm:entry-point")
static final int cidInt8Array = 0;
+ @pragma("vm:entry-point")
+ static final int cidExternalUint8Array = 0;
+ @pragma("vm:entry-point")
+ static final int cidExternalInt8Array = 0;
+ @pragma("vm:entry-point")
+ static final int cidUint8ClampedArray = 0;
+ @pragma("vm:entry-point")
+ static final int cidExternalUint8ClampedArray = 0;
}
diff --git a/sdk/lib/_internal/vm/lib/convert_patch.dart b/sdk/lib/_internal/vm/lib/convert_patch.dart
index 9191e40..14a2c17 100644
--- a/sdk/lib/_internal/vm/lib/convert_patch.dart
+++ b/sdk/lib/_internal/vm/lib/convert_patch.dart
@@ -16,6 +16,7 @@
ClassID,
patch,
POWERS_OF_TEN,
+ unsafeCast,
writeIntoOneByteString,
writeIntoTwoByteString;
@@ -1669,6 +1670,9 @@
"QQQQQQQQQQQQQQQQRRRRRbbbbbbbbbbb" // E0-FF
;
+ /// Max chunk to scan at a time. Avoids staying away from safepoints too long.
+ static const int scanChunkSize = 65536;
+
/// Reset the decoder to a state where it is ready to decode a new string but
/// will not skip a leading BOM. Used by the fused UTF-8 / JSON decoder.
void reset() {
@@ -1676,6 +1680,43 @@
_bomIndex = -1;
}
+ @pragma("vm:prefer-inline")
+ int scan(Uint8List bytes, int start, int end) {
+ // Assumes 0 <= start <= end <= bytes.length
+ int size = 0;
+ _scanFlags = 0;
+ int localStart = start;
+ while (end - localStart > scanChunkSize) {
+ int localEnd = localStart + scanChunkSize;
+ size += _scan(bytes, localStart, localEnd, scanTable);
+ localStart = localEnd;
+ }
+ size += _scan(bytes, localStart, end, scanTable);
+ return size;
+ }
+
+ // This method is recognized by the VM and compiled into specialized code.
+ @pragma("vm:prefer-inline")
+ int _scan(Uint8List bytes, int start, int end, String scanTable) {
+ int size = 0;
+ int flags = 0;
+ for (int i = start; i < end; i++) {
+ int t = scanTable.codeUnitAt(bytes[i]);
+ size += t & sizeMask;
+ flags |= t;
+ }
+ _scanFlags |= flags & flagsMask;
+ return size;
+ }
+
+ @pragma("vm:prefer-inline")
+ static bool _isNativeUint8List(List<int> codeUnits) {
+ final int cid = ClassID.getID(codeUnits);
+ return cid == ClassID.cidUint8ArrayView ||
+ cid == ClassID.cidUint8Array ||
+ cid == ClassID.cidExternalUint8Array;
+ }
+
// The VM decoder handles BOM explicitly instead of via the state machine.
@patch
_Utf8Decoder(this.allowMalformed) : _state = initial;
@@ -1687,8 +1728,8 @@
// Have bytes as Uint8List.
Uint8List bytes;
int errorOffset;
- if (codeUnits is Uint8List) {
- bytes = codeUnits;
+ if (_isNativeUint8List(codeUnits)) {
+ bytes = unsafeCast<Uint8List>(codeUnits);
errorOffset = 0;
} else {
bytes = _makeUint8List(codeUnits, start, end);
@@ -1752,8 +1793,8 @@
// Have bytes as Uint8List.
Uint8List bytes;
int errorOffset;
- if (codeUnits is Uint8List) {
- bytes = codeUnits;
+ if (_isNativeUint8List(codeUnits)) {
+ bytes = unsafeCast<Uint8List>(codeUnits);
errorOffset = 0;
} else {
bytes = _makeUint8List(codeUnits, start, end);
@@ -1889,30 +1930,6 @@
return i;
}
- // Scanning functions to compute the size of the resulting string and flags
- // (written to _scanFlags) indicating which decoder to use.
- // TODO(dartbug.com/41702): Intrinsify this function.
- int scan(Uint8List bytes, int start, int end) {
- _scanFlags = 0;
- for (int i = start; i < end; i++) {
- if (bytes[i] > 127) return i - start + scan2(bytes, i, end);
- }
- return end - start;
- }
-
- int scan2(Uint8List bytes, int start, int end) {
- final String scanTable = _Utf8Decoder.scanTable;
- int size = 0;
- int flags = 0;
- for (int i = start; i < end; i++) {
- int t = scanTable.codeUnitAt(bytes[i]);
- size += t & sizeMask;
- flags |= t;
- }
- _scanFlags = flags & flagsMask;
- return size;
- }
-
String decode8(Uint8List bytes, int start, int end, int size) {
assert(start < end);
// TODO(dartbug.com/41704): Allocate an uninitialized _OneByteString and
diff --git a/sdk_nnbd/lib/_internal/vm/bin/vmservice_server.dart b/sdk_nnbd/lib/_internal/vm/bin/vmservice_server.dart
index a45c806..4b30879 100644
--- a/sdk_nnbd/lib/_internal/vm/bin/vmservice_server.dart
+++ b/sdk_nnbd/lib/_internal/vm/bin/vmservice_server.dart
@@ -349,7 +349,6 @@
// Redirect to the same URI with the trailing '/' to correctly serve
// index.html.
request.response.redirect(result);
- request.response.close();
return;
}
@@ -362,11 +361,8 @@
WebSocketClient(webSocket, _service);
});
} else {
- request.response.statusCode = HttpStatus.forbidden;
- request.response.write('Cannot connect directly to the VM service as '
- 'a Dart Development Service (DDS) instance has taken control and '
- 'can be found at ${_service.ddsUri}.');
- request.response.close();
+ // Forward the websocket connection request to DDS.
+ request.response.redirect(_service.ddsUri);
}
return;
}
diff --git a/sdk_nnbd/lib/_internal/vm/lib/class_id_fasta.dart b/sdk_nnbd/lib/_internal/vm/lib/class_id_fasta.dart
index 9ca88ec..c81bd60 100644
--- a/sdk_nnbd/lib/_internal/vm/lib/class_id_fasta.dart
+++ b/sdk_nnbd/lib/_internal/vm/lib/class_id_fasta.dart
@@ -27,5 +27,15 @@
@pragma("vm:entry-point")
static final int cidUint8Array = 0;
@pragma("vm:entry-point")
+ static final int cidInt8ArrayView = 0;
+ @pragma("vm:entry-point")
static final int cidInt8Array = 0;
+ @pragma("vm:entry-point")
+ static final int cidExternalUint8Array = 0;
+ @pragma("vm:entry-point")
+ static final int cidExternalInt8Array = 0;
+ @pragma("vm:entry-point")
+ static final int cidUint8ClampedArray = 0;
+ @pragma("vm:entry-point")
+ static final int cidExternalUint8ClampedArray = 0;
}
diff --git a/sdk_nnbd/lib/_internal/vm/lib/convert_patch.dart b/sdk_nnbd/lib/_internal/vm/lib/convert_patch.dart
index 3044e01..6375c2b 100644
--- a/sdk_nnbd/lib/_internal/vm/lib/convert_patch.dart
+++ b/sdk_nnbd/lib/_internal/vm/lib/convert_patch.dart
@@ -14,6 +14,7 @@
ClassID,
patch,
POWERS_OF_TEN,
+ unsafeCast,
writeIntoOneByteString,
writeIntoTwoByteString;
@@ -1673,6 +1674,9 @@
"QQQQQQQQQQQQQQQQRRRRRbbbbbbbbbbb" // E0-FF
;
+ /// Max chunk to scan at a time. Avoids staying away from safepoints too long.
+ static const int scanChunkSize = 65536;
+
/// Reset the decoder to a state where it is ready to decode a new string but
/// will not skip a leading BOM. Used by the fused UTF-8 / JSON decoder.
void reset() {
@@ -1680,6 +1684,43 @@
_bomIndex = -1;
}
+ @pragma("vm:prefer-inline")
+ int scan(Uint8List bytes, int start, int end) {
+ // Assumes 0 <= start <= end <= bytes.length
+ int size = 0;
+ _scanFlags = 0;
+ int localStart = start;
+ while (end - localStart > scanChunkSize) {
+ int localEnd = localStart + scanChunkSize;
+ size += _scan(bytes, localStart, localEnd, scanTable);
+ localStart = localEnd;
+ }
+ size += _scan(bytes, localStart, end, scanTable);
+ return size;
+ }
+
+ // This method is recognized by the VM and compiled into specialized code.
+ @pragma("vm:prefer-inline")
+ int _scan(Uint8List bytes, int start, int end, String scanTable) {
+ int size = 0;
+ int flags = 0;
+ for (int i = start; i < end; i++) {
+ int t = scanTable.codeUnitAt(bytes[i]);
+ size += t & sizeMask;
+ flags |= t;
+ }
+ _scanFlags |= flags & flagsMask;
+ return size;
+ }
+
+ @pragma("vm:prefer-inline")
+ static bool _isNativeUint8List(List<int> array) {
+ final int cid = ClassID.getID(array);
+ return cid == ClassID.cidUint8ArrayView ||
+ cid == ClassID.cidUint8Array ||
+ cid == ClassID.cidExternalUint8Array;
+ }
+
// The VM decoder handles BOM explicitly instead of via the state machine.
@patch
_Utf8Decoder(this.allowMalformed) : _state = initial;
@@ -1691,8 +1732,8 @@
// Have bytes as Uint8List.
Uint8List bytes;
int errorOffset;
- if (codeUnits is Uint8List) {
- bytes = codeUnits;
+ if (_isNativeUint8List(codeUnits)) {
+ bytes = unsafeCast<Uint8List>(codeUnits);
errorOffset = 0;
} else {
bytes = _makeUint8List(codeUnits, start, end);
@@ -1756,8 +1797,8 @@
// Have bytes as Uint8List.
Uint8List bytes;
int errorOffset;
- if (codeUnits is Uint8List) {
- bytes = codeUnits;
+ if (_isNativeUint8List(codeUnits)) {
+ bytes = unsafeCast<Uint8List>(codeUnits);
errorOffset = 0;
} else {
bytes = _makeUint8List(codeUnits, start, end);
@@ -1893,30 +1934,6 @@
return i;
}
- // Scanning functions to compute the size of the resulting string and flags
- // (written to _scanFlags) indicating which decoder to use.
- // TODO(dartbug.com/41702): Intrinsify this function.
- int scan(Uint8List bytes, int start, int end) {
- _scanFlags = 0;
- for (int i = start; i < end; i++) {
- if (bytes[i] > 127) return i - start + scan2(bytes, i, end);
- }
- return end - start;
- }
-
- int scan2(Uint8List bytes, int start, int end) {
- final String scanTable = _Utf8Decoder.scanTable;
- int size = 0;
- int flags = 0;
- for (int i = start; i < end; i++) {
- int t = scanTable.codeUnitAt(bytes[i]);
- size += t & sizeMask;
- flags |= t;
- }
- _scanFlags = flags & flagsMask;
- return size;
- }
-
String decode8(Uint8List bytes, int start, int end, int size) {
assert(start < end);
// TODO(dartbug.com/41704): Allocate an uninitialized _OneByteString and
diff --git a/tests/co19/co19-co19.status b/tests/co19/co19-co19.status
index 00bb904..9aea031 100644
--- a/tests/co19/co19-co19.status
+++ b/tests/co19/co19-co19.status
@@ -2,94 +2,38 @@
# 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.
-Language/Classes/*: Skip # Not migrated to NNBD
-Language/Classes/Abstract_Instance_Members/*: Skip # Not migrated to NNBD
-Language/Classes/Class_Member_Conflicts/*: Skip # Not migrated to NNBD
Language/Classes/Constructors/*: Skip # Not migrated to NNBD
Language/Classes/Constructors/Constant_Constructors/*: Skip # Not migrated to NNBD
Language/Classes/Constructors/Factories/*: Skip # Not migrated to NNBD
Language/Classes/Constructors/Generative_Constructors/*: Skip # Not migrated to NNBD
-Language/Classes/Getters/*: Skip # Not migrated to NNBD
-Language/Classes/Instance_Methods/*: Skip # Not migrated to NNBD
Language/Classes/Instance_Methods/Operators/*: Skip # Not migrated to NNBD
-Language/Classes/Instance_Variables/*: Skip # Not migrated to NNBD
-Language/Classes/Setters/*: Skip # Not migrated to NNBD
-Language/Classes/Static_Methods/*: Skip # Not migrated to NNBD
-Language/Classes/Static_Variables/*: Skip # Not migrated to NNBD
-Language/Classes/Superclasses/*: Skip # Not migrated to NNBD
Language/Classes/Superclasses/Inheritance_and_Overriding/*: Skip # Not migrated to NNBD
-Language/Classes/Superinterfaces/*: Skip # Not migrated to NNBD
-Language/Enums/*: Skip # Not migrated to NNBD
+Language/Enums/*: Skip # Not migrated to NNBD:
Language/Errors_and_Warnings/*: Skip # Not migrated to NNBD
-Language/Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Additive_Expressions/*: Skip # Not migrated to NNBD
Language/Expressions/Assignable_Expressions/*: Skip # Not migrated to NNBD
Language/Expressions/Assignment/*: Skip # Not migrated to NNBD
Language/Expressions/Assignment/Compound_Assignment/*: Skip # Not migrated to NNBD
-Language/Expressions/Await_Expressions/*: Skip # Not migrated to NNBD
Language/Expressions/Bitwise_Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Booleans/*: Skip # Not migrated to NNBD
Language/Expressions/Booleans/Boolean_Conversion/*: Skip # Not migrated to NNBD
-Language/Expressions/Conditional/*: Skip # Not migrated to NNBD
Language/Expressions/Constants/*: Skip # Not migrated to NNBD
Language/Expressions/Equality/*: Skip # Not migrated to NNBD
Language/Expressions/Function_Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Function_Invocation/*: Skip # Not migrated to NNBD
-Language/Expressions/Function_Invocation/Actual_Argument_List_Evaluation/*: Skip # Not migrated to NNBD
-Language/Expressions/Function_Invocation/Binding_Actuals_to_Formals/*: Skip # Not migrated to NNBD
-Language/Expressions/Function_Invocation/Function_Expression_Invocation/*: Skip # Not migrated to NNBD
-Language/Expressions/Function_Invocation/Unqualified_Invocation/*: Skip # Not migrated to NNBD
Language/Expressions/Identifier_Reference/*: Skip # Not migrated to NNBD
Language/Expressions/If_null_Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Instance_Creation/*: Skip # Not migrated to NNBD
Language/Expressions/Instance_Creation/Const/*: Skip # Not migrated to NNBD
Language/Expressions/Instance_Creation/New/*: Skip # Not migrated to NNBD
Language/Expressions/Lists/*: Skip # Not migrated to NNBD
-Language/Expressions/Logical_Boolean_Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Lookup/*: Skip # Not migrated to NNBD
-Language/Expressions/Lookup/Getter_and_Setter_Lookup/*: Skip # Not migrated to NNBD
-Language/Expressions/Lookup/Method_Lookup/*: Skip # Not migrated to NNBD
Language/Expressions/Maps/*: Skip # Not migrated to NNBD
-Language/Expressions/Method_Invocation/*: Skip # Not migrated to NNBD
-Language/Expressions/Method_Invocation/Cascaded_Invocations/*: Skip # Not migrated to NNBD
Language/Expressions/Method_Invocation/Ordinary_Invocation/*: Skip # Not migrated to NNBD
Language/Expressions/Method_Invocation/Super_Invocation/*: Skip # Not migrated to NNBD
-Language/Expressions/Multiplicative_Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Null/*: Skip # Not migrated to NNBD
-Language/Expressions/Numbers/*: Skip # Not migrated to NNBD
-Language/Expressions/Object_Identity/*: Skip # Not migrated to NNBD
-Language/Expressions/Postfix_Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Property_Extraction/*: Skip # Not migrated to NNBD
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/*: Skip # Not migrated to NNBD
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/*: Skip # Not migrated to NNBD
-Language/Expressions/Property_Extraction/Super_Closurization/*: Skip # Not migrated to NNBD
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/*: Skip # Not migrated to NNBD
-Language/Expressions/Relational_Expressions/*: Skip # Not migrated to NNBD
-Language/Expressions/Shift/*: Skip # Not migrated to NNBD
-Language/Expressions/Spawning_an_Isolate/*: Skip # Not migrated to NNBD
-Language/Expressions/Strings/*: Skip # Not migrated to NNBD
-Language/Expressions/Strings/String_Interpolation/*: Skip # Not migrated to NNBD
-Language/Expressions/Symbols/*: Skip # Not migrated to NNBD
-Language/Expressions/This/*: Skip # Not migrated to NNBD
-Language/Expressions/Throw/*: Skip # Not migrated to NNBD
-Language/Expressions/Top_level_Getter_Invocation/*: Skip # Not migrated to NNBD
-Language/Expressions/Type_Cast/*: Skip # Not migrated to NNBD
-Language/Expressions/Type_Test/*: Skip # Not migrated to NNBD
Language/Expressions/Unary_Expressions/*: Skip # Not migrated to NNBD
Language/Functions/*: Skip # Not migrated to NNBD
-Language/Functions/External_Functions/*: Skip # Not migrated to NNBD
-Language/Functions/Formal_Parameters/*: Skip # Not migrated to NNBD
-Language/Functions/Formal_Parameters/Optional_Formals/*: Skip # Not migrated to NNBD
-Language/Functions/Formal_Parameters/Required_Formals/*: Skip # Not migrated to NNBD
-Language/Functions/Function_Declarations/*: Skip # Not migrated to NNBD
-Language/Functions/Type_of_a_Function/*: Skip # Not migrated to NNBD
Language/Generics/*: Skip # Not migrated to NNBD
Language/Generics/Superbounded_types/*: Skip # Not migrated to NNBD
Language/Interfaces/Superinterfaces/*: Skip # Not migrated to NNBD
Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/*: Skip # Not migrated to NNBD
Language/Libraries_and_Scripts/*: Skip # Not migrated to NNBD
Language/Libraries_and_Scripts/Exports/*: Skip # Not migrated to NNBD
-Language/Libraries_and_Scripts/Imports/*: Skip # Not migrated to NNBD
Language/Libraries_and_Scripts/Parts/*: Skip # Not migrated to NNBD
Language/Libraries_and_Scripts/Scripts/*: Skip # Not migrated to NNBD
Language/Libraries_and_Scripts/URIs/*: Skip # Not migrated to NNBD
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index dddded9..7fae7f3 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -4,6 +4,13 @@
[ $compiler == dart2js ]
Language/Expressions/Null/instance_of_class_null_t01: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/522.
+Language/Expressions/Numbers/integer_size_t03: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Numbers/static_type_of_int_t01: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Numbers/syntax_t06: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Numbers/syntax_t09: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Object_Identity/object_t02: SkipByDesign # https://github.com/dart-lang/sdk/issues/42222#issuecomment-640431711
+Language/Expressions/Shift/integer_t01: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Shift/integer_t02: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign
Language/Metadata/before*: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/523.
LibTest/io/*: SkipByDesign # dart:io not supported.
diff --git a/tests/co19/co19-dartdevc.status b/tests/co19/co19-dartdevc.status
index 087f30b..1361ff8 100644
--- a/tests/co19/co19-dartdevc.status
+++ b/tests/co19/co19-dartdevc.status
@@ -55,6 +55,13 @@
Language/Expressions/Function_Invocation/async_generator_invokation_t08: Skip # Times out
Language/Expressions/Function_Invocation/async_generator_invokation_t10: Skip # Times out
Language/Expressions/Null/instance_of_class_null_t01: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/522.
+Language/Expressions/Numbers/integer_size_t03: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Numbers/static_type_of_int_t01: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Numbers/syntax_t06: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Numbers/syntax_t09: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Object_Identity/object_t02: SkipByDesign # https://github.com/dart-lang/sdk/issues/42222#issuecomment-640431711
+Language/Expressions/Shift/integer_t01: SkipByDesign # big integer cannot be represented in JavaScript
+Language/Expressions/Shift/integer_t02: SkipByDesign # big integer cannot be represented in JavaScript
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign # dart:isolate not supported.
Language/Metadata/before*: Skip # dart:mirrors not supported https://github.com/dart-lang/co19/issues/523.
Language/Types/Interface_Types/subtype_t27: Skip # Times out
diff --git a/tests/dart2js_2/41449a_test.dart b/tests/dart2js_2/41449a_test.dart
new file mode 100644
index 0000000..435ac7b
--- /dev/null
+++ b/tests/dart2js_2/41449a_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2020, 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.
+//
+// dart2jsOptions=-O0
+
+// @dart = 2.7
+
+// Regression test for passing type parameters through call-through stub.
+//
+// We use an abstract class with two implementations to avoid the optimizer
+// 'inlining' the call-through stub, so we are testing that the stub itself
+// passes through the type parameters.
+
+import 'package:expect/expect.dart';
+
+abstract class AAA {
+ dynamic get foo;
+}
+
+class B1 implements AAA {
+ final dynamic foo;
+ B1(this.foo);
+}
+
+class B2 implements AAA {
+ final dynamic _arr;
+ B2(foo) : _arr = [foo];
+ dynamic get foo => _arr.first;
+}
+
+@pragma('dart2js:noInline')
+test1<T>(AAA a, String expected) {
+ // call-through getter 'foo' with one type argument.
+ Expect.equals(expected, a.foo<T>());
+}
+
+@pragma('dart2js:noInline')
+test2<U, V>(AAA a, String expected) {
+ // call-through getter 'foo' with two type arguments.
+ Expect.equals(expected, a.foo<U, V>());
+}
+
+main() {
+ test1<int>(B1(<P>() => '$P'), 'int');
+ test1<num>(B2(<Q>() => '$Q'), 'num');
+
+ test2<int, num>(B1(<A, B>() => '$A $B'), 'int num');
+ test2<num, int>(B2(<X, Y>() => '$X $Y'), 'num int');
+}
diff --git a/tests/dart2js_2/41449b_test.dart b/tests/dart2js_2/41449b_test.dart
new file mode 100644
index 0000000..f7bf8e5
--- /dev/null
+++ b/tests/dart2js_2/41449b_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2020, 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 = 2.7
+
+// This test is the same as 41449a_test.dart without forcing `-O0`.
+//
+// Regression test for passing type parameters through call-through stub.
+//
+// We use an abstract class with two implementations to avoid the optimizer
+// 'inlining' the call-through stub, so we are testing that the stub itself
+// passes through the type parameters.
+
+import 'package:expect/expect.dart';
+
+abstract class AAA {
+ dynamic get foo;
+}
+
+class B1 implements AAA {
+ final dynamic foo;
+ B1(this.foo);
+}
+
+class B2 implements AAA {
+ final dynamic _arr;
+ B2(foo) : _arr = [foo];
+ dynamic get foo => _arr.first;
+}
+
+@pragma('dart2js:noInline')
+test1<T>(AAA a, String expected) {
+ // call-through getter 'foo' with one type argument.
+ Expect.equals(expected, a.foo<T>());
+}
+
+@pragma('dart2js:noInline')
+test2<U, V>(AAA a, String expected) {
+ // call-through getter 'foo' with two type arguments.
+ Expect.equals(expected, a.foo<U, V>());
+}
+
+main() {
+ test1<int>(B1(<P>() => '$P'), 'int');
+ test1<num>(B2(<Q>() => '$Q'), 'num');
+
+ test2<int, num>(B1(<A, B>() => '$A $B'), 'int num');
+ test2<num, int>(B2(<X, Y>() => '$X $Y'), 'num int');
+}
diff --git a/tests/dart2js_2/42189_test.dart b/tests/dart2js_2/42189_test.dart
new file mode 100644
index 0000000..e1bf87e
--- /dev/null
+++ b/tests/dart2js_2/42189_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2020, 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.
+//
+// dart2jsOptions=-O0
+
+// @dart = 2.7
+
+// Regression test for issue 42891. The root cause was a malformed SSA due to
+// generating a dynamic entry point argument test for an elided parameter
+// directly on the HLocalValue , which should only be an operand to HLocalGet
+// and HLocalSet.
+
+import "package:expect/expect.dart";
+
+class CCC {
+ void foo([num x = 123]) {
+ try {
+ Expect.equals(123, x);
+ x = 0;
+ } finally {
+ Expect.equals(0, x);
+ }
+ }
+
+ void bar([num x = 456]) {
+ try {
+ Expect.equals(123, x);
+ x = 0;
+ } finally {
+ Expect.equals(0, x);
+ }
+ }
+}
+
+void main() {
+ CCC().foo();
+ CCC().bar(123);
+}
diff --git a/tests/compiler/dart2js_native/abstract_class_test.dart b/tests/dart2js_2/native/abstract_class_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/abstract_class_test.dart
rename to tests/dart2js_2/native/abstract_class_test.dart
diff --git a/tests/compiler/dart2js_native/bound_closure_super_test.dart b/tests/dart2js_2/native/bound_closure_super_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/bound_closure_super_test.dart
rename to tests/dart2js_2/native/bound_closure_super_test.dart
diff --git a/tests/compiler/dart2js_native/bound_closure_test.dart b/tests/dart2js_2/native/bound_closure_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/bound_closure_test.dart
rename to tests/dart2js_2/native/bound_closure_test.dart
diff --git a/tests/compiler/dart2js_native/browser_compat_1_prepatched_test.dart b/tests/dart2js_2/native/browser_compat_1_prepatched_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/browser_compat_1_prepatched_test.dart
rename to tests/dart2js_2/native/browser_compat_1_prepatched_test.dart
diff --git a/tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart b/tests/dart2js_2/native/browser_compat_1_unpatched_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/browser_compat_1_unpatched_test.dart
rename to tests/dart2js_2/native/browser_compat_1_unpatched_test.dart
diff --git a/tests/compiler/dart2js_native/browser_compat_2_test.dart b/tests/dart2js_2/native/browser_compat_2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/browser_compat_2_test.dart
rename to tests/dart2js_2/native/browser_compat_2_test.dart
diff --git a/tests/compiler/dart2js_native/catch_javascript_null_stack_trace_test.dart b/tests/dart2js_2/native/catch_javascript_null_stack_trace_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/catch_javascript_null_stack_trace_test.dart
rename to tests/dart2js_2/native/catch_javascript_null_stack_trace_test.dart
diff --git a/tests/compiler/dart2js_native/compiler_test_internals.dart b/tests/dart2js_2/native/compiler_test_internals.dart
similarity index 100%
rename from tests/compiler/dart2js_native/compiler_test_internals.dart
rename to tests/dart2js_2/native/compiler_test_internals.dart
diff --git a/tests/compiler/dart2js_native/compute_this_script_test.dart b/tests/dart2js_2/native/compute_this_script_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/compute_this_script_test.dart
rename to tests/dart2js_2/native/compute_this_script_test.dart
diff --git a/tests/compiler/dart2js_native/core_type_check_native_test.dart b/tests/dart2js_2/native/core_type_check_native_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/core_type_check_native_test.dart
rename to tests/dart2js_2/native/core_type_check_native_test.dart
diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/dart2js_2/native/dart2js_native.status
similarity index 100%
rename from tests/compiler/dart2js_native/dart2js_native.status
rename to tests/dart2js_2/native/dart2js_native.status
diff --git a/tests/compiler/dart2js_native/dispatch_property_initialization_test.dart b/tests/dart2js_2/native/dispatch_property_initialization_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/dispatch_property_initialization_test.dart
rename to tests/dart2js_2/native/dispatch_property_initialization_test.dart
diff --git a/tests/compiler/dart2js_native/downcast_test.dart b/tests/dart2js_2/native/downcast_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/downcast_test.dart
rename to tests/dart2js_2/native/downcast_test.dart
diff --git a/tests/compiler/dart2js_native/error_safeToString_test.dart b/tests/dart2js_2/native/error_safeToString_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/error_safeToString_test.dart
rename to tests/dart2js_2/native/error_safeToString_test.dart
diff --git a/tests/compiler/dart2js_native/event_loop_test.dart b/tests/dart2js_2/native/event_loop_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/event_loop_test.dart
rename to tests/dart2js_2/native/event_loop_test.dart
diff --git a/tests/compiler/dart2js_native/fake_thing_2_test.dart b/tests/dart2js_2/native/fake_thing_2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/fake_thing_2_test.dart
rename to tests/dart2js_2/native/fake_thing_2_test.dart
diff --git a/tests/compiler/dart2js_native/fake_thing_test.dart b/tests/dart2js_2/native/fake_thing_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/fake_thing_test.dart
rename to tests/dart2js_2/native/fake_thing_test.dart
diff --git a/tests/compiler/dart2js_native/field_type2_test.dart b/tests/dart2js_2/native/field_type2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/field_type2_test.dart
rename to tests/dart2js_2/native/field_type2_test.dart
diff --git a/tests/compiler/dart2js_native/field_type_test.dart b/tests/dart2js_2/native/field_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/field_type_test.dart
rename to tests/dart2js_2/native/field_type_test.dart
diff --git a/tests/compiler/dart2js_native/fixup_get_tag_test.dart b/tests/dart2js_2/native/fixup_get_tag_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/fixup_get_tag_test.dart
rename to tests/dart2js_2/native/fixup_get_tag_test.dart
diff --git a/tests/compiler/dart2js_native/foreign_test.dart b/tests/dart2js_2/native/foreign_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/foreign_test.dart
rename to tests/dart2js_2/native/foreign_test.dart
diff --git a/tests/compiler/dart2js_native/hash_code_test.dart b/tests/dart2js_2/native/hash_code_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/hash_code_test.dart
rename to tests/dart2js_2/native/hash_code_test.dart
diff --git a/tests/compiler/dart2js_native/inference_of_helper_methods_test.dart b/tests/dart2js_2/native/inference_of_helper_methods_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/inference_of_helper_methods_test.dart
rename to tests/dart2js_2/native/inference_of_helper_methods_test.dart
diff --git a/tests/compiler/dart2js_native/internal_library_test.dart b/tests/dart2js_2/native/internal_library_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/internal_library_test.dart
rename to tests/dart2js_2/native/internal_library_test.dart
diff --git a/tests/compiler/dart2js_native/is_check_test.dart b/tests/dart2js_2/native/is_check_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/is_check_test.dart
rename to tests/dart2js_2/native/is_check_test.dart
diff --git a/tests/compiler/dart2js_native/issue9182_test.dart b/tests/dart2js_2/native/issue9182_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/issue9182_test.dart
rename to tests/dart2js_2/native/issue9182_test.dart
diff --git a/tests/compiler/dart2js_native/js_const_test.dart b/tests/dart2js_2/native/js_const_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/js_const_test.dart
rename to tests/dart2js_2/native/js_const_test.dart
diff --git a/tests/compiler/dart2js_native/js_constant_test.dart b/tests/dart2js_2/native/js_constant_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/js_constant_test.dart
rename to tests/dart2js_2/native/js_constant_test.dart
diff --git a/tests/compiler/dart2js_native/jsobject_test.dart b/tests/dart2js_2/native/jsobject_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/jsobject_test.dart
rename to tests/dart2js_2/native/jsobject_test.dart
diff --git a/tests/compiler/dart2js_native/load_elim_refinement_test.dart b/tests/dart2js_2/native/load_elim_refinement_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/load_elim_refinement_test.dart
rename to tests/dart2js_2/native/load_elim_refinement_test.dart
diff --git a/tests/compiler/dart2js_native/native_call_arity1_frog_test.dart b/tests/dart2js_2/native/native_call_arity1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_call_arity1_frog_test.dart
rename to tests/dart2js_2/native/native_call_arity1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_call_arity2_frog_test.dart b/tests/dart2js_2/native/native_call_arity2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_call_arity2_frog_test.dart
rename to tests/dart2js_2/native/native_call_arity2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_call_arity3_frog_test.dart b/tests/dart2js_2/native/native_call_arity3_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_call_arity3_frog_test.dart
rename to tests/dart2js_2/native/native_call_arity3_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_checked_arguments1_frog_test.dart b/tests/dart2js_2/native/native_checked_arguments1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_checked_arguments1_frog_test.dart
rename to tests/dart2js_2/native/native_checked_arguments1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_checked_fields_frog_test.dart b/tests/dart2js_2/native/native_checked_fields_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_checked_fields_frog_test.dart
rename to tests/dart2js_2/native/native_checked_fields_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_avoids_hidden_name_frog_test.dart b/tests/dart2js_2/native/native_class_avoids_hidden_name_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_avoids_hidden_name_frog_test.dart
rename to tests/dart2js_2/native/native_class_avoids_hidden_name_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_fields_2_test.dart b/tests/dart2js_2/native/native_class_fields_2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_fields_2_test.dart
rename to tests/dart2js_2/native/native_class_fields_2_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_fields_3_test.dart b/tests/dart2js_2/native/native_class_fields_3_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_fields_3_test.dart
rename to tests/dart2js_2/native/native_class_fields_3_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_fields_test.dart b/tests/dart2js_2/native/native_class_fields_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_fields_test.dart
rename to tests/dart2js_2/native/native_class_fields_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart b/tests/dart2js_2/native/native_class_inheritance1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_inheritance1_frog_test.dart
rename to tests/dart2js_2/native/native_class_inheritance1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_inheritance2_frog_test.dart b/tests/dart2js_2/native/native_class_inheritance2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_inheritance2_frog_test.dart
rename to tests/dart2js_2/native/native_class_inheritance2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_inheritance3_frog_test.dart b/tests/dart2js_2/native/native_class_inheritance3_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_inheritance3_frog_test.dart
rename to tests/dart2js_2/native/native_class_inheritance3_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_inheritance4_frog_test.dart b/tests/dart2js_2/native/native_class_inheritance4_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_inheritance4_frog_test.dart
rename to tests/dart2js_2/native/native_class_inheritance4_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_is_check1_frog_test.dart b/tests/dart2js_2/native/native_class_is_check1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_is_check1_frog_test.dart
rename to tests/dart2js_2/native/native_class_is_check1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_is_check3_frog_test.dart b/tests/dart2js_2/native/native_class_is_check3_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_is_check3_frog_test.dart
rename to tests/dart2js_2/native/native_class_is_check3_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_class_with_dart_methods_frog_test.dart b/tests/dart2js_2/native/native_class_with_dart_methods_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_class_with_dart_methods_frog_test.dart
rename to tests/dart2js_2/native/native_class_with_dart_methods_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_closure_identity_frog_test.dart b/tests/dart2js_2/native/native_closure_identity_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_closure_identity_frog_test.dart
rename to tests/dart2js_2/native/native_closure_identity_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_constructor_name_test.dart b/tests/dart2js_2/native/native_constructor_name_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_constructor_name_test.dart
rename to tests/dart2js_2/native/native_constructor_name_test.dart
diff --git a/tests/compiler/dart2js_native/native_equals_frog_test.dart b/tests/dart2js_2/native/native_equals_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_equals_frog_test.dart
rename to tests/dart2js_2/native/native_equals_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_exception2_test.dart b/tests/dart2js_2/native/native_exception2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_exception2_test.dart
rename to tests/dart2js_2/native/native_exception2_test.dart
diff --git a/tests/compiler/dart2js_native/native_exception_test.dart b/tests/dart2js_2/native/native_exception_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_exception_test.dart
rename to tests/dart2js_2/native/native_exception_test.dart
diff --git a/tests/compiler/dart2js_native/native_exceptions1_frog_test.dart b/tests/dart2js_2/native/native_exceptions1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_exceptions1_frog_test.dart
rename to tests/dart2js_2/native/native_exceptions1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_invocation2_test.dart b/tests/dart2js_2/native/native_field_invocation2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_invocation2_test.dart
rename to tests/dart2js_2/native/native_field_invocation2_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_invocation3_test.dart b/tests/dart2js_2/native/native_field_invocation3_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_invocation3_test.dart
rename to tests/dart2js_2/native/native_field_invocation3_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_invocation4_test.dart b/tests/dart2js_2/native/native_field_invocation4_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_invocation4_test.dart
rename to tests/dart2js_2/native/native_field_invocation4_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_invocation5_test.dart b/tests/dart2js_2/native/native_field_invocation5_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_invocation5_test.dart
rename to tests/dart2js_2/native/native_field_invocation5_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_invocation6_test.dart b/tests/dart2js_2/native/native_field_invocation6_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_invocation6_test.dart
rename to tests/dart2js_2/native/native_field_invocation6_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_invocation_test.dart b/tests/dart2js_2/native/native_field_invocation_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_invocation_test.dart
rename to tests/dart2js_2/native/native_field_invocation_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_name_test.dart b/tests/dart2js_2/native/native_field_name_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_name_test.dart
rename to tests/dart2js_2/native/native_field_name_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_optimization_test.dart b/tests/dart2js_2/native/native_field_optimization_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_optimization_test.dart
rename to tests/dart2js_2/native/native_field_optimization_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_rename_1_frog_test.dart b/tests/dart2js_2/native/native_field_rename_1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_rename_1_frog_test.dart
rename to tests/dart2js_2/native/native_field_rename_1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_field_rename_2_frog_test.dart b/tests/dart2js_2/native/native_field_rename_2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_field_rename_2_frog_test.dart
rename to tests/dart2js_2/native/native_field_rename_2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_library_same_name_used_frog_test.dart b/tests/dart2js_2/native/native_library_same_name_used_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_library_same_name_used_frog_test.dart
rename to tests/dart2js_2/native/native_library_same_name_used_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_library_same_name_used_lib1.dart b/tests/dart2js_2/native/native_library_same_name_used_lib1.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_library_same_name_used_lib1.dart
rename to tests/dart2js_2/native/native_library_same_name_used_lib1.dart
diff --git a/tests/compiler/dart2js_native/native_library_same_name_used_lib2.dart b/tests/dart2js_2/native/native_library_same_name_used_lib2.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_library_same_name_used_lib2.dart
rename to tests/dart2js_2/native/native_library_same_name_used_lib2.dart
diff --git a/tests/compiler/dart2js_native/native_method_inlining_test.dart b/tests/dart2js_2/native/native_method_inlining_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_method_inlining_test.dart
rename to tests/dart2js_2/native/native_method_inlining_test.dart
diff --git a/tests/compiler/dart2js_native/native_method_rename1_frog_test.dart b/tests/dart2js_2/native/native_method_rename1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_method_rename1_frog_test.dart
rename to tests/dart2js_2/native/native_method_rename1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_method_rename2_frog_test.dart b/tests/dart2js_2/native/native_method_rename2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_method_rename2_frog_test.dart
rename to tests/dart2js_2/native/native_method_rename2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_method_rename3_frog_test.dart b/tests/dart2js_2/native/native_method_rename3_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_method_rename3_frog_test.dart
rename to tests/dart2js_2/native/native_method_rename3_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_method_with_keyword_name_test.dart b/tests/dart2js_2/native/native_method_with_keyword_name_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_method_with_keyword_name_test.dart
rename to tests/dart2js_2/native/native_method_with_keyword_name_test.dart
diff --git a/tests/compiler/dart2js_native/native_missing_method1_frog_test.dart b/tests/dart2js_2/native/native_missing_method1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_missing_method1_frog_test.dart
rename to tests/dart2js_2/native/native_missing_method1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_missing_method2_frog_test.dart b/tests/dart2js_2/native/native_missing_method2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_missing_method2_frog_test.dart
rename to tests/dart2js_2/native/native_missing_method2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_mixin_field2_test.dart b/tests/dart2js_2/native/native_mixin_field2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_mixin_field2_test.dart
rename to tests/dart2js_2/native/native_mixin_field2_test.dart
diff --git a/tests/compiler/dart2js_native/native_mixin_field_test.dart b/tests/dart2js_2/native/native_mixin_field_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_mixin_field_test.dart
rename to tests/dart2js_2/native/native_mixin_field_test.dart
diff --git a/tests/compiler/dart2js_native/native_mixin_multiple2_test.dart b/tests/dart2js_2/native/native_mixin_multiple2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_mixin_multiple2_test.dart
rename to tests/dart2js_2/native/native_mixin_multiple2_test.dart
diff --git a/tests/compiler/dart2js_native/native_mixin_multiple3_test.dart b/tests/dart2js_2/native/native_mixin_multiple3_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_mixin_multiple3_test.dart
rename to tests/dart2js_2/native/native_mixin_multiple3_test.dart
diff --git a/tests/compiler/dart2js_native/native_mixin_multiple_test.dart b/tests/dart2js_2/native/native_mixin_multiple_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_mixin_multiple_test.dart
rename to tests/dart2js_2/native/native_mixin_multiple_test.dart
diff --git a/tests/compiler/dart2js_native/native_mixin_test.dart b/tests/dart2js_2/native/native_mixin_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_mixin_test.dart
rename to tests/dart2js_2/native/native_mixin_test.dart
diff --git a/tests/compiler/dart2js_native/native_mixin_with_plain_test.dart b/tests/dart2js_2/native/native_mixin_with_plain_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_mixin_with_plain_test.dart
rename to tests/dart2js_2/native/native_mixin_with_plain_test.dart
diff --git a/tests/compiler/dart2js_native/native_named_constructors2_frog_test.dart b/tests/dart2js_2/native/native_named_constructors2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_named_constructors2_frog_test.dart
rename to tests/dart2js_2/native/native_named_constructors2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_named_constructors3_frog_test.dart b/tests/dart2js_2/native/native_named_constructors3_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_named_constructors3_frog_test.dart
rename to tests/dart2js_2/native/native_named_constructors3_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception2_frog_test.dart b/tests/dart2js_2/native/native_no_such_method_exception2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_no_such_method_exception2_frog_test.dart
rename to tests/dart2js_2/native/native_no_such_method_exception2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_no_such_method_exception_frog_test.dart b/tests/dart2js_2/native/native_no_such_method_exception_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_no_such_method_exception_frog_test.dart
rename to tests/dart2js_2/native/native_no_such_method_exception_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_novel_html_test.dart b/tests/dart2js_2/native/native_novel_html_test.dart
similarity index 95%
rename from tests/compiler/dart2js_native/native_novel_html_test.dart
rename to tests/dart2js_2/native/native_novel_html_test.dart
index fdd3e1f..5330028 100644
--- a/tests/compiler/dart2js_native/native_novel_html_test.dart
+++ b/tests/dart2js_2/native/native_novel_html_test.dart
@@ -10,7 +10,7 @@
@Native("HTMLElement")
class Element {
- String dartMethod(int x) => 'dartMethod(${nativeMethod(x+1)})';
+ String dartMethod(int x) => 'dartMethod(${nativeMethod(x + 1)})';
String nativeMethod(int x) native;
}
diff --git a/tests/compiler/dart2js_native/native_null_closure_frog_test.dart b/tests/dart2js_2/native/native_null_closure_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_null_closure_frog_test.dart
rename to tests/dart2js_2/native/native_null_closure_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_null_frog_test.dart b/tests/dart2js_2/native/native_null_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_null_frog_test.dart
rename to tests/dart2js_2/native/native_null_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_property_frog_test.dart b/tests/dart2js_2/native/native_property_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_property_frog_test.dart
rename to tests/dart2js_2/native/native_property_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_test.dart b/tests/dart2js_2/native/native_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_test.dart
rename to tests/dart2js_2/native/native_test.dart
diff --git a/tests/compiler/dart2js_native/native_testing.dart b/tests/dart2js_2/native/native_testing.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_testing.dart
rename to tests/dart2js_2/native/native_testing.dart
diff --git a/tests/compiler/dart2js_native/native_to_string_frog_test.dart b/tests/dart2js_2/native/native_to_string_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_to_string_frog_test.dart
rename to tests/dart2js_2/native/native_to_string_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_use_native_name_in_table_frog_test.dart b/tests/dart2js_2/native/native_use_native_name_in_table_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_use_native_name_in_table_frog_test.dart
rename to tests/dart2js_2/native/native_use_native_name_in_table_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_window1_frog_test.dart b/tests/dart2js_2/native/native_window1_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_window1_frog_test.dart
rename to tests/dart2js_2/native/native_window1_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_window2_frog_test.dart b/tests/dart2js_2/native/native_window2_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_window2_frog_test.dart
rename to tests/dart2js_2/native/native_window2_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_wrapping_function3_frog_test.dart b/tests/dart2js_2/native/native_wrapping_function3_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_wrapping_function3_frog_test.dart
rename to tests/dart2js_2/native/native_wrapping_function3_frog_test.dart
diff --git a/tests/compiler/dart2js_native/native_wrapping_function_frog_test.dart b/tests/dart2js_2/native/native_wrapping_function_frog_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/native_wrapping_function_frog_test.dart
rename to tests/dart2js_2/native/native_wrapping_function_frog_test.dart
diff --git a/tests/compiler/dart2js_native/oddly_named_fields_test.dart b/tests/dart2js_2/native/oddly_named_fields_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/oddly_named_fields_test.dart
rename to tests/dart2js_2/native/oddly_named_fields_test.dart
diff --git a/tests/compiler/dart2js_native/optimization_hints_test.dart b/tests/dart2js_2/native/optimization_hints_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/optimization_hints_test.dart
rename to tests/dart2js_2/native/optimization_hints_test.dart
diff --git a/tests/compiler/dart2js_native/rti_only_native_test.dart b/tests/dart2js_2/native/rti_only_native_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/rti_only_native_test.dart
rename to tests/dart2js_2/native/rti_only_native_test.dart
diff --git a/tests/compiler/dart2js_native/runtimetype_test.dart b/tests/dart2js_2/native/runtimetype_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/runtimetype_test.dart
rename to tests/dart2js_2/native/runtimetype_test.dart
diff --git a/tests/compiler/dart2js_native/static_methods_test.dart b/tests/dart2js_2/native/static_methods_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/static_methods_test.dart
rename to tests/dart2js_2/native/static_methods_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_1_test.dart b/tests/dart2js_2/native/subclassing_1_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_1_test.dart
rename to tests/dart2js_2/native/subclassing_1_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_2_test.dart b/tests/dart2js_2/native/subclassing_2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_2_test.dart
rename to tests/dart2js_2/native/subclassing_2_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_3_test.dart b/tests/dart2js_2/native/subclassing_3_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_3_test.dart
rename to tests/dart2js_2/native/subclassing_3_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_4_test.dart b/tests/dart2js_2/native/subclassing_4_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_4_test.dart
rename to tests/dart2js_2/native/subclassing_4_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_5_test.dart b/tests/dart2js_2/native/subclassing_5_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_5_test.dart
rename to tests/dart2js_2/native/subclassing_5_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_constructor_1_test.dart b/tests/dart2js_2/native/subclassing_constructor_1_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_constructor_1_test.dart
rename to tests/dart2js_2/native/subclassing_constructor_1_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_constructor_2_test.dart b/tests/dart2js_2/native/subclassing_constructor_2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_constructor_2_test.dart
rename to tests/dart2js_2/native/subclassing_constructor_2_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_super_call_test.dart b/tests/dart2js_2/native/subclassing_super_call_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_super_call_test.dart
rename to tests/dart2js_2/native/subclassing_super_call_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_super_field_1_test.dart b/tests/dart2js_2/native/subclassing_super_field_1_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_super_field_1_test.dart
rename to tests/dart2js_2/native/subclassing_super_field_1_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_super_field_2_test.dart b/tests/dart2js_2/native/subclassing_super_field_2_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_super_field_2_test.dart
rename to tests/dart2js_2/native/subclassing_super_field_2_test.dart
diff --git a/tests/compiler/dart2js_native/subclassing_type_test.dart b/tests/dart2js_2/native/subclassing_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/subclassing_type_test.dart
rename to tests/dart2js_2/native/subclassing_type_test.dart
diff --git a/tests/compiler/dart2js_native/super_call_test.dart b/tests/dart2js_2/native/super_call_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/super_call_test.dart
rename to tests/dart2js_2/native/super_call_test.dart
diff --git a/tests/compiler/dart2js_native/super_property_test.dart b/tests/dart2js_2/native/super_property_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/super_property_test.dart
rename to tests/dart2js_2/native/super_property_test.dart
diff --git a/tests/compiler/dart2js_native/type_error_decode_test.dart b/tests/dart2js_2/native/type_error_decode_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/type_error_decode_test.dart
rename to tests/dart2js_2/native/type_error_decode_test.dart
diff --git a/tests/compiler/dart2js_native/undefined_bailout_test.dart b/tests/dart2js_2/native/undefined_bailout_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/undefined_bailout_test.dart
rename to tests/dart2js_2/native/undefined_bailout_test.dart
diff --git a/tests/compiler/dart2js_native/uninstantiated_type_parameter_test.dart b/tests/dart2js_2/native/uninstantiated_type_parameter_test.dart
similarity index 100%
rename from tests/compiler/dart2js_native/uninstantiated_type_parameter_test.dart
rename to tests/dart2js_2/native/uninstantiated_type_parameter_test.dart
diff --git a/tests/language/closure/param_null_to_object_test.dart b/tests/language/closure/param_null_to_object_test.dart
index e34f400..b1139f3 100644
--- a/tests/language/closure/param_null_to_object_test.dart
+++ b/tests/language/closure/param_null_to_object_test.dart
@@ -28,4 +28,39 @@
Expect.isTrue(h is int Function(String));
Expect.isFalse(h is int Function(Object));
Expect.isFalse(h is int Function(Object?));
+
+ int Function(Null) i = (Null x) => 1; // Runtime type is int Function(Null)
+ Expect.isTrue(i is int Function(Null));
+ Expect.isTrue(i is int Function(Never));
+ Expect.isFalse(i is int Function(String));
+ Expect.isFalse(i is int Function(Object));
+ Expect.isFalse(i is int Function(Object?));
+
+ int Function(Never) j = (Never x) => 1; // Runtime type is int Function(Never)
+ Expect.isFalse(j is int Function(Null));
+ Expect.isTrue(j is int Function(Never));
+ Expect.isFalse(j is int Function(String));
+ Expect.isFalse(j is int Function(Object));
+ Expect.isFalse(j is int Function(Object?));
+
+ // Test that the criteria used for weakening the parameter type
+ // is that the downwards context parameter type is a subtype of Null
+ void test<X extends Null, Y extends Never>() {
+ int Function(X) f = (x) => 1; // Runtime type is int Function(Object?)
+ Expect.isTrue(f is int Function(Null));
+ Expect.isTrue(f is int Function(Never));
+ Expect.isTrue(f is int Function(String));
+ Expect.isTrue(f is int Function(Object));
+ Expect.isTrue(f is int Function(Object?));
+
+ int Function(Y) g = (x) => 1; // Runtime type is int Function(Object?)
+ Expect.isTrue(g is int Function(Null));
+ Expect.isTrue(g is int Function(Never));
+ Expect.isTrue(g is int Function(String));
+ Expect.isTrue(g is int Function(Object));
+ Expect.isTrue(g is int Function(Object?));
+ }
+
+ test<Null, Never>();
+ test<Never, Never>();
}
diff --git a/tests/language/generic_methods/fbounded_futureor_test.dart b/tests/language/generic_methods/fbounded_futureor_test.dart
new file mode 100644
index 0000000..14e41fa
--- /dev/null
+++ b/tests/language/generic_methods/fbounded_futureor_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2020, 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:async';
+import 'package:expect/expect.dart';
+
+void main() {
+ void f1<T extends FutureOr<T>>() {}
+ void f2<S extends FutureOr<S>>() {}
+
+ Expect.equals(f1.runtimeType, f2.runtimeType);
+}
diff --git a/tests/language/nnbd/const/potentially_constant_types_error_test.dart b/tests/language/nnbd/const/potentially_constant_types_error_test.dart
new file mode 100644
index 0000000..0242836
--- /dev/null
+++ b/tests/language/nnbd/const/potentially_constant_types_error_test.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2020, 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.
+
+// Requirements=nnbd-strong
+
+/// Test instance checks and casts in constants may use potentially constant
+/// types, and cause compile time errors when the casts fail.
+
+class C1<T> {
+ final t;
+
+ /// Check casts to T
+ const C1.test(dynamic x) : t = x as T;
+}
+
+class C2<T> {
+ final l;
+
+ /// Check casts to List<T>
+ const C2.test(dynamic x) : l = x as List<T>;
+}
+
+void main() {
+ const c1 = C1<int>.test("hello");
+ // ^
+ // [analyzer] unspecified
+ // [cfe] Constant evaluation error:
+ const c2 = C1<int>.test(null);
+ // ^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ const c3 = C2<int>.test(<num>[0]);
+ // ^
+ // [analyzer] unspecified
+ // [cfe] Constant evaluation error:
+ const c4 = C2<int>.test("hello");
+ // ^
+ // [analyzer] unspecified
+ // [cfe] Constant evaluation error:
+ const c5 = C2<int>.test(null);
+ // ^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+}
diff --git a/tests/language/nnbd/const/potentially_constant_types_test.dart b/tests/language/nnbd/const/potentially_constant_types_test.dart
new file mode 100644
index 0000000..7e45aeb
--- /dev/null
+++ b/tests/language/nnbd/const/potentially_constant_types_test.dart
@@ -0,0 +1,143 @@
+// Copyright (c) 2020, 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.
+
+// Requirements=nnbd-strong
+
+/// Test instance checks and casts in constants may use potentially constant
+/// types, and evaluate appropriately.
+
+import 'package:expect/expect.dart';
+
+class C<T> {
+ final bool isT;
+ final bool isListT;
+ final T? t;
+ final List<T>? l;
+
+ /// Check instance tests in isolation
+ const C.test1(dynamic x)
+ : isT = x is T,
+ isListT = x is List<T>,
+ t = null,
+ l = null;
+
+ /// Check casts to T in isolation
+ const C.test2(dynamic x)
+ : isT = true,
+ isListT = false,
+ t = x as T,
+ l = null;
+
+ /// Check casts to List<T> in isolation
+ const C.test3(dynamic x)
+ : isT = false,
+ isListT = true,
+ t = null,
+ l = x as List<T>;
+
+ /// Combine instance checks with casts, conditional expressions, promotion
+ const C.test4(dynamic x)
+ : isT = x is T,
+ isListT = x is List<T>,
+ t = (x is T) ? x : null,
+ l = (x is List<T>) ? x : null;
+}
+
+void main() {
+ {
+ // Test instance checks of T
+ const c1 = C<int>.test1(0);
+ const c2 = C<int>.test1(0);
+ const c3 = C<int>.test1(1);
+ const c4 = C<int>.test1("hello");
+ const c5 = C<int>.test1(null);
+ Expect.identical(c1, c2);
+ Expect.identical(c1, c3);
+ Expect.notIdentical(c1, c4);
+ Expect.notIdentical(c1, c5);
+ Expect.isTrue(c1.isT);
+ Expect.isTrue(c2.isT);
+ Expect.isTrue(c3.isT);
+ Expect.isFalse(c4.isT);
+ Expect.isFalse(c5.isT);
+ Expect.isFalse(c1.isListT);
+ Expect.isFalse(c2.isListT);
+ Expect.isFalse(c3.isListT);
+ Expect.isFalse(c4.isListT);
+ Expect.isFalse(c5.isListT);
+ }
+ {
+ // Test instance checks of List<T>
+ const c1 = C<int>.test1(<int>[0]);
+ const c2 = C<int>.test1(<int>[0]);
+ const c3 = C<int>.test1(<int>[1]);
+ const c4 = C<int>.test1(<num>[1]);
+ const c5 = C<num>.test1(<int>[1]);
+ Expect.identical(c1, c2);
+ Expect.identical(c1, c3);
+ Expect.notIdentical(c1, c4);
+ Expect.notIdentical(c1, c5);
+ Expect.notIdentical(c4, c5);
+ Expect.isFalse(c1.isT);
+ Expect.isFalse(c2.isT);
+ Expect.isFalse(c3.isT);
+ Expect.isFalse(c4.isT);
+ Expect.isFalse(c5.isT);
+ Expect.isTrue(c1.isListT);
+ Expect.isTrue(c2.isListT);
+ Expect.isTrue(c3.isListT);
+ Expect.isFalse(c4.isListT);
+ Expect.isTrue(c5.isListT);
+ }
+ {
+ // Test casts to T
+ const c1 = C<int>.test2(0);
+ const c2 = C<int>.test2(0);
+ const c3 = C<num>.test2(1);
+ Expect.identical(c1, c2);
+ Expect.notIdentical(c1, c3);
+ }
+ {
+ // Test casts to List<T>
+ const c1 = C<int>.test3(<int>[0]);
+ const c2 = C<int>.test3(<int>[0]);
+ const c3 = C<num>.test3(<int>[0]);
+ Expect.identical(c1, c2);
+ Expect.notIdentical(c1, c3);
+ }
+
+ {
+ // Combined tests
+ const c1 = C<num>.test4(0);
+ const c2 = C<num>.test4("hello");
+ const c3 = C<num>.test4(<int>[0]);
+ const c4 = C<num>.test4(<String>["hello"]);
+ const c5 = C<int>.test4(<num>[0]);
+
+ Expect.isTrue(c1.isT);
+ Expect.isFalse(c1.isListT);
+ Expect.equals(c1.t, 0);
+ Expect.equals(c1.l, null);
+
+ Expect.isFalse(c2.isT);
+ Expect.isFalse(c2.isListT);
+ Expect.equals(c2.t, null);
+ Expect.equals(c2.l, null);
+
+ Expect.isFalse(c3.isT);
+ Expect.isTrue(c3.isListT);
+ Expect.equals(c3.t, null);
+ Expect.identical(c3.l, const <int>[0]);
+
+ Expect.isFalse(c4.isT);
+ Expect.isFalse(c4.isListT);
+ Expect.equals(c4.t, null);
+ Expect.equals(c4.l, null);
+
+ Expect.isFalse(c5.isT);
+ Expect.isFalse(c5.isListT);
+ Expect.equals(c5.t, null);
+ Expect.equals(c5.l, null);
+ }
+}
diff --git a/tests/language/nnbd/never/never_error_test.dart b/tests/language/nnbd/never/never_error_test.dart
new file mode 100644
index 0000000..9ce7609
--- /dev/null
+++ b/tests/language/nnbd/never/never_error_test.dart
@@ -0,0 +1,126 @@
+// Copyright (c) 2020, 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.
+
+// Requirements=nnbd-strong
+
+/// Test that `Never` has all members, and that as a result no extensions
+/// apply to it. Also test that `Never` is inferred as the type of a
+/// throw expression, and as the return type of function literals that
+/// never return.
+
+import 'package:expect/expect.dart';
+
+/// A call of the form staticErrorIfNotNever(t) will produce a static error
+/// unless `t` has type `Never`.
+void staticErrorIfNotNever<T extends Never>(T t) {}
+
+void neverHasAllMembers(Never x) {
+ {
+ // getters
+ var t = x.arglebargle;
+ staticErrorIfNotNever(t);
+ }
+ {
+ // setter
+ x.arglebargle = 3;
+ }
+ {
+ // operator[]
+ x[0] = 3;
+ }
+ {
+ // methods
+ var t = x.arglebargle(0);
+ staticErrorIfNotNever(t);
+ }
+ {
+ // methods with named parameters
+ var t = x.arglebargle(foo: 0);
+ staticErrorIfNotNever(t);
+ }
+ {
+ // call method
+ var t = x(3);
+ staticErrorIfNotNever(t);
+ }
+ {
+ // Object members
+ staticErrorIfNotNever(x.toString());
+ staticErrorIfNotNever(x.toString);
+ staticErrorIfNotNever(x.runtimeType);
+ staticErrorIfNotNever(x.noSuchMethod);
+ staticErrorIfNotNever(x.noSuchMethod(x));
+ staticErrorIfNotNever(x.hashCode);
+ staticErrorIfNotNever(x == x);
+ staticErrorIfNotNever(x == 3);
+ staticErrorIfNotNever(3 == x);
+// ^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
+// [cfe] Inferred type argument 'bool' doesn't conform to the bound 'Never' of the type variable 'T' on 'staticErrorIfNotNever'.
+ }
+}
+
+extension NeverExt on Never {
+ int neverMethod() => 3;
+}
+
+extension ObjectExt on Object {
+ int objectMethod() => 3;
+}
+
+void extensionsDontApply(Never x) {
+ {
+ var t = x.neverMethod();
+ staticErrorIfNotNever(t);
+ }
+ {
+ var t = x.objectMethod();
+ staticErrorIfNotNever(t);
+ }
+ {
+ var t = NeverExt(x).neverMethod();
+ staticErrorIfNotNever(t);
+// ^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
+// [cfe] Inferred type argument 'int' doesn't conform to the bound 'Never' of the type variable 'T' on 'staticErrorIfNotNever'.
+ }
+ {
+ var t = ObjectExt(x).objectMethod();
+ staticErrorIfNotNever(t);
+// ^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.COULD_NOT_INFER
+// [cfe] Inferred type argument 'int' doesn't conform to the bound 'Never' of the type variable 'T' on 'staticErrorIfNotNever'.
+ }
+}
+
+void throwHasTypeNever() {
+ var t = throw "hello";
+ staticErrorIfNotNever(t);
+}
+
+void neverReturns(bool b) {
+ {
+ var f = () => throw "Unreachable";
+ var t = f();
+ staticErrorIfNotNever(t);
+ }
+ {
+ var f = () {
+ if (b) {
+ throw "argle";
+ } else {
+ throw "bargle";
+ }
+ };
+ var t = f();
+ staticErrorIfNotNever(t);
+ }
+}
+
+void main() {
+ neverHasAllMembers(throw "Unreachable");
+ extensionsDontApply(throw "Unreachable");
+ throwHasTypeNever();
+ neverReturns(true);
+}
diff --git a/tests/language/nnbd/static_errors/local_function_inference.dart b/tests/language/nnbd/static_errors/local_function_inference.dart
new file mode 100644
index 0000000..9cb6a37
--- /dev/null
+++ b/tests/language/nnbd/static_errors/local_function_inference.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2020, 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 that the type of a local function is an error if local function type
+/// inference requires the type of the function being inferred.
+
+void main() {
+ f() {
+ return 3;
+ }
+
+ f().arglebargle;
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'int'.
+ f().isEven; // Inferred type is int
+
+ g() {
+ if (f() == 3) {
+ return g();
+ } else {
+ return 3;
+ }
+ }
+ // ^
+ // [analyzer] undefined
+ // [cfe] undefined
+}
diff --git a/tests/language/nnbd/type_promotion/downwards_inference_error_test.dart b/tests/language/nnbd/type_promotion/downwards_inference_error_test.dart
new file mode 100644
index 0000000..d54b522
--- /dev/null
+++ b/tests/language/nnbd/type_promotion/downwards_inference_error_test.dart
@@ -0,0 +1,152 @@
+// Copyright (c) 2020, 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 that downwards inference uses the promoted type of the variable in an
+/// assignment as the context, but still considers the assignment as a valid
+/// promotion/demotion point.
+
+/// A generic class to serve as the base type.
+class C<S> {
+ S cMethod(S x) => x;
+}
+
+/// An inference context C<S> constrains the first type variable of D but not
+/// the second.
+class D<S, T> extends C<S> {
+ S dMethod1(S x) => x;
+ T dMethod2(T x) => x;
+}
+
+/// Generic function which if inferred in a context C<A> with argument type B,
+/// should infer to mkD<A, B>
+D<S, T> mkD<S, T>(T x) => D();
+
+/// Generic function which if inferred in a context D<S0, S1> with argument type
+/// D<T0, T1>, should infer to useD<T0>.
+C<T> useD<T>(D<T, int> d) => d;
+
+void main() {
+ {
+ C<String> x = C();
+
+ // Inference uses C<String> as a downwards context, constraining S from
+ // mkD<S,T> to String. Upwards inference constrains T to int. D<String,
+ // int> is not a type of interest so no promotion should happen.
+ {
+ // y has the type of the RHS of the assignment
+ var y = x = mkD(3);
+
+ // x still has type C<String>
+ x.dMethod1("hello");
+ //^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'dMethod1' isn't defined for the class 'C<String>'.
+ x.dMethod2(3);
+ //^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'dMethod2' isn't defined for the class 'C<String>'.
+
+ var t0 = x.cMethod("hello");
+ t0.length;
+ t0.arglebargle; // t0 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'String'.
+
+ // y has type D<String, int>
+ var t1 = y.dMethod1("hello");
+ t1.length;
+ t1.arglebargle; // t1 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'String'.
+ var t2 = y.dMethod2(3);
+ t2.isEven;
+ t2.arglebargle; // t2 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'int'.
+ }
+
+ // Establish D<String, int> as a type of interest
+ if (x is D<String, int>) {}
+ // Inference uses C<String> as a downwards context, constraining S from
+ // mkD<S,T> to String. Upwards inference constrains T to int. D<String,
+ // int> is a type of interest so promotion should happen.
+ {
+ // y has the type of the RHS of the assignment
+ var y = x = mkD(3);
+
+ // x has type D<String, int>
+ var t0 = x.dMethod1("hello");
+ t0.length;
+ t0.arglebargle; // t0 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'String'.
+ var t1 = x.dMethod2(3);
+ t1.isEven;
+ t1.arglebargle; // t1 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'int'.
+
+ // y has type D<String, int>
+ var t2 = y.dMethod1("hello");
+ t2.length;
+ t2.arglebargle; // t2 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'String'.
+ var t3 = y.dMethod2(3);
+ t3.isEven;
+ t3.arglebargle; // t3 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'int'.
+ }
+
+ // Inference should use D<String, int> as a downwards context, T from
+ // useD<T> to int. The variable x as an argument has type D<String, int>
+ // which is assignable to D<String, int> so the call should have no error.
+ // C<String> is a type of interest, so x should be demoted after the call.
+ {
+ // y has the type of the RHS of the assignment
+ var y = x = useD(x);
+
+ // x has type C<String>, and not D<String, int>
+ x.dMethod1("hello");
+ //^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'dMethod1' isn't defined for the class 'C<String>'.
+ x.dMethod2(3);
+ //^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'dMethod2' isn't defined for the class 'C<String>'.
+
+ var t0 = x.cMethod("hello");
+ t0.length;
+ t0.arglebargle; // t0 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'String'.
+
+ // C<String>, and not D<String, int>
+ y.dMethod1("hello");
+ //^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'dMethod1' isn't defined for the class 'C<String>'.
+ y.dMethod2(3);
+ //^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'dMethod2' isn't defined for the class 'C<String>'.
+ var t1 = y.cMethod("hello");
+ t1.length;
+ t1.arglebargle; // t0 is not dynamic
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'arglebargle' isn't defined for the class 'String'.
+ }
+ }
+}
diff --git a/tests/language/nnbd/typedef/typedef_error_test.dart b/tests/language/nnbd/typedef/typedef_error_test.dart
new file mode 100644
index 0000000..f1bed37
--- /dev/null
+++ b/tests/language/nnbd/typedef/typedef_error_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2020, 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.
+
+// Requirements=nnbd-weak
+
+/// Test that typedefs imported from opted out libraries are treated as
+/// non-nullable at the top level, with legacy components.
+
+import 'typedef_opted_out.dart';
+
+int? takesNonNullable(int x) {}
+void main() {
+ F f = null; // typedefs from opted out libraries are treated as non-nullable
+ // ^^^^
+ // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+ // [cfe] A value of type 'Null' can't be assigned to a variable of type 'int Function(int)'.
+
+ f = takesNonNullable; // F is int* Function(int*)
+ f(null); // F is int* Function(int*)
+}
diff --git a/tests/language/nnbd/typedef/typedef_opted_out.dart b/tests/language/nnbd/typedef/typedef_opted_out.dart
new file mode 100644
index 0000000..1576bc6
--- /dev/null
+++ b/tests/language/nnbd/typedef/typedef_opted_out.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2020, 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=2.7
+
+typedef F = int Function(int);
diff --git a/tests/language/null/access_error_test.dart b/tests/language/null/access_error_test.dart
new file mode 100644
index 0000000..e4f11f5
--- /dev/null
+++ b/tests/language/null/access_error_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2011, 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 NullAccessTest {
+ static void testNullVariable() {
+ dynamic variable;
+ bool exceptionCaught = false;
+ bool wrongExceptionCaught = false;
+ try {
+ variable++;
+ } on NoSuchMethodError catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isTrue(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+ }
+
+ static dynamic helperFunction(dynamic parameter) {
+ return parameter++;
+ }
+
+ static void testNullFunctionCall() {
+ dynamic variable;
+ bool exceptionCaught = false;
+ bool wrongExceptionCaught = false;
+ try {
+ variable = helperFunction(variable);
+ } on NoSuchMethodError catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isTrue(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+ }
+
+ static void testMain() {
+ testNullVariable();
+ testNullFunctionCall();
+ }
+}
+
+main() {
+ NullAccessTest.testMain();
+}
diff --git a/tests/language/null/checked_null_test.dart b/tests/language/null/checked_null_test.dart
new file mode 100644
index 0000000..b4fa1f2
--- /dev/null
+++ b/tests/language/null/checked_null_test.dart
@@ -0,0 +1,30 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+class A {
+ Map? a;
+ Comparator? b;
+ // This code exhibited a bug in dart2js, where the type of [a] was inferred to
+ // be [Comparator] or null;
+ A()
+ : b = null,
+ a = null;
+}
+
+main() {
+ Expect.throws(bar);
+}
+
+bar() {
+ // We would create a typed selector for the call to foo, where the
+ // receiver type is a typedef. Some code in the dart2js backend were
+ // not dealing correctly with typedefs and lead the compiler to
+ // crash.
+ new A().a?.foo();
+ // ^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'foo' isn't defined for the class 'Map<dynamic, dynamic>'.
+}
diff --git a/tests/language/null/checked_runtime_test.dart b/tests/language/null/checked_runtime_test.dart
new file mode 100644
index 0000000..31ace35
--- /dev/null
+++ b/tests/language/null/checked_runtime_test.dart
@@ -0,0 +1,30 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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.
+
+import "package:expect/expect.dart";
+
+class A {
+ Map? a;
+ Comparator? b;
+ // This code exhibited a bug in dart2js, where the type of [a] was inferred to
+ // be [Comparator] or null;
+ A()
+ : b = null,
+ a = null;
+}
+
+main() {
+
+}
+
+bar() {
+ // We would create a typed selector for the call to foo, where the
+ // receiver type is a typedef. Some code in the dart2js backend were
+ // not dealing correctly with typedefs and lead the compiler to
+ // crash.
+
+}
diff --git a/tests/language/null/inline_test.dart b/tests/language/null/inline_test.dart
new file mode 100644
index 0000000..265eff5
--- /dev/null
+++ b/tests/language/null/inline_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2013, 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 that inlining takes null into account.
+
+import "package:expect/expect.dart";
+
+class A {
+ foo() => this;
+}
+
+var global;
+
+main() {
+ Expect.throws(() => global.foo());
+ global = new A();
+ Expect.equals(global, global.foo());
+}
diff --git a/tests/language/null/is2_test.dart b/tests/language/null/is2_test.dart
new file mode 100644
index 0000000..48e4a4f
--- /dev/null
+++ b/tests/language/null/is2_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2013, 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 Test<T> {
+ foo(a) => a is T;
+}
+
+main() {
+ Expect.isFalse(new Test<Object>().foo(null));
+ Expect.isTrue(new Test<Object?>().foo(null));
+ Expect.isTrue(new Test<dynamic>().foo(null));
+ Expect.isFalse(new Test<int>().foo(null));
+ Expect.isFalse(null is List<Object>);
+}
diff --git a/tests/language/null/is_test.dart b/tests/language/null/is_test.dart
new file mode 100644
index 0000000..6908854
--- /dev/null
+++ b/tests/language/null/is_test.dart
@@ -0,0 +1,48 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+main() {
+ Expect.isFalse(null is Object);
+ Expect.isTrue(null is Object?);
+ Expect.isTrue(null is Null);
+ Expect.isFalse(null is int);
+ Expect.isFalse(null is bool);
+ Expect.isFalse(null is num);
+ Expect.isFalse(null is String);
+ Expect.isFalse(null is List);
+ Expect.isFalse(null is Expect);
+
+ test(null);
+
+ Expect.isFalse(1 is Null);
+ Expect.isFalse("1" is Null);
+ Expect.isFalse(true is Null);
+ Expect.isFalse(false is Null);
+ Expect.isFalse(new Object() is Null);
+
+ testNegative(1);
+ testNegative("1");
+ testNegative(true);
+ testNegative(false);
+ testNegative(new Object());
+}
+
+test(n) {
+ // Test where the argument is not a compile-time constant.
+ Expect.isFalse(n is Object);
+ Expect.isTrue(n is Object?);
+ Expect.isTrue(n is Null);
+ Expect.isFalse(n is int);
+ Expect.isFalse(n is bool);
+ Expect.isFalse(n is num);
+ Expect.isFalse(n is String);
+ Expect.isFalse(n is List);
+ Expect.isFalse(n is Expect);
+}
+
+testNegative(n) {
+ Expect.isFalse(n is Null);
+}
diff --git a/tests/language/null/method_test.dart b/tests/language/null/method_test.dart
new file mode 100644
index 0000000..bf5b51f
--- /dev/null
+++ b/tests/language/null/method_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to not compile null methods
+// in the presence of typed selectors.
+
+import "package:expect/expect.dart";
+
+class C {
+ foo(s) {
+ return s.hashCode;
+ }
+}
+
+main() {
+ var c = new C();
+ Expect.isNotNull(c.foo('foo'));
+ Expect.isNotNull(c.foo(null));
+}
diff --git a/tests/language/null/no_such_method_test.dart b/tests/language/null/no_such_method_test.dart
new file mode 100644
index 0000000..299ba2d
--- /dev/null
+++ b/tests/language/null/no_such_method_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2013, 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";
+
+main() {
+ Expect.throwsNoSuchMethodError(() => -(null as dynamic));
+ // Make sure we have an untyped call to operator-.
+ print(-array[0]);
+}
+
+var array = <dynamic>[1];
diff --git a/tests/language/null/null2_test.dart b/tests/language/null/null2_test.dart
new file mode 100644
index 0000000..3357043
--- /dev/null
+++ b/tests/language/null/null2_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2014, 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.
+// Second dart test program.
+
+import "package:expect/expect.dart";
+
+// Magic incantation to avoid the compiler recognizing the constant values
+// at compile time. If the result is computed at compile time, the dynamic code
+// will not be tested.
+confuse(x) {
+ try {
+ if (new DateTime.now().millisecondsSinceEpoch == 42) x = 42;
+ throw [x];
+ } on dynamic catch (e) {
+ return e[0];
+ }
+ return 42;
+}
+
+main() {
+ Expect.equals("Null", null.runtimeType.toString());
+ Expect.equals("Null", confuse(null).runtimeType.toString());
+}
diff --git a/tests/language/null/null_test.dart b/tests/language/null/null_test.dart
new file mode 100644
index 0000000..f13312d
--- /dev/null
+++ b/tests/language/null/null_test.dart
@@ -0,0 +1,222 @@
+// Copyright (c) 2013, 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.
+// Second dart test program.
+
+// VMOptions=--optimization-counter-threshold=5
+
+import "package:expect/expect.dart";
+
+class BadInherit
+ extends Null // //# 01: compile-time error
+ implements Null // //# 02: compile-time error
+ extends Object with Null // //# 03: compile-time error
+{}
+
+class EqualsNotCalled {
+ int get hashCode => throw "And don't warn!";
+ bool operator ==(Object other) {
+ throw "SHOULD NOT GET HERE";
+ }
+}
+
+class Generic<T> {
+ bool test(o) => o is T;
+ T cast(o) => o as T;
+ Type get type => T;
+}
+
+class Generic2<T, S> {
+ bool test(o) => new Generic<T>().test(o);
+ T cast(o) => new Generic<T>().cast(o);
+ Type get type => new Generic<T>().type;
+}
+
+// Magic incantation to avoid the compiler recognizing the constant values
+// at compile time. If the result is computed at compile time, the dynamic code
+// will not be tested.
+confuse(x) {
+ try {
+ if (new DateTime.now().millisecondsSinceEpoch == 42) x = 42;
+ throw [x];
+ } on dynamic catch (e) {
+ return e[0];
+ }
+ return 42;
+}
+
+void main() {
+ for (int i = 0; i < 10; i++) {
+ test();
+ }
+}
+
+void test() {
+ new BadInherit(); // Make sure class is referenced.
+
+ void foo(var obj) {
+ Expect.equals(null, obj);
+ }
+
+ bool compareToNull(var value) {
+ return null == value;
+ }
+
+ bool compareWithNull(var value) {
+ return value == null;
+ }
+
+ var val = 1;
+ var obj = confuse(null); // Null value that isn't known at compile-time.
+ Expect.isTrue(identical(obj, null), "identical");
+
+ Expect.isTrue(null == null);
+ Expect.isTrue(null == obj);
+ Expect.isTrue(obj == null);
+ Expect.isTrue(obj == obj);
+
+ // Using == null or null == will not call any equality method.
+ Expect.isFalse(new EqualsNotCalled() == null);
+ Expect.isFalse(null == new EqualsNotCalled());
+ Expect.isFalse(new EqualsNotCalled() == obj);
+ Expect.isFalse(obj == new EqualsNotCalled());
+
+ Expect.isFalse(null == false);
+ Expect.isFalse(null == 0);
+ Expect.isFalse(null == "");
+ Expect.isFalse(null == []);
+ Expect.isFalse(null == 0.0);
+ Expect.isFalse(null == -0.0);
+ Expect.isFalse(null == double.nan);
+
+ Expect.isFalse(obj == false);
+ Expect.isFalse(obj == 0);
+ Expect.isFalse(obj == "");
+ Expect.isFalse(obj == []);
+ Expect.isFalse(obj == 0.0);
+ Expect.isFalse(obj == -0.0);
+ Expect.isFalse(obj == double.nan);
+
+ // Explicit constant expressions.
+ const t1 = null == null;
+ const t2 = null == 0;
+ const t3 = false == null;
+ Expect.isTrue(t1);
+ Expect.isFalse(t2);
+ Expect.isFalse(t3);
+
+ foo(obj);
+ foo(null);
+ if (obj != null) {
+ foo(null);
+ } else {
+ foo(obj);
+ }
+
+ // Test "is" operator.
+ Expect.isTrue(null is Null);
+ Expect.isTrue(obj is Null);
+ Expect.isFalse(null is Object);
+ Expect.isFalse(obj is Object);
+ Expect.isTrue(null is Object?);
+ Expect.isTrue(obj is Object?);
+ Expect.isTrue(null is dynamic);
+ Expect.isTrue(obj is dynamic);
+ Expect.isFalse(null is String);
+ Expect.isFalse(obj is String);
+ Expect.isFalse(0 is Null); // It's only assignable.
+ Expect.isFalse(null is! Null);
+ Expect.isFalse(obj is! Null);
+ Expect.isTrue(null is! Object);
+ Expect.isTrue(obj is! Object);
+ Expect.isFalse(null is! Object?);
+ Expect.isFalse(obj is! Object?);
+ Expect.isFalse(null is! dynamic);
+ Expect.isFalse(obj is! dynamic);
+ Expect.isTrue(null is! String);
+ Expect.isTrue(obj is! String);
+ Expect.isTrue(0 is! Null); // It's only assignable.
+
+ // Test "is" operator with generic type variable.
+ Expect.isTrue(new Generic<Null>().test(null));
+ Expect.isFalse(new Generic<Null>().test(42));
+ Expect.isTrue(new Generic2<Null, int>().test(null));
+ Expect.isFalse(new Generic2<Null, int>().test(42));
+
+ // Test cast, "as", operator.
+ Expect.equals(null, null as Null);
+ if (isStrongMode) {
+ Expect.throwsTypeError(() => null as Object);
+ } else {
+ Expect.equals(null, null as Object);
+ }
+ Expect.equals(null, null as Object?);
+ if (isStrongMode) {
+ Expect.throwsTypeError(() => null as int);
+ } else {
+ Expect.equals(null, null as int);
+ }
+ Expect.equals(null, null as int?);
+ Expect.throwsTypeError(() => 42 as Null);
+ Expect.equals(null, new Generic<Null>().cast(null));
+ Expect.equals(null, new Generic<Object?>().cast(null));
+ Expect.equals(null, new Generic<int?>().cast(null));
+
+ Expect.equals(null, obj as Null);
+ if (isStrongMode) {
+ Expect.throwsTypeError(() => obj as Object);
+ } else {
+ Expect.equals(null, obj as Object);
+ }
+ Expect.equals(null, obj as Object?);
+ if (isStrongMode) {
+ Expect.throwsTypeError(() => obj as int);
+ } else {
+ Expect.equals(null, obj as int);
+ }
+ Expect.equals(null, obj as int?);
+ Expect.equals(null, new Generic<Null>().cast(obj));
+ Expect.equals(null, new Generic<Object?>().cast(obj));
+ Expect.equals(null, new Generic<int?>().cast(obj));
+
+ Expect.equals("null", null.toString());
+ Expect.equals("null", "${null}");
+ Expect.equals("null", obj.toString());
+ Expect.equals("null", "${obj}");
+
+ Expect.equals(Null, null.runtimeType);
+ Expect.equals(Null, obj.runtimeType);
+ Expect.equals(Null, new Generic<Null>().type);
+ Expect.equals(Null, new Generic2<Null, int>().type);
+
+ Expect.isFalse(compareToNull(val));
+ Expect.isTrue(compareToNull(obj));
+ Expect.isFalse(compareWithNull(val));
+ Expect.isTrue(compareWithNull(obj));
+
+ // Re-initialize obj to cancel promotion from previous "as" operators.
+ obj = confuse(null);
+
+ // Method/value extraction. The runtimeType was checked above, and operator==
+ // cannot be extracted.
+ // Currently fails in VM.
+ Expect.equals(null.toString, obj.toString);
+ Expect.equals(null.noSuchMethod, obj.noSuchMethod);
+ Expect.equals(null.hashCode, obj.hashCode);
+
+ var toString = null.toString;
+ Expect.equals("null", toString());
+ Expect.equals("null", Function.apply(toString, []));
+
+ Expect.throws(() => obj.notDeclared());
+ var noSuchMethod = null.noSuchMethod;
+ // Assign to "dynamic" to prevent compile-time error.
+ dynamic capture = new CaptureInvocationMirror();
+ var mirror = capture.notDeclared();
+ Expect.throws(() => noSuchMethod(mirror));
+ Expect.throws(() => Function.apply(noSuchMethod, [mirror]));
+}
+
+class CaptureInvocationMirror {
+ noSuchMethod(mirror) => mirror;
+}
diff --git a/tests/language/null/to_string2_test.dart b/tests/language/null/to_string2_test.dart
new file mode 100644
index 0000000..e544930
--- /dev/null
+++ b/tests/language/null/to_string2_test.dart
@@ -0,0 +1,18 @@
+// 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.
+// Test correct handling of NULL object in invocation and implicit closures.
+
+import "package:expect/expect.dart";
+
+class A {}
+
+A? foo() => null;
+
+main() {
+ A? nullObj = foo();
+ var x = nullObj.toString();
+ Expect.isTrue(x is String);
+ var y = nullObj.toString;
+ Expect.isNotNull(y);
+}
diff --git a/tests/language/null/to_string_test.dart b/tests/language/null/to_string_test.dart
new file mode 100644
index 0000000..08bb56a
--- /dev/null
+++ b/tests/language/null/to_string_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2011, 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 correct handling of NULL object in invocation and implicit closures.
+
+import "package:expect/expect.dart";
+
+main() {
+ var nullObj = null;
+ var x = nullObj.toString();
+ Expect.isTrue(x is String);
+ var y = nullObj.toString;
+ Expect.isNotNull(y);
+}
diff --git a/tests/language/number/constant_folding1_test.dart b/tests/language/number/constant_folding1_test.dart
new file mode 100644
index 0000000..8ee351c
--- /dev/null
+++ b/tests/language/number/constant_folding1_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2011, 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";
+
+// On frogsh constant folded hex literals of large magnitude were truncated on
+// constant folding - Issue 636 is 'fixed', remaining concerns at Issue 638.
+
+highDigitTruncationTest() {
+ Expect.equals(0x12345678A, 0x123456789 + 1);
+
+ // in 32 bits this is 0xF0000000 which is negative.
+ Expect.isTrue(0x1f0000000 > 0);
+
+ Expect.equals(0xf0, 0xf * 16);
+ Expect.equals(0xff0, 0xff * 16);
+ Expect.equals(0xfff0, 0xfff * 16);
+ Expect.equals(0xffff0, 0xffff * 16);
+ Expect.equals(0xfffff0, 0xfffff * 16);
+ Expect.equals(0xffffff0, 0xffffff * 16);
+ Expect.equals(0xfffffff0, 0xfffffff * 16);
+ Expect.equals(0xffffffff0, 0xffffffff * 16);
+ Expect.equals(0xfffffffff0, 0xfffffffff * 16);
+ Expect.equals(0xffffffffff0, 0xffffffffff * 16);
+}
+
+main() {
+ highDigitTruncationTest();
+}
diff --git a/tests/language/number/identifier_runtime_test.dart b/tests/language/number/identifier_runtime_test.dart
new file mode 100644
index 0000000..3450bd1
--- /dev/null
+++ b/tests/language/number/identifier_runtime_test.dart
@@ -0,0 +1,44 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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";
+
+main() {
+ // Integer literals.
+ Expect.isTrue(2 is int);
+ Expect.equals(2, 2 as int);
+ Expect.isTrue(-2 is int);
+ Expect.equals(-2, -2 as int);
+ Expect.isTrue(0x10 is int);
+ Expect.isTrue(-0x10 is int);
+ // "a" will be part of hex literal, the following "s" is an error.
+
+
+
+ // Double literals.
+ Expect.isTrue(2.0 is double);
+ Expect.equals(2.0, 2.0 as double);
+ Expect.isTrue(-2.0 is double);
+ Expect.equals(-2.0, -2.0 as double);
+ Expect.isTrue(.2 is double);
+ Expect.equals(0.2, .2 as double);
+ Expect.isTrue(1e2 is double);
+ Expect.equals(1e2, 1e2 as double);
+ Expect.isTrue(1e-2 is double);
+ Expect.equals(1e-2, 1e-2 as double);
+ Expect.isTrue(1e+2 is double);
+ Expect.equals(1e+2, 1e+2 as double);
+
+
+
+
+
+
+
+
+
+}
diff --git a/tests/language/number/identifier_test.dart b/tests/language/number/identifier_test.dart
new file mode 100644
index 0000000..ce91927
--- /dev/null
+++ b/tests/language/number/identifier_test.dart
@@ -0,0 +1,121 @@
+// Copyright (c) 2011, 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";
+
+main() {
+ // Integer literals.
+ Expect.isTrue(2 is int);
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION
+ // ^^^
+ // [analyzer] STATIC_WARNING.TYPE_TEST_WITH_NON_TYPE
+ Expect.equals(2, 2 as int);
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION
+ // ^^^
+ // [analyzer] STATIC_WARNING.CAST_TO_NON_TYPE
+ Expect.isTrue(-2 is int);
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION
+ // ^^^
+ // [analyzer] STATIC_WARNING.TYPE_TEST_WITH_NON_TYPE
+ Expect.equals(-2, -2 as int);
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION
+ // ^^^
+ // [analyzer] STATIC_WARNING.CAST_TO_NON_TYPE
+ Expect.isTrue(0x10 is int);
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION
+ // ^^^
+ // [analyzer] STATIC_WARNING.TYPE_TEST_WITH_NON_TYPE
+ Expect.isTrue(-0x10 is int);
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.REFERENCED_BEFORE_DECLARATION
+ // ^^^
+ // [analyzer] STATIC_WARNING.TYPE_TEST_WITH_NON_TYPE
+
+ // "a" will be part of hex literal, the following "s" is an error.
+ 0x10as int;
+//^^^^^
+// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
+// [cfe] Expected ';' after this.
+// ^
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
+// [cfe] 's' isn't a type.
+// ^
+// [cfe] Can't declare 'int' because it was already used in this scope.
+ 0x;
+//^
+// [cfe] A hex digit (0-9 or A-F) must follow '0x'.
+// ^
+// [analyzer] SYNTACTIC_ERROR.MISSING_HEX_DIGIT
+
+ // Double literals.
+ Expect.isTrue(2.0 is double);
+ Expect.equals(2.0, 2.0 as double);
+ Expect.isTrue(-2.0 is double);
+ Expect.equals(-2.0, -2.0 as double);
+ Expect.isTrue(.2 is double);
+ Expect.equals(0.2, .2 as double);
+ Expect.isTrue(1e2 is double);
+ Expect.equals(1e2, 1e2 as double);
+ Expect.isTrue(1e-2 is double);
+ Expect.equals(1e-2, 1e-2 as double);
+ Expect.isTrue(1e+2 is double);
+ Expect.equals(1e+2, 1e+2 as double);
+ Expect.throwsNoSuchMethodError(() => 1.e+2);
+ // ^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'e' isn't defined for the class 'int'.
+ 1d;
+//^
+// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
+// [cfe] Expected ';' after this.
+// ^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] Getter not found: 'd'.
+ 1D;
+//^
+// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
+// [cfe] Expected ';' after this.
+// ^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] Getter not found: 'D'.
+ Expect.throwsNoSuchMethodError(() => 1.d+2);
+ // ^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'd' isn't defined for the class 'int'.
+ Expect.throwsNoSuchMethodError(() => 1.D+2);
+ // ^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'D' isn't defined for the class 'int'.
+ 1.1d;
+//^^^
+// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
+// [cfe] Expected ';' after this.
+// ^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] Getter not found: 'd'.
+ 1.1D;
+//^^^
+// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
+// [cfe] Expected ';' after this.
+// ^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] Getter not found: 'D'.
+ 1e;
+//^
+// [cfe] Numbers in exponential notation should always contain an exponent (an integer number with an optional sign).
+// ^
+// [analyzer] SYNTACTIC_ERROR.MISSING_DIGIT
+ 1x;
+//^
+// [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
+// [cfe] Expected ';' after this.
+// ^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] Getter not found: 'x'.
+}
diff --git a/tests/language/number/identity2_test.dart b/tests/language/number/identity2_test.dart
new file mode 100644
index 0000000..5dde8ee
--- /dev/null
+++ b/tests/language/number/identity2_test.dart
@@ -0,0 +1,38 @@
+// 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.
+// Dart test program for testing params.
+//
+// Contains test that is failing on dart2js. Merge this test with
+// 'number_identity_test.dart' once fixed.
+// VMOptions=--optimization-counter-threshold=10
+
+import "package:expect/expect.dart";
+import 'dart:typed_data';
+
+double uint64toDouble(int i) {
+ var buffer = new Uint8List(8).buffer;
+ var bdata = new ByteData.view(buffer);
+ bdata.setUint64(0, i);
+ return bdata.getFloat64(0);
+}
+
+testNumberIdentity() {
+ var a = double.nan;
+ var b = a + 0.0;
+ Expect.isTrue(identical(a, b));
+
+ a = uint64toDouble((1 << 64) - 1);
+ b = uint64toDouble((1 << 64) - 2);
+ Expect.isFalse(identical(a, b));
+
+ a = 0.0 / 0.0;
+ b = 1.0 / 0.0;
+ Expect.isFalse(identical(a, b));
+}
+
+main() {
+ for (int i = 0; i < 20; i++) {
+ testNumberIdentity();
+ }
+}
diff --git a/tests/language/number/identity_test.dart b/tests/language/number/identity_test.dart
new file mode 100644
index 0000000..a4eb7a5
--- /dev/null
+++ b/tests/language/number/identity_test.dart
@@ -0,0 +1,33 @@
+// 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.
+// Dart test program for testing params.
+// VMOptions=--optimization-counter-threshold=10
+
+import "package:expect/expect.dart";
+
+main() {
+ for (int i = 0; i < 20; i++) testNumberIdentity();
+}
+
+testNumberIdentity() {
+ const int smi = 8;
+ const int mint = 9223372036854775806;
+ const double dbl = 8.0;
+
+ var a = smi;
+ var b = a + 0;
+ Expect.isTrue(identical(a, b));
+ Expect.isFalse(identical(b, mint));
+
+ a = mint;
+ b = a + 0;
+ Expect.isTrue(identical(a, b));
+ Expect.isFalse(identical(b, smi));
+ Expect.isFalse(identical(b, dbl));
+
+ var a2 = dbl;
+ var b2 = a2 + 0.0;
+ Expect.isTrue(identical(a2, b2));
+ Expect.isFalse(identical(b2, mint));
+}
diff --git a/tests/language/number/infinity_test.dart b/tests/language/number/infinity_test.dart
new file mode 100644
index 0000000..8d3a8d6
--- /dev/null
+++ b/tests/language/number/infinity_test.dart
@@ -0,0 +1,17 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+int inscrutable(int x) => x == 0 ? 0 : x | inscrutable(x & (x - 1));
+
+main() {
+ var things = [0, double.infinity, double.negativeInfinity];
+ var first = things[1];
+ var second = things[2];
+ Expect.isFalse(first is int);
+ Expect.isFalse(second is int);
+ Expect.isTrue(first is double);
+ Expect.isTrue(second is double);
+}
diff --git a/tests/language/number/int2_test.dart b/tests/language/number/int2_test.dart
new file mode 100644
index 0000000..a2c15cc
--- /dev/null
+++ b/tests/language/number/int2_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to throw NoSuchMethod if an
+// int did not fit in the SMI range.
+
+import "package:expect/expect.dart";
+
+main() {
+ // dart2js knows that this list is int or null.
+ dynamic b = [null, 9223372036854775806];
+
+ // Use b[1] twice to ensure dart2js realizes it's the same value
+ // after type propagation.
+
+ // dart2js will inline an ArgumentError check on b[a].
+ 42 + b[1];
+ // dart2js will inline a NoSuchMethodError check.
+ var c = b[1] & 1;
+ Expect.equals(0, c);
+}
diff --git a/tests/language/number/int64_literal_runtime_10_test.dart b/tests/language/number/int64_literal_runtime_10_test.dart
new file mode 100644
index 0000000..6391a0f
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_10_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+ maxInt64Value = -0x8000000000000000 - 1;
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_11_test.dart b/tests/language/number/int64_literal_runtime_11_test.dart
new file mode 100644
index 0000000..02ae918
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_11_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+
+
+ maxInt64Value = -(0x8000000000000001);
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_1_test.dart b/tests/language/number/int64_literal_runtime_1_test.dart
new file mode 100644
index 0000000..3b23e7f
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_1_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+ minInt64Value = -9223372036854775807 - 1;
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_2_test.dart b/tests/language/number/int64_literal_runtime_2_test.dart
new file mode 100644
index 0000000..6664a7d
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_2_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+ minInt64Value = -9223372036854775808;
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_3_test.dart b/tests/language/number/int64_literal_runtime_3_test.dart
new file mode 100644
index 0000000..6a474c9
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_3_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+ minInt64Value = -(0x8000000000000000);
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_4_test.dart b/tests/language/number/int64_literal_runtime_4_test.dart
new file mode 100644
index 0000000..e40dd6b
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_4_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+ minInt64Value = 0x8000000000000000;
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_5_test.dart b/tests/language/number/int64_literal_runtime_5_test.dart
new file mode 100644
index 0000000..d9f1aac
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_5_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+ minInt64Value = -0x8000000000000000;
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_6_test.dart b/tests/language/number/int64_literal_runtime_6_test.dart
new file mode 100644
index 0000000..fefa1f3
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_6_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+ maxInt64Value = 9223372036854775807;
+
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_7_test.dart b/tests/language/number/int64_literal_runtime_7_test.dart
new file mode 100644
index 0000000..227ea41
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_7_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+ maxInt64Value = 9223372036854775807;
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_8_test.dart b/tests/language/number/int64_literal_runtime_8_test.dart
new file mode 100644
index 0000000..07ba174
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_8_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+ maxInt64Value = -9223372036854775808 - 1;
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_9_test.dart b/tests/language/number/int64_literal_runtime_9_test.dart
new file mode 100644
index 0000000..7aabfc2
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_9_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+ maxInt64Value = 0x8000000000000000 - 1;
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_runtime_test.dart b/tests/language/number/int64_literal_runtime_test.dart
new file mode 100644
index 0000000..d135bb1
--- /dev/null
+++ b/tests/language/number/int64_literal_runtime_test.dart
@@ -0,0 +1,40 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+
+
+
+
+
+
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+
+
+
+
+
+
+
+
+
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int64_literal_test.dart b/tests/language/number/int64_literal_test.dart
new file mode 100644
index 0000000..edce72e
--- /dev/null
+++ b/tests/language/number/int64_literal_test.dart
@@ -0,0 +1,49 @@
+// 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';
+
+const String realMaxInt64Value = '9223372036854775807';
+const String realMinInt64Value = '-9223372036854775808';
+
+const int i21 = 2097152;
+
+main() {
+ int minInt64Value = -1 * i21 * i21 * i21;
+ minInt64Value = -9223372036854775807 - 1;
+ minInt64Value = -9223372036854775808;
+ minInt64Value = -(9223372036854775808);
+ // ^^^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INTEGER_LITERAL_OUT_OF_RANGE
+ // [cfe] The integer literal 9223372036854775808 can't be represented in 64 bits.
+ minInt64Value = -(0x8000000000000000);
+ minInt64Value = 0x8000000000000000;
+ minInt64Value = -0x8000000000000000;
+
+ Expect.equals('$minInt64Value', realMinInt64Value);
+ Expect.equals('${minInt64Value - 1}', realMaxInt64Value);
+
+ int maxInt64Value = 1 * i21 * i21 * i21 - 1;
+ maxInt64Value = 9223372036854775807;
+ maxInt64Value = 9223372036854775807;
+ maxInt64Value = 9223372036854775808 - 1;
+ // ^^^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INTEGER_LITERAL_OUT_OF_RANGE
+ // [cfe] The integer literal 9223372036854775808 can't be represented in 64 bits.
+ maxInt64Value = -9223372036854775808 - 1;
+ maxInt64Value = -9223372036854775809;
+ // ^^^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INTEGER_LITERAL_OUT_OF_RANGE
+ // [cfe] The integer literal 9223372036854775809 can't be represented in 64 bits.
+ maxInt64Value = 0x8000000000000000 - 1;
+ maxInt64Value = -0x8000000000000000 - 1;
+ maxInt64Value = -0x8000000000000001;
+ // ^^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INTEGER_LITERAL_OUT_OF_RANGE
+ // [cfe] The integer literal 0x8000000000000001 can't be represented in 64 bits.
+ maxInt64Value = -(0x8000000000000001);
+
+ Expect.equals('$maxInt64Value', realMaxInt64Value);
+ Expect.equals('${maxInt64Value + 1}', realMinInt64Value);
+}
diff --git a/tests/language/number/int_test.dart b/tests/language/number/int_test.dart
new file mode 100644
index 0000000..c1d084c
--- /dev/null
+++ b/tests/language/number/int_test.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2011, 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 basic integer operations.
+
+import "package:expect/expect.dart";
+
+main() {
+ test(literal, number) {
+ Expect.equals(literal, number);
+ Expect.identical(literal, number);
+ }
+
+ test(0, 0 + 0);
+ test(1, 1 + 0);
+ test(2, 1 + 1);
+ test(3, -1 + 4);
+ test(3, 4 + -1);
+
+ test(-0, -(0));
+ test(-3, -(3));
+
+ test(1, 1 - 0);
+ test(0, 1 - 1);
+ test(1, 2 - 1);
+ test(2, 4 - 2);
+ test(-2, 2 - 4);
+
+ test(0, 3 * 0);
+ test(0, 0 * 3);
+ test(1, 1 * 1);
+ test(5, 5 * 1);
+ test(15, 3 * 5);
+ test(-1, 1 * -1);
+ test(-15, -5 * 3);
+ test(15, -5 * -3);
+
+ test(1, 2 ~/ 2);
+ test(2, 2 ~/ 1);
+ test(2, 4 ~/ 2);
+ test(2, 5 ~/ 2);
+ test(-2, -5 ~/ 2);
+ test(-2, -4 ~/ 2);
+ test(-2, 5 ~/ -2);
+ test(-2, 4 ~/ -2);
+
+ test(3, 7 % 4);
+ test(2, 9 % 7);
+ test(2, -7 % 9);
+ test(7, 7 % -9);
+ test(7, 7 % 9);
+ test(2, -7 % -9);
+
+ test(3, (7).remainder(4));
+ test(2, (9).remainder(7));
+ test(-7, (-7).remainder(9));
+ test(7, (7).remainder(-9));
+ test(7, (7).remainder(9));
+ test(-7, (-7).remainder(-9));
+}
diff --git a/tests/language/number/numbers_test.dart b/tests/language/number/numbers_test.dart
new file mode 100644
index 0000000..e7c8a75
--- /dev/null
+++ b/tests/language/number/numbers_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2011, 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 number types.
+
+library NumbersTest.dart;
+
+import "package:expect/expect.dart";
+
+class NumbersTest {
+ static double testMain() {
+ var one = 1;
+ Expect.equals(true, one is Object);
+ Expect.equals(true, one is num);
+ Expect.equals(true, one is int);
+ Expect.equals(false, one is double);
+
+ var two = 2.0;
+ Expect.equals(true, two is Object);
+ Expect.equals(true, two is num);
+ Expect.equals(false, two is int);
+ Expect.equals(true, two is double);
+
+ var result = one + two;
+ Expect.equals(true, result is Object);
+ Expect.equals(true, result is num);
+ Expect.equals(false, result is int);
+ Expect.equals(true, result is double);
+
+ Expect.equals(3.0, result);
+ return result;
+ }
+}
+
+main() {
+ NumbersTest.testMain();
+}
diff --git a/tests/language/number/syntax_test.dart b/tests/language/number/syntax_test.dart
new file mode 100644
index 0000000..94e6890
--- /dev/null
+++ b/tests/language/number/syntax_test.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2011, 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 NumberSyntaxTest {
+ static void testMain() {
+ testShortDoubleSyntax();
+ testDotSelectorSyntax();
+ }
+
+ static void testShortDoubleSyntax() {
+ Expect.equals(0.0, .0);
+ Expect.equals(0.5, .5);
+ Expect.equals(0.1234, .1234);
+ }
+
+ static void testDotSelectorSyntax() {
+ // Integers.
+ Expect.equals('0', 0.toString());
+ Expect.equals('1', 1.toString());
+ Expect.equals('123', 123.toString());
+
+ Expect.equals('0', 0.toString());
+ Expect.equals('1', 1.toString());
+ Expect.equals('123', 123.toString());
+
+ Expect.equals('0', 0.toString());
+ Expect.equals('1', 1.toString());
+ Expect.equals('123', 123.toString());
+
+ // Doubles.
+ Expect.equals((0.0).toString(), 0.0.toString());
+ Expect.equals((0.1).toString(), .1.toString());
+ Expect.equals((1.1).toString(), 1.1.toString());
+ Expect.equals((123.4).toString(), 123.4.toString());
+
+ Expect.equals((0.0).toString(), 0.0.toString());
+ Expect.equals((0.1).toString(), .1.toString());
+ Expect.equals((1.1).toString(), 1.1.toString());
+ Expect.equals((123.4).toString(), 123.4.toString());
+
+ Expect.equals((0.0).toString(), 0.0.toString());
+ Expect.equals((0.1).toString(), .1.toString());
+ Expect.equals((1.1).toString(), 1.1.toString());
+ Expect.equals((123.4).toString(), 123.4.toString());
+
+ // Exponent notation.
+ Expect.equals((0e0).toString(), 0e0.toString());
+ Expect.equals((1e+1).toString(), 1e+1.toString());
+ Expect.equals((2.1e-34).toString(), 2.1e-34.toString());
+ }
+}
+
+main() {
+ NumberSyntaxTest.testMain();
+}
diff --git a/tests/language/number/web_int_literals_runtime_test.dart b/tests/language/number/web_int_literals_runtime_test.dart
new file mode 100644
index 0000000..dfbcf56
--- /dev/null
+++ b/tests/language/number/web_int_literals_runtime_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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";
+
+main() {
+ check(0x8000000000000000);
+
+ check(0x7FFF00001111F000);
+ check(0x7FFF00001111FC00);
+
+
+
+
+ check(0xFFFF00001111F000);
+ check(0xFFFF00001111F800);
+
+
+
+
+
+ // Test all runs of 53 and 54 bits.
+ check(0x000FFFFFFFFFFFFF);
+ check(0x001FFFFFFFFFFFFF);
+
+ check(0x003FFFFFFFFFFFFE);
+
+ check(0x007FFFFFFFFFFFFC);
+
+ check(0x00FFFFFFFFFFFFF8);
+
+ check(0x01FFFFFFFFFFFFF0);
+
+ check(0x03FFFFFFFFFFFFE0);
+
+ check(0x07FFFFFFFFFFFFC0);
+
+ check(0x0FFFFFFFFFFFFF80);
+
+ check(0x1FFFFFFFFFFFFF00);
+
+ check(0x3FFFFFFFFFFFFE00);
+
+ check(0x7FFFFFFFFFFFFC00);
+
+ check(0xFFFFFFFFFFFFF800);
+
+ // Too big, even on VM.
+
+
+
+ // 9223372036854775808 - 512 is rounded.
+
+ // 9223372036854775808 - 1024 is exact.
+ check(9223372036854774784);
+
+ check(-9223372036854775808);
+
+
+ check(-9223372036854774784);
+
+
+}
+
+check(int n) {}
diff --git a/tests/language/number/web_int_literals_test.dart b/tests/language/number/web_int_literals_test.dart
new file mode 100644
index 0000000..094b739
--- /dev/null
+++ b/tests/language/number/web_int_literals_test.dart
@@ -0,0 +1,69 @@
+// 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";
+
+main() {
+ check(0x8000000000000000);
+
+ check(0x7FFF00001111F000);
+ check(0x7FFF00001111FC00);
+ check(0x7FFF00001111FE00);
+ check(0x7FFF00001111FF00);
+ check(0x7FFF00001111FFFF);
+
+ check(0xFFFF00001111F000);
+ check(0xFFFF00001111F800);
+ check(0xFFFF00001111FC00);
+ check(0xFFFF00001111FE00);
+ check(0xFFFF00001111FF00);
+ check(0xFFFF00001111FFFF);
+
+ // Test all runs of 53 and 54 bits.
+ check(0x000FFFFFFFFFFFFF);
+ check(0x001FFFFFFFFFFFFF);
+ check(0x003FFFFFFFFFFFFF);
+ check(0x003FFFFFFFFFFFFE);
+ check(0x007FFFFFFFFFFFFE);
+ check(0x007FFFFFFFFFFFFC);
+ check(0x00FFFFFFFFFFFFFC);
+ check(0x00FFFFFFFFFFFFF8);
+ check(0x01FFFFFFFFFFFFF8);
+ check(0x01FFFFFFFFFFFFF0);
+ check(0x03FFFFFFFFFFFFF0);
+ check(0x03FFFFFFFFFFFFE0);
+ check(0x07FFFFFFFFFFFFE0);
+ check(0x07FFFFFFFFFFFFC0);
+ check(0x0FFFFFFFFFFFFFC0);
+ check(0x0FFFFFFFFFFFFF80);
+ check(0x1FFFFFFFFFFFFF80);
+ check(0x1FFFFFFFFFFFFF00);
+ check(0x3FFFFFFFFFFFFF00);
+ check(0x3FFFFFFFFFFFFE00);
+ check(0x7FFFFFFFFFFFFE00);
+ check(0x7FFFFFFFFFFFFC00);
+ check(0xFFFFFFFFFFFFFC00);
+ check(0xFFFFFFFFFFFFF800);
+
+ // Too big, even on VM.
+ check(9223372036854775808);
+ // ^^^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.INTEGER_LITERAL_OUT_OF_RANGE
+ // [cfe] The integer literal 9223372036854775808 can't be represented in 64 bits.
+ check(9223372036854775807);
+ check(9223372036854775806);
+ // 9223372036854775808 - 512 is rounded.
+ check(9223372036854775296);
+ // 9223372036854775808 - 1024 is exact.
+ check(9223372036854774784);
+
+ check(-9223372036854775808);
+ check(-9223372036854775807);
+ check(-9223372036854775296);
+ check(-9223372036854774784);
+
+ check(1000000000000000001);
+}
+
+check(int n) {}
diff --git a/tests/language/optimize/allocation_sinking_inlining_test.dart b/tests/language/optimize/allocation_sinking_inlining_test.dart
new file mode 100644
index 0000000..6ed5501
--- /dev/null
+++ b/tests/language/optimize/allocation_sinking_inlining_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2013, 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+// Test allocation sinking with polymorphic inlining.
+
+import "package:expect/expect.dart";
+
+class A {
+ foo(x) => ++x.f;
+}
+
+class B {
+ foo(x) => --x.f;
+}
+
+class C {
+ int f = 0;
+}
+
+test(obj) {
+ var c = new C();
+ return obj.foo(c);
+}
+
+main() {
+ var a = new A();
+ var b = new B();
+ Expect.equals(1, test(a));
+ Expect.equals(-1, test(b));
+ for (var i = 0; i < 20; i++) test(a);
+ Expect.equals(1, test(a));
+ Expect.equals(-1, test(b));
+}
diff --git a/tests/language/optimize/bailout2_test.dart b/tests/language/optimize/bailout2_test.dart
new file mode 100644
index 0000000..8a0dd87
--- /dev/null
+++ b/tests/language/optimize/bailout2_test.dart
@@ -0,0 +1,26 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+var a;
+
+main() {
+ // Write a loop to force a bailout method on [A.foo].
+ for (int i = 0; i < 10; i++) {
+ if (a != null) new A().foo([]);
+ Expect.equals(42, new A().foo(new A()));
+ }
+}
+
+class A {
+ // In dart2js, the optimized version of foo tries to optimize the
+ // uses of a.length (which is used two times here: for the index,
+ // and for the bounds check), and that optimization used to crash
+ // the compiler.
+ foo(a) => a[a.length];
+
+ int get length => 42;
+ operator [](index) => 42;
+}
diff --git a/tests/language/optimize/bailout3_test.dart b/tests/language/optimize/bailout3_test.dart
new file mode 100644
index 0000000..6fc0923
--- /dev/null
+++ b/tests/language/optimize/bailout3_test.dart
@@ -0,0 +1,41 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+// Test that the return type of a method is being registered for both
+// its bailout and optimized version in dart2js.
+
+var a;
+
+bar() {
+ if (a[0] == 0) {
+ // Force bailout version.
+ bar();
+ // Avoid inlining.
+ throw 0;
+ }
+ for (int i = 0; i < 10; i++) {
+ a[0] = 42;
+ }
+ // This return should say that bar can return an array or unknown.
+ return a;
+}
+
+foo() {
+ if (a[0] == 0) {
+ // Avoid inlining.
+ throw 0;
+ }
+ var b = bar();
+ // This check used to fail because dart2js was assuming [b] was an
+ // array.
+ Expect.equals(1, b.length);
+}
+
+main() {
+ a = new Map();
+ bar();
+ foo();
+}
diff --git a/tests/language/optimize/bailout4_test.dart b/tests/language/optimize/bailout4_test.dart
new file mode 100644
index 0000000..c55c8b7
--- /dev/null
+++ b/tests/language/optimize/bailout4_test.dart
@@ -0,0 +1,32 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+// Test that dart2s computes the right bailout environment in presence
+// of nested loops.
+
+class A {
+ operator [](index) => 42;
+}
+
+var a = new A();
+var b = new List<dynamic>.filled(4, null);
+int count = 0;
+
+main() {
+ // Make the method recursive to make sure it gets an optimized
+ // version.
+ if (b[0] != null) main();
+
+ for (int i = 0; i < 2; i++) {
+ for (int j = 0; j < 2; j++) {
+ for (int k = 0; k < 2; k++) {
+ Expect.equals(42, a[i + j + k]);
+ count++;
+ }
+ }
+ }
+ Expect.equals(8, count);
+}
diff --git a/tests/language/optimize/bailout5_test.dart b/tests/language/optimize/bailout5_test.dart
new file mode 100644
index 0000000..1d9c233
--- /dev/null
+++ b/tests/language/optimize/bailout5_test.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2013, 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";
+
+// Test to make sure the bailout environment in dart2js is correct.
+
+var global;
+
+class A {
+ var array;
+
+ initArray() {
+ return global[0] == null ? [null] : new Map();
+ }
+
+ bar() {
+ array = initArray();
+ do {
+ var element = array[0]; // bailout here
+ if (element is Map) continue;
+ if (element == null) break;
+ } while (true);
+ return global[0]; // bailout here
+ }
+
+ baz() {
+ do {
+ var element = bar();
+ if (element == null) return global[0]; // bailout here
+ if (element is Map) continue;
+ if (element is num) break;
+ } while (true);
+ return global[0]; // bailout here
+ }
+}
+
+void main() {
+ global = [1];
+ for (int i = 0; i < 2; i++) {
+ Expect.equals(1, new A().baz());
+ Expect.equals(1, new A().bar());
+ }
+ global = new Map();
+ for (int i = 0; i < 2; i++) {
+ Expect.equals(null, new A().baz());
+ Expect.equals(null, new A().bar());
+ }
+
+ global[0] = 42;
+ for (int i = 0; i < 2; i++) {
+ Expect.equals(42, new A().baz());
+ Expect.equals(42, new A().bar());
+ }
+}
diff --git a/tests/language/optimize/bailout6_test.dart b/tests/language/optimize/bailout6_test.dart
new file mode 100644
index 0000000..38b84db
--- /dev/null
+++ b/tests/language/optimize/bailout6_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2013, 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";
+
+// Test for dart2js to make sure the computed bailout environment is
+// correct.
+
+var global;
+
+class A {
+ var array;
+
+ foo() {
+ do {
+ var element = global;
+ if (element is Map) continue;
+ if (element is num) break;
+ } while (true);
+ return array[0]; // bailout here.
+ }
+}
+
+void main() {
+ var a = new A();
+ a.array = [42];
+ global = 42;
+
+ for (int i = 0; i < 2; i++) {
+ Expect.equals(42, a.foo());
+ }
+
+ a.array = new Map();
+ a.array[0] = 42;
+ for (int i = 0; i < 2; i++) {
+ Expect.equals(42, a.foo());
+ }
+ global = null;
+}
diff --git a/tests/language/optimize/bailout7_test.dart b/tests/language/optimize/bailout7_test.dart
new file mode 100644
index 0000000..b71fe72
--- /dev/null
+++ b/tests/language/optimize/bailout7_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2013, 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";
+
+// Test to make sure the do/while loop exit condition is generated.
+
+var global;
+
+class A {
+ var array;
+
+ initArray() {
+ if (global[0] == null) {
+ return [2];
+ } else {
+ var map = new Map();
+ map[0] = 2;
+ return map;
+ }
+ }
+
+ bar() {
+ array = initArray();
+ var element;
+ do {
+ element = array[0]; // bailout here
+ if (element is Map) continue;
+ if (element == null) break;
+ } while (element != 2);
+ return global[0]; // bailout here
+ }
+}
+
+void main() {
+ global = [2];
+ for (int i = 0; i < 2; i++) {
+ Expect.equals(2, new A().bar());
+ }
+
+ global = new Map();
+ global[0] = 2;
+ for (int i = 0; i < 2; i++) {
+ Expect.equals(2, new A().bar());
+ }
+}
diff --git a/tests/language/optimize/bailout_container_type_test.dart b/tests/language/optimize/bailout_container_type_test.dart
new file mode 100644
index 0000000..b2992a2
--- /dev/null
+++ b/tests/language/optimize/bailout_container_type_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to generate bad code for the
+// non-bailout version of [main].
+
+var a = [
+ false,
+ [1, 2, 3]
+];
+var b;
+
+main() {
+ // Defeat type inferencing for [b].
+ b = new Object();
+ b = 42;
+ b = [];
+
+ // Make the function recursive to force a bailout version.
+ if (a[0] as bool) main();
+
+ // We used to ask [b] to be of the same type as [a], but not
+ // checking that the length and element type are the same.
+ var arrayPhi = (a[0] as bool) ? a : b;
+
+ if (arrayPhi.length != 0) {
+ throw 'Test failed';
+ }
+}
diff --git a/tests/language/optimize/bailout_test.dart b/tests/language/optimize/bailout_test.dart
new file mode 100644
index 0000000..a4b8bbc
--- /dev/null
+++ b/tests/language/optimize/bailout_test.dart
@@ -0,0 +1,48 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+// Test that a call to a bailout method in dart2js resolves to the
+// right method.
+
+var reachedAfoo = new C();
+
+class A {
+ foo() {
+ // Using '++' makes sure there is a type guard.
+ reachedAfoo++;
+ }
+}
+
+class B extends A {
+ foo() {
+ reachedAfoo++;
+ // Call the Expect method after the type guard.
+ Expect.fail('Should never reach B.foo');
+ }
+
+ bar() {
+ super.foo();
+ }
+}
+
+class C {
+ int value = 0;
+ operator +(int val) {
+ value += val;
+ return this;
+ }
+}
+
+main() {
+ // Using a loop makes sure the 'foo' methods will have an optimized
+ // version.
+ while (reachedAfoo.value != 0) {
+ new A().foo();
+ new B().foo();
+ }
+ new B().bar();
+ Expect.equals(1, reachedAfoo.value);
+}
diff --git a/tests/language/optimize/cha_deopt1_deferred_lib.dart b/tests/language/optimize/cha_deopt1_deferred_lib.dart
new file mode 100644
index 0000000..7add3ed
--- /dev/null
+++ b/tests/language/optimize/cha_deopt1_deferred_lib.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2014, 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 "cha_deopt1_lib.dart";
+
+class U extends T {
+ m() => "good horse";
+}
+
+make_u() => new U();
diff --git a/tests/language/optimize/cha_deopt1_lib.dart b/tests/language/optimize/cha_deopt1_lib.dart
new file mode 100644
index 0000000..72a86f3
--- /dev/null
+++ b/tests/language/optimize/cha_deopt1_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2014, 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 mylib;
+
+class T {
+ m() => 42;
+}
diff --git a/tests/language/optimize/cha_deopt1_test.dart b/tests/language/optimize/cha_deopt1_test.dart
new file mode 100644
index 0000000..7cb2a88
--- /dev/null
+++ b/tests/language/optimize/cha_deopt1_test.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2014, 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.
+// VMOptions=--optimization-counter-threshold=100 --no-background-compilation
+
+// Test lazy deoptimization at field guards with deferred loading.
+
+import "package:expect/expect.dart";
+import "cha_deopt1_lib.dart";
+import "cha_deopt1_deferred_lib.dart" deferred as d;
+
+var loaded = false;
+
+main() {
+ for (var i = 0; i < 2000; i++) bla();
+ Expect.equals(42, bla());
+ d.loadLibrary().then((_) {
+ loaded = true;
+ Expect.equals("good horse", bla());
+ });
+}
+
+make_t() {
+ try {
+ if (loaded) {
+ return d.make_u();
+ } else {
+ return new T();
+ }
+ } catch (e) {}
+}
+
+bla() {
+ var x = new X();
+ x.test(make_t());
+ return x.fld.m();
+}
+
+class X {
+ T fld = new T();
+
+ test(T t) {
+ if (t != null) {
+ T tmp = t;
+ fld = tmp;
+ }
+ }
+}
diff --git a/tests/language/optimize/cha_deopt2_deferred_lib.dart b/tests/language/optimize/cha_deopt2_deferred_lib.dart
new file mode 100644
index 0000000..53bf9a8
--- /dev/null
+++ b/tests/language/optimize/cha_deopt2_deferred_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2014, 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 "cha_deopt2_lib.dart";
+
+class U extends T {}
+
+make_u() => new U();
diff --git a/tests/language/optimize/cha_deopt2_lib.dart b/tests/language/optimize/cha_deopt2_lib.dart
new file mode 100644
index 0000000..922cf9a
--- /dev/null
+++ b/tests/language/optimize/cha_deopt2_lib.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2014, 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 mylib;
+
+class A {}
+
+class B {}
+
+class C {}
+
+class D {}
+
+class E {}
+
+class T {}
diff --git a/tests/language/optimize/cha_deopt2_test.dart b/tests/language/optimize/cha_deopt2_test.dart
new file mode 100644
index 0000000..7372f5e
--- /dev/null
+++ b/tests/language/optimize/cha_deopt2_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2014, 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.
+// VMOptions=--optimization-counter-threshold=100 --no-background-compilation
+// VMOptions=--optimization-counter-threshold=100 --no-background-compilation --no-use-field-guards
+
+// Test lazy deoptimization at type checks with deferred loading.
+
+import "package:expect/expect.dart";
+import "cha_deopt2_lib.dart";
+import "cha_deopt2_deferred_lib.dart" deferred as d;
+
+var loaded = false;
+
+main() {
+ for (var i = 0; i < 2000; i++) bla();
+ Expect.equals(1, bla());
+ d.loadLibrary().then((_) {
+ loaded = true;
+ Expect.equals(1, bla());
+ });
+}
+
+make_array() {
+ try {
+ if (loaded) {
+ return [new A(), new B(), new C(), new D(), new E(), d.make_u()];
+ } else {
+ return [new A(), new B(), new C(), new D(), new E(), new T()];
+ }
+ } catch (e) {}
+}
+
+bla() {
+ var count = 0;
+ for (var x in make_array()) {
+ if (x is T) count++;
+ }
+ return count;
+}
diff --git a/tests/language/optimize/cha_deopt3_deferred_lib.dart b/tests/language/optimize/cha_deopt3_deferred_lib.dart
new file mode 100644
index 0000000..31ad3d2
--- /dev/null
+++ b/tests/language/optimize/cha_deopt3_deferred_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2014, 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 "cha_deopt3_lib.dart";
+
+class U implements T {}
+
+make_u() => new U();
diff --git a/tests/language/optimize/cha_deopt3_lib.dart b/tests/language/optimize/cha_deopt3_lib.dart
new file mode 100644
index 0000000..922cf9a
--- /dev/null
+++ b/tests/language/optimize/cha_deopt3_lib.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2014, 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 mylib;
+
+class A {}
+
+class B {}
+
+class C {}
+
+class D {}
+
+class E {}
+
+class T {}
diff --git a/tests/language/optimize/cha_deopt3_test.dart b/tests/language/optimize/cha_deopt3_test.dart
new file mode 100644
index 0000000..dfcd7af
--- /dev/null
+++ b/tests/language/optimize/cha_deopt3_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2014, 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.
+// VMOptions=--optimization-counter-threshold=100 --no-background-compilation
+// VMOptions=--optimization-counter-threshold=100 --no-background-compilation --no-use-field-guards
+
+// Test lazy deoptimization at type checks with interface implementation.
+
+import "package:expect/expect.dart";
+import "cha_deopt3_lib.dart";
+import "cha_deopt3_deferred_lib.dart" deferred as d;
+
+var loaded = false;
+
+main() {
+ for (var i = 0; i < 2000; i++) bla();
+ Expect.equals(1, bla());
+ d.loadLibrary().then((_) {
+ loaded = true;
+ Expect.equals(1, bla());
+ });
+}
+
+make_array() {
+ try {
+ if (loaded) {
+ return [new A(), new B(), new C(), new D(), new E(), d.make_u()];
+ } else {
+ return [new A(), new B(), new C(), new D(), new E(), new T()];
+ }
+ } catch (e) {}
+}
+
+bla() {
+ var count = 0;
+ for (var x in make_array()) {
+ if (x is T) count++;
+ }
+ return count;
+}
diff --git a/tests/language/optimize/code_motion_crash_test.dart b/tests/language/optimize/code_motion_crash_test.dart
new file mode 100644
index 0000000..f0d30b8
--- /dev/null
+++ b/tests/language/optimize/code_motion_crash_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to crash during the
+// [SsaCodeMotion] phase on this code.
+
+class A {
+ final finalField;
+ var field = 2;
+ foo() {
+ new A().field = 42;
+ }
+
+ A._() : finalField = 42;
+ A() : finalField = [new A._(), new B(), new Object()][1];
+}
+
+class B {
+ foo() {}
+ bar() {}
+}
+
+main() {
+ var a = new A();
+ // Create a new block for SsaCodeMotion: the phase will want to move
+ // field access on [a] to this block.
+ if (true) {
+ var b = a.finalField;
+ var d = a.field;
+ b.bar();
+
+ // [c] gets GVN'ed with [b]. As a consequence, the type propagator
+ // that runs after GVN sees that [c] can only be a [B] because of
+ // the call to [bar].
+ var c = a.finalField;
+ c.foo();
+
+ // [e] does not get GVN'ed because the GVN phase sees [c.foo()] as
+ // having side effects.
+ var e = a.field;
+ if (d + e != 4) throw 'Test failed';
+ }
+}
diff --git a/tests/language/optimize/constant_array_string_access_test.dart b/tests/language/optimize/constant_array_string_access_test.dart
new file mode 100644
index 0000000..f2efc0e
--- /dev/null
+++ b/tests/language/optimize/constant_array_string_access_test.dart
@@ -0,0 +1,62 @@
+// 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+// Test optimized constant string and constant array access.
+
+void testConstantStringAndIndexCodeUnitAt() {
+ int test(b) {
+ if (b) return "hest".codeUnitAt(400);
+ return "hest".codeUnitAt(2);
+ }
+
+ Expect.throws(() => test(true));
+ for (int i = 0; i < 20; i++) test(false);
+ Expect.throws(() => test(true));
+}
+
+void testConstantArrayAndIndexAt() {
+ int testPositive(b) {
+ var a = const [1, 2, 3, 4];
+ if (b) return a[400];
+ return a[2];
+ }
+
+ int testNegative(b) {
+ var a = const [1, 2, 3, 4];
+ if (b) return a[-1];
+ return a[2];
+ }
+
+ Expect.throws(() => testPositive(true));
+ for (int i = 0; i < 20; i++) testPositive(false);
+ Expect.throws(() => testPositive(true));
+
+ Expect.throws(() => testNegative(true));
+ for (int i = 0; i < 20; i++) testNegative(false);
+ Expect.throws(() => testNegative(true));
+}
+
+foo(a) {
+ if (a == 1) {
+ return 2;
+ }
+ var aa = const [1, 2];
+ return aa[2.3]; /*@compile-error=unspecified*/
+}
+
+void testNonSmiIndex() {
+ for (int i = 0; i < 20; i++) {
+ foo(1);
+ }
+ Expect.throws(() => foo(2));
+}
+
+main() {
+ testConstantStringAndIndexCodeUnitAt();
+ testConstantArrayAndIndexAt();
+ testNonSmiIndex();
+}
diff --git a/tests/language/optimize/constant_fold_equals_test.dart b/tests/language/optimize/constant_fold_equals_test.dart
new file mode 100644
index 0000000..2db1966
--- /dev/null
+++ b/tests/language/optimize/constant_fold_equals_test.dart
@@ -0,0 +1,17 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+main() {
+ dynamic a = 'foo';
+ for (int i = 0; i < 10; i++) {
+ if (i == 0) {
+ Expect.isTrue(identical(a, 'foo'));
+ } else {
+ Expect.isTrue(a == 2);
+ }
+ a = 2;
+ }
+}
diff --git a/tests/language/optimize/constant_propagation_phis_test.dart b/tests/language/optimize/constant_propagation_phis_test.dart
new file mode 100644
index 0000000..0ba7d72
--- /dev/null
+++ b/tests/language/optimize/constant_propagation_phis_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2013, 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.
+// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
+
+import "package:expect/expect.dart";
+
+// Test that constant propagation correctly updates phis when predecessor's
+// reachability changes.
+
+final keys = const ["keyA"];
+final values = const ["a"];
+
+main() {
+ for (var i = 0; i < 20; i++) test(keys[0]);
+}
+
+test(key) {
+ var ref = key2value(key);
+ Expect.equals("a", (ref == null) ? "-" : ref);
+}
+
+key2value(key) {
+ var index = indexOf(keys, key);
+ return (index == -1) ? null : values[index];
+}
+
+indexOf(keys, key) {
+ for (var i = keys.length - 1; i >= 0; i--) {
+ var equals = keys[i] == key;
+ if (equals) return i;
+ }
+ return -1;
+}
diff --git a/tests/language/optimize/critical_edge2_test.dart b/tests/language/optimize/critical_edge2_test.dart
new file mode 100644
index 0000000..75e3f13
--- /dev/null
+++ b/tests/language/optimize/critical_edge2_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2014, 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 broke dart2js.
+// A compiler must not construct a critical edge on this program.
+//
+// See critical_edge_test.dart for a description of the problem.
+
+import "package:expect/expect.dart";
+
+String parse(String uri) {
+ int index = 0;
+ int char = -1;
+
+ void parseAuth() {
+ index;
+ char;
+ }
+
+ while (index < 1000) {
+ char = uri.codeUnitAt(index);
+ if (char == 1234) {
+ break;
+ }
+ if (char == 0x3A) {
+ return "good";
+ }
+ index++;
+ }
+
+ print(char);
+ return "bad";
+}
+
+main() {
+ Expect.equals("good", parse("dart:_foreign_helper"));
+}
diff --git a/tests/language/optimize/critical_edge_test.dart b/tests/language/optimize/critical_edge_test.dart
new file mode 100644
index 0000000..28c7fd4
--- /dev/null
+++ b/tests/language/optimize/critical_edge_test.dart
@@ -0,0 +1,66 @@
+// Copyright (c) 2014, 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 broke dart2js.
+// A compiler must not construct a critical edge on this program.
+//
+// In particular we have to watch out for:
+// - the while-loop branch going to the body-block and to the exit-block, and
+// - the exit-block having as incoming the condition-block and the
+// break-blocks.
+//
+// Triggering the bug is relatively hard, since pushing instructions back the
+// exit-block to the incoming blocks is not guaranteed to trigger an error.
+// Dart2js frequently ended up with update-assignments just before the
+// condition:
+// for (int i = 0; state = state0, i < 10; i++) {
+// if (..) { state = 1; }
+// ...
+// }
+// use(state);
+//
+// In this case the "state" variable was assigned before the loop and then
+// reassigned before the break. The exit-block pushed the assignment back
+// to its incoming blocks and that's why the "state = state0" assignment ended
+// up just before the condition.
+// Note that the assignment was executed at every iteration instead of just
+// when exiting the loop.
+// This repeated assignments don't have any negative effect unless the state
+// variable is also assigned and used inside the loop-body. It turns out that
+// this is very rare and needs some tricks to make happen.
+
+import "package:expect/expect.dart";
+
+String parse(String uri) {
+ int index = 0;
+ int char = -1;
+
+ void parseAuth() {
+ index;
+ char;
+ }
+
+ int state = 0;
+ while (true) {
+ char = uri.codeUnitAt(index);
+ if (char == 1234) {
+ state = (index == 0) ? 1 : 2;
+ break;
+ }
+ if (char == 0x3A) {
+ return "good";
+ }
+ index++;
+ }
+
+ if (state == 1) {
+ print(char == 1234);
+ print(index == uri.length);
+ }
+ return "bad";
+}
+
+main() {
+ Expect.equals("good", parse("dart:_foreign_helper"));
+}
diff --git a/tests/language/optimize/dead_field_access_test.dart b/tests/language/optimize/dead_field_access_test.dart
new file mode 100644
index 0000000..cacaa34
--- /dev/null
+++ b/tests/language/optimize/dead_field_access_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2015, 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 Foo {
+ var field = 10;
+}
+
+@pragma('dart2js:noInline')
+getField(x) {
+ x.field;
+ return 34;
+}
+
+main() {
+ Expect.equals(34, getField(new Foo()));
+ Expect.throws(() => getField(null));
+}
diff --git a/tests/language/optimize/deopt_inlined_function_lazy_test.dart b/tests/language/optimize/deopt_inlined_function_lazy_test.dart
new file mode 100644
index 0000000..d827884
--- /dev/null
+++ b/tests/language/optimize/deopt_inlined_function_lazy_test.dart
@@ -0,0 +1,34 @@
+// 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.
+// Test lazy deoptimization from within an inlined function.
+// VMOptions=--deoptimize_alot --optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+call_native(x) {
+ // Wrap in try to avoid inlining.
+ // Use a large int so the intrinsifier does not fire.
+ try {
+ return x + 9223372036854775807;
+ } finally {}
+}
+
+bar(x) {
+ if (x < 0) call_native(x);
+ x = 42;
+ return x;
+}
+
+foo(x) {
+ x = bar(x);
+ return x;
+}
+
+main() {
+ Expect.equals(42, foo(1));
+ for (var i = 0; i < 20; i++) foo(7);
+ Expect.equals(42, foo(2));
+ // Call the runtime to trigger lazy deopt with foo/bar on the stack.
+ Expect.equals(42, foo(-1));
+}
diff --git a/tests/language/optimize/deopt_inlined_function_test.dart b/tests/language/optimize/deopt_inlined_function_test.dart
new file mode 100644
index 0000000..e9158ef
--- /dev/null
+++ b/tests/language/optimize/deopt_inlined_function_test.dart
@@ -0,0 +1,35 @@
+// 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.
+// Test deoptimization from within an inlined function.
+
+import "package:expect/expect.dart";
+
+class A {
+ deopt_here() => 1;
+}
+
+class B {
+ deopt_here() => 2;
+}
+
+dynamic obj = new A();
+
+bar(x) {
+ x = 42;
+ obj.deopt_here();
+ return x;
+}
+
+foo(x) {
+ x = bar(x);
+ return x;
+}
+
+main() {
+ Expect.equals(42, foo(1));
+ for (var i = 0; i < 2000; i++) foo(7);
+ Expect.equals(42, foo(2));
+ obj = new B();
+ Expect.equals(42, foo(3)); // <-- deoptimization via foo/bar/obj.deopt_here
+}
diff --git a/tests/language/optimize/deopt_lazy_finalization_test.dart b/tests/language/optimize/deopt_lazy_finalization_test.dart
new file mode 100644
index 0000000..aaebd21
--- /dev/null
+++ b/tests/language/optimize/deopt_lazy_finalization_test.dart
@@ -0,0 +1,46 @@
+// 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.
+// Test deoptimziation caused by lazy finalization.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+main() {
+ Expect.equals(20000, part1());
+ // Trigger lazy finalization of class B, which should invalidate
+ // optimized code for A.loop.
+ Expect.equals(-20000, part2());
+}
+
+part1() {
+ var a = new A();
+ a.loop();
+ // Second invocation calls optimized code.
+ return a.loop();
+}
+
+part2() {
+ var b = new B();
+ b.loop();
+ // Second invocation calls optimized code.
+ return b.loop();
+}
+
+class A {
+ int foo() => 2;
+
+ loop() {
+ var sum = 0;
+ for (int i = 0; i < 10000; i++) {
+ sum += foo();
+ }
+ return sum;
+ }
+}
+
+class Aa extends A {}
+
+class B extends Aa {
+ foo() => -2;
+}
diff --git a/tests/language/optimize/deopt_no_feedback_test.dart b/tests/language/optimize/deopt_no_feedback_test.dart
new file mode 100644
index 0000000..ed8caa1
--- /dev/null
+++ b/tests/language/optimize/deopt_no_feedback_test.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2011, 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 deoptimization caused by running code that did not collect type
+// feedback before.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+testStoreIndexed() {
+ test(a, i, v, flag) {
+ if (flag) {
+ // No type feedback in first pass
+ return a[i] = v;
+ } else {
+ return a[i] = i;
+ }
+ }
+
+ var a = new List<dynamic>.filled(10, null);
+ for (var i = 0; i < 20; i++) {
+ var r = test(a, 3, 888, false);
+ Expect.equals(3, r);
+ Expect.equals(3, a[3]);
+ }
+ // Deopt.
+ var r = test(a, 3, 888, true);
+ Expect.equals(888, r);
+ Expect.equals(888, a[3]);
+}
+
+testIncrLocal() {
+ test(a, flag) {
+ if (flag) {
+ a++;
+ return a;
+ } else {
+ return -1;
+ }
+ }
+
+ for (var i = 0; i < 20; i++) {
+ var r = test(10, false);
+ Expect.equals(-1, r);
+ }
+ // Deopt.
+ var r = test(10, true);
+ Expect.equals(11, r);
+}
+
+main() {
+ for (var i = 0; i < 20; i++) {}
+ testStoreIndexed();
+ testIncrLocal();
+}
diff --git a/tests/language/optimize/deopt_smi_op_test.dart b/tests/language/optimize/deopt_smi_op_test.dart
new file mode 100644
index 0000000..30e9fd2
--- /dev/null
+++ b/tests/language/optimize/deopt_smi_op_test.dart
@@ -0,0 +1,36 @@
+// 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+// Test hoisted (loop-invariant) smi operations with deoptimization.
+
+test_mul(h) {
+ var x;
+ for (var i = 0; i < 3; i++) {
+ x = h * 100000;
+ }
+ return x;
+}
+
+test_neg(h) {
+ var x;
+ for (var i = 0; i < 3; i++) {
+ x = -h;
+ }
+ return x;
+}
+
+main() {
+ for (var i = 0; i < 20; i++) test_mul(10);
+ Expect.equals(1000000, test_mul(10));
+ Expect.equals(100000000000, test_mul(1000000));
+ Expect.equals(100000 * 0x3fffffffffffffff, test_mul(0x3fffffffffffffff));
+
+ for (var i = 0; i < 20; i++) test_neg(10);
+ Expect.equals(-10, test_neg(10));
+ Expect.equals(0x40000000, test_neg(-0x40000000));
+ Expect.equals(0x4000000000000000, test_neg(-0x4000000000000000));
+}
diff --git a/tests/language/optimize/deoptimized_function_on_stack_test.dart b/tests/language/optimize/deoptimized_function_on_stack_test.dart
new file mode 100644
index 0000000..d0df460
--- /dev/null
+++ b/tests/language/optimize/deoptimized_function_on_stack_test.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2011, 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.
+// VMOptions=--optimization-counter-threshold=10
+
+import "package:expect/expect.dart";
+
+// This is a test for deoptimization infrastructure and to reproduce the
+// failure from bug 5442338.
+
+main() {
+ warmup();
+ runTest();
+}
+
+// Create a situation where method 'call' is optimized for using class A
+// when calling foo.
+warmup() {
+ List a = [new A(), new A(), new A(), new A()];
+ var res = 0;
+ for (int i = 0; i < 20; i++) {
+ res = call(a, 0);
+ }
+ Expect.equals(10, res);
+}
+
+// Create a situation where several optimized frames of 'call' are on stack
+// when deoptimization occurs because B.foo is called. After the first
+// deoptimization, several optimized frames of 'call' are still on stack and
+// some of them will be deoptimized.
+runTest() {
+ List a = [new A(), new A(), new B(), new A(), new B(), new B()];
+ var res = call(a, 0);
+ Expect.equals(35, res);
+}
+
+// This method will be optimized for using class A when calling 'foo' and
+// later will be deoptimized because B.foo is required.
+call(List a, int n) {
+ if (n < a.length) {
+ var sum = call(a, n + 1);
+ for (int i = n; i < a.length; i++) {
+ sum += a[i].foo();
+ }
+ return sum;
+ }
+ return 0;
+}
+
+class A {
+ foo() {
+ return 1;
+ }
+}
+
+class B {
+ foo() {
+ return 2;
+ }
+}
diff --git a/tests/language/optimize/hoisting_checked_mode_assert_test.dart b/tests/language/optimize/hoisting_checked_mode_assert_test.dart
new file mode 100644
index 0000000..ac45ebf
--- /dev/null
+++ b/tests/language/optimize/hoisting_checked_mode_assert_test.dart
@@ -0,0 +1,22 @@
+// 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+// Test checked mode assertions inside loops.
+
+int foo(x, n) {
+ double z = 0.0;
+ for (var i = 0; i < n; i++) {
+ double z = x;
+ }
+ return 0;
+}
+
+main() {
+ for (var i = 0; i < 20; i++) foo(1.0, 10);
+ Expect.equals(0, foo(1.0, 10));
+ Expect.equals(0, foo(2, 0)); // Must not throw in checked mode.
+}
diff --git a/tests/language/optimize/inferrer_closure_test.dart b/tests/language/optimize/inferrer_closure_test.dart
new file mode 100644
index 0000000..6841bb4
--- /dev/null
+++ b/tests/language/optimize/inferrer_closure_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to not see a closure could be
+// invoked through a getter access followed by an invocation.
+
+var closure = (Object a) => a.toString();
+
+get foo => closure;
+
+main() {
+ if (foo(42) != '42') {
+ throw 'Test failed';
+ }
+}
diff --git a/tests/language/optimize/inferrer_constructor2_test.dart b/tests/language/optimize/inferrer_constructor2_test.dart
new file mode 100644
index 0000000..58da3ad
--- /dev/null
+++ b/tests/language/optimize/inferrer_constructor2_test.dart
@@ -0,0 +1,62 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to optimistically infer the
+// wrong types for fields because of generative constructors being
+// inlined.
+
+import "package:expect/expect.dart";
+import "../compiler_annotations.dart";
+
+class A {
+ var foo;
+ var bar;
+
+ @DontInline()
+ A() {
+ // Currently defeat inlining by using a closure.
+ bar = () => 42;
+ foo = 54;
+ }
+ A.inline();
+}
+
+main() {
+ // Make sure A's constructor is analyzed first by surrounding the
+ // body by two allocations.
+ new A();
+ bar();
+ new A();
+}
+
+class B {
+ var bar;
+ var closure;
+ @DontInline()
+ B() {
+ // Currently defeat inlining by using a closure.
+ closure = () => 42;
+ bar = new A().foo;
+ }
+}
+
+@DontInline()
+bar() {
+ // Make sure B's constructor is analyzed first by surrounding the
+ // body by two allocations.
+ new B();
+ // Currently defeat inlining by using a closure.
+ Expect.throwsNoSuchMethodError(() => new A.inline().foo + 42);
+ codegenLast();
+ new B();
+}
+
+@DontInline()
+codegenLast() {
+ // This assignment currently defeats simple type inference, but not
+ // the optimistic inferrer.
+ new A().foo = new B().bar;
+ // Currently defeat inlining by using a closure.
+ new B().closure = () => 42;
+}
diff --git a/tests/language/optimize/inferrer_constructor3_test.dart b/tests/language/optimize/inferrer_constructor3_test.dart
new file mode 100644
index 0000000..395f113
--- /dev/null
+++ b/tests/language/optimize/inferrer_constructor3_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to optimistically infer the
+// wrong types for fields because of generative constructors being
+// inlined.
+
+import "package:expect/expect.dart";
+import "../compiler_annotations.dart";
+
+class A {
+ var field;
+ A(this.field);
+}
+
+dynamic c = () => new List<dynamic>.filled(42, null)[0];
+
+main() {
+ bar();
+ // Defeat type inferencing.
+ new A(c());
+ doIt();
+ bar();
+}
+
+@DontInline()
+doIt() {
+ () => 42;
+ var c = new A(null);
+ Expect.throwsNoSuchMethodError(() => c.field + 42);
+}
+
+@DontInline()
+bar() {
+ () => 42;
+ return inlineLevel1();
+}
+
+inlineLevel1() {
+ return inlineLevel2();
+}
+
+inlineLevel2() {
+ return inlineLevel3();
+}
+
+inlineLevel3() {
+ return inlineLevel4();
+}
+
+inlineLevel4() {
+ return new A(42);
+}
diff --git a/tests/language/optimize/inferrer_constructor4_test.dart b/tests/language/optimize/inferrer_constructor4_test.dart
new file mode 100644
index 0000000..bf9e40d
--- /dev/null
+++ b/tests/language/optimize/inferrer_constructor4_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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";
+
+escape(object) {
+ print(object.field + 42);
+}
+
+class A {
+ A() {
+ escape(this);
+ }
+}
+
+class B extends A {
+ var field;
+ B() {
+ field = 42;
+ }
+}
+
+main() {
+ Expect.throwsNoSuchMethodError(() => new B());
+}
diff --git a/tests/language/optimize/inferrer_constructor5_runtime_test.dart b/tests/language/optimize/inferrer_constructor5_runtime_test.dart
new file mode 100644
index 0000000..eec6a13
--- /dev/null
+++ b/tests/language/optimize/inferrer_constructor5_runtime_test.dart
@@ -0,0 +1,25 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2013, 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 {
+ A() {
+
+ }
+}
+
+class B extends A {
+ var field;
+ B() {
+ field = 42;
+ }
+}
+
+main() {
+
+}
diff --git a/tests/language/optimize/inferrer_constructor5_test.dart b/tests/language/optimize/inferrer_constructor5_test.dart
new file mode 100644
index 0000000..7221fea
--- /dev/null
+++ b/tests/language/optimize/inferrer_constructor5_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2013, 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 {
+ A() {
+ print(field + 42);
+ // ^^^^^
+ // [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+ // [cfe] The getter 'field' isn't defined for the class 'A'.
+ }
+}
+
+class B extends A {
+ var field;
+ B() {
+ field = 42;
+ }
+}
+
+main() {
+ Expect.throwsNoSuchMethodError(() => new B());
+}
diff --git a/tests/language/optimize/inferrer_constructor_test.dart b/tests/language/optimize/inferrer_constructor_test.dart
new file mode 100644
index 0000000..482ef3c
--- /dev/null
+++ b/tests/language/optimize/inferrer_constructor_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2013, 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 that dart2js type inferrer detects dead code.
+
+import "package:expect/expect.dart";
+
+class A {
+ var field;
+ A(test) {
+ if (test) {
+ return;
+ field = 42;
+ } else {
+ field = 54;
+ }
+ }
+}
+
+main() {
+ var a = new A(true);
+ Expect.throwsNoSuchMethodError(() => a.field + 42);
+}
diff --git a/tests/language/optimize/inferrer_named_parameter_test.dart b/tests/language/optimize/inferrer_named_parameter_test.dart
new file mode 100644
index 0000000..a6655b4
--- /dev/null
+++ b/tests/language/optimize/inferrer_named_parameter_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js's type inferrer, that used to not
+// correctly infer optional named parameters.
+
+import "package:expect/expect.dart";
+import "../compiler_annotations.dart";
+
+@DontInline()
+foo({path}) {
+ () => 42;
+ return path;
+}
+
+main() {
+ foo(path: '42');
+ Expect.isFalse(foo() is String);
+}
diff --git a/tests/language/optimize/inferrer_synthesized_constructor_test.dart b/tests/language/optimize/inferrer_synthesized_constructor_test.dart
new file mode 100644
index 0000000..ca695c3
--- /dev/null
+++ b/tests/language/optimize/inferrer_synthesized_constructor_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js's type inferrer that used to not
+// propagate default types in synthesized calls.
+
+import "package:expect/expect.dart";
+
+class A {
+ final x;
+ A([this.x = 'foo']);
+}
+
+class B extends A {
+ // The synthesized constructor was not saying that it would call
+ // [A]'s constructor with its default type.
+}
+
+main() {
+ // By calling [B]'s constructor with an int parameter, the inferrer
+ // used to only see this call and consider the [A.x] field to always
+ // be int.
+ Expect.equals(84, new A(42).x + 42);
+ Expect.throwsTypeError(() => new B().x + 42);
+}
diff --git a/tests/language/optimize/inferrer_synthesized_super_constructor2_test.dart b/tests/language/optimize/inferrer_synthesized_super_constructor2_test.dart
new file mode 100644
index 0000000..bb183af
--- /dev/null
+++ b/tests/language/optimize/inferrer_synthesized_super_constructor2_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2013, 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.
+
+bool inConstructor = false;
+
+class A {
+ A._() {
+ inConstructor = true;
+ }
+}
+
+class B extends A {
+ B() : super._();
+}
+
+main() {
+ new B();
+ if (!inConstructor) throw 'Test failed';
+}
diff --git a/tests/language/optimize/inferrer_synthesized_super_constructor_test.dart b/tests/language/optimize/inferrer_synthesized_super_constructor_test.dart
new file mode 100644
index 0000000..1a7284b
--- /dev/null
+++ b/tests/language/optimize/inferrer_synthesized_super_constructor_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2013, 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 '../compiler_annotations.dart';
+
+class A {
+ @DontInline()
+ A([a]) {
+ () => 42;
+ if (a != null) throw 'Test failed';
+ }
+}
+
+class B extends A {
+ B();
+}
+
+main() {
+ new B();
+}
diff --git a/tests/language/optimize/inferrer_this_access_test.dart b/tests/language/optimize/inferrer_this_access_test.dart
new file mode 100644
index 0000000..4d1b5fc
--- /dev/null
+++ b/tests/language/optimize/inferrer_this_access_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2013, 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 {
+ var fisk;
+ A() {
+ // dart2js's inferrer used to not recognize the following call to
+ // be on [this].
+ fisk--;
+ fisk = 42;
+ }
+}
+
+abstract class B {
+ var a;
+ B() {
+ hest = 54;
+ a = 42;
+ }
+ set hest(value);
+}
+
+class C extends B {
+ set hest(value) {
+ a + 42;
+ }
+}
+
+main() {
+ Expect.throwsNoSuchMethodError(() => new A());
+ Expect.throwsNoSuchMethodError(() => new C());
+}
diff --git a/tests/language/optimize/inline_add_constants_to_initial_env_test.dart b/tests/language/optimize/inline_add_constants_to_initial_env_test.dart
new file mode 100644
index 0000000..cd64f44
--- /dev/null
+++ b/tests/language/optimize/inline_add_constants_to_initial_env_test.dart
@@ -0,0 +1,16 @@
+// 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.
+// Test that SSA values are correctly numbered after inlining that adds
+// constants to original environment.
+// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
+
+h(x, y) => x == y;
+
+g(y, [x0 = 0, x1 = 1, x2 = 2, x3 = 3]) => y + x0 + x1 + x2 + x3;
+
+f(y) => h(y, g(y));
+
+main() {
+ for (var i = 0; i < 20; i++) f(i);
+}
diff --git a/tests/language/optimize/inline_argument_test.dart b/tests/language/optimize/inline_argument_test.dart
new file mode 100644
index 0000000..61761c5
--- /dev/null
+++ b/tests/language/optimize/inline_argument_test.dart
@@ -0,0 +1,26 @@
+// 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.
+// Test that when inlining A.foo, we're not evaluating the argument
+// twice.
+
+import "package:expect/expect.dart";
+
+class A {
+ var field = 0;
+
+ foo(b) {
+ Expect.equals(0, b);
+ Expect.equals(0, b);
+ }
+
+ bar() {
+ foo(field++);
+ }
+}
+
+main() {
+ var a = new A();
+ a.bar();
+ Expect.equals(1, a.field);
+}
diff --git a/tests/language/optimize/inline_closure_with_constant_arguments_test.dart b/tests/language/optimize/inline_closure_with_constant_arguments_test.dart
new file mode 100644
index 0000000..1b33e01
--- /dev/null
+++ b/tests/language/optimize/inline_closure_with_constant_arguments_test.dart
@@ -0,0 +1,22 @@
+// 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.
+// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
+
+import "package:expect/expect.dart";
+
+// Test inlining of a closure call with constant propagation.
+primeForSmis(bool b) {
+ smi_op(a, b) => a + b;
+ if (b) {
+ return smi_op(1, 2);
+ } else {
+ return smi_op(true, false);
+ }
+}
+
+main() {
+ for (var i = 0; i < 20; i++) {
+ Expect.equals(3, primeForSmis(true));
+ }
+}
diff --git a/tests/language/optimize/inline_conditional_test.dart b/tests/language/optimize/inline_conditional_test.dart
new file mode 100644
index 0000000..c0ad20f
--- /dev/null
+++ b/tests/language/optimize/inline_conditional_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js. There was a bug in the variable
+// allocator when a pure (side-effect free) instruction stand
+// in-between an inlined `if` and its inlined expression.
+
+import "package:expect/expect.dart";
+
+var topLevel;
+
+// Make [foo] an inlineable expression with a return type check.
+Function? foo(c) {
+ // Use [c] twice to make sure it is stored in a local.
+ return (c is Function ? null : c);
+}
+
+bar() {
+ var b = new Object();
+ f() {
+ // Inside a closure, locals that escape are stored in a closure
+ // class. By using [b] in both branches, the optimizers will move
+ // the fetching of [b] before the `if`. This puts the fetching
+ // instruction in between the `if` and the expression of the `if`.
+ // This instruction being pure, the variable allocator was dealing
+ // with it in a special way.
+ //
+ // Because the expression in the `if` is being recognized by the
+ // optimizers as being also a JavaScript expression, we do not
+ // allocate a name for it. But some expressions that it uses still
+ // can have a name, and our variable allocator did not handle live
+ // variables due to the inlining of the ternary expression in [foo].
+ if (foo(topLevel) == null) {
+ return b.toString();
+ } else {
+ return b.hashCode;
+ }
+ }
+
+ return f();
+}
+
+main() {
+ // Make sure the inferrer does not get an exact type for [topLevel].
+ topLevel = new Object();
+ topLevel = main;
+ var res = bar();
+ Expect.isTrue(res is String);
+}
diff --git a/tests/language/optimize/inline_effect_context_test.dart b/tests/language/optimize/inline_effect_context_test.dart
new file mode 100644
index 0000000..7e83f37
--- /dev/null
+++ b/tests/language/optimize/inline_effect_context_test.dart
@@ -0,0 +1,40 @@
+// 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.
+// Test inlining of simple function with control flow in an effect context.
+// Optimize function foo with instance of A and inlined function bar. Call later
+// with instance of B and cause deoptimization.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+import "package:expect/expect.dart";
+
+class A {
+ var x = 1;
+}
+
+class B {
+ var x = 0;
+}
+
+int bar(o) {
+ if (o.x > 0) {
+ // <-- Deoptimize from inner frame.
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int foo(o) {
+ bar(o); // <-- Used in an effect context.
+ return 1;
+}
+
+main() {
+ dynamic o = new A();
+ int sum = 0;
+ for (int i = 0; i < 20; i++) sum += foo(o);
+ o = new B();
+ sum += foo(o); // <-- Cause deoptimization of bar within foo.
+ Expect.equals(21, sum);
+}
diff --git a/tests/language/optimize/inline_getter_test.dart b/tests/language/optimize/inline_getter_test.dart
new file mode 100644
index 0000000..0384b39
--- /dev/null
+++ b/tests/language/optimize/inline_getter_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2011, 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 inlining of instance getters.
+// Three classes access always the same field. Optimize method foo and inline
+// getter for classes 'A' and 'B'. Call later via 'C' and cause deoptimization.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+import "package:expect/expect.dart";
+
+class A {
+ int f;
+ A(this.f) {}
+ int foo() {
+ return f; // <-- inline getter for classes 'A' and 'B'.
+ }
+}
+
+class B extends A {
+ B() : super(2) {}
+}
+
+class C extends A {
+ C() : super(10) {}
+}
+
+class InlineGetterTest {
+ static testMain() {
+ var a = new A(1);
+ var b = new B();
+ int sum = 0;
+ for (int i = 0; i < 20; i++) {
+ sum += a.foo();
+ sum += b.foo();
+ }
+ var c = new C();
+ sum += c.foo(); // <-- Deoptimizing.
+ Expect.equals(70, sum);
+ }
+}
+
+main() {
+ InlineGetterTest.testMain();
+}
diff --git a/tests/language/optimize/inline_in_for_initializer_and_bailout_test.dart b/tests/language/optimize/inline_in_for_initializer_and_bailout_test.dart
new file mode 100644
index 0000000..fb97c62
--- /dev/null
+++ b/tests/language/optimize/inline_in_for_initializer_and_bailout_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2013, 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";
+
+dynamic a = 42;
+
+inlineMe() {
+ // Add control flow to confuse the compiler.
+ if (a is int) {
+ print('a is int');
+ }
+ return a[0];
+}
+
+main() {
+ a = [42];
+ // Make [main] recursive to force a bailout version.
+ if (false) main();
+ int i = 0;
+ for (i = inlineMe(); i < 42; i++);
+ Expect.equals(42, i);
+}
diff --git a/tests/language/optimize/inline_super_field_lib.dart b/tests/language/optimize/inline_super_field_lib.dart
new file mode 100644
index 0000000..dbc3ea6
--- /dev/null
+++ b/tests/language/optimize/inline_super_field_lib.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2013, 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 inline_super_field_lib;
+
+// The comment is inserted to ensure that the offset of [bar] is not within
+// the length of the [:inline_super_field_test.dart] script.
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+var i = 0;
+
+class M1 {
+ final bar = ++i;
+}
diff --git a/tests/language/optimize/inline_super_field_test.dart b/tests/language/optimize/inline_super_field_test.dart
new file mode 100644
index 0000000..b3316f9
--- /dev/null
+++ b/tests/language/optimize/inline_super_field_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2013, 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 that source maps use the correct compilation unit when super class
+// fields from another compilation unit are inlined.
+
+library inline_super_field_test;
+
+import 'package:expect/expect.dart';
+import "inline_super_field_lib.dart";
+
+class S {}
+
+class C extends S with M1 {}
+
+void main() {
+ var c = new C();
+ Expect.equals(1, c.bar);
+}
diff --git a/tests/language/optimize/inline_super_part.dart b/tests/language/optimize/inline_super_part.dart
new file mode 100644
index 0000000..914ff4d
--- /dev/null
+++ b/tests/language/optimize/inline_super_part.dart
@@ -0,0 +1,9 @@
+// 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.
+
+part of inline_super_test;
+
+class Player extends LivingActor {
+ Player() : super();
+}
diff --git a/tests/language/optimize/inline_super_test.dart b/tests/language/optimize/inline_super_test.dart
new file mode 100644
index 0000000..beffdaa
--- /dev/null
+++ b/tests/language/optimize/inline_super_test.dart
@@ -0,0 +1,38 @@
+// 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.
+
+// Regression test for dart2js issue 6639.
+
+library inline_super_test;
+
+import "package:expect/expect.dart";
+
+part 'inline_super_part.dart';
+
+// Long comment to ensure source positions in the following code are
+// larger than the part file. Best way to ensure that is to include
+// the part as a comment:
+//
+// class Player extends LivingActor {
+// Player (deathCallback) : super(null, deathCallback);
+// }
+
+class Percept {}
+
+class Actor {
+ final percept;
+ Actor(this.percept);
+}
+
+class LivingActor extends Actor {
+ // The bug occurs when inlining the node [:new Percept():] into
+ // [Actor]'s constructor. When this inlining is being initiated
+ // from [Player], we must take care to ensure that we know that we
+ // are inlining from this location, and not [Player].
+ LivingActor() : super(new Percept());
+}
+
+main() {
+ Expect.isTrue(new Player().percept is Percept);
+}
diff --git a/tests/language/optimize/inline_test.dart b/tests/language/optimize/inline_test.dart
new file mode 100644
index 0000000..0458c6f
--- /dev/null
+++ b/tests/language/optimize/inline_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to produce a non-valid SSA
+// graph when inlining within a loop.
+
+class X {
+ void x(a, b) {
+ do {
+ if (identical(a, b)) {
+ break;
+ }
+ } while (p(a, b));
+ }
+
+ bool p(a, b) {
+ return identical(a, b);
+ }
+}
+
+main() {
+ var x = new X();
+ x.x(1, 2);
+}
diff --git a/tests/language/optimize/inline_test_context_test.dart b/tests/language/optimize/inline_test_context_test.dart
new file mode 100644
index 0000000..42ad2bf
--- /dev/null
+++ b/tests/language/optimize/inline_test_context_test.dart
@@ -0,0 +1,44 @@
+// 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.
+// Test inlining of simple function with control flow in a test context.
+// Optimize function foo with instance of A and inlined function bar. Call later
+// with instance of B and cause deoptimization.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+import "package:expect/expect.dart";
+
+class A {
+ var x = 1;
+}
+
+class B {
+ var x = 0;
+}
+
+bool bar(o) {
+ if (o.x > 0) {
+ // <-- Deoptimize from inner frame.
+ return true;
+ } else {
+ return false;
+ }
+}
+
+int foo(o) {
+ if (bar(o)) {
+ // <-- Used in a test context.
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+main() {
+ dynamic o = new A();
+ int sum = 0;
+ for (int i = 0; i < 20; i++) sum += foo(o);
+ o = new B();
+ sum += foo(o); // <-- Cause deoptimization of bar within foo.
+ Expect.equals(20, sum);
+}
diff --git a/tests/language/optimize/inline_throw_test.dart b/tests/language/optimize/inline_throw_test.dart
new file mode 100644
index 0000000..24ee7c6
--- /dev/null
+++ b/tests/language/optimize/inline_throw_test.dart
@@ -0,0 +1,303 @@
+// Copyright (c) 2013, 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 check that we don't fail to compile when an
+// inlinable method contains a throw.
+
+import 'package:expect/expect.dart';
+
+dynamic x = false;
+
+bool? called;
+
+bool callMeTrue() {
+ called = true;
+ return true;
+}
+
+bool callMeFalse() {
+ called = true;
+ return false;
+}
+
+void callMe() {
+ called = true;
+}
+
+testCallThenThrow(fn) {
+ called = false;
+ Expect.throws(() => fn());
+ Expect.isTrue(called);
+}
+
+testCall(fn) {
+ called = false;
+ fn();
+ Expect.isTrue(called);
+}
+
+testNoThrow(fn) {
+ called = false;
+ Expect.throws(() => fn());
+ Expect.isFalse(called);
+}
+
+kast(x) {
+ throw x;
+}
+
+ternary(a, b, c) {
+ if (x == 2) throw "ternary";
+}
+
+hest() => kast("hest");
+hest2() {
+ return kast("hest2");
+}
+
+foo() => true || kast("foo");
+bar() => false || kast("foo");
+barc() => callMeTrue() || kast("foo");
+barCallThrow() => callMeFalse() || kast("foo");
+baz(x) => x ? kast("baz") : 0;
+bazc() => callMeFalse() ? kast("baz") : 0;
+bazCallThrow() => callMeTrue() ? kast("baz") : 0;
+fizz(x) => x ? 0 : kast("baz");
+fizzc() => callMeTrue() ? 0 : kast("baz");
+fizzCallThrow() => callMeFalse() ? 0 : kast("baz");
+fuzz() => kast("baz") ? 0 : 1;
+farce() => !kast("baz");
+unary() => ~(kast("baz"));
+boo() {
+ callMe();
+ x = kast("boo");
+}
+
+yo() {
+ throw kast("yo");
+}
+
+bin() {
+ return 5 * kast("bin");
+}
+
+binCallThrow() {
+ return (callMe() as dynamic) * kast("binct");
+}
+
+hoo() {
+ x[kast("hoo")] = 0;
+ x[kast("hoo")];
+ kast("hoo").x = 0;
+ kast("hoo").x;
+}
+
+switcheroo() {
+ switch (kast("switcheroo")) {
+ case 0:
+ boo();
+ }
+}
+
+class ThrowConstructor {
+ ThrowConstructor()
+ : foo = callMeTrue(),
+ bar = kast("ThrowConstructor") {
+ called = false;
+ }
+
+ bool foo;
+ var bar;
+}
+
+throwConstructor() {
+ called = false;
+ return new ThrowConstructor();
+}
+
+cascade() {
+ return []..add(callMeTrue())..add(kast("cascade"));
+}
+
+interpole() => "inter${kast('tada!')}pole";
+interpoleCallThrow() => "inter${callMeTrue()}...${kast('tada!')}pole";
+
+call1() => ternary(0, kast("call1"), 1);
+call2() => ternary(kast("call2"), 0, 1);
+call3() => ternary(0, 1, kast("call3"));
+call1c() => ternary(callMe() as dynamic, kast("call1"), 1);
+call3c() => ternary(callMeTrue(), 1, kast("call3"));
+call4c() => ternary(0, callMeTrue(), kast("call3"));
+
+sendSet() {
+ var x = kast("sendSet");
+}
+
+sendSetCallThrow() {
+ var x = callMe() as dynamic, y = kast("sendSet");
+}
+
+isSend() => kast("isSend") is int;
+
+vile() {
+ while (kast("vile")) {
+ callMe();
+ }
+}
+
+dovile() {
+ var x = 0;
+ do {
+ callMe();
+ x = 1;
+ } while (kast("vile"));
+ print(x);
+}
+
+dovileBreak() {
+ var x = 0;
+ do {
+ callMe();
+ x = 1;
+ break;
+ } while (kast("vile"));
+ return (x);
+}
+
+dovileContinue() {
+ var x = 0;
+ do {
+ callMe();
+ x = 1;
+ continue;
+ } while (kast("vile"));
+ return (x);
+}
+
+dovileBreakContinue(x) {
+ do {
+ callMe();
+ if (x == 1) break;
+ continue;
+ } while (kast("vile"));
+ return (x);
+}
+
+faar1() {
+ callMe();
+ for (kast("faar"); called = false; called = false) {
+ called = false;
+ }
+}
+
+faar2() {
+ for (callMe(); kast("faar"); called = false) {
+ called = false;
+ }
+}
+
+faar3() {
+ for (; true; kast("faar")) {
+ callMe();
+ }
+ called = false;
+}
+
+faar4() {
+ callMe();
+ for (kast("faar"); called = false; called = false) {
+ called = false;
+ continue;
+ }
+}
+
+faar5() {
+ for (callMe(); kast("faar"); called = false) {
+ called = false;
+ continue;
+ }
+}
+
+faar6() {
+ for (; true; kast("faar")) {
+ callMe();
+ continue;
+ }
+ called = false;
+}
+
+faar7() {
+ callMe();
+ for (kast("faar"); called = false; called = false) {
+ called = false;
+ break;
+ }
+}
+
+faar8() {
+ for (callMe(); kast("faar"); called = false) {
+ called = false;
+ break;
+ }
+}
+
+faar9() {
+ for (; true; kast("faar")) {
+ callMe();
+ break;
+ called = false;
+ }
+}
+
+main() {
+ Expect.throws(hest);
+ Expect.throws(hest2);
+ foo();
+ Expect.throws(bar);
+ testCall(barc);
+ testCallThenThrow(barCallThrow);
+ Expect.equals(0, baz(false));
+ Expect.throws(() => baz(true));
+ testCall(bazc);
+ testCallThenThrow(bazCallThrow);
+ Expect.throws(() => fizz(false));
+ testCall(fizzc);
+ testCallThenThrow(fizzCallThrow);
+ Expect.throws(fuzz);
+ Expect.throws(farce);
+ Expect.throws(unary);
+ testCallThenThrow(boo);
+ Expect.throws(yo);
+ Expect.throws(bin);
+ testCallThenThrow(binCallThrow);
+ Expect.throws(hoo);
+ Expect.throws(switcheroo);
+ Expect.throws(interpole);
+ testCallThenThrow(interpoleCallThrow);
+ Expect.throws(call1);
+ Expect.throws(call2);
+ Expect.throws(call3);
+ testCallThenThrow(call1c);
+ testCallThenThrow(call3c);
+ testCallThenThrow(call4c);
+ Expect.throws(sendSet);
+ testCallThenThrow(sendSetCallThrow);
+ Expect.throws(isSend);
+ testNoThrow(vile);
+ testCallThenThrow(dovile);
+ testCall(dovileBreak);
+ testCallThenThrow(dovileContinue);
+ testCallThenThrow(throwConstructor);
+ testCallThenThrow(cascade);
+ dovileBreakContinue(1);
+ testCallThenThrow(faar1);
+ testCallThenThrow(faar2);
+ testCallThenThrow(faar3);
+ testCallThenThrow(faar4);
+ testCallThenThrow(faar5);
+ testCallThenThrow(faar6);
+ testCallThenThrow(faar7);
+ testCallThenThrow(faar8);
+ testCall(faar9);
+}
diff --git a/tests/language/optimize/inline_value_context_test.dart b/tests/language/optimize/inline_value_context_test.dart
new file mode 100644
index 0000000..5bdd909
--- /dev/null
+++ b/tests/language/optimize/inline_value_context_test.dart
@@ -0,0 +1,44 @@
+// 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.
+// Test inlining of simple function with control flow in a value context.
+// Optimize function foo with instance of A and inlined function bar. Call later
+// with instance of B and cause deoptimization.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+import "package:expect/expect.dart";
+
+class A {
+ var x = 1;
+}
+
+class B {
+ var x = 0;
+}
+
+int bar(o) {
+ if (o.x > 0) {
+ // <-- Deoptimize from inner frame.
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+int foo(o) {
+ if (bar(o) > 0) {
+ // <-- Used in a value context.
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+main() {
+ dynamic o = new A();
+ int sum = 0;
+ for (int i = 0; i < 20; i++) sum += foo(o);
+ o = new B();
+ sum += foo(o); // <-- Cause deoptimization of bar within foo.
+ Expect.equals(20, sum);
+}
diff --git a/tests/language/optimize/isempty_test.dart b/tests/language/optimize/isempty_test.dart
new file mode 100644
index 0000000..7b8e77c
--- /dev/null
+++ b/tests/language/optimize/isempty_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2013, 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+// Test optimization and polymorphic inlining of String.isEmpty.
+
+import "package:expect/expect.dart";
+
+test(s) => s.isEmpty;
+
+main() {
+ var x = "abc";
+ var y = [123, 12345, 765];
+ Expect.equals(false, test(x));
+ Expect.equals(false, test(y));
+ for (var i = 0; i < 20; i++) test(x);
+ Expect.equals(false, test(x));
+ Expect.equals(false, test(y));
+}
diff --git a/tests/language/optimize/licm2_test.dart b/tests/language/optimize/licm2_test.dart
new file mode 100644
index 0000000..9e82949
--- /dev/null
+++ b/tests/language/optimize/licm2_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, 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 that a loop invariant code motion optimization does not try to
+// hoist instructions that may throw.
+
+import "package:expect/expect.dart";
+
+var a = 42;
+var b;
+
+main() {
+ Expect.throws(() {
+ while (true) {
+ a = 54;
+ b.length;
+ }
+ });
+ b = [];
+ Expect.equals(54, a);
+}
diff --git a/tests/language/optimize/licm3_test.dart b/tests/language/optimize/licm3_test.dart
new file mode 100644
index 0000000..9b78e1f
--- /dev/null
+++ b/tests/language/optimize/licm3_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2013, 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 that a loop invariant code motion optimization correctly hoists
+// instructions that may cause deoptimization.
+
+import "package:expect/expect.dart";
+
+foo(o) {
+ var r = 0;
+ for (var i = 0; i < 3; i++) {
+ r += o.z as int;
+ }
+ return r;
+}
+
+class A {
+ var z = 3;
+}
+
+main() {
+ var a = new A();
+ for (var i = 0; i < 10000; i++) foo(a);
+ Expect.equals(9, foo(a));
+ Expect.throws(() => foo(42));
+ for (var i = 0; i < 10000; i++) foo(a);
+ Expect.throws(() => foo(42));
+}
diff --git a/tests/language/optimize/licm_test.dart b/tests/language/optimize/licm_test.dart
new file mode 100644
index 0000000..002c5d9
--- /dev/null
+++ b/tests/language/optimize/licm_test.dart
@@ -0,0 +1,27 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+var sum = 0;
+var foo = 0;
+var bar = 1;
+
+test() {
+ while (true) {
+ if (0 == foo) {
+ sum += 2;
+ if (1 == bar) {
+ sum += 3;
+ break;
+ }
+ break;
+ }
+ }
+}
+
+main() {
+ test();
+ Expect.equals(5, sum);
+}
diff --git a/tests/language/optimize/lists_test.dart b/tests/language/optimize/lists_test.dart
new file mode 100644
index 0000000..ea4cd6d
--- /dev/null
+++ b/tests/language/optimize/lists_test.dart
@@ -0,0 +1,31 @@
+// 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.
+// Test program for correct optimizations related to types fo allocated lists.
+// VMOptions=--optimization-counter-threshold=10
+
+import "package:expect/expect.dart";
+
+main() {
+ // Trigger optimization of 'test' method.
+ for (int i = 0; i < 20; i++) {
+ test(2);
+ }
+}
+
+test(n) {
+ var a = []; // Growable list.
+ var b = new List<dynamic>.filled(10, null); // Fixed size list.
+ var c = const [1, 2, 3, 4]; // Constant aray.
+ // In optimized mode the class checks will be eliminated since the
+ // constructors above provide information about exact types.
+ a.add(4);
+ b[0] = 5;
+ Expect.equals(4, a[0]);
+ Expect.equals(5, b[0]);
+ // Test bound check elimination.
+ Expect.equals(2, c[1]);
+ // Test elimination of array length computation.
+ var v = c[n];
+ Expect.equals(v, c[n]);
+}
diff --git a/tests/language/optimize/osr_test.dart b/tests/language/optimize/osr_test.dart
new file mode 100644
index 0000000..3bc8db3
--- /dev/null
+++ b/tests/language/optimize/osr_test.dart
@@ -0,0 +1,95 @@
+// Copyright (c) 2014, 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.
+// VMOptions=--optimization-counter-threshold=5 --no-background-compilation
+// Test correct OSR (issue 16151).
+
+import "dart:collection";
+import "package:expect/expect.dart";
+
+List create([int? length]) {
+ return new MyList(length);
+}
+
+main() {
+ test(create);
+}
+
+class MyList<E> extends ListBase<E> {
+ List<E?> _list;
+
+ MyList([int? length])
+ : _list = (length == null ? <E?>[] : new List<E?>.filled(length, null));
+
+ E operator [](int index) => _list[index]!;
+
+ void operator []=(int index, E value) {
+ _list[index] = value;
+ }
+
+ int get length => _list.length;
+
+ void set length(int newLength) {
+ _list.length = newLength;
+ }
+}
+
+test(List create([int length])) {
+ sort_A01_t02_test(create);
+}
+
+// From library co19 sort_A01_t02.
+
+sort_A01_t02_test(List create([int length])) {
+ int c(var a, var b) {
+ return a < b ? -1 : (a == b ? 0 : 1);
+ }
+
+ int maxlen = 7;
+ int prevLength = 0;
+ for (int length = 1; length < maxlen; ++length) {
+ // Check that we are making progress.
+ if (prevLength == length) {
+ // Cannot use Expect.notEquals since it hides the bug.
+ throw "No progress made";
+ }
+ prevLength = length;
+ List a = create(length);
+ List expected = create(length);
+ for (int i = 0; i < length; ++i) {
+ expected[i] = i;
+ a[i] = i;
+ }
+
+ void swap(int i, int j) {
+ var t = a[i];
+ a[i] = a[j];
+ a[j] = t;
+ }
+
+ void check() {
+ return;
+ // Deleting the code below will throw a RangeError instead of throw above.
+ var a_copy = new List<dynamic>.filled(length, null);
+ a_copy.setRange(0, length, a);
+ a_copy.sort(c);
+ }
+
+ void permute(int n) {
+ if (n == 1) {
+ check();
+ } else {
+ for (int i = 0; i < n; i++) {
+ permute(n - 1);
+ if (n % 2 == 1) {
+ swap(0, n - 1);
+ } else {
+ swap(i, n - 1);
+ }
+ }
+ }
+ } //void permute
+
+ permute(length);
+ } //for i in 0..length
+} // test
diff --git a/tests/language/optimize/phi_merge_test.dart b/tests/language/optimize/phi_merge_test.dart
new file mode 100644
index 0000000..ab8059c
--- /dev/null
+++ b/tests/language/optimize/phi_merge_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to crash on this code.
+
+class A {
+ operator []=(index, value) {
+ switch (value) {
+ case 42:
+ break;
+ case 43:
+ break;
+ }
+ }
+}
+
+main() {
+ // Make [a] a phi.
+ var a;
+ if (true) {
+ a = new A();
+ } else {
+ a = new A();
+ }
+ // `A[]=` being inlined, the compiler was confused when merging the
+ // phis after the switch.
+ a[0] = 42;
+
+ // Use [a] to provoke the crash.
+ print(a);
+}
diff --git a/tests/language/optimize/pure_function2_test.dart b/tests/language/optimize/pure_function2_test.dart
new file mode 100644
index 0000000..61b218e
--- /dev/null
+++ b/tests/language/optimize/pure_function2_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2014, 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";
+
+// Regression test for issue 17483.
+
+confuse(x) {
+ if (new DateTime.now().millisecondsSinceEpoch == 42) return confuse(x);
+ return x;
+}
+
+foo(trace) {
+ trace.add("foo");
+ return "foo";
+}
+
+bar(trace) {
+ trace.add("bar");
+ return "bar";
+}
+
+main() {
+ var f = confuse(foo);
+ var b = confuse(bar);
+
+ var trace = [];
+ // Dart2js must keep the order of t1 and t2.
+ var t1 = f(trace);
+ var t2 = b(trace);
+ var t3 = identical(t2, "foo");
+ trace.add(t1);
+ trace.add(t3);
+ trace.add(t3);
+ Expect.listEquals(["foo", "bar", "foo", false, false], trace);
+}
diff --git a/tests/language/optimize/pure_function_test.dart b/tests/language/optimize/pure_function_test.dart
new file mode 100644
index 0000000..4bd36be
--- /dev/null
+++ b/tests/language/optimize/pure_function_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2014, 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";
+
+// Regression test for issue 17483.
+
+class A {
+ var x, y;
+ A(x, this.y) {
+ this.x = x;
+ }
+ toString() => "a";
+}
+
+foo(trace) => trace.add("foo");
+bar(trace) => trace.add("bar");
+
+main() {
+ var trace = [];
+ // Dart2js must keep the order of t1 and t2.
+ var t1 = foo(trace);
+ var t2 = bar(trace);
+ // Dart2js inlines the constructor, yielding something like:
+ // t3 = jsNew A(null, t2); // Note that jsNew is pure.
+ // t3.x = t1;
+ // t3 is used twice and cannot be generated at use site.
+ // Dart2js must not allow t1 to cross the t3-line.
+ var a = new A(t1, t2);
+ // Use a. It is already implicitly used by the this.x = x line in its
+ // constructor. With the following use we use it twice and make sure that
+ // the allocation can not be generated at use-site.
+ trace.add(a.toString());
+ Expect.listEquals(["foo", "bar", "a"], trace);
+}
diff --git a/tests/language/optimize/redundant_array_load_test.dart b/tests/language/optimize/redundant_array_load_test.dart
new file mode 100644
index 0000000..44256c7
--- /dev/null
+++ b/tests/language/optimize/redundant_array_load_test.dart
@@ -0,0 +1,30 @@
+// 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+// Test optimization of redundant array loads.
+
+var A = [0, 2, 3];
+
+test1(a) {
+ int x = a[0];
+ int y = a[1];
+ ++a[0];
+ return a[0] + y + a[2];
+}
+
+int test2(a) {
+ return a[2] + a[2];
+}
+
+main() {
+ for (int i = 0; i < 20; i++) {
+ test1(A);
+ test2(A);
+ }
+ Expect.equals(26, test1(A));
+ Expect.equals(6, test2(A));
+}
diff --git a/tests/language/optimize/setter_test.dart b/tests/language/optimize/setter_test.dart
new file mode 100644
index 0000000..60cf407
--- /dev/null
+++ b/tests/language/optimize/setter_test.dart
@@ -0,0 +1,155 @@
+// Copyright (c) 2011, 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 various setter situations, testing special cases in optimizing compiler.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+class A {
+ int field = 0;
+}
+
+class B extends A {}
+
+void sameImplicitSetter() {
+ oneTarget(var a, var v) {
+ a.field = v;
+ }
+
+ A a = new A();
+ B b = new B();
+ // Optimize 'oneTarget' for one class, one target.
+ for (int i = 0; i < 20; i++) {
+ oneTarget(a, 5);
+ Expect.equals(5, a.field);
+ }
+ // Deoptimize 'oneTarget', since class B is not expected.
+ oneTarget(b, 6);
+ Expect.equals(6, b.field);
+ // Optimize 'oneTarget' for A and B classes, one target.
+ for (int i = 0; i < 20; i++) {
+ oneTarget(a, 7);
+ Expect.equals(7, a.field);
+ }
+ oneTarget(b, 8);
+ Expect.equals(8, b.field);
+}
+
+// Deoptimize when no feedback exists.
+void setterNoFeedback() {
+ maybeSet(var a, var v, bool set_it) {
+ if (set_it) {
+ return a.field = v;
+ }
+ return -1;
+ }
+
+ A a = new A();
+ for (int i = 0; i < 20; i++) {
+ var r = maybeSet(a, 5, false);
+ Expect.equals(0, a.field);
+ Expect.equals(-1, r);
+ }
+ var r = maybeSet(a, 5, true);
+ Expect.equals(5, a.field);
+ Expect.equals(5, r);
+ for (int i = 0; i < 20; i++) {
+ var r = maybeSet(a, 6, true);
+ Expect.equals(6, a.field);
+ Expect.equals(6, r);
+ }
+}
+
+// Check non-implicit setter
+class X {
+ int pField = 0;
+ set field(v) {
+ pField = v;
+ }
+
+ get field => 10;
+}
+
+void sameNotImplicitSetter() {
+ oneTarget(var a, var v) {
+ return a.field = v;
+ }
+
+ incField(var a) {
+ a.field++;
+ }
+
+ X x = new X();
+ for (int i = 0; i < 20; i++) {
+ var r = oneTarget(x, 3);
+ Expect.equals(3, x.pField);
+ Expect.equals(3, r);
+ }
+ oneTarget(x, 0);
+ for (int i = 0; i < 20; i++) {
+ incField(x);
+ }
+ Expect.equals(11, x.pField);
+}
+
+class Y {
+ int field = 0;
+}
+
+multiImplicitSetter() {
+ oneTarget(var a, var v) {
+ return a.field = v;
+ }
+
+ // Both classes 'Y' and 'A' have a distinct field getter.
+ A a = new A();
+ Y y = new Y();
+ for (int i = 0; i < 20; i++) {
+ var r = oneTarget(a, 5);
+ Expect.equals(5, a.field);
+ Expect.equals(5, r);
+ r = oneTarget(y, 6);
+ Expect.equals(6, y.field);
+ Expect.equals(6, r);
+ }
+}
+
+class Z {
+ int pField = 0;
+ set field(v) {
+ pField = v;
+ }
+
+ get field => 10;
+}
+
+multiNotImplicitSetter() {
+ oneTarget(var a, var v) {
+ return a.field = v;
+ }
+
+ Y y = new Y();
+ Z z = new Z();
+ for (int i = 0; i < 20; i++) {
+ var r = oneTarget(y, 8);
+ Expect.equals(8, y.field);
+ Expect.equals(8, r);
+ r = oneTarget(z, 12);
+ Expect.equals(12, z.pField);
+ Expect.equals(12, r);
+ }
+ A a = new A();
+ var r = oneTarget(a, 11);
+ Expect.equals(11, a.field);
+ Expect.equals(11, r);
+}
+
+void main() {
+ sameImplicitSetter();
+ setterNoFeedback();
+ sameNotImplicitSetter();
+
+ multiImplicitSetter();
+ multiNotImplicitSetter();
+}
diff --git a/tests/language/optimize/string_charat_test.dart b/tests/language/optimize/string_charat_test.dart
new file mode 100644
index 0000000..f3368fe
--- /dev/null
+++ b/tests/language/optimize/string_charat_test.dart
@@ -0,0 +1,65 @@
+// 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+import "package:expect/expect.dart";
+
+// Test optimized [] on strings.
+
+var a = "abc";
+var b = "øbc";
+var c = new String.fromCharCodes([123, 456, 789]);
+
+test_charat(s, i) {
+ return s[i];
+}
+
+test_const_str(i) {
+ return "abc"[i];
+}
+
+test_const_index(s) {
+ return s[0];
+}
+
+test_const_index2(s) {
+ return s[3];
+}
+
+main() {
+ Expect.equals("a", test_charat(a, 0));
+ for (var i = 0; i < 20; i++) test_charat(a, 0);
+ Expect.equals("a", test_charat(a, 0));
+ Expect.equals("b", test_charat(a, 1));
+ Expect.equals("c", test_charat(a, 2));
+ Expect.throws(() => test_charat(a, 3));
+
+ Expect.equals("a", test_const_str(0));
+ for (var i = 0; i < 20; i++) test_const_str(0);
+ Expect.equals("a", test_const_str(0));
+ Expect.equals("b", test_const_str(1));
+ Expect.equals("c", test_const_str(2));
+ Expect.throws(() => test_const_str(3));
+
+ Expect.equals("a", test_const_index(a));
+ for (var i = 0; i < 20; i++) test_const_index(a);
+ Expect.equals("a", test_const_index(a));
+ Expect.equals("ø", test_const_index(b));
+ Expect.equals(new String.fromCharCodes([123]), test_const_index(c));
+ Expect.throws(() => test_const_index2(a));
+
+ Expect.equals("ø", test_charat(b, 0));
+ for (var i = 0; i < 20; i++) test_charat(b, 0);
+ Expect.equals("ø", test_charat(b, 0));
+ Expect.equals("b", test_charat(b, 1));
+ Expect.equals("c", test_charat(b, 2));
+ Expect.throws(() => test_charat(b, 3));
+
+ Expect.equals(new String.fromCharCodes([123]), test_charat(c, 0));
+ for (var i = 0; i < 20; i++) test_charat(c, 0);
+ Expect.equals(new String.fromCharCodes([123]), test_charat(c, 0));
+ Expect.equals(new String.fromCharCodes([456]), test_charat(c, 1));
+ Expect.equals(new String.fromCharCodes([789]), test_charat(c, 2));
+ Expect.throws(() => test_charat(c, 3));
+}
diff --git a/tests/language/optimize/string_charcodeat_test.dart b/tests/language/optimize/string_charcodeat_test.dart
new file mode 100644
index 0000000..14e09db
--- /dev/null
+++ b/tests/language/optimize/string_charcodeat_test.dart
@@ -0,0 +1,78 @@
+// 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.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+// Test optimized CodeUnitAt and array access.
+
+import "package:expect/expect.dart";
+
+String one_byte = "hest";
+String two_byte = "h\u{2029}ns";
+
+int testOneByteCodeUnitAt(String x, int j) {
+ int test() {
+ return x.codeUnitAt(j);
+ }
+
+ for (int i = 0; i < 20; i++) test();
+ return test();
+}
+
+int testTwoByteCodeUnitAt(String x, int j) {
+ int test() {
+ return x.codeUnitAt(j);
+ }
+
+ for (int i = 0; i < 20; i++) test();
+ return test();
+}
+
+int testConstantStringCodeUnitAt(int j) {
+ int test() {
+ return "høns".codeUnitAt(j);
+ }
+
+ for (int i = 0; i < 20; i++) test();
+ return test();
+}
+
+int testConstantIndexCodeUnitAt(String x) {
+ int test() {
+ return x.codeUnitAt(1);
+ }
+
+ for (int i = 0; i < 20; i++) test();
+ return test();
+}
+
+int testOneByteCodeUnitAtInLoop(var x) {
+ var result = 0;
+ for (int i = 0; i < x.length; i++) {
+ result += x.codeUnitAt(i) as int;
+ }
+ return result;
+}
+
+int testTwoByteCodeUnitAtInLoop(var x) {
+ var result = 0;
+ for (int i = 0; i < x.length; i++) {
+ result += x.codeUnitAt(i) as int;
+ }
+ return result;
+}
+
+main() {
+ for (int j = 0; j < 10; j++) {
+ Expect.equals(101, testOneByteCodeUnitAt(one_byte, 1));
+ Expect.equals(8233, testTwoByteCodeUnitAt(two_byte, 1));
+ Expect.equals(248, testConstantStringCodeUnitAt(1));
+ Expect.equals(101, testConstantIndexCodeUnitAt(one_byte));
+ }
+ for (int j = 0; j < 20; j++) {
+ Expect.equals(436, testOneByteCodeUnitAtInLoop(one_byte));
+ Expect.equals(8562, testTwoByteCodeUnitAtInLoop(two_byte));
+ }
+ Expect.throws(() => testOneByteCodeUnitAtInLoop(123));
+ Expect.throws(() => testTwoByteCodeUnitAtInLoop(123));
+}
diff --git a/tests/language/override/const_field_test.dart b/tests/language/override/const_field_test.dart
new file mode 100644
index 0000000..8018296
--- /dev/null
+++ b/tests/language/override/const_field_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2019, 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 checking that static/instance field shadowing do not conflict.
+
+import 'package:expect/expect.dart';
+
+class A {
+ final field;
+ const A(this.field);
+}
+
+class B extends A {
+ final field;
+ const B(this.field, fieldA) : super(fieldA);
+ get fieldA => super.field;
+}
+
+main() {
+ const b = B(1, 2);
+ Expect.equals(1, b.field);
+ Expect.equals(2, b.fieldA);
+}
diff --git a/tests/language/override/field_method1_test.dart b/tests/language/override/field_method1_test.dart
new file mode 100644
index 0000000..bee5869
--- /dev/null
+++ b/tests/language/override/field_method1_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2019, 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.
+
+/// Overriding field with method.
+
+class A {
+ var foo;
+}
+
+class B extends A {
+ foo() {}
+//^^^
+// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_METHOD_AND_FIELD
+// [cfe] Can't declare a member that conflicts with an inherited one.
+}
+
+main() {
+ B().foo();
+}
diff --git a/tests/language/override/field_method2_test.dart b/tests/language/override/field_method2_test.dart
new file mode 100644
index 0000000..0b5e4b3
--- /dev/null
+++ b/tests/language/override/field_method2_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2019, 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.
+
+/// Overriding getter with method.
+
+class A {
+ get foo => 123;
+}
+
+class B extends A {
+ foo() {}
+//^^^
+// [analyzer] COMPILE_TIME_ERROR.CONFLICTING_METHOD_AND_FIELD
+// [cfe] Can't declare a member that conflicts with an inherited one.
+}
+
+main() {
+ B().foo();
+}
diff --git a/tests/language/override/field_method3_test.dart b/tests/language/override/field_method3_test.dart
new file mode 100644
index 0000000..dbd5cfe
--- /dev/null
+++ b/tests/language/override/field_method3_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2019, 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.
+
+/// Overriding method with field.
+
+class A {
+ foo() {}
+}
+
+class B extends A {
+ var foo;
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_FIELD_AND_METHOD
+ // [cfe] Can't declare a member that conflicts with an inherited one.
+}
+
+main() {
+ B().foo;
+}
diff --git a/tests/language/override/field_method4_test.dart b/tests/language/override/field_method4_test.dart
new file mode 100644
index 0000000..eecea07
--- /dev/null
+++ b/tests/language/override/field_method4_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2019, 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.
+
+/// Overriding method with getter.
+
+class A {
+ foo() => 999;
+}
+
+class B extends A {
+ get foo => 123;
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_FIELD_AND_METHOD
+ // [cfe] Can't declare a member that conflicts with an inherited one.
+}
+
+main() {
+ B().foo;
+}
diff --git a/tests/language/override/field_test.dart b/tests/language/override/field_test.dart
new file mode 100644
index 0000000..739eacd
--- /dev/null
+++ b/tests/language/override/field_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2011, 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 checking that static/instance field shadowing do not conflict.
+
+class A {
+ int instanceFieldInA = 0;
+ static int staticFieldInA = 0;
+}
+
+class B extends A {
+ static int instanceFieldInA = 0; // //# 01: compile-time error
+ int staticFieldInA = 0; // //# 02: ok
+ static int staticFieldInA = 0; // //# 03: ok
+}
+
+main() {
+ var x = new B();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_1_test.dart b/tests/language/override/inheritance_abstract_runtime_1_test.dart
new file mode 100644
index 0000000..97b0057
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_1_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+ method1();
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class I {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+ method1() {}
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_2_test.dart b/tests/language/override/inheritance_abstract_runtime_2_test.dart
new file mode 100644
index 0000000..2b15235
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_2_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+
+ method5();
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class I {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+
+
+
+
+ method5() {}
+
+
+
+
+
+
+
+
+
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_3_test.dart b/tests/language/override/inheritance_abstract_runtime_3_test.dart
new file mode 100644
index 0000000..c54794a
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_3_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+
+
+ method6();
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class I {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+
+
+
+
+
+ method6([a]) {}
+
+
+
+
+
+
+
+
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_4_test.dart b/tests/language/override/inheritance_abstract_runtime_4_test.dart
new file mode 100644
index 0000000..ddfba63
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_4_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+
+
+
+
+
+
+
+
+
+
+
+ method18() {}
+
+}
+
+abstract class I {
+
+
+
+
+
+
+
+
+ method18() {}
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_5_test.dart b/tests/language/override/inheritance_abstract_runtime_5_test.dart
new file mode 100644
index 0000000..48a350d
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_5_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+
+
+
+
+
+
+
+
+
+
+
+
+ method27() {}
+}
+
+abstract class I {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+
+
+
+
+
+
+
+
+
+
+
+
+
+ method27();
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_6_test.dart b/tests/language/override/inheritance_abstract_runtime_6_test.dart
new file mode 100644
index 0000000..e8b1123
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_6_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class I {
+
+
+
+
+
+ method15() {}
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+
+
+
+
+
+
+
+
+ method15() {}
+
+
+
+
+
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_7_test.dart b/tests/language/override/inheritance_abstract_runtime_7_test.dart
new file mode 100644
index 0000000..e1d3cab
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_7_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class I {
+
+
+
+
+
+
+ method16() {}
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+
+
+
+
+
+
+
+
+
+ method16([a]) {}
+
+
+
+
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_runtime_test.dart b/tests/language/override/inheritance_abstract_runtime_test.dart
new file mode 100644
index 0000000..40685ca
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_runtime_test.dart
@@ -0,0 +1,69 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2014, 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 A {
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class I {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+abstract class J {
+
+
+
+}
+
+class Class extends A implements I, J {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_abstract_test.dart b/tests/language/override/inheritance_abstract_test.dart
new file mode 100644
index 0000000..9218fab
--- /dev/null
+++ b/tests/language/override/inheritance_abstract_test.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2014, 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 A {
+ method1();
+ method5();
+ method6();
+ method7();
+ get getter8;
+ set setter9(_);
+ method10();
+ get getter11;
+ set setter12(_);
+ get field13;
+ set field14(_);
+ method18() {}
+ method27() {}
+}
+
+abstract class I {
+ method10() {}
+ get getter11 => 0;
+ set setter12(_) {}
+ var field13;
+ var field14;
+ method15() {}
+ method16() {}
+ method17() {}
+ method18() {}
+ var member19;
+ var member20;
+ var member21;
+ get member22 => 0;
+ set member23(_) {}
+ var member24;
+ var field25;
+ var member26;
+}
+
+abstract class J {
+ get member20 => null;
+ set member20(_) {}
+ var member21;
+}
+
+class Class extends A implements I, J {
+// ^^^^^
+// [analyzer] STATIC_WARNING.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER
+// [cfe] The non-abstract class 'Class' is missing implementations for these members:
+ method1() {}
+ method2();
+//^^^^^^^^^^
+// [analyzer] STATIC_WARNING.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER
+ get getter3;
+//^^^^^^^^^^^^
+// [analyzer] STATIC_WARNING.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER
+ set setter4(_);
+//^^^^^^^^^^^^^^^
+// [analyzer] STATIC_WARNING.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER
+ method5() {}
+ method6([a]) {}
+ set field13(_) {}
+ get field14 => 0;
+ method15() {}
+ method16([a]) {}
+ get member24 => 0;
+ final field25 = 0;
+ set member26(_) {}
+ method27();
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_field_test.dart b/tests/language/override/inheritance_field_test.dart
new file mode 100644
index 0000000..3843c91
--- /dev/null
+++ b/tests/language/override/inheritance_field_test.dart
@@ -0,0 +1,127 @@
+// Copyright (c) 2014, 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:meta/meta.dart" show virtual;
+
+class A {
+ get getter1 => null; //# 01: ok
+ num get getter2 => 0; //# 02: ok
+ num get getter3 => 0; //# 03: ok
+ int get getter4 => 0; //# 04: compile-time error
+ int get getter5 => 0; //# 05: compile-time error
+ int get getter6 => 0; //# 06: compile-time error
+ int get getter7 => 0; //# 07: compile-time error
+ int get getter8 => 0; //# 08: compile-time error
+
+ set setter1(_) => null; //# 21: ok
+ void set setter2(_) {} //# 22: ok
+ set setter3(_) => null; //# 23: ok
+ set setter4(_) => null; //# 24: ok
+ set setter5(num _) => null; //# 25: ok
+ set setter6(num _) => null; //# 26: compile-time error
+ set setter7(int _) => null; //# 27: ok
+ set setter8(int _) => null; //# 28: compile-time error
+ set setter9(int _) => null; //# 29: compile-time error
+ set setter10(int _) => null; //# 30: compile-time error
+ set setter11(int _) => null; //# 31: compile-time error
+
+ @virtual int field1 = 0; //# 41: ok
+ num field2 = 0; //# 42: compile-time error
+ int field3 = 0; //# 43: compile-time error
+ int field4 = 0; //# 44: compile-time error
+ int field5 = 0; //# 45: compile-time error
+ @virtual num field6 = 0; //# 46: ok
+ num field7 = 0; //# 47: compile-time error
+ num get field8 => 0; //# 48: compile-time error
+ num field9 = 0; //# 49: compile-time error
+ num field10 = 0; //# 50: compile-time error
+ set field11(int _) {} //# 51: ok
+ void set field12(int _) {} //# 52: ok
+ num field13 = 0; //# 53: compile-time error
+ set field14(num _) {} //# 54: compile-time error
+ num field15 = 0; //# 55: ok
+}
+
+class B extends A {
+ num get getter6 => 0; //# 06: continued
+ set setter9(num _) => null; //# 29: continued
+ num field5 = 0; //# 45: continued
+}
+
+abstract class I {
+ num get getter7 => 0; //# 07: continued
+ String get getter8 => ""; //# 08: continued
+ int get getter9 => 0; //# 09: compile-time error
+ int get getter10 => 0; //# 10: compile-time error
+ int get getter11 => 0; //# 11: compile-time error
+ set setter10(num _) => null; //# 30: continued
+ set setter11(String _) => null; //# 31: continued
+ set setter12(int _) => null; //# 32: compile-time error
+ set setter13(int _) => null; //# 33: compile-time error
+ set setter13(num _) => null; //# 33a: compile-time error
+ set setter14(int _) => null; //# 34: compile-time error
+}
+
+abstract class J {
+ String get getter9 => ""; //# 09: continued
+ num get getter10 => 0; //# 10: continued
+ num get getter11 => 0; //# 11: continued
+ set setter12(String _) => null; //# 32: continued
+ set setter13(num _) => null; //# 33: continued
+ set setter13(int _) => null; //# 33a: continued
+ set setter14(num _) => null; //# 34: continued
+}
+
+abstract class Class extends B implements I, J {
+ get getter1 => null; //# 01: continued
+ num get getter2 => 0; //# 02: continued
+ int get getter3 => 0; //# 03: continued
+ num get getter4 => 0; //# 04: continued
+ double get getter5 => 0.0; //# 05: continued
+ double get getter6 => 0.0; //# 06: continued
+ double get getter7 => 0.0; //# 07: continued
+ double get getter8 => 0.0; //# 08: continued
+ double get getter9 => 0.0; //# 09: continued
+
+ set setter1(_) => null; //# 21: continued
+ set setter2(_) => null; //# 22: continued
+ void set setter3(_) {} //# 23: continued
+ void set setter4(_) {} //# 24: continued
+ set setter5(num _) => null; //# 25: continued
+ set setter6(int _) => null; //# 26: continued
+ set setter7(num _) => null; //# 27: continued
+ set setter8(double _) => null; //# 28: continued
+ set setter9(double _) => null; //# 29: continued
+ set setter10(double _) => null; //# 30: continued
+ set setter11(double _) => null; //# 31: continued
+ set setter12(double _) => null; //# 32: continued
+
+ int field1 = 0; //# 41: continued
+ int field2 = 0; //# 42: continued
+ num field3 = 0; //# 43: continued
+ double field4 = 0.0; //# 44: continued
+ double field5 = 0.0; //# 45: continued
+ int get field6 => 0; //# 46: continued
+ String get field7 => ""; //# 47: continued
+ String field8 = ""; //# 48: continued
+ set field9(int _) {} //# 49: continued
+ void set field10(int _) {} //# 50: continued
+ num field11 = 0; //# 51: continued
+ num field12 = 0; //# 52: continued
+ set field13(String _) {} //# 53: continued
+ String field14 = ""; //# 54: continued
+ set field15(covariant int _) {} //# 55: continued
+}
+
+class SubClass extends Class {
+ double get getter10 => 0.0; //# 10: continued
+ String get getter11 => ""; //# 11: continued
+ set setter13(double _) => null; //# 33: continued
+ set setter13(double _) => null; //# 33a: continued
+ set setter14(String _) => null; //# 34: continued
+}
+
+main() {
+ new SubClass();
+}
diff --git a/tests/language/override/inheritance_generic_test.dart b/tests/language/override/inheritance_generic_test.dart
new file mode 100644
index 0000000..dd0481d
--- /dev/null
+++ b/tests/language/override/inheritance_generic_test.dart
@@ -0,0 +1,74 @@
+// Copyright (c) 2014, 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<T> {
+ method1(T t) => null; //# 01: ok
+ method2(T t) => null; //# 02: compile-time error
+ method4(T t) => null; //# 04: compile-time error
+ method5(T t) => null; //# 05: ok
+ method7(T t) => null; //# 07: compile-time error
+}
+
+class B<S> extends A
+<S> //# 01: continued
+<num> //# 02: continued
+<S> //# 04: continued
+<S> //# 05: continued
+{
+ method1(S s) => null; //# 01: continued
+ method2(int i) => null; //# 02: continued
+ method3(S s) => null; //# 03: ok
+ method4(int i) => null; //# 04: continued
+ method6(S s) => null; //# 06: compile-time error
+}
+
+abstract class I<U> {
+ method3(U u) => null; //# 03: continued
+ method6(U u) => null; //# 06: continued
+ method7(U u) => null; //# 07: continued
+ method8(U u) => null; //# 08: compile-time error
+ method9(U u) => null; //# 09: compile-time error
+ method10(U u) => null; //# 10: compile-time error
+}
+
+abstract class J<V> {
+ method8(V v) => null; //# 08: continued
+ method9(V v) => null; //# 09: continued
+ method10(V v) => null; //# 10: continued
+}
+
+abstract class Class<W> extends B
+<double> //# 03: continued
+<W> //# 05: continued
+<W> //# 06: continued
+<int> //# 07: continued
+ implements
+ I
+<int> //# 03: continued
+<num> //# 06: continued
+<String> //# 07: continued
+<int> //# 08: continued
+<int> //# 09: continued
+<int> //# 10: continued
+ ,
+ J
+<String> //# 08: continued
+<num> //# 09: continued
+<num> //# 10: continued
+{
+ method3(num i) => null; //# 03: continued
+ method5(W w) => null; //# 05: continued
+ method6(int i) => null; //# 06: continued
+ method7(double d) => null; //# 07: continued
+ method8(double d) => null; //# 08: continued
+}
+
+class SubClass extends Class {
+ method9(double d) => null; //# 09: continued
+ method10(String s) => null; //# 10: continued
+}
+
+main() {
+ new SubClass();
+}
diff --git a/tests/language/override/inheritance_method2_test.dart b/tests/language/override/inheritance_method2_test.dart
new file mode 100644
index 0000000..e22571f
--- /dev/null
+++ b/tests/language/override/inheritance_method2_test.dart
@@ -0,0 +1,1112 @@
+// 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.
+
+main() {
+ new C();
+}
+
+class A {
+ method1(covariant dynamic a) => null; //# 001: ok
+ method2(covariant dynamic a) => null; //# 002: ok
+ method3(covariant dynamic a) => null; //# 003: ok
+ method4(covariant dynamic a) => null; //# 004: ok
+ method5(covariant dynamic a) => null; //# 005: ok
+ method6(covariant dynamic a) => null; //# 006: ok
+ method7(covariant dynamic a) => null; //# 007: ok
+ method8(covariant dynamic a) => null; //# 008: ok
+ method9(covariant dynamic a) => null; //# 009: ok
+ method10(covariant dynamic a) => null; //# 010: ok
+ method11(covariant dynamic a) => null; //# 011: ok
+ method12(covariant dynamic a) => null; //# 012: compile-time error
+ method13(covariant dynamic a) => null; //# 013: ok
+ method14(covariant dynamic a) => null; //# 014: ok
+ method15(covariant dynamic a) => null; //# 015: ok
+ method16(covariant dynamic a) => null; //# 016: compile-time error
+ method17(covariant dynamic a) => null; //# 017: ok
+ method18(covariant dynamic a) => null; //# 018: ok
+ method19(covariant dynamic a) => null; //# 019: ok
+ method20(covariant dynamic a) => null; //# 020: compile-time error
+ method21(covariant dynamic a) => null; //# 021: ok
+ method22(covariant dynamic a) => null; //# 022: ok
+ method23(covariant dynamic a) => null; //# 023: ok
+ method24(covariant dynamic a) => null; //# 024: compile-time error
+ method25(covariant dynamic a) => null; //# 025: ok
+ method26(covariant dynamic a) => null; //# 026: compile-time error
+ method27(covariant dynamic a) => null; //# 027: compile-time error
+ method28(covariant dynamic a) => null; //# 028: ok
+ method29(covariant dynamic a) => null; //# 029: ok
+ method30(covariant dynamic a) => null; //# 030: compile-time error
+ method31(covariant dynamic a) => null; //# 031: compile-time error
+ method32(covariant dynamic a) => null; //# 032: ok
+ method33(covariant dynamic a) => null; //# 033: ok
+ method34(covariant dynamic a) => null; //# 034: ok
+ method35(covariant dynamic a) => null; //# 035: ok
+ method36(covariant dynamic a) => null; //# 036: ok
+ method37(covariant dynamic a) => null; //# 037: ok
+ method38(covariant dynamic a) => null; //# 038: ok
+ method39(covariant dynamic a) => null; //# 039: ok
+ method40(covariant dynamic a) => null; //# 040: ok
+ method41(covariant dynamic a) => null; //# 041: ok
+ method42(covariant dynamic a) => null; //# 042: ok
+ method43(covariant dynamic a) => null; //# 043: ok
+ method44(covariant dynamic a) => null; //# 044: compile-time error
+ method45(covariant dynamic a) => null; //# 045: ok
+ method46(covariant dynamic a) => null; //# 046: ok
+ method47(covariant dynamic a) => null; //# 047: ok
+ method48(covariant dynamic a) => null; //# 048: compile-time error
+ method49(covariant dynamic a) => null; //# 049: ok
+ method50(covariant dynamic a) => null; //# 050: ok
+ method51(covariant dynamic a) => null; //# 051: ok
+ method52(covariant dynamic a) => null; //# 052: compile-time error
+ method53(covariant dynamic a) => null; //# 053: ok
+ method54(covariant dynamic a) => null; //# 054: ok
+ method55(covariant dynamic a) => null; //# 055: ok
+ method56(covariant dynamic a) => null; //# 056: compile-time error
+ method57(covariant dynamic a) => null; //# 057: ok
+ method58(covariant dynamic a) => null; //# 058: compile-time error
+ method59(covariant dynamic a) => null; //# 059: compile-time error
+ method60(covariant dynamic a) => null; //# 060: ok
+ method61(covariant dynamic a) => null; //# 061: ok
+ method62(covariant dynamic a) => null; //# 062: compile-time error
+ method63(covariant dynamic a) => null; //# 063: compile-time error
+ method64(covariant dynamic a) => null; //# 064: ok
+ method65(covariant num a) => null; //# 065: ok
+ method66(covariant num a) => null; //# 066: ok
+ method67(covariant num a) => null; //# 067: ok
+ method68(covariant num a) => null; //# 068: compile-time error
+ method69(covariant num a) => null; //# 069: ok
+ method70(covariant num a) => null; //# 070: ok
+ method71(covariant num a) => null; //# 071: ok
+ method72(covariant num a) => null; //# 072: compile-time error
+ method73(covariant num a) => null; //# 073: ok
+ method74(covariant num a) => null; //# 074: ok
+ method75(covariant num a) => null; //# 075: ok
+ method76(covariant num a) => null; //# 076: compile-time error
+ method77(covariant num a) => null; //# 077: ok
+ method78(covariant num a) => null; //# 078: ok
+ method79(covariant num a) => null; //# 079: ok
+ method80(covariant num a) => null; //# 080: compile-time error
+ method81(covariant num a) => null; //# 081: ok
+ method82(covariant num a) => null; //# 082: ok
+ method83(covariant num a) => null; //# 083: ok
+ method84(covariant num a) => null; //# 084: compile-time error
+ method85(covariant num a) => null; //# 085: ok
+ method86(covariant num a) => null; //# 086: ok
+ method87(covariant num a) => null; //# 087: ok
+ method88(covariant num a) => null; //# 088: compile-time error
+ method89(covariant num a) => null; //# 089: compile-time error
+ method90(covariant num a) => null; //# 090: ok
+ method91(covariant num a) => null; //# 091: ok
+ method92(covariant num a) => null; //# 092: ok
+ method93(covariant num a) => null; //# 093: compile-time error
+ method94(covariant num a) => null; //# 094: ok
+ method95(covariant num a) => null; //# 095: ok
+ method96(covariant num a) => null; //# 096: ok
+ method97(covariant num a) => null; //# 097: compile-time error
+ method98(covariant num a) => null; //# 098: ok
+ method99(covariant num a) => null; //# 099: ok
+ method100(covariant num a) => null; //# 100: ok
+ method101(covariant num a) => null; //# 101: compile-time error
+ method102(covariant num a) => null; //# 102: ok
+ method103(covariant num a) => null; //# 103: ok
+ method104(covariant num a) => null; //# 104: ok
+ method105(covariant num a) => null; //# 105: compile-time error
+ method106(covariant num a) => null; //# 106: ok
+ method107(covariant num a) => null; //# 107: ok
+ method108(covariant num a) => null; //# 108: ok
+ method109(covariant num a) => null; //# 109: compile-time error
+ method110(covariant num a) => null; //# 110: ok
+ method111(covariant num a) => null; //# 111: ok
+ method112(covariant num a) => null; //# 112: ok
+ method113(covariant num a) => null; //# 113: compile-time error
+ method114(covariant num a) => null; //# 114: compile-time error
+ method115(covariant int a) => null; //# 115: ok
+ method116(covariant int a) => null; //# 116: ok
+ method117(covariant int a) => null; //# 117: ok
+ method118(covariant int a) => null; //# 118: compile-time error
+ method119(covariant int a) => null; //# 119: ok
+ method120(covariant int a) => null; //# 120: ok
+ method121(covariant int a) => null; //# 121: ok
+ method122(covariant int a) => null; //# 122: compile-time error
+ method123(covariant int a) => null; //# 123: ok
+ method124(covariant int a) => null; //# 124: ok
+ method125(covariant int a) => null; //# 125: ok
+ method126(covariant int a) => null; //# 126: compile-time error
+ method127(covariant int a) => null; //# 127: ok
+ method128(covariant int a) => null; //# 128: ok
+ method129(covariant int a) => null; //# 129: ok
+ method130(covariant int a) => null; //# 130: compile-time error
+ method131(covariant int a) => null; //# 131: ok
+ method132(covariant int a) => null; //# 132: ok
+ method133(covariant int a) => null; //# 133: ok
+ method134(covariant int a) => null; //# 134: compile-time error
+ method135(covariant int a) => null; //# 135: ok
+ method136(covariant int a) => null; //# 136: ok
+ method137(covariant int a) => null; //# 137: ok
+ method138(covariant int a) => null; //# 138: compile-time error
+ method139(covariant int a) => null; //# 139: compile-time error
+ method140(covariant int a) => null; //# 140: ok
+ method141(covariant int a) => null; //# 141: ok
+ method142(covariant int a) => null; //# 142: ok
+ method143(covariant int a) => null; //# 143: compile-time error
+ method144(covariant int a) => null; //# 144: ok
+ method145(covariant int a) => null; //# 145: ok
+ method146(covariant int a) => null; //# 146: ok
+ method147(covariant int a) => null; //# 147: compile-time error
+ method148(covariant int a) => null; //# 148: ok
+ method149(covariant int a) => null; //# 149: ok
+ method150(covariant int a) => null; //# 150: ok
+ method151(covariant int a) => null; //# 151: compile-time error
+ method152(covariant int a) => null; //# 152: ok
+ method153(covariant int a) => null; //# 153: ok
+ method154(covariant int a) => null; //# 154: ok
+ method155(covariant int a) => null; //# 155: compile-time error
+ method156(covariant int a) => null; //# 156: ok
+ method157(covariant int a) => null; //# 157: ok
+ method158(covariant int a) => null; //# 158: ok
+ method159(covariant int a) => null; //# 159: compile-time error
+ method160(covariant int a) => null; //# 160: ok
+ method161(covariant int a) => null; //# 161: ok
+ method162(covariant int a) => null; //# 162: ok
+ method163(covariant int a) => null; //# 163: compile-time error
+ method164(covariant int a) => null; //# 164: compile-time error
+ method165(covariant String a) => null; //# 165: ok
+ method166(covariant String a) => null; //# 166: compile-time error
+ method167(covariant String a) => null; //# 167: compile-time error
+ method168(covariant String a) => null; //# 168: ok
+ method169(covariant String a) => null; //# 169: ok
+ method170(covariant String a) => null; //# 170: compile-time error
+ method171(covariant String a) => null; //# 171: compile-time error
+ method172(covariant String a) => null; //# 172: ok
+ method173(covariant String a) => null; //# 173: compile-time error
+ method174(covariant String a) => null; //# 174: compile-time error
+ method175(covariant String a) => null; //# 175: ok
+ method176(covariant String a) => null; //# 176: compile-time error
+ method177(covariant String a) => null; //# 177: compile-time error
+ method178(covariant String a) => null; //# 178: ok
+ method179(covariant String a) => null; //# 179: ok
+ method180(covariant String a) => null; //# 180: compile-time error
+ method181(covariant String a) => null; //# 181: compile-time error
+ method182(covariant String a) => null; //# 182: ok
+ method183(covariant String a) => null; //# 183: ok
+ method184(covariant String a) => null; //# 184: compile-time error
+ method185(covariant String a) => null; //# 185: compile-time error
+ method186(covariant String a) => null; //# 186: ok
+ method187(covariant String a) => null; //# 187: ok
+ method188(covariant String a) => null; //# 188: compile-time error
+ method189(covariant String a) => null; //# 189: compile-time error
+ method190(covariant String a) => null; //# 190: ok
+ method191(covariant String a) => null; //# 191: compile-time error
+ method192(covariant String a) => null; //# 192: compile-time error
+ method193(covariant String a) => null; //# 193: ok
+ method194(covariant String a) => null; //# 194: compile-time error
+ method195(covariant String a) => null; //# 195: compile-time error
+ method196(covariant String a) => null; //# 196: ok
+ method197(covariant String a) => null; //# 197: ok
+ method198(covariant String a) => null; //# 198: compile-time error
+ method199(covariant String a) => null; //# 199: compile-time error
+ method200(covariant String a) => null; //# 200: ok
+ method201(dynamic a) => null; //# 201: ok
+ method202(dynamic a) => null; //# 202: ok
+ method203(dynamic a) => null; //# 203: ok
+ method204(dynamic a) => null; //# 204: ok
+ method205(dynamic a) => null; //# 205: ok
+ method206(dynamic a) => null; //# 206: ok
+ method207(dynamic a) => null; //# 207: ok
+ method208(dynamic a) => null; //# 208: ok
+ method209(dynamic a) => null; //# 209: ok
+ method210(dynamic a) => null; //# 210: ok
+ method211(dynamic a) => null; //# 211: ok
+ method212(dynamic a) => null; //# 212: compile-time error
+ method213(dynamic a) => null; //# 213: ok
+ method214(dynamic a) => null; //# 214: ok
+ method215(dynamic a) => null; //# 215: ok
+ method216(dynamic a) => null; //# 216: compile-time error
+ method217(dynamic a) => null; //# 217: ok
+ method218(dynamic a) => null; //# 218: ok
+ method219(dynamic a) => null; //# 219: ok
+ method220(dynamic a) => null; //# 220: compile-time error
+ method221(dynamic a) => null; //# 221: ok
+ method222(dynamic a) => null; //# 222: ok
+ method223(dynamic a) => null; //# 223: ok
+ method224(dynamic a) => null; //# 224: compile-time error
+ method225(dynamic a) => null; //# 225: ok
+ method226(dynamic a) => null; //# 226: compile-time error
+ method227(dynamic a) => null; //# 227: compile-time error
+ method228(dynamic a) => null; //# 228: ok
+ method229(dynamic a) => null; //# 229: ok
+ method230(dynamic a) => null; //# 230: compile-time error
+ method231(dynamic a) => null; //# 231: compile-time error
+ method232(dynamic a) => null; //# 232: ok
+ method233(dynamic a) => null; //# 233: ok
+ method234(dynamic a) => null; //# 234: ok
+ method235(dynamic a) => null; //# 235: ok
+ method236(dynamic a) => null; //# 236: ok
+ method237(dynamic a) => null; //# 237: ok
+ method238(dynamic a) => null; //# 238: compile-time error
+ method239(dynamic a) => null; //# 239: compile-time error
+ method240(dynamic a) => null; //# 240: compile-time error
+ method241(dynamic a) => null; //# 241: compile-time error
+ method242(dynamic a) => null; //# 242: compile-time error
+ method243(dynamic a) => null; //# 243: compile-time error
+ method244(num a) => null; //# 244: ok
+ method245(num a) => null; //# 245: ok
+ method246(num a) => null; //# 246: ok
+ method247(num a) => null; //# 247: compile-time error
+ method248(num a) => null; //# 248: ok
+ method249(num a) => null; //# 249: ok
+ method250(num a) => null; //# 250: ok
+ method251(num a) => null; //# 251: compile-time error
+ method252(num a) => null; //# 252: ok
+ method253(num a) => null; //# 253: ok
+ method254(num a) => null; //# 254: ok
+ method255(num a) => null; //# 255: compile-time error
+ method256(num a) => null; //# 256: ok
+ method257(num a) => null; //# 257: ok
+ method258(num a) => null; //# 258: ok
+ method259(num a) => null; //# 259: compile-time error
+ method260(num a) => null; //# 260: ok
+ method261(num a) => null; //# 261: ok
+ method262(num a) => null; //# 262: ok
+ method263(num a) => null; //# 263: compile-time error
+ method264(num a) => null; //# 264: ok
+ method265(num a) => null; //# 265: ok
+ method266(num a) => null; //# 266: ok
+ method267(num a) => null; //# 267: compile-time error
+ method268(num a) => null; //# 268: compile-time error
+ method269(num a) => null; //# 269: ok
+ method270(num a) => null; //# 270: ok
+ method271(num a) => null; //# 271: ok
+ method272(num a) => null; //# 272: compile-time error
+ method273(num a) => null; //# 273: ok
+ method274(num a) => null; //# 274: compile-time error
+ method275(num a) => null; //# 275: compile-time error
+ method276(num a) => null; //# 276: compile-time error
+ method277(num a) => null; //# 277: ok
+ method278(num a) => null; //# 278: ok
+ method279(num a) => null; //# 279: ok
+ method280(num a) => null; //# 280: compile-time error
+ method281(num a) => null; //# 281: ok
+ method282(num a) => null; //# 282: ok
+ method283(num a) => null; //# 283: compile-time error
+ method284(num a) => null; //# 284: compile-time error
+ method285(num a) => null; //# 285: compile-time error
+ method286(num a) => null; //# 286: compile-time error
+ method287(int a) => null; //# 287: ok
+ method288(int a) => null; //# 288: ok
+ method289(int a) => null; //# 289: ok
+ method290(int a) => null; //# 290: compile-time error
+ method291(int a) => null; //# 291: ok
+ method292(int a) => null; //# 292: ok
+ method293(int a) => null; //# 293: ok
+ method294(int a) => null; //# 294: compile-time error
+ method295(int a) => null; //# 295: ok
+ method296(int a) => null; //# 296: ok
+ method297(int a) => null; //# 297: ok
+ method298(int a) => null; //# 298: compile-time error
+ method299(int a) => null; //# 299: ok
+ method300(int a) => null; //# 300: ok
+ method301(int a) => null; //# 301: ok
+ method302(int a) => null; //# 302: compile-time error
+ method303(int a) => null; //# 303: ok
+ method304(int a) => null; //# 304: ok
+ method305(int a) => null; //# 305: ok
+ method306(int a) => null; //# 306: compile-time error
+ method307(int a) => null; //# 307: ok
+ method308(int a) => null; //# 308: ok
+ method309(int a) => null; //# 309: ok
+ method310(int a) => null; //# 310: compile-time error
+ method311(int a) => null; //# 311: compile-time error
+ method312(int a) => null; //# 312: ok
+ method313(int a) => null; //# 313: ok
+ method314(int a) => null; //# 314: ok
+ method315(int a) => null; //# 315: compile-time error
+ method316(int a) => null; //# 316: ok
+ method317(int a) => null; //# 317: compile-time error
+ method318(int a) => null; //# 318: compile-time error
+ method319(int a) => null; //# 319: compile-time error
+ method320(int a) => null; //# 320: ok
+ method321(int a) => null; //# 321: ok
+ method322(int a) => null; //# 322: ok
+ method323(int a) => null; //# 323: compile-time error
+ method324(int a) => null; //# 324: ok
+ method325(int a) => null; //# 325: ok
+ method326(int a) => null; //# 326: compile-time error
+ method327(int a) => null; //# 327: compile-time error
+ method328(int a) => null; //# 328: ok
+ method329(int a) => null; //# 329: ok
+ method330(int a) => null; //# 330: ok
+ method331(int a) => null; //# 331: compile-time error
+ method332(int a) => null; //# 332: ok
+ method333(int a) => null; //# 333: ok
+ method334(int a) => null; //# 334: ok
+ method335(int a) => null; //# 335: compile-time error
+ method336(int a) => null; //# 336: compile-time error
+ method337(String a) => null; //# 337: ok
+ method338(String a) => null; //# 338: compile-time error
+ method339(String a) => null; //# 339: compile-time error
+ method340(String a) => null; //# 340: ok
+ method341(String a) => null; //# 341: ok
+ method342(String a) => null; //# 342: compile-time error
+ method343(String a) => null; //# 343: compile-time error
+ method344(String a) => null; //# 344: ok
+ method345(String a) => null; //# 345: compile-time error
+ method346(String a) => null; //# 346: compile-time error
+ method347(String a) => null; //# 347: ok
+ method348(String a) => null; //# 348: compile-time error
+ method349(String a) => null; //# 349: compile-time error
+ method350(String a) => null; //# 350: ok
+ method351(String a) => null; //# 351: ok
+ method352(String a) => null; //# 352: compile-time error
+ method353(String a) => null; //# 353: compile-time error
+ method354(String a) => null; //# 354: ok
+ method355(String a) => null; //# 355: ok
+ method356(String a) => null; //# 356: compile-time error
+ method357(String a) => null; //# 357: compile-time error
+ method358(String a) => null; //# 358: ok
+ method359(String a) => null; //# 359: ok
+ method360(String a) => null; //# 360: compile-time error
+ method361(String a) => null; //# 361: compile-time error
+ method362(String a) => null; //# 362: compile-time error
+ method363(String a) => null; //# 363: compile-time error
+ method364(String a) => null; //# 364: compile-time error
+ method365(String a) => null; //# 365: ok
+ method366(String a) => null; //# 366: compile-time error
+ method367(String a) => null; //# 367: compile-time error
+ method368(String a) => null; //# 368: ok
+ method369(String a) => null; //# 369: ok
+ method370(String a) => null; //# 370: compile-time error
+ method371(String a) => null; //# 371: compile-time error
+ method372(String a) => null; //# 372: ok
+}
+
+class B extends A {
+ method1(covariant dynamic a) => null; //# 001: continued
+ method2(covariant dynamic a) => null; //# 002: continued
+ method3(covariant dynamic a) => null; //# 003: continued
+ method4(covariant dynamic a) => null; //# 004: continued
+ method5(covariant dynamic a) => null; //# 005: continued
+ method6(covariant dynamic a) => null; //# 006: continued
+ method7(covariant dynamic a) => null; //# 007: continued
+ method8(covariant dynamic a) => null; //# 008: continued
+ method9(covariant num a) => null; //# 009: continued
+ method10(covariant num a) => null; //# 010: continued
+ method11(covariant num a) => null; //# 011: continued
+ method12(covariant num a) => null; //# 012: continued
+ method13(covariant num a) => null; //# 013: continued
+ method14(covariant num a) => null; //# 014: continued
+ method15(covariant num a) => null; //# 015: continued
+ method16(covariant num a) => null; //# 016: continued
+ method17(covariant int a) => null; //# 017: continued
+ method18(covariant int a) => null; //# 018: continued
+ method19(covariant int a) => null; //# 019: continued
+ method20(covariant int a) => null; //# 020: continued
+ method21(covariant int a) => null; //# 021: continued
+ method22(covariant int a) => null; //# 022: continued
+ method23(covariant int a) => null; //# 023: continued
+ method24(covariant int a) => null; //# 024: continued
+ method25(covariant String a) => null; //# 025: continued
+ method26(covariant String a) => null; //# 026: continued
+ method27(covariant String a) => null; //# 027: continued
+ method28(covariant String a) => null; //# 028: continued
+ method29(covariant String a) => null; //# 029: continued
+ method30(covariant String a) => null; //# 030: continued
+ method31(covariant String a) => null; //# 031: continued
+ method32(covariant String a) => null; //# 032: continued
+ method33(dynamic a) => null; //# 033: continued
+ method34(dynamic a) => null; //# 034: continued
+ method35(dynamic a) => null; //# 035: continued
+ method36(dynamic a) => null; //# 036: continued
+ method37(dynamic a) => null; //# 037: continued
+ method38(dynamic a) => null; //# 038: continued
+ method39(dynamic a) => null; //# 039: continued
+ method40(dynamic a) => null; //# 040: continued
+ method41(num a) => null; //# 041: continued
+ method42(num a) => null; //# 042: continued
+ method43(num a) => null; //# 043: continued
+ method44(num a) => null; //# 044: continued
+ method45(num a) => null; //# 045: continued
+ method46(num a) => null; //# 046: continued
+ method47(num a) => null; //# 047: continued
+ method48(num a) => null; //# 048: continued
+ method49(int a) => null; //# 049: continued
+ method50(int a) => null; //# 050: continued
+ method51(int a) => null; //# 051: continued
+ method52(int a) => null; //# 052: continued
+ method53(int a) => null; //# 053: continued
+ method54(int a) => null; //# 054: continued
+ method55(int a) => null; //# 055: continued
+ method56(int a) => null; //# 056: continued
+ method57(String a) => null; //# 057: continued
+ method58(String a) => null; //# 058: continued
+ method59(String a) => null; //# 059: continued
+ method60(String a) => null; //# 060: continued
+ method61(String a) => null; //# 061: continued
+ method62(String a) => null; //# 062: continued
+ method63(String a) => null; //# 063: continued
+ method64(String a) => null; //# 064: continued
+ method65(covariant dynamic a) => null; //# 065: continued
+ method66(covariant dynamic a) => null; //# 066: continued
+ method67(covariant dynamic a) => null; //# 067: continued
+ method68(covariant dynamic a) => null; //# 068: continued
+ method69(covariant dynamic a) => null; //# 069: continued
+ method70(covariant dynamic a) => null; //# 070: continued
+ method71(covariant dynamic a) => null; //# 071: continued
+ method72(covariant dynamic a) => null; //# 072: continued
+ method73(covariant num a) => null; //# 073: continued
+ method74(covariant num a) => null; //# 074: continued
+ method75(covariant num a) => null; //# 075: continued
+ method76(covariant num a) => null; //# 076: continued
+ method77(covariant num a) => null; //# 077: continued
+ method78(covariant num a) => null; //# 078: continued
+ method79(covariant num a) => null; //# 079: continued
+ method80(covariant num a) => null; //# 080: continued
+ method81(covariant int a) => null; //# 081: continued
+ method82(covariant int a) => null; //# 082: continued
+ method83(covariant int a) => null; //# 083: continued
+ method84(covariant int a) => null; //# 084: continued
+ method85(covariant int a) => null; //# 085: continued
+ method86(covariant int a) => null; //# 086: continued
+ method87(covariant int a) => null; //# 087: continued
+ method88(covariant int a) => null; //# 088: continued
+ method89(covariant String a) => null; //# 089: continued
+ method90(dynamic a) => null; //# 090: continued
+ method91(dynamic a) => null; //# 091: continued
+ method92(dynamic a) => null; //# 092: continued
+ method93(dynamic a) => null; //# 093: continued
+ method94(dynamic a) => null; //# 094: continued
+ method95(dynamic a) => null; //# 095: continued
+ method96(dynamic a) => null; //# 096: continued
+ method97(dynamic a) => null; //# 097: continued
+ method98(num a) => null; //# 098: continued
+ method99(num a) => null; //# 099: continued
+ method100(num a) => null; //# 100: continued
+ method101(num a) => null; //# 101: continued
+ method102(num a) => null; //# 102: continued
+ method103(num a) => null; //# 103: continued
+ method104(num a) => null; //# 104: continued
+ method105(num a) => null; //# 105: continued
+ method106(int a) => null; //# 106: continued
+ method107(int a) => null; //# 107: continued
+ method108(int a) => null; //# 108: continued
+ method109(int a) => null; //# 109: continued
+ method110(int a) => null; //# 110: continued
+ method111(int a) => null; //# 111: continued
+ method112(int a) => null; //# 112: continued
+ method113(int a) => null; //# 113: continued
+ method114(String a) => null; //# 114: continued
+ method115(covariant dynamic a) => null; //# 115: continued
+ method116(covariant dynamic a) => null; //# 116: continued
+ method117(covariant dynamic a) => null; //# 117: continued
+ method118(covariant dynamic a) => null; //# 118: continued
+ method119(covariant dynamic a) => null; //# 119: continued
+ method120(covariant dynamic a) => null; //# 120: continued
+ method121(covariant dynamic a) => null; //# 121: continued
+ method122(covariant dynamic a) => null; //# 122: continued
+ method123(covariant num a) => null; //# 123: continued
+ method124(covariant num a) => null; //# 124: continued
+ method125(covariant num a) => null; //# 125: continued
+ method126(covariant num a) => null; //# 126: continued
+ method127(covariant num a) => null; //# 127: continued
+ method128(covariant num a) => null; //# 128: continued
+ method129(covariant num a) => null; //# 129: continued
+ method130(covariant num a) => null; //# 130: continued
+ method131(covariant int a) => null; //# 131: continued
+ method132(covariant int a) => null; //# 132: continued
+ method133(covariant int a) => null; //# 133: continued
+ method134(covariant int a) => null; //# 134: continued
+ method135(covariant int a) => null; //# 135: continued
+ method136(covariant int a) => null; //# 136: continued
+ method137(covariant int a) => null; //# 137: continued
+ method138(covariant int a) => null; //# 138: continued
+ method139(covariant String a) => null; //# 139: continued
+ method140(dynamic a) => null; //# 140: continued
+ method141(dynamic a) => null; //# 141: continued
+ method142(dynamic a) => null; //# 142: continued
+ method143(dynamic a) => null; //# 143: continued
+ method144(dynamic a) => null; //# 144: continued
+ method145(dynamic a) => null; //# 145: continued
+ method146(dynamic a) => null; //# 146: continued
+ method147(dynamic a) => null; //# 147: continued
+ method148(num a) => null; //# 148: continued
+ method149(num a) => null; //# 149: continued
+ method150(num a) => null; //# 150: continued
+ method151(num a) => null; //# 151: continued
+ method152(num a) => null; //# 152: continued
+ method153(num a) => null; //# 153: continued
+ method154(num a) => null; //# 154: continued
+ method155(num a) => null; //# 155: continued
+ method156(int a) => null; //# 156: continued
+ method157(int a) => null; //# 157: continued
+ method158(int a) => null; //# 158: continued
+ method159(int a) => null; //# 159: continued
+ method160(int a) => null; //# 160: continued
+ method161(int a) => null; //# 161: continued
+ method162(int a) => null; //# 162: continued
+ method163(int a) => null; //# 163: continued
+ method164(String a) => null; //# 164: continued
+ method165(covariant dynamic a) => null; //# 165: continued
+ method166(covariant dynamic a) => null; //# 166: continued
+ method167(covariant dynamic a) => null; //# 167: continued
+ method168(covariant dynamic a) => null; //# 168: continued
+ method169(covariant dynamic a) => null; //# 169: continued
+ method170(covariant dynamic a) => null; //# 170: continued
+ method171(covariant dynamic a) => null; //# 171: continued
+ method172(covariant dynamic a) => null; //# 172: continued
+ method173(covariant num a) => null; //# 173: continued
+ method174(covariant int a) => null; //# 174: continued
+ method175(covariant String a) => null; //# 175: continued
+ method176(covariant String a) => null; //# 176: continued
+ method177(covariant String a) => null; //# 177: continued
+ method178(covariant String a) => null; //# 178: continued
+ method179(covariant String a) => null; //# 179: continued
+ method180(covariant String a) => null; //# 180: continued
+ method181(covariant String a) => null; //# 181: continued
+ method182(covariant String a) => null; //# 182: continued
+ method183(dynamic a) => null; //# 183: continued
+ method184(dynamic a) => null; //# 184: continued
+ method185(dynamic a) => null; //# 185: continued
+ method186(dynamic a) => null; //# 186: continued
+ method187(dynamic a) => null; //# 187: continued
+ method188(dynamic a) => null; //# 188: continued
+ method189(dynamic a) => null; //# 189: continued
+ method190(dynamic a) => null; //# 190: continued
+ method191(num a) => null; //# 191: continued
+ method192(int a) => null; //# 192: continued
+ method193(String a) => null; //# 193: continued
+ method194(String a) => null; //# 194: continued
+ method195(String a) => null; //# 195: continued
+ method196(String a) => null; //# 196: continued
+ method197(String a) => null; //# 197: continued
+ method198(String a) => null; //# 198: continued
+ method199(String a) => null; //# 199: continued
+ method200(String a) => null; //# 200: continued
+ method201(covariant dynamic a) => null; //# 201: continued
+ method202(covariant dynamic a) => null; //# 202: continued
+ method203(covariant dynamic a) => null; //# 203: continued
+ method204(covariant dynamic a) => null; //# 204: continued
+ method205(covariant dynamic a) => null; //# 205: continued
+ method206(covariant dynamic a) => null; //# 206: continued
+ method207(covariant dynamic a) => null; //# 207: continued
+ method208(covariant dynamic a) => null; //# 208: continued
+ method209(covariant num a) => null; //# 209: continued
+ method210(covariant num a) => null; //# 210: continued
+ method211(covariant num a) => null; //# 211: continued
+ method212(covariant num a) => null; //# 212: continued
+ method213(covariant num a) => null; //# 213: continued
+ method214(covariant num a) => null; //# 214: continued
+ method215(covariant num a) => null; //# 215: continued
+ method216(covariant num a) => null; //# 216: continued
+ method217(covariant int a) => null; //# 217: continued
+ method218(covariant int a) => null; //# 218: continued
+ method219(covariant int a) => null; //# 219: continued
+ method220(covariant int a) => null; //# 220: continued
+ method221(covariant int a) => null; //# 221: continued
+ method222(covariant int a) => null; //# 222: continued
+ method223(covariant int a) => null; //# 223: continued
+ method224(covariant int a) => null; //# 224: continued
+ method225(covariant String a) => null; //# 225: continued
+ method226(covariant String a) => null; //# 226: continued
+ method227(covariant String a) => null; //# 227: continued
+ method228(covariant String a) => null; //# 228: continued
+ method229(covariant String a) => null; //# 229: continued
+ method230(covariant String a) => null; //# 230: continued
+ method231(covariant String a) => null; //# 231: continued
+ method232(covariant String a) => null; //# 232: continued
+ method233(dynamic a) => null; //# 233: continued
+ method234(dynamic a) => null; //# 234: continued
+ method235(dynamic a) => null; //# 235: continued
+ method236(dynamic a) => null; //# 236: continued
+ method237(dynamic a) => null; //# 237: continued
+ method238(dynamic a) => null; //# 238: continued
+ method239(dynamic a) => null; //# 239: continued
+ method240(dynamic a) => null; //# 240: continued
+ method241(num a) => null; //# 241: continued
+ method242(int a) => null; //# 242: continued
+ method243(String a) => null; //# 243: continued
+ method244(covariant dynamic a) => null; //# 244: continued
+ method245(covariant dynamic a) => null; //# 245: continued
+ method246(covariant dynamic a) => null; //# 246: continued
+ method247(covariant dynamic a) => null; //# 247: continued
+ method248(covariant dynamic a) => null; //# 248: continued
+ method249(covariant dynamic a) => null; //# 249: continued
+ method250(covariant dynamic a) => null; //# 250: continued
+ method251(covariant dynamic a) => null; //# 251: continued
+ method252(covariant num a) => null; //# 252: continued
+ method253(covariant num a) => null; //# 253: continued
+ method254(covariant num a) => null; //# 254: continued
+ method255(covariant num a) => null; //# 255: continued
+ method256(covariant num a) => null; //# 256: continued
+ method257(covariant num a) => null; //# 257: continued
+ method258(covariant num a) => null; //# 258: continued
+ method259(covariant num a) => null; //# 259: continued
+ method260(covariant int a) => null; //# 260: continued
+ method261(covariant int a) => null; //# 261: continued
+ method262(covariant int a) => null; //# 262: continued
+ method263(covariant int a) => null; //# 263: continued
+ method264(covariant int a) => null; //# 264: continued
+ method265(covariant int a) => null; //# 265: continued
+ method266(covariant int a) => null; //# 266: continued
+ method267(covariant int a) => null; //# 267: continued
+ method268(covariant String a) => null; //# 268: continued
+ method269(dynamic a) => null; //# 269: continued
+ method270(dynamic a) => null; //# 270: continued
+ method271(dynamic a) => null; //# 271: continued
+ method272(dynamic a) => null; //# 272: continued
+ method273(dynamic a) => null; //# 273: continued
+ method274(dynamic a) => null; //# 274: continued
+ method275(dynamic a) => null; //# 275: continued
+ method276(dynamic a) => null; //# 276: continued
+ method277(num a) => null; //# 277: continued
+ method278(num a) => null; //# 278: continued
+ method279(num a) => null; //# 279: continued
+ method280(num a) => null; //# 280: continued
+ method281(num a) => null; //# 281: continued
+ method282(num a) => null; //# 282: continued
+ method283(num a) => null; //# 283: continued
+ method284(num a) => null; //# 284: continued
+ method285(int a) => null; //# 285: continued
+ method286(String a) => null; //# 286: continued
+ method287(covariant dynamic a) => null; //# 287: continued
+ method288(covariant dynamic a) => null; //# 288: continued
+ method289(covariant dynamic a) => null; //# 289: continued
+ method290(covariant dynamic a) => null; //# 290: continued
+ method291(covariant dynamic a) => null; //# 291: continued
+ method292(covariant dynamic a) => null; //# 292: continued
+ method293(covariant dynamic a) => null; //# 293: continued
+ method294(covariant dynamic a) => null; //# 294: continued
+ method295(covariant num a) => null; //# 295: continued
+ method296(covariant num a) => null; //# 296: continued
+ method297(covariant num a) => null; //# 297: continued
+ method298(covariant num a) => null; //# 298: continued
+ method299(covariant num a) => null; //# 299: continued
+ method300(covariant num a) => null; //# 300: continued
+ method301(covariant num a) => null; //# 301: continued
+ method302(covariant num a) => null; //# 302: continued
+ method303(covariant int a) => null; //# 303: continued
+ method304(covariant int a) => null; //# 304: continued
+ method305(covariant int a) => null; //# 305: continued
+ method306(covariant int a) => null; //# 306: continued
+ method307(covariant int a) => null; //# 307: continued
+ method308(covariant int a) => null; //# 308: continued
+ method309(covariant int a) => null; //# 309: continued
+ method310(covariant int a) => null; //# 310: continued
+ method311(covariant String a) => null; //# 311: continued
+ method312(dynamic a) => null; //# 312: continued
+ method313(dynamic a) => null; //# 313: continued
+ method314(dynamic a) => null; //# 314: continued
+ method315(dynamic a) => null; //# 315: continued
+ method316(dynamic a) => null; //# 316: continued
+ method317(dynamic a) => null; //# 317: continued
+ method318(dynamic a) => null; //# 318: continued
+ method319(dynamic a) => null; //# 319: continued
+ method320(num a) => null; //# 320: continued
+ method321(num a) => null; //# 321: continued
+ method322(num a) => null; //# 322: continued
+ method323(num a) => null; //# 323: continued
+ method324(num a) => null; //# 324: continued
+ method325(num a) => null; //# 325: continued
+ method326(num a) => null; //# 326: continued
+ method327(num a) => null; //# 327: continued
+ method328(int a) => null; //# 328: continued
+ method329(int a) => null; //# 329: continued
+ method330(int a) => null; //# 330: continued
+ method331(int a) => null; //# 331: continued
+ method332(int a) => null; //# 332: continued
+ method333(int a) => null; //# 333: continued
+ method334(int a) => null; //# 334: continued
+ method335(int a) => null; //# 335: continued
+ method336(String a) => null; //# 336: continued
+ method337(covariant dynamic a) => null; //# 337: continued
+ method338(covariant dynamic a) => null; //# 338: continued
+ method339(covariant dynamic a) => null; //# 339: continued
+ method340(covariant dynamic a) => null; //# 340: continued
+ method341(covariant dynamic a) => null; //# 341: continued
+ method342(covariant dynamic a) => null; //# 342: continued
+ method343(covariant dynamic a) => null; //# 343: continued
+ method344(covariant dynamic a) => null; //# 344: continued
+ method345(covariant num a) => null; //# 345: continued
+ method346(covariant int a) => null; //# 346: continued
+ method347(covariant String a) => null; //# 347: continued
+ method348(covariant String a) => null; //# 348: continued
+ method349(covariant String a) => null; //# 349: continued
+ method350(covariant String a) => null; //# 350: continued
+ method351(covariant String a) => null; //# 351: continued
+ method352(covariant String a) => null; //# 352: continued
+ method353(covariant String a) => null; //# 353: continued
+ method354(covariant String a) => null; //# 354: continued
+ method355(dynamic a) => null; //# 355: continued
+ method356(dynamic a) => null; //# 356: continued
+ method357(dynamic a) => null; //# 357: continued
+ method358(dynamic a) => null; //# 358: continued
+ method359(dynamic a) => null; //# 359: continued
+ method360(dynamic a) => null; //# 360: continued
+ method361(dynamic a) => null; //# 361: continued
+ method362(dynamic a) => null; //# 362: continued
+ method363(num a) => null; //# 363: continued
+ method364(int a) => null; //# 364: continued
+ method365(String a) => null; //# 365: continued
+ method366(String a) => null; //# 366: continued
+ method367(String a) => null; //# 367: continued
+ method368(String a) => null; //# 368: continued
+ method369(String a) => null; //# 369: continued
+ method370(String a) => null; //# 370: continued
+ method371(String a) => null; //# 371: continued
+ method372(String a) => null; //# 372: continued
+}
+
+class C extends B {
+ method1(covariant dynamic a) => null; //# 001: continued
+ method2(covariant num a) => null; //# 002: continued
+ method3(covariant int a) => null; //# 003: continued
+ method4(covariant String a) => null; //# 004: continued
+ method5(dynamic a) => null; //# 005: continued
+ method6(num a) => null; //# 006: continued
+ method7(int a) => null; //# 007: continued
+ method8(String a) => null; //# 008: continued
+ method9(covariant dynamic a) => null; //# 009: continued
+ method10(covariant num a) => null; //# 010: continued
+ method11(covariant int a) => null; //# 011: continued
+ method12(covariant String a) => null; //# 012: continued
+ method13(dynamic a) => null; //# 013: continued
+ method14(num a) => null; //# 014: continued
+ method15(int a) => null; //# 015: continued
+ method16(String a) => null; //# 016: continued
+ method17(covariant dynamic a) => null; //# 017: continued
+ method18(covariant num a) => null; //# 018: continued
+ method19(covariant int a) => null; //# 019: continued
+ method20(covariant String a) => null; //# 020: continued
+ method21(dynamic a) => null; //# 021: continued
+ method22(num a) => null; //# 022: continued
+ method23(int a) => null; //# 023: continued
+ method24(String a) => null; //# 024: continued
+ method25(covariant dynamic a) => null; //# 025: continued
+ method26(covariant num a) => null; //# 026: continued
+ method27(covariant int a) => null; //# 027: continued
+ method28(covariant String a) => null; //# 028: continued
+ method29(dynamic a) => null; //# 029: continued
+ method30(num a) => null; //# 030: continued
+ method31(int a) => null; //# 031: continued
+ method32(String a) => null; //# 032: continued
+ method33(covariant dynamic a) => null; //# 033: continued
+ method34(covariant num a) => null; //# 034: continued
+ method35(covariant int a) => null; //# 035: continued
+ method36(covariant String a) => null; //# 036: continued
+ method37(dynamic a) => null; //# 037: continued
+ method38(num a) => null; //# 038: continued
+ method39(int a) => null; //# 039: continued
+ method40(String a) => null; //# 040: continued
+ method41(covariant dynamic a) => null; //# 041: continued
+ method42(covariant num a) => null; //# 042: continued
+ method43(covariant int a) => null; //# 043: continued
+ method44(covariant String a) => null; //# 044: continued
+ method45(dynamic a) => null; //# 045: continued
+ method46(num a) => null; //# 046: continued
+ method47(int a) => null; //# 047: continued
+ method48(String a) => null; //# 048: continued
+ method49(covariant dynamic a) => null; //# 049: continued
+ method50(covariant num a) => null; //# 050: continued
+ method51(covariant int a) => null; //# 051: continued
+ method52(covariant String a) => null; //# 052: continued
+ method53(dynamic a) => null; //# 053: continued
+ method54(num a) => null; //# 054: continued
+ method55(int a) => null; //# 055: continued
+ method56(String a) => null; //# 056: continued
+ method57(covariant dynamic a) => null; //# 057: continued
+ method58(covariant num a) => null; //# 058: continued
+ method59(covariant int a) => null; //# 059: continued
+ method60(covariant String a) => null; //# 060: continued
+ method61(dynamic a) => null; //# 061: continued
+ method62(num a) => null; //# 062: continued
+ method63(int a) => null; //# 063: continued
+ method64(String a) => null; //# 064: continued
+ method65(covariant dynamic a) => null; //# 065: continued
+ method66(covariant num a) => null; //# 066: continued
+ method67(covariant int a) => null; //# 067: continued
+ method68(covariant String a) => null; //# 068: continued
+ method69(dynamic a) => null; //# 069: continued
+ method70(num a) => null; //# 070: continued
+ method71(int a) => null; //# 071: continued
+ method72(String a) => null; //# 072: continued
+ method73(covariant dynamic a) => null; //# 073: continued
+ method74(covariant num a) => null; //# 074: continued
+ method75(covariant int a) => null; //# 075: continued
+ method76(covariant String a) => null; //# 076: continued
+ method77(dynamic a) => null; //# 077: continued
+ method78(num a) => null; //# 078: continued
+ method79(int a) => null; //# 079: continued
+ method80(String a) => null; //# 080: continued
+ method81(covariant dynamic a) => null; //# 081: continued
+ method82(covariant num a) => null; //# 082: continued
+ method83(covariant int a) => null; //# 083: continued
+ method84(covariant String a) => null; //# 084: continued
+ method85(dynamic a) => null; //# 085: continued
+ method86(num a) => null; //# 086: continued
+ method87(int a) => null; //# 087: continued
+ method88(String a) => null; //# 088: continued
+ method90(covariant dynamic a) => null; //# 090: continued
+ method91(covariant num a) => null; //# 091: continued
+ method92(covariant int a) => null; //# 092: continued
+ method93(covariant String a) => null; //# 093: continued
+ method94(dynamic a) => null; //# 094: continued
+ method95(num a) => null; //# 095: continued
+ method96(int a) => null; //# 096: continued
+ method97(String a) => null; //# 097: continued
+ method98(covariant dynamic a) => null; //# 098: continued
+ method99(covariant num a) => null; //# 099: continued
+ method100(covariant int a) => null; //# 100: continued
+ method101(covariant String a) => null; //# 101: continued
+ method102(dynamic a) => null; //# 102: continued
+ method103(num a) => null; //# 103: continued
+ method104(int a) => null; //# 104: continued
+ method105(String a) => null; //# 105: continued
+ method106(covariant dynamic a) => null; //# 106: continued
+ method107(covariant num a) => null; //# 107: continued
+ method108(covariant int a) => null; //# 108: continued
+ method109(covariant String a) => null; //# 109: continued
+ method110(dynamic a) => null; //# 110: continued
+ method111(num a) => null; //# 111: continued
+ method112(int a) => null; //# 112: continued
+ method113(String a) => null; //# 113: continued
+ method115(covariant dynamic a) => null; //# 115: continued
+ method116(covariant num a) => null; //# 116: continued
+ method117(covariant int a) => null; //# 117: continued
+ method118(covariant String a) => null; //# 118: continued
+ method119(dynamic a) => null; //# 119: continued
+ method120(num a) => null; //# 120: continued
+ method121(int a) => null; //# 121: continued
+ method122(String a) => null; //# 122: continued
+ method123(covariant dynamic a) => null; //# 123: continued
+ method124(covariant num a) => null; //# 124: continued
+ method125(covariant int a) => null; //# 125: continued
+ method126(covariant String a) => null; //# 126: continued
+ method127(dynamic a) => null; //# 127: continued
+ method128(num a) => null; //# 128: continued
+ method129(int a) => null; //# 129: continued
+ method130(String a) => null; //# 130: continued
+ method131(covariant dynamic a) => null; //# 131: continued
+ method132(covariant num a) => null; //# 132: continued
+ method133(covariant int a) => null; //# 133: continued
+ method134(covariant String a) => null; //# 134: continued
+ method135(dynamic a) => null; //# 135: continued
+ method136(num a) => null; //# 136: continued
+ method137(int a) => null; //# 137: continued
+ method138(String a) => null; //# 138: continued
+ method140(covariant dynamic a) => null; //# 140: continued
+ method141(covariant num a) => null; //# 141: continued
+ method142(covariant int a) => null; //# 142: continued
+ method143(covariant String a) => null; //# 143: continued
+ method144(dynamic a) => null; //# 144: continued
+ method145(num a) => null; //# 145: continued
+ method146(int a) => null; //# 146: continued
+ method147(String a) => null; //# 147: continued
+ method148(covariant dynamic a) => null; //# 148: continued
+ method149(covariant num a) => null; //# 149: continued
+ method150(covariant int a) => null; //# 150: continued
+ method151(covariant String a) => null; //# 151: continued
+ method152(dynamic a) => null; //# 152: continued
+ method153(num a) => null; //# 153: continued
+ method154(int a) => null; //# 154: continued
+ method155(String a) => null; //# 155: continued
+ method156(covariant dynamic a) => null; //# 156: continued
+ method157(covariant num a) => null; //# 157: continued
+ method158(covariant int a) => null; //# 158: continued
+ method159(covariant String a) => null; //# 159: continued
+ method160(dynamic a) => null; //# 160: continued
+ method161(num a) => null; //# 161: continued
+ method162(int a) => null; //# 162: continued
+ method163(String a) => null; //# 163: continued
+ method165(covariant dynamic a) => null; //# 165: continued
+ method166(covariant num a) => null; //# 166: continued
+ method167(covariant int a) => null; //# 167: continued
+ method168(covariant String a) => null; //# 168: continued
+ method169(dynamic a) => null; //# 169: continued
+ method170(num a) => null; //# 170: continued
+ method171(int a) => null; //# 171: continued
+ method172(String a) => null; //# 172: continued
+ method175(covariant dynamic a) => null; //# 175: continued
+ method176(covariant num a) => null; //# 176: continued
+ method177(covariant int a) => null; //# 177: continued
+ method178(covariant String a) => null; //# 178: continued
+ method179(dynamic a) => null; //# 179: continued
+ method180(num a) => null; //# 180: continued
+ method181(int a) => null; //# 181: continued
+ method182(String a) => null; //# 182: continued
+ method183(covariant dynamic a) => null; //# 183: continued
+ method184(covariant num a) => null; //# 184: continued
+ method185(covariant int a) => null; //# 185: continued
+ method186(covariant String a) => null; //# 186: continued
+ method187(dynamic a) => null; //# 187: continued
+ method188(num a) => null; //# 188: continued
+ method189(int a) => null; //# 189: continued
+ method190(String a) => null; //# 190: continued
+ method193(covariant dynamic a) => null; //# 193: continued
+ method194(covariant num a) => null; //# 194: continued
+ method195(covariant int a) => null; //# 195: continued
+ method196(covariant String a) => null; //# 196: continued
+ method197(dynamic a) => null; //# 197: continued
+ method198(num a) => null; //# 198: continued
+ method199(int a) => null; //# 199: continued
+ method200(String a) => null; //# 200: continued
+ method201(covariant dynamic a) => null; //# 201: continued
+ method202(covariant num a) => null; //# 202: continued
+ method203(covariant int a) => null; //# 203: continued
+ method204(covariant String a) => null; //# 204: continued
+ method205(dynamic a) => null; //# 205: continued
+ method206(num a) => null; //# 206: continued
+ method207(int a) => null; //# 207: continued
+ method208(String a) => null; //# 208: continued
+ method209(covariant dynamic a) => null; //# 209: continued
+ method210(covariant num a) => null; //# 210: continued
+ method211(covariant int a) => null; //# 211: continued
+ method212(covariant String a) => null; //# 212: continued
+ method213(dynamic a) => null; //# 213: continued
+ method214(num a) => null; //# 214: continued
+ method215(int a) => null; //# 215: continued
+ method216(String a) => null; //# 216: continued
+ method217(covariant dynamic a) => null; //# 217: continued
+ method218(covariant num a) => null; //# 218: continued
+ method219(covariant int a) => null; //# 219: continued
+ method220(covariant String a) => null; //# 220: continued
+ method221(dynamic a) => null; //# 221: continued
+ method222(num a) => null; //# 222: continued
+ method223(int a) => null; //# 223: continued
+ method224(String a) => null; //# 224: continued
+ method225(covariant dynamic a) => null; //# 225: continued
+ method226(covariant num a) => null; //# 226: continued
+ method227(covariant int a) => null; //# 227: continued
+ method228(covariant String a) => null; //# 228: continued
+ method229(dynamic a) => null; //# 229: continued
+ method230(num a) => null; //# 230: continued
+ method231(int a) => null; //# 231: continued
+ method232(String a) => null; //# 232: continued
+ method233(covariant dynamic a) => null; //# 233: continued
+ method234(covariant num a) => null; //# 234: continued
+ method235(covariant int a) => null; //# 235: continued
+ method236(covariant String a) => null; //# 236: continued
+ method237(dynamic a) => null; //# 237: continued
+ method238(num a) => null; //# 238: continued
+ method239(int a) => null; //# 239: continued
+ method240(String a) => null; //# 240: continued
+ method244(covariant dynamic a) => null; //# 244: continued
+ method245(covariant num a) => null; //# 245: continued
+ method246(covariant int a) => null; //# 246: continued
+ method247(covariant String a) => null; //# 247: continued
+ method248(dynamic a) => null; //# 248: continued
+ method249(num a) => null; //# 249: continued
+ method250(int a) => null; //# 250: continued
+ method251(String a) => null; //# 251: continued
+ method252(covariant dynamic a) => null; //# 252: continued
+ method253(covariant num a) => null; //# 253: continued
+ method254(covariant int a) => null; //# 254: continued
+ method255(covariant String a) => null; //# 255: continued
+ method256(dynamic a) => null; //# 256: continued
+ method257(num a) => null; //# 257: continued
+ method258(int a) => null; //# 258: continued
+ method259(String a) => null; //# 259: continued
+ method260(covariant dynamic a) => null; //# 260: continued
+ method261(covariant num a) => null; //# 261: continued
+ method262(covariant int a) => null; //# 262: continued
+ method263(covariant String a) => null; //# 263: continued
+ method264(dynamic a) => null; //# 264: continued
+ method265(num a) => null; //# 265: continued
+ method266(int a) => null; //# 266: continued
+ method267(String a) => null; //# 267: continued
+ method269(covariant dynamic a) => null; //# 269: continued
+ method270(covariant num a) => null; //# 270: continued
+ method271(covariant int a) => null; //# 271: continued
+ method272(covariant String a) => null; //# 272: continued
+ method273(dynamic a) => null; //# 273: continued
+ method274(num a) => null; //# 274: continued
+ method275(int a) => null; //# 275: continued
+ method276(String a) => null; //# 276: continued
+ method277(covariant dynamic a) => null; //# 277: continued
+ method278(covariant num a) => null; //# 278: continued
+ method279(covariant int a) => null; //# 279: continued
+ method280(covariant String a) => null; //# 280: continued
+ method281(dynamic a) => null; //# 281: continued
+ method282(num a) => null; //# 282: continued
+ method283(int a) => null; //# 283: continued
+ method284(String a) => null; //# 284: continued
+ method287(covariant dynamic a) => null; //# 287: continued
+ method288(covariant num a) => null; //# 288: continued
+ method289(covariant int a) => null; //# 289: continued
+ method290(covariant String a) => null; //# 290: continued
+ method291(dynamic a) => null; //# 291: continued
+ method292(num a) => null; //# 292: continued
+ method293(int a) => null; //# 293: continued
+ method294(String a) => null; //# 294: continued
+ method295(covariant dynamic a) => null; //# 295: continued
+ method296(covariant num a) => null; //# 296: continued
+ method297(covariant int a) => null; //# 297: continued
+ method298(covariant String a) => null; //# 298: continued
+ method299(dynamic a) => null; //# 299: continued
+ method300(num a) => null; //# 300: continued
+ method301(int a) => null; //# 301: continued
+ method302(String a) => null; //# 302: continued
+ method303(covariant dynamic a) => null; //# 303: continued
+ method304(covariant num a) => null; //# 304: continued
+ method305(covariant int a) => null; //# 305: continued
+ method306(covariant String a) => null; //# 306: continued
+ method307(dynamic a) => null; //# 307: continued
+ method308(num a) => null; //# 308: continued
+ method309(int a) => null; //# 309: continued
+ method310(String a) => null; //# 310: continued
+ method312(covariant dynamic a) => null; //# 312: continued
+ method313(covariant num a) => null; //# 313: continued
+ method314(covariant int a) => null; //# 314: continued
+ method315(covariant String a) => null; //# 315: continued
+ method316(dynamic a) => null; //# 316: continued
+ method317(num a) => null; //# 317: continued
+ method318(int a) => null; //# 318: continued
+ method319(String a) => null; //# 319: continued
+ method320(covariant dynamic a) => null; //# 320: continued
+ method321(covariant num a) => null; //# 321: continued
+ method322(covariant int a) => null; //# 322: continued
+ method323(covariant String a) => null; //# 323: continued
+ method324(dynamic a) => null; //# 324: continued
+ method325(num a) => null; //# 325: continued
+ method326(int a) => null; //# 326: continued
+ method327(String a) => null; //# 327: continued
+ method328(covariant dynamic a) => null; //# 328: continued
+ method329(covariant num a) => null; //# 329: continued
+ method330(covariant int a) => null; //# 330: continued
+ method331(covariant String a) => null; //# 331: continued
+ method332(dynamic a) => null; //# 332: continued
+ method333(num a) => null; //# 333: continued
+ method334(int a) => null; //# 334: continued
+ method335(String a) => null; //# 335: continued
+ method337(covariant dynamic a) => null; //# 337: continued
+ method338(covariant num a) => null; //# 338: continued
+ method339(covariant int a) => null; //# 339: continued
+ method340(covariant String a) => null; //# 340: continued
+ method341(dynamic a) => null; //# 341: continued
+ method342(num a) => null; //# 342: continued
+ method343(int a) => null; //# 343: continued
+ method344(String a) => null; //# 344: continued
+ method347(covariant dynamic a) => null; //# 347: continued
+ method348(covariant num a) => null; //# 348: continued
+ method349(covariant int a) => null; //# 349: continued
+ method350(covariant String a) => null; //# 350: continued
+ method351(dynamic a) => null; //# 351: continued
+ method352(num a) => null; //# 352: continued
+ method353(int a) => null; //# 353: continued
+ method354(String a) => null; //# 354: continued
+ method355(covariant dynamic a) => null; //# 355: continued
+ method356(covariant num a) => null; //# 356: continued
+ method357(covariant int a) => null; //# 357: continued
+ method358(covariant String a) => null; //# 358: continued
+ method359(dynamic a) => null; //# 359: continued
+ method360(num a) => null; //# 360: continued
+ method361(int a) => null; //# 361: continued
+ method362(String a) => null; //# 362: continued
+ method365(covariant dynamic a) => null; //# 365: continued
+ method366(covariant num a) => null; //# 366: continued
+ method367(covariant int a) => null; //# 367: continued
+ method368(covariant String a) => null; //# 368: continued
+ method369(dynamic a) => null; //# 369: continued
+ method370(num a) => null; //# 370: continued
+ method371(int a) => null; //# 371: continued
+ method372(String a) => null; //# 372: continued
+}
diff --git a/tests/language/override/inheritance_method_test.dart b/tests/language/override/inheritance_method_test.dart
new file mode 100644
index 0000000..a7870e9
--- /dev/null
+++ b/tests/language/override/inheritance_method_test.dart
@@ -0,0 +1,116 @@
+// Copyright (c) 2014, 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 static warnings for method overrides.
+
+class A {
+ method1() => null; //# 01: ok
+ method2(a) => null; //# 02: ok
+ method3(a, b, c, d) => null; //# 03: ok
+ method4() => null; //# 04: compile-time error
+ method6(a, b, c) => null; //# 06: compile-time error
+ method7([a]) => null; //# 07: ok
+ method8([a, b]) => null; //# 08: ok
+ method9([a, b, c]) => null; //# 09: ok
+ method10([a]) => null; //# 10: ok
+ method11(a) => null; //# 11: compile-time error
+ method12(a, [b]) => null; //# 12: compile-time error
+ method13(a, [b]) => null; //# 13: compile-time error
+ method14(a, b, [c, d, e]) => null; //# 14: compile-time error
+ method15({a}) => null; //# 15: ok
+ method16({a, b}) => null; //# 16: ok
+ method17({a, b, c}) => null; //# 17: ok
+ method18(d, {a, b, c}) => null; //# 18: ok
+ method19({a}) => null; //# 19: compile-time error
+ method20({a, b}) => null; //# 20: compile-time error
+ method21({a, b, c, d}) => null; //# 21: compile-time error
+
+ method22(int a) => null; //# 22: ok
+ method23(int a) => null; //# 23: ok
+ void method24() {} //# 24: ok
+ method25() => null; //# 25: ok
+ void method26() {} //# 26: ok
+ int method27() => 0; //# 27: compile-time error
+ method28(int a) => null; //# 28: compile-time error
+ method29(int a) => null; //# 29: compile-time error
+ method30(int a) => null; //# 30: compile-time error
+ method34(int a) => null; //# 34: ok
+ method35(int a) => null; //# 35: ok
+ method36(int a) => null; //# 36: compile-time error
+ method37(num a) => null; //# 37: ok
+ method38(covariant num a) => null; //# 38: ok
+ method39(num a) => null; //# 39: compile-time error
+}
+
+class B extends A {
+ method28(num a) => null; //# 28: continued
+ method29(a) => null; //# 29: continued
+ method34(num a) => null; //# 34: continued
+ method35(dynamic a) => null; //# 35: continued
+ method36(dynamic a) => null; //# 36: continued
+ method37(covariant dynamic a) => null; //# 37: continued
+ method38(dynamic a) => null; //# 38: continued
+ method39(covariant dynamic a) => null; //# 39: continued
+}
+
+abstract class I {
+ method5() => null; //# 05: compile-time error
+ method31(int a) => null; //# 31: compile-time error
+ method32(int a) => null; //# 32: compile-time error
+ method33(num a) => null; //# 33: compile-time error
+}
+
+abstract class J {
+ method31(num a) => null; //# 31: continued
+ method32(double a) => null; //# 32: continued
+ method33(int a) => null; //# 33: continued
+}
+
+class Class extends B implements I, J {
+ method1() => null; //# 01: continued
+ method2(b) => null; //# 02: continued
+ method3(b, a, d, c) => null; //# 03: continued
+ method4(a) => null; //# 04: continued
+ method5(a) => null; //# 05: continued
+ method6(a, b, c, d) => null; //# 06: continued
+ method7([a]) => null; //# 07: continued
+ method8([b, a]) => null; //# 08: continued
+ method9([b, d, a, c]) => null; //# 09: continued
+ method10([a]) => null; //# 10: continued
+ method11() => null; //# 11: continued
+ method12(a) => null; //# 12: continued
+ method13([a]) => null; //# 13: continued
+ method14([a, b, c, d]) => null; //# 14: continued
+ method15({a}) => null; //# 15: continued
+ method16({b, a}) => null; //# 16: continued
+ method17({b, c, a, d}) => null; //# 17: continued
+ method18(e, {b, c, a, d}) => null; //# 18: continued
+ method19() => null; //# 19: continued
+ method20({b}) => null; //# 20: continued
+ method21({a, e, d, c}) => null; //# 21: continued
+
+ method22(int a) => null; //# 22: continued
+ method23(num a) => null; //# 23: continued
+ method24() => null; //# 24: continued
+ void method25() {} //# 25: continued
+ int method26() => 0; //# 26: continued
+ void method27() {} //# 27: continued
+ method28(double a) => null; //# 28: continued
+ method29(String a) => null; //# 29: continued
+ method30(String a) => null; //# 30: continued
+ method36(int a) => null; //# 36: continued
+ method37(int a) => null; //# 37: continued
+ method38(int a) => null; //# 38: continued
+ method39(String a) => null; //# 39: continued
+}
+
+class SubClass extends Class {
+ method31(double a) => null; //# 31: continued
+ method32(String a) => null; //# 32: continued
+ method33(double a) => null; //# 33: continued
+}
+
+main() {
+ new SubClass();
+}
diff --git a/tests/language/override/inheritance_mixed_test.dart b/tests/language/override/inheritance_mixed_test.dart
new file mode 100644
index 0000000..d4218d6
--- /dev/null
+++ b/tests/language/override/inheritance_mixed_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2014, 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 {
+ var member1; //# 01: compile-time error
+ member2() {} //# 02: compile-time error
+ get member3 => null; //# 03: compile-time error
+ member4() {} //# 04: compile-time error
+}
+
+abstract class I {
+ var member5; //# 05: ok
+ var member6; //# 06: compile-time error
+ get member7; //# 07: compile-time error
+ get member8; //# 08: compile-time error
+ get member9; //# 09: compile-time error
+}
+
+abstract class J {
+ get member5; //# 05: continued
+ member6() {} //# 06: continued
+ member7() {} //# 07: continued
+ member8() {} //# 08: continued
+ member9() {} //# 09: continued
+}
+
+abstract class B extends A implements I, J {}
+
+class Class extends B {
+ member1() {} //# 01: continued
+ var member2; //# 02: continued
+ member3() {} //# 03: continued
+ get member4 => null; //# 04: continued
+ var member5; //# 05: continued
+ member8() {} //# 08: continued
+ get member9 => null; //# 09: continued
+}
+
+main() {
+ new Class();
+}
diff --git a/tests/language/override/inheritance_no_such_method_test.dart b/tests/language/override/inheritance_no_such_method_test.dart
new file mode 100644
index 0000000..535f5a4
--- /dev/null
+++ b/tests/language/override/inheritance_no_such_method_test.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2013, 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 use of noSuchMethod in relation to abstract methods in
+// concrete classes.
+
+abstract class A {
+ method6(); //# 06: compile-time error
+ method7(); //# 07: compile-time error
+ method8(); //# 08: ok
+}
+
+abstract class I {
+ method9(); //# 09: compile-time error
+ method10(); //# 10: compile-time error
+ method11(); //# 11: ok
+}
+
+class Class1 extends A implements I {
+ method1(); //# 01: compile-time error
+
+ noSuchMethod(_) => null; //# 03: ok
+ method3(); //# 03: continued
+
+ noSuchMethod(_, [__]) => null; //# 04: ok
+ method4(); //# 04: continued
+
+ noSuchMethod(_); //# 05: compile-time error
+ method5(); //# 05: continued
+
+ noSuchMethod(_) => null; //# 08: continued
+
+ noSuchMethod(_) => null; //# 11: continued
+}
+
+class B {
+ method12(); //# 12: compile-time error
+
+ noSuchMethod(_) => null; //# 13: ok
+ method13(); //# 13: continued
+}
+
+class Class2 extends B {}
+
+main() {
+ new Class1();
+ new Class2();
+}
diff --git a/tests/language/override/inheritance_setter_test.dart b/tests/language/override/inheritance_setter_test.dart
new file mode 100644
index 0000000..f709c75
--- /dev/null
+++ b/tests/language/override/inheritance_setter_test.dart
@@ -0,0 +1,32 @@
+main() {
+ new C();
+}
+
+class A {
+ void set setter1(num x) {} //# 001: compile-time error
+ void set setter2(num x) {} //# 002: compile-time error
+ void set setter3(num x) {} //# 003: ok
+ void set setter4(num x) {} //# 004: compile-time error
+ void set setter5(num x) {} //# 005: ok
+ void set setter6(num x) {} //# 006: compile-time error
+ void set setter7(num x) {} //# 007: ok
+}
+
+class B extends A {
+ void set setter1(covariant dynamic x) {} //# 001: continued
+ void set setter2(int x) {} //# 002: continued
+ void set setter3(covariant dynamic x) {} //# 003: continued
+ void set setter4(dynamic x) {} //# 004: continued
+ void set setter5(covariant dynamic x) {} //# 005: continued
+ covariant dynamic setter6; //# 006: continued
+ covariant dynamic setter7; //# 007: continued
+}
+
+class C extends B {
+ void set setter1(String x) {} //# 001: continued
+ void set setter3(num x) {} //# 003: continued
+ void set setter4(int x) {} //# 004: continued
+ void set setter5(int x) {} //# 005: continued
+ void set setter6(String x) {} //# 006: continued
+ void set setter7(int x) {} //# 007: continued
+}
diff --git a/tests/language/override/method_with_field_runtime_test.dart b/tests/language/override/method_with_field_runtime_test.dart
new file mode 100644
index 0000000..c18d588
--- /dev/null
+++ b/tests/language/override/method_with_field_runtime_test.dart
@@ -0,0 +1,34 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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.
+
+import "package:expect/expect.dart";
+
+// Test overriding a method with a field.
+
+class Super {
+ Super() : super();
+
+ instanceMethod() => 42;
+}
+
+class Sub extends Super {
+ Sub() : super();
+
+
+
+ superInstanceMethod() => super.instanceMethod();
+}
+
+main() {
+ var s = new Sub();
+ Super sup = s;
+ Sub sub = s;
+ print(s.instanceMethod);
+ Expect.equals(42, s.superInstanceMethod());
+
+ Expect.equals(42, sub.superInstanceMethod());
+}
diff --git a/tests/language/override/method_with_field_test.dart b/tests/language/override/method_with_field_test.dart
new file mode 100644
index 0000000..edd17fd
--- /dev/null
+++ b/tests/language/override/method_with_field_test.dart
@@ -0,0 +1,37 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+// Test overriding a method with a field.
+
+class Super {
+ Super() : super();
+
+ instanceMethod() => 42;
+}
+
+class Sub extends Super {
+ Sub() : super();
+
+ var instanceMethod = 87;
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.CONFLICTING_FIELD_AND_METHOD
+ // [cfe] Can't declare a member that conflicts with an inherited one.
+
+ superInstanceMethod() => super.instanceMethod();
+}
+
+main() {
+ var s = new Sub();
+ Super sup = s;
+ Sub sub = s;
+ print(s.instanceMethod);
+ Expect.equals(42, s.superInstanceMethod());
+ Expect.equals(42, sup.superInstanceMethod());
+ // ^^^^^^^^^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+ // [cfe] The method 'superInstanceMethod' isn't defined for the class 'Super'.
+ Expect.equals(42, sub.superInstanceMethod());
+}
diff --git a/tests/language/part/missing_part_of_tag_part.dart b/tests/language/part/missing_part_of_tag_part.dart
new file mode 100644
index 0000000..c4618bc
--- /dev/null
+++ b/tests/language/part/missing_part_of_tag_part.dart
@@ -0,0 +1,3 @@
+// Copyright (c) 2013, 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.
diff --git a/tests/language/part/missing_part_of_tag_test.dart b/tests/language/part/missing_part_of_tag_test.dart
new file mode 100644
index 0000000..ea91f42
--- /dev/null
+++ b/tests/language/part/missing_part_of_tag_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2013, 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 for missing part-of tag.
+
+library lib;
+
+part 'missing_part_of_tag_part.dart'; //# 01: compile-time error
+
+void main() {}
diff --git a/tests/language/part/of_multiple_libs_lib.dart b/tests/language/part/of_multiple_libs_lib.dart
new file mode 100644
index 0000000..e1d5306
--- /dev/null
+++ b/tests/language/part/of_multiple_libs_lib.dart
@@ -0,0 +1,11 @@
+// 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 ambiguous_lib;
+
+part "of_multiple_libs_part.dart";
+
+test() {
+ foo();
+}
diff --git a/tests/language/part/of_multiple_libs_part.dart b/tests/language/part/of_multiple_libs_part.dart
new file mode 100644
index 0000000..4ac530b
--- /dev/null
+++ b/tests/language/part/of_multiple_libs_part.dart
@@ -0,0 +1,11 @@
+// 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 ambiguous_lib;
+
+bar() {}
+
+foo() {
+ bar();
+}
diff --git a/tests/language/part/of_multiple_libs_runtime_test.dart b/tests/language/part/of_multiple_libs_runtime_test.dart
new file mode 100644
index 0000000..31b3e8d
--- /dev/null
+++ b/tests/language/part/of_multiple_libs_runtime_test.dart
@@ -0,0 +1,16 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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 ambiguous_lib;
+
+
+
+part "of_multiple_libs_part.dart";
+
+main() {
+ foo();
+}
diff --git a/tests/language/part/of_multiple_libs_test.dart b/tests/language/part/of_multiple_libs_test.dart
new file mode 100644
index 0000000..811617b
--- /dev/null
+++ b/tests/language/part/of_multiple_libs_test.dart
@@ -0,0 +1,15 @@
+// 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 ambiguous_lib;
+
+import 'of_multiple_libs_lib.dart';
+
+part "of_multiple_libs_part.dart";
+
+//^
+// [cfe] Method not found: 'foo'.
+main() {
+ foo();
+}
diff --git a/tests/language/part/of_uri2_part.dart b/tests/language/part/of_uri2_part.dart
new file mode 100644
index 0000000..2893a74
--- /dev/null
+++ b/tests/language/part/of_uri2_part.dart
@@ -0,0 +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 file.
+
+part of "of_uri2_test.dart";
+
+// Refer to declaration in library and other part.
+const bar1 = "part1";
+const baz1 = "$foo${bar2}1";
diff --git a/tests/language/part/of_uri2_part2.dart b/tests/language/part/of_uri2_part2.dart
new file mode 100644
index 0000000..0b049fb
--- /dev/null
+++ b/tests/language/part/of_uri2_part2.dart
@@ -0,0 +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 file.
+
+part of part_of_uri2;
+
+// Refer to declaration in library and other part.
+const bar2 = "part2";
+const baz2 = "$foo${bar1}2";
diff --git a/tests/language/part/of_uri2_test.dart b/tests/language/part/of_uri2_test.dart
new file mode 100644
index 0000000..ae0a12d
--- /dev/null
+++ b/tests/language/part/of_uri2_test.dart
@@ -0,0 +1,15 @@
+// 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.
+
+library part_of_uri2;
+
+part "of_uri2_part.dart"; // declares bar1, baz1, uses URI.
+part "of_uri2_part2.dart"; // declares bar2, baz2, uses id.
+
+const foo = 'foo';
+const qux = "$baz1$baz2";
+
+main() {
+ if (!identical(qux, "foopart21foopart12")) throw "Fail: $qux";
+}
diff --git a/tests/language/part/of_uri_part.dart b/tests/language/part/of_uri_part.dart
new file mode 100644
index 0000000..65e9fd7
--- /dev/null
+++ b/tests/language/part/of_uri_part.dart
@@ -0,0 +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 file.
+
+part of "of_uri_test.dart";
+
+// Refer to declaration in library and other part.
+const bar1 = "part1";
+const baz1 = "$foo${bar2}1";
diff --git a/tests/language/part/of_uri_part2.dart b/tests/language/part/of_uri_part2.dart
new file mode 100644
index 0000000..9facbf4
--- /dev/null
+++ b/tests/language/part/of_uri_part2.dart
@@ -0,0 +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 file.
+
+part of "of_uri_test.dart";
+
+// Refer to declaration in library and other part.
+const bar2 = "part2";
+const baz2 = "$foo${bar1}2";
diff --git a/tests/language/part/of_uri_test.dart b/tests/language/part/of_uri_test.dart
new file mode 100644
index 0000000..acb568d
--- /dev/null
+++ b/tests/language/part/of_uri_test.dart
@@ -0,0 +1,14 @@
+// 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.
+
+// No library declaration
+part "of_uri_part.dart"; // declares bar1, baz1
+part "of_uri_part2.dart"; // declares bar2, baz2
+
+const foo = 'foo';
+const qux = "$baz1$baz2";
+
+main() {
+ if (!identical(qux, "foopart21foopart12")) throw "Fail: $qux";
+}
diff --git a/tests/language/part/part.dart b/tests/language/part/part.dart
new file mode 100644
index 0000000..6c255db
--- /dev/null
+++ b/tests/language/part/part.dart
@@ -0,0 +1,7 @@
+// 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.
+
+part of org.dartlang.test.part_test;
+
+const foo = 'foo';
diff --git a/tests/language/part/part2_test.dart b/tests/language/part/part2_test.dart
new file mode 100644
index 0000000..706bc1f
--- /dev/null
+++ b/tests/language/part/part2_test.dart
@@ -0,0 +1,11 @@
+// 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.
+
+library org.dartlang.test.part2_test;
+
+part "part.dart"; //# 01: compile-time error
+
+main() {
+ print(foo); //# 01: continued
+}
diff --git a/tests/language/part/part_test.dart b/tests/language/part/part_test.dart
new file mode 100644
index 0000000..cc6cd77
--- /dev/null
+++ b/tests/language/part/part_test.dart
@@ -0,0 +1,11 @@
+// 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.
+
+library org.dartlang.test.part_test;
+
+part "part.dart";
+
+main() {
+ print(foo);
+}
diff --git a/tests/language/part/refers_to_core_library_runtime_test.dart b/tests/language/part/refers_to_core_library_runtime_test.dart
new file mode 100644
index 0000000..e9abfec
--- /dev/null
+++ b/tests/language/part/refers_to_core_library_runtime_test.dart
@@ -0,0 +1,14 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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.
+
+// This test reproduces https://github.com/dart-lang/sdk/issues/29709.
+
+library dart.async;
+
+
+
+main() {}
diff --git a/tests/language/part/refers_to_core_library_test.dart b/tests/language/part/refers_to_core_library_test.dart
new file mode 100644
index 0000000..4eb8dc7
--- /dev/null
+++ b/tests/language/part/refers_to_core_library_test.dart
@@ -0,0 +1,15 @@
+// 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.
+
+// This test reproduces https://github.com/dart-lang/sdk/issues/29709.
+
+library dart.async;
+
+part 'dart:async/future.dart';
+// ^
+// [cfe] Can't use 'org-dartlang-untranslatable-uri:dart%3Aasync%2Ffuture.dart' as a part, because it has no 'part of' declaration.
+// ^
+// [cfe] Not found: 'dart:async/future.dart'
+
+main() {}
diff --git a/tests/language/part/self_test.dart b/tests/language/part/self_test.dart
new file mode 100644
index 0000000..cc3e777
--- /dev/null
+++ b/tests/language/part/self_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2019, 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 "self_test.dart";
+// ^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.PART_OF_NON_PART
+
+main() {
+ print('should not be able to recursively include self as library part');
+}
diff --git a/tests/language/prefix/assignment_runtime_test.dart b/tests/language/prefix/assignment_runtime_test.dart
new file mode 100644
index 0000000..c33c8f5
--- /dev/null
+++ b/tests/language/prefix/assignment_runtime_test.dart
@@ -0,0 +1,29 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2015, 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.
+
+// Validate that assignment to a prefix is handled consistently with the
+// following spec text from section 16.19 (Assignment):
+// Evaluation of an assignment a of the form v = e proceeds as follows:
+// Let d be the innermost declaration whose name is v or v=, if it exists.
+// It is a compile-time error if d denotes a prefix object.
+
+import "empty_library.dart" as p;
+
+class Base {
+ var p;
+}
+
+class Derived extends Base {
+ void f() {
+
+ }
+}
+
+main() {
+ new Derived().f();
+
+}
diff --git a/tests/language/prefix/assignment_test.dart b/tests/language/prefix/assignment_test.dart
new file mode 100644
index 0000000..5a32011
--- /dev/null
+++ b/tests/language/prefix/assignment_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2015, 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.
+
+// Validate that assignment to a prefix is handled consistently with the
+// following spec text from section 16.19 (Assignment):
+// Evaluation of an assignment a of the form v = e proceeds as follows:
+// Let d be the innermost declaration whose name is v or v=, if it exists.
+// It is a compile-time error if d denotes a prefix object.
+
+import "empty_library.dart" as p;
+
+class Base {
+ var p;
+}
+
+class Derived extends Base {
+ void f() {
+ p = 1;
+// ^
+// [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
+// [cfe] A prefix can't be used as an expression.
+ }
+}
+
+main() {
+ new Derived().f();
+ p = 1;
+//^
+// [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
+// [cfe] A prefix can't be used as an expression.
+}
diff --git a/tests/language/prefix/empty_library.dart b/tests/language/prefix/empty_library.dart
new file mode 100644
index 0000000..fe101dc
--- /dev/null
+++ b/tests/language/prefix/empty_library.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2015, 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 empty_library;
diff --git a/tests/language/prefix/identifier_reference_test.dart b/tests/language/prefix/identifier_reference_test.dart
new file mode 100644
index 0000000..e59b6fe
--- /dev/null
+++ b/tests/language/prefix/identifier_reference_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2015, 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.
+
+// Validate the following spec text from section 16.32 (Identifier Reference):
+// Evaluation of an identifier expression e of the form id proceeds as
+// follows:
+// Let d be the innermost declaration in the enclosing lexical scope whose
+// name is id or id=. If no such declaration exists in the lexical scope,
+// d be the declaration of the inherited member named id if it exists.
+// - If d is a prefix p, a compile-time error occurs unless the token
+// immediately following d is '.'.
+
+import "package:expect/expect.dart";
+import "empty_library.dart" as p;
+
+void f(x) {}
+
+main() {
+ f(p); // //# 01: compile-time error
+ var x = p; // //# 02: compile-time error
+ var x = p[0]; //# 03: compile-time error
+ p[0] = null; // //# 04: compile-time error
+ p += 0; // //# 05: compile-time error
+}
diff --git a/tests/language/prefix/import_collision_runtime_test.dart b/tests/language/prefix/import_collision_runtime_test.dart
new file mode 100644
index 0000000..e0dc3c0
--- /dev/null
+++ b/tests/language/prefix/import_collision_runtime_test.dart
@@ -0,0 +1,16 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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.
+
+// Using the same prefix name while importing two different libraries is
+// not an error but both library1.dart and library2.dart define 'foo' which
+// results in a duplicate definition error.
+import "../library1.dart" as lib2; // defines 'foo'.
+import "../library2.dart" as lib2; // also defines 'foo'.
+
+main() {
+
+}
diff --git a/tests/language/prefix/import_collision_test.dart b/tests/language/prefix/import_collision_test.dart
new file mode 100644
index 0000000..6ad50cb
--- /dev/null
+++ b/tests/language/prefix/import_collision_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2011, 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.
+
+// Using the same prefix name while importing two different libraries is
+// not an error but both library1.dart and library2.dart define 'foo' which
+// results in a duplicate definition error.
+import "../library1.dart" as lib2; // defines 'foo'.
+import "../library2.dart" as lib2; // also defines 'foo'.
+
+main() {
+ lib2.foo = 1;
+ // ^^^
+ // [analyzer] STATIC_WARNING.AMBIGUOUS_IMPORT
+ // [cfe] Setter not found: 'foo'.
+}
diff --git a/tests/language/prefix/invalid_name_runtime_test.dart b/tests/language/prefix/invalid_name_runtime_test.dart
new file mode 100644
index 0000000..a2a71f1
--- /dev/null
+++ b/tests/language/prefix/invalid_name_runtime_test.dart
@@ -0,0 +1,13 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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.
+
+// Prefix must be a valid identifier.
+import "../library1.dart"
+
+ ;
+
+main() {}
diff --git a/tests/language/prefix/invalid_name_test.dart b/tests/language/prefix/invalid_name_test.dart
new file mode 100644
index 0000000..7ee08b1
--- /dev/null
+++ b/tests/language/prefix/invalid_name_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2011, 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.
+
+// Prefix must be a valid identifier.
+import "../library1.dart"
+ as lib1.invalid
+ // ^^^^
+ // [analyzer] SYNTACTIC_ERROR.EXPECTED_TOKEN
+ // [cfe] Expected ';' after this.
+ // ^
+ // [analyzer] SYNTACTIC_ERROR.EXPECTED_EXECUTABLE
+ // [cfe] Expected a declaration, but got '.'.
+ // ^^^^^^^
+ // [analyzer] SYNTACTIC_ERROR.MISSING_CONST_FINAL_VAR_OR_TYPE
+ // [cfe] Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+ ;
+
+main() {}
diff --git a/tests/language/prefix/new_test.dart b/tests/language/prefix/new_test.dart
new file mode 100644
index 0000000..23c7834
--- /dev/null
+++ b/tests/language/prefix/new_test.dart
@@ -0,0 +1,12 @@
+// 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.
+
+library PrefixTest;
+
+import "package:expect/expect.dart";
+import "test1.dart";
+
+main() {
+ Expect.equals(Prefix.getSource(), Prefix.getImport() + 1);
+}
diff --git a/tests/language/prefix/new_test1.dart b/tests/language/prefix/new_test1.dart
new file mode 100644
index 0000000..106de80
--- /dev/null
+++ b/tests/language/prefix/new_test1.dart
@@ -0,0 +1,19 @@
+// 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.
+
+library PrefixTest1;
+
+import "test2.dart" as test2;
+
+class Prefix {
+ static const int foo = 43;
+
+ static getSource() {
+ return foo;
+ }
+
+ static getImport() {
+ return test2.Prefix.foo;
+ }
+}
diff --git a/tests/language/prefix/new_test2.dart b/tests/language/prefix/new_test2.dart
new file mode 100644
index 0000000..75a5c6e
--- /dev/null
+++ b/tests/language/prefix/new_test2.dart
@@ -0,0 +1,9 @@
+// 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.
+
+library PrefixNewTest2;
+
+class Prefix {
+ static const int foo = 42;
+}
diff --git a/tests/language/prefix/prefix101_test.dart b/tests/language/prefix/prefix101_test.dart
new file mode 100644
index 0000000..b479e6d
--- /dev/null
+++ b/tests/language/prefix/prefix101_test.dart
@@ -0,0 +1,57 @@
+// 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.
+
+// Test to check if we are able to import multiple libraries using the
+// same prefix.
+
+library Prefix101Test.dart;
+
+import "package:expect/expect.dart";
+import "../library10.dart" as lib101;
+import "../library11.dart" as lib101;
+
+class Prefix101Test {
+ static Test1() {
+ var result = 0;
+ var obj = new lib101.Library10(1);
+ result = obj.fld;
+ Expect.equals(1, result);
+ result += obj.func();
+ Expect.equals(3, result);
+ result += lib101.Library10.static_func();
+ Expect.equals(6, result);
+ result += lib101.Library10.static_fld;
+ Expect.equals(10, result);
+ }
+
+ static Test2() {
+ var result = 0;
+ var obj = new lib101.Library11(4);
+ result = obj.fld;
+ Expect.equals(4, result);
+ result += obj.func();
+ Expect.equals(7, result);
+ result += lib101.Library11.static_func();
+ Expect.equals(9, result);
+ result += lib101.Library11.static_fld;
+ Expect.equals(10, result);
+ }
+
+ static Test3() {
+ Expect.equals(10, lib101.top_level10);
+ Expect.equals(20, lib101.top_level_func10());
+ }
+
+ static Test4() {
+ Expect.equals(100, lib101.top_level11);
+ Expect.equals(200, lib101.top_level_func11());
+ }
+}
+
+main() {
+ Prefix101Test.Test1();
+ Prefix101Test.Test2();
+ Prefix101Test.Test3();
+ Prefix101Test.Test4();
+}
diff --git a/tests/language/prefix/prefix10_test.dart b/tests/language/prefix/prefix10_test.dart
new file mode 100644
index 0000000..3e0853c
--- /dev/null
+++ b/tests/language/prefix/prefix10_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2011, 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 Prefix10Test.dart;
+
+import "package:expect/expect.dart";
+import "../library10.dart" as lib10;
+import "../library11.dart" as lib11;
+
+class Prefix10Test {
+ static Test1() {
+ var result = 0;
+ var obj = new lib10.Library10(1);
+ result = obj.fld;
+ Expect.equals(1, result);
+ result += obj.func();
+ Expect.equals(3, result);
+ result += lib10.Library10.static_func();
+ Expect.equals(6, result);
+ result += lib10.Library10.static_fld;
+ Expect.equals(10, result);
+ }
+
+ static Test2() {
+ var result = 0;
+ var obj = new lib11.Library11(4);
+ result = obj.fld;
+ Expect.equals(4, result);
+ result += obj.func();
+ Expect.equals(7, result);
+ result += lib11.Library11.static_func();
+ Expect.equals(9, result);
+ result += lib11.Library11.static_fld;
+ Expect.equals(10, result);
+ }
+
+ static Test3() {
+ Expect.equals(10, lib10.top_level10);
+ Expect.equals(20, lib10.top_level_func10());
+ }
+
+ static Test4() {
+ Expect.equals(100, lib11.top_level11);
+ Expect.equals(200, lib11.top_level_func11());
+ }
+}
+
+main() {
+ Prefix10Test.Test1();
+ Prefix10Test.Test2();
+ Prefix10Test.Test3();
+ Prefix10Test.Test4();
+}
diff --git a/tests/language/prefix/prefix11_test.dart b/tests/language/prefix/prefix11_test.dart
new file mode 100644
index 0000000..ec09c33
--- /dev/null
+++ b/tests/language/prefix/prefix11_test.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2011, 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 Prefix11Test.dart;
+
+import "package:expect/expect.dart";
+import "../library10.dart";
+import "../library11.dart" as lib11;
+
+class Prefix11Test {
+ static Test1() {
+ var result = 0;
+ var obj = new Library10(1);
+ result = obj.fld;
+ Expect.equals(1, result);
+ result += obj.func();
+ Expect.equals(3, result);
+ result += Library10.static_func();
+ Expect.equals(6, result);
+ result += Library10.static_fld;
+ Expect.equals(10, result);
+ }
+
+ static Test2() {
+ var result = 0;
+ var obj = new lib11.Library11(4);
+ result = obj.fld;
+ Expect.equals(4, result);
+ result += obj.func();
+ Expect.equals(7, result);
+ result += lib11.Library11.static_func();
+ Expect.equals(9, result);
+ result += lib11.Library11.static_fld;
+ Expect.equals(10, result);
+ }
+
+ static Test3() {
+ Expect.equals(10, top_level10);
+ Expect.equals(20, top_level_func10());
+ }
+
+ static Test4() {
+ Expect.equals(100, lib11.top_level11);
+ Expect.equals(200, lib11.top_level_func11());
+ }
+}
+
+main() {
+ Prefix11Test.Test1();
+ Prefix11Test.Test2();
+ Prefix11Test.Test3();
+ Prefix11Test.Test4();
+}
diff --git a/tests/language/prefix/prefix12_test.dart b/tests/language/prefix/prefix12_test.dart
new file mode 100644
index 0000000..5ce98bd
--- /dev/null
+++ b/tests/language/prefix/prefix12_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2011, 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 Prefix12Test.dart;
+
+import "package:expect/expect.dart";
+import "../library11.dart" as lib11;
+
+class Prefix12Test {
+ static Test1() {
+ var result = 0;
+ var obj = new lib11.Library11.namedConstructor(10);
+ result = obj.fld;
+ Expect.equals(10, result);
+ }
+
+ static Test2() {
+ int result = 0;
+ var obj = new lib11.Library111<int>.namedConstructor(10);
+ result = obj.fld;
+ Expect.equals(10, result);
+ }
+}
+
+main() {
+ Prefix12Test.Test1();
+ Prefix12Test.Test2();
+}
diff --git a/tests/language/prefix/prefix14_test.dart b/tests/language/prefix/prefix14_test.dart
new file mode 100644
index 0000000..f9d5c68
--- /dev/null
+++ b/tests/language/prefix/prefix14_test.dart
@@ -0,0 +1,71 @@
+// Copyright (c) 2011, 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.
+//
+// Use qualified symbols at various places.
+
+library Prefix14Test.dart;
+
+import "package:expect/expect.dart";
+import "../library12.dart" as lib12;
+
+typedef lib12.Library12 myFunc(lib12.Library12 param);
+
+class myInterface implements lib12.Library12Interface {
+ myInterface(lib12.Library12 this.myfld);
+ lib12.Library12 addObjects(lib12.Library12 value1, lib12.Library12 value2) {
+ myfld.fld = (value1.fld + value2.fld + myfld.fld);
+ return myfld;
+ }
+
+ lib12.Library12 myfld;
+}
+
+class myClass extends lib12.Library12 {
+ myClass(int value) : super(value);
+ static lib12.Library12 func1() {
+ var i = new lib12.Library12(10);
+ return i;
+ }
+
+ static lib12.Library12 func2(lib12.Library12 param) {
+ return param;
+ }
+}
+
+class myClass1 {
+ myClass1(int value) : fld1 = new lib12.Library12(value);
+ lib12.Library12 fld1;
+}
+
+class myClass2 {
+ myClass2(lib12.Library12 this.fld2);
+ lib12.Library12 fld2;
+}
+
+main() {
+ var o;
+ o = myClass.func1();
+ Expect.equals(2, o.func());
+ o = new myClass(10);
+ Expect.equals(10, o.fld);
+
+ myFunc func = myClass.func2;
+ Expect.equals(2, func(new lib12.Library12(10)).func());
+ Expect.equals(10, func(new lib12.Library12(10)).fld);
+
+ o = new myClass1(100);
+ Expect.equals(2, o.fld1.func());
+ Expect.equals(100, o.fld1.fld);
+
+ o = new myClass2(new lib12.Library12(200));
+ Expect.equals(2, o.fld2.func());
+ Expect.equals(200, o.fld2.fld);
+
+ o = new myInterface(new lib12.Library12(100));
+ Expect.equals(2, o.myfld.func());
+ Expect.equals(100, o.myfld.fld);
+ o = o.addObjects(new lib12.Library12(200), new lib12.Library12(300));
+ Expect.equals(2, o.func());
+ Expect.equals(600, o.fld);
+}
diff --git a/tests/language/prefix/prefix15_test.dart b/tests/language/prefix/prefix15_test.dart
new file mode 100644
index 0000000..123ae99
--- /dev/null
+++ b/tests/language/prefix/prefix15_test.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2011, 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.
+//
+// Use qualified symbols with generics at various places.
+
+library Prefix15Test.dart;
+
+import "package:expect/expect.dart";
+import "../library12.dart" as lib12;
+
+typedef T myFunc<T>(T param);
+
+class myInterface<T extends lib12.Library12>
+ implements lib12.Library12Interface {
+ myInterface(T this.myfld);
+ T addObjects(covariant T value1, covariant T value2) {
+ myfld.fld = (value1.fld + value2.fld + myfld.fld);
+ return myfld;
+ }
+
+ T myfld;
+}
+
+class myClass2<T> {
+ myClass2(T this.fld2);
+ T func(T val) => val;
+ T fld2;
+}
+
+main() {
+ var o;
+ o = new myClass2<lib12.Library12>(new lib12.Library12(100));
+ myFunc<lib12.Library12> func = o.func;
+ Expect.equals(2, func(new lib12.Library12(10)).func());
+ Expect.equals(10, func(new lib12.Library12(10)).fld);
+
+ o = new myClass2<lib12.Library12>(new lib12.Library12(200));
+ Expect.equals(2, o.fld2.func());
+ Expect.equals(200, o.fld2.fld);
+
+ o = new myInterface<lib12.Library12>(new lib12.Library12(100));
+ Expect.equals(2, o.myfld.func());
+ Expect.equals(100, o.myfld.fld);
+ o = o.addObjects(new lib12.Library12(200), new lib12.Library12(300));
+ Expect.equals(2, o.func());
+ Expect.equals(600, o.fld);
+}
diff --git a/tests/language/prefix/prefix16_runtime_test.dart b/tests/language/prefix/prefix16_runtime_test.dart
new file mode 100644
index 0000000..b309ea2
--- /dev/null
+++ b/tests/language/prefix/prefix16_runtime_test.dart
@@ -0,0 +1,30 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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.
+//
+// Unresolved imported symbols are errors.
+// In this test, the function myFunc contains malformed types because
+// lib12.Library13 is not resolved.
+
+import "package:expect/expect.dart";
+import "../library12.dart" as lib12;
+
+typedef
+
+ myFunc(
+
+ param);
+typedef
+
+ myFunc2(
+
+ param, int i);
+
+main() {
+ Expect.isTrue(((Object? x) => x) is myFunc);
+ Expect.isTrue(((Object? x, int y) => x) is myFunc2);
+ Expect.isFalse(((Object? x, String y) => x) is myFunc2);
+}
diff --git a/tests/language/prefix/prefix16_test.dart b/tests/language/prefix/prefix16_test.dart
new file mode 100644
index 0000000..874b910
--- /dev/null
+++ b/tests/language/prefix/prefix16_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2011, 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.
+//
+// Unresolved imported symbols are errors.
+// In this test, the function myFunc contains malformed types because
+// lib12.Library13 is not resolved.
+
+import "package:expect/expect.dart";
+import "../library12.dart" as lib12;
+
+typedef
+ lib12.Library13
+// ^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
+// [cfe] Type 'lib12.Library13' not found.
+ myFunc(
+ lib12.Library13
+// ^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
+// [cfe] Type 'lib12.Library13' not found.
+ param);
+typedef
+ lib12.Library13
+// ^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
+// [cfe] Type 'lib12.Library13' not found.
+ myFunc2(
+ lib12.Library13
+// ^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
+// [cfe] Type 'lib12.Library13' not found.
+ param, int i);
+
+main() {
+ Expect.isTrue(((Object x) => x) is myFunc);
+ Expect.isTrue(((Object x, int y) => x) is myFunc2);
+ Expect.isFalse(((Object x, String y) => x) is myFunc2);
+}
diff --git a/tests/language/prefix/prefix17_test.dart b/tests/language/prefix/prefix17_test.dart
new file mode 100644
index 0000000..9b11ac2
--- /dev/null
+++ b/tests/language/prefix/prefix17_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2011, 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 Prefix17Test.dart;
+
+import "../library12.dart" as lib12;
+
+class LocalClass {
+ static int static_fld = 42;
+}
+
+void main() {
+ var lc1 = new lib12.Library12(5);
+ lib12.Library12 lc2 = new lib12.Library12(10);
+ lib12.Library12 lc2m = new lib12.Library12.other(10, 2);
+ lib12.Library12.static_fld = 43;
+ //print("${LocalClass.static_fld}, ${lc1.fld}, ${lc2.fld}, ${lc2m.fld}, ${lib12.Library12.static_fld}");
+}
diff --git a/tests/language/prefix/prefix21_bad_lib.dart b/tests/language/prefix/prefix21_bad_lib.dart
new file mode 100644
index 0000000..1869a7f
--- /dev/null
+++ b/tests/language/prefix/prefix21_bad_lib.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2011, 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 Prefix21Bad;
+
+int badFunction(int x) {
+ return x << 1;
+}
+
+Function get getValue {
+ return badFunction;
+}
diff --git a/tests/language/prefix/prefix21_good_lib.dart b/tests/language/prefix/prefix21_good_lib.dart
new file mode 100644
index 0000000..2557726
--- /dev/null
+++ b/tests/language/prefix/prefix21_good_lib.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2011, 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 Prefix21Good;
+
+int goodFunction(int x) {
+ return x;
+}
+
+Function get getValue {
+ return goodFunction;
+}
diff --git a/tests/language/prefix/prefix21_test.dart b/tests/language/prefix/prefix21_test.dart
new file mode 100644
index 0000000..bcaebd1
--- /dev/null
+++ b/tests/language/prefix/prefix21_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2011, 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 Prefix21;
+
+import "package:expect/expect.dart";
+import "prefix21_good_lib.dart" as good;
+import "prefix21_bad_lib.dart" as bad;
+
+main() {
+ Expect.equals(good.getValue(42), 42);
+ Expect.equals(bad.getValue(42), 84);
+}
diff --git a/tests/language/prefix/prefix22_runtime_test.dart b/tests/language/prefix/prefix22_runtime_test.dart
new file mode 100644
index 0000000..286256a
--- /dev/null
+++ b/tests/language/prefix/prefix22_runtime_test.dart
@@ -0,0 +1,22 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// 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.
+//
+// Unresolved symbols should be reported as static type warnings.
+// This should not prevent execution.
+
+library Prefix21NegativeTest.dart;
+import "../library12.dart" as lib12;
+
+class myClass {
+ myClass(
+
+ p) { }
+}
+
+main() {
+ new myClass(null); // no dynamic type error when assigning null
+}
diff --git a/tests/language/prefix/prefix22_test.dart b/tests/language/prefix/prefix22_test.dart
new file mode 100644
index 0000000..e28423d
--- /dev/null
+++ b/tests/language/prefix/prefix22_test.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.
+//
+// Unresolved symbols should be reported as static type warnings.
+// This should not prevent execution.
+
+library Prefix21NegativeTest.dart;
+import "../library12.dart" as lib12;
+
+class myClass {
+ myClass(
+ lib12.Library13
+// ^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
+// [cfe] Type 'lib12.Library13' not found.
+// ^
+// [cfe] 'Library13' isn't a type.
+ p) { }
+}
+
+main() {
+ new myClass(null); // no dynamic type error when assigning null
+}
diff --git a/tests/language/prefix/prefix23_runtime_test.dart b/tests/language/prefix/prefix23_runtime_test.dart
new file mode 100644
index 0000000..6ab1736
--- /dev/null
+++ b/tests/language/prefix/prefix23_runtime_test.dart
@@ -0,0 +1,21 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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.
+//
+// Unresolved symbols should be reported as an static type warnings.
+// This should not prevent execution.
+
+library Prefix23Test.dart;
+
+import "../library12.dart" as lib12;
+
+class myClass {
+ final
+
+ fld = null;
+}
+
+main() {}
diff --git a/tests/language/prefix/prefix23_test.dart b/tests/language/prefix/prefix23_test.dart
new file mode 100644
index 0000000..ef85f1f
--- /dev/null
+++ b/tests/language/prefix/prefix23_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2011, 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.
+//
+// Unresolved symbols should be reported as an static type warnings.
+// This should not prevent execution.
+
+library Prefix23Test.dart;
+
+import "../library12.dart" as lib12;
+
+class myClass {
+ final
+ lib12.Library13
+// ^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
+// [cfe] Type 'lib12.Library13' not found.
+// ^
+// [cfe] 'Library13' isn't a type.
+ fld = null;
+}
+
+main() {}
diff --git a/tests/language/prefix/prefix24_lib1.dart b/tests/language/prefix/prefix24_lib1.dart
new file mode 100644
index 0000000..557ed84
--- /dev/null
+++ b/tests/language/prefix/prefix24_lib1.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2013, 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 prefix24_lib1;
+
+import "prefix24_lib2.dart" as X;
+
+// lib1_foo() returns value of bar() in library prefix24_lib2.
+lib1_foo() => X.bar();
diff --git a/tests/language/prefix/prefix24_lib2.dart b/tests/language/prefix/prefix24_lib2.dart
new file mode 100644
index 0000000..d4dd592
--- /dev/null
+++ b/tests/language/prefix/prefix24_lib2.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2013, 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 prefix24_lib2;
+
+bar() => "prefix24_lib2_bar";
diff --git a/tests/language/prefix/prefix24_lib3.dart b/tests/language/prefix/prefix24_lib3.dart
new file mode 100644
index 0000000..4490f9b
--- /dev/null
+++ b/tests/language/prefix/prefix24_lib3.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2013, 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 prefix24_lib3;
+
+class X {
+ static bar() => "static method bar of class X";
+}
diff --git a/tests/language/prefix/prefix24_test.dart b/tests/language/prefix/prefix24_test.dart
new file mode 100644
index 0000000..1e2f4e6
--- /dev/null
+++ b/tests/language/prefix/prefix24_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, 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 prefix24_test;
+
+import "package:expect/expect.dart";
+
+// Import a library that contains library prefix X.
+import "prefix24_lib1.dart";
+
+// Import a library that declares class X.
+import "prefix24_lib3.dart";
+
+// Check that the library prefix X that is used in library prefix24_lib1
+// remains private to that library and does not collide with class X
+// defined in (and imported from) prefix24_lib3;
+
+main() {
+ Expect.equals("static method bar of class X", X.bar());
+ Expect.equals("prefix24_lib2_bar", lib1_foo());
+}
diff --git a/tests/language/prefix/prefix_test.dart b/tests/language/prefix/prefix_test.dart
new file mode 100644
index 0000000..bcecae7
--- /dev/null
+++ b/tests/language/prefix/prefix_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2011, 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 PrefixTest.dart;
+
+import "package:expect/expect.dart";
+import "test1.dart";
+
+class PrefixTest {
+ static testMain() {
+ Expect.equals(Prefix.getSource(), Prefix.getImport() + 1);
+ }
+}
+
+main() {
+ PrefixTest.testMain();
+}
diff --git a/tests/language/prefix/shadow_runtime_test.dart b/tests/language/prefix/shadow_runtime_test.dart
new file mode 100644
index 0000000..dc83ce3
--- /dev/null
+++ b/tests/language/prefix/shadow_runtime_test.dart
@@ -0,0 +1,36 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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.
+
+// Type parameters can shadow a library prefix.
+
+import "package:expect/expect.dart";
+import "../library10.dart" as T;
+import "../library10.dart" as lib10;
+
+class P<T> {
+ test() {
+
+ }
+}
+
+main() {
+ new P<int>().test();
+
+ {
+ // Variables in the local scope hide the library prefix.
+
+ var result = 0;
+ result = lib10.Library10.static_fld;
+ Expect.equals(4, result);
+ }
+
+ {
+ // Shadowing is not an error.
+ var lib10 = 1;
+ Expect.equals(2, lib10 + 1);
+ }
+}
diff --git a/tests/language/prefix/shadow_test.dart b/tests/language/prefix/shadow_test.dart
new file mode 100644
index 0000000..4a5bdc2
--- /dev/null
+++ b/tests/language/prefix/shadow_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2011, 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.
+
+// Type parameters can shadow a library prefix.
+
+import "package:expect/expect.dart";
+import "../library10.dart" as T;
+import "../library10.dart" as lib10;
+
+class P<T> {
+ test() {
+ new T.Library10(10);
+ // ^
+ // [cfe] Method not found: 'T.Library10'.
+ }
+}
+
+main() {
+ new P<int>().test();
+
+ {
+ // Variables in the local scope hide the library prefix.
+ var lib10 = 0;
+ var result = 0;
+ result = lib10.Library10.static_fld;
+ // ^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_GETTER
+ // [cfe] The getter 'Library10' isn't defined for the class 'int'.
+ Expect.equals(4, result);
+ }
+
+ {
+ // Shadowing is not an error.
+ var lib10 = 1;
+ Expect.equals(2, lib10 + 1);
+ }
+}
diff --git a/tests/language/prefix/test1.dart b/tests/language/prefix/test1.dart
new file mode 100644
index 0000000..a9c546c
--- /dev/null
+++ b/tests/language/prefix/test1.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2011, 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 PrefixTest1.dart;
+
+import "test2.dart" as prefix;
+
+class Prefix {
+ static const int foo = 43;
+
+ static getSource() {
+ return foo;
+ }
+
+ static getImport() {
+ return prefix.Prefix.foo;
+ }
+}
diff --git a/tests/language/prefix/test2.dart b/tests/language/prefix/test2.dart
new file mode 100644
index 0000000..8538ca3
--- /dev/null
+++ b/tests/language/prefix/test2.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2011, 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 PrefixTest2.dart;
+
+class Prefix {
+ static const int foo = 42;
+}
diff --git a/tests/language/prefix/transitive_import_prefix_runtime_test.dart b/tests/language/prefix/transitive_import_prefix_runtime_test.dart
new file mode 100644
index 0000000..7b016cc
--- /dev/null
+++ b/tests/language/prefix/transitive_import_prefix_runtime_test.dart
@@ -0,0 +1,14 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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 "../library10.dart";
+
+main() {
+ // Library prefixes in the imported libraries should not be visible here.
+
+
+
+}
diff --git a/tests/language/prefix/transitive_import_prefix_test.dart b/tests/language/prefix/transitive_import_prefix_test.dart
new file mode 100644
index 0000000..9186560
--- /dev/null
+++ b/tests/language/prefix/transitive_import_prefix_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2011, 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 "../library10.dart";
+
+main() {
+ // Library prefixes in the imported libraries should not be visible here.
+ new lib11.Library11(1);
+ // ^^^^^^^^^^^^^^^
+ // [analyzer] STATIC_WARNING.NEW_WITH_NON_TYPE
+ // [cfe] Method not found: 'lib11.Library11'.
+ lib11.Library11.static_func();
+//^^^^^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] Getter not found: 'lib11'.
+ lib11.Library11.static_fld;
+//^^^^^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] Getter not found: 'lib11'.
+}
diff --git a/tests/language/prefix/transitive_import_runtime_test.dart b/tests/language/prefix/transitive_import_runtime_test.dart
new file mode 100644
index 0000000..6c130f6
--- /dev/null
+++ b/tests/language/prefix/transitive_import_runtime_test.dart
@@ -0,0 +1,18 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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.
+
+// Symbols in libraries imported by the prefixed library should not be visible.
+
+import "../library12.dart" as lib12;
+
+main() {
+ // Class should not be visible.
+
+
+ // Variable should not be visible.
+
+}
diff --git a/tests/language/prefix/transitive_import_test.dart b/tests/language/prefix/transitive_import_test.dart
new file mode 100644
index 0000000..0ae3fa7
--- /dev/null
+++ b/tests/language/prefix/transitive_import_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2011, 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.
+
+// Symbols in libraries imported by the prefixed library should not be visible.
+
+import "../library12.dart" as lib12;
+
+main() {
+ // Class should not be visible.
+ new lib12.Library11(1);
+ // ^^^^^^^^^
+ // [analyzer] STATIC_WARNING.NEW_WITH_NON_TYPE
+ // [cfe] Method not found: 'Library11'.
+
+ // Variable should not be visible.
+ lib12.top_level11;
+ // ^^^^^^^^^^^
+ // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_PREFIXED_NAME
+ // [cfe] Getter not found: 'top_level11'.
+}
diff --git a/tests/language/prefix/unqualified_invocation_runtime_test.dart b/tests/language/prefix/unqualified_invocation_runtime_test.dart
new file mode 100644
index 0000000..0841ed0
--- /dev/null
+++ b/tests/language/prefix/unqualified_invocation_runtime_test.dart
@@ -0,0 +1,32 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2015, 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.
+
+// Validate the following spec text from section 16.14.3 (Unqualified
+// invocation):
+// An unqualifiedfunction invocation i has the form
+// id(a1, ..., an, xn+1 : an+1, ..., xn+k : an+k),
+// where id is an identifier.
+// If there exists a lexically visible declaration named id, let fid be the
+// innermost such declaration. Then:
+// - If fid is a prefix object, a compile-time error occurs.
+
+import "empty_library.dart" as p;
+
+class Base {
+ void p() {}
+}
+
+class Derived extends Base {
+ void f() {
+
+ }
+}
+
+main() {
+ new Derived().f();
+
+}
diff --git a/tests/language/prefix/unqualified_invocation_test.dart b/tests/language/prefix/unqualified_invocation_test.dart
new file mode 100644
index 0000000..decb209
--- /dev/null
+++ b/tests/language/prefix/unqualified_invocation_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2015, 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.
+
+// Validate the following spec text from section 16.14.3 (Unqualified
+// invocation):
+// An unqualifiedfunction invocation i has the form
+// id(a1, ..., an, xn+1 : an+1, ..., xn+k : an+k),
+// where id is an identifier.
+// If there exists a lexically visible declaration named id, let fid be the
+// innermost such declaration. Then:
+// - If fid is a prefix object, a compile-time error occurs.
+
+import "empty_library.dart" as p;
+
+class Base {
+ void p() {}
+}
+
+class Derived extends Base {
+ void f() {
+ p();
+// ^
+// [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
+// [cfe] A prefix can't be used as an expression.
+ }
+}
+
+main() {
+ new Derived().f();
+ p();
+//^
+// [analyzer] COMPILE_TIME_ERROR.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT
+// [cfe] A prefix can't be used as an expression.
+}
diff --git a/tests/language/prefix/unresolved_class_runtime_test.dart b/tests/language/prefix/unresolved_class_runtime_test.dart
new file mode 100644
index 0000000..17442cc
--- /dev/null
+++ b/tests/language/prefix/unresolved_class_runtime_test.dart
@@ -0,0 +1,22 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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.
+
+// Unresolved symbols should be reported as an error.
+import "../library12.dart" as lib12;
+
+class Subclass
+
+{}
+
+class Implementer
+
+{}
+
+main() {
+ new Subclass();
+ new Implementer();
+}
diff --git a/tests/language/prefix/unresolved_class_test.dart b/tests/language/prefix/unresolved_class_test.dart
new file mode 100644
index 0000000..dd46a62
--- /dev/null
+++ b/tests/language/prefix/unresolved_class_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2011, 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.
+
+// Unresolved symbols should be reported as an error.
+import "../library12.dart" as lib12;
+
+class Subclass
+ extends lib12.Library13
+ // ^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.EXTENDS_NON_CLASS
+ // [cfe] Type 'lib12.Library13' not found.
+{}
+
+class Implementer
+ implements lib12.Library13
+ // ^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
+ // [cfe] Type 'lib12.Library13' not found.
+{}
+
+main() {
+ new Subclass();
+ new Implementer();
+}
diff --git a/tests/language/prefix/variable_collision_runtime_test.dart b/tests/language/prefix/variable_collision_runtime_test.dart
new file mode 100644
index 0000000..87082c0
--- /dev/null
+++ b/tests/language/prefix/variable_collision_runtime_test.dart
@@ -0,0 +1,12 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2011, 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 "../library10.dart" as lib10;
+
+// Top level variables cannot shadow library prefixes, they should collide.
+
+
+main() {}
diff --git a/tests/language/prefix/variable_collision_test.dart b/tests/language/prefix/variable_collision_test.dart
new file mode 100644
index 0000000..fa19d62
--- /dev/null
+++ b/tests/language/prefix/variable_collision_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2011, 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 "../library10.dart" as lib10;
+// ^
+// [cfe] 'lib10' is already declared in this scope.
+
+// Top level variables cannot shadow library prefixes, they should collide.
+var lib10;
+// ^^^^^
+// [analyzer] COMPILE_TIME_ERROR.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER
+
+main() {}
diff --git a/tests/language/private/access_lib.dart b/tests/language/private/access_lib.dart
new file mode 100644
index 0000000..1ffa127
--- /dev/null
+++ b/tests/language/private/access_lib.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2015, 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 private;
+
+_function() {}
+
+class _Class {}
+
+class Class {
+ Class._constructor();
+}
diff --git a/tests/language/private/access_runtime_test.dart b/tests/language/private/access_runtime_test.dart
new file mode 100644
index 0000000..f314be7
--- /dev/null
+++ b/tests/language/private/access_runtime_test.dart
@@ -0,0 +1,20 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2015, 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 'access_lib.dart';
+import 'access_lib.dart' as private;
+
+main() {
+
+
+
+
+
+
+}
diff --git a/tests/language/private/access_test.dart b/tests/language/private/access_test.dart
new file mode 100644
index 0000000..a1cf6a1
--- /dev/null
+++ b/tests/language/private/access_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2015, 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 'access_lib.dart';
+import 'access_lib.dart' as private;
+
+main() {
+ _function();
+//^^^^^^^^^
+// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_FUNCTION
+// [cfe] Method not found: '_function'.
+ private._function();
+//^
+// [cfe] Method not found: '_function'.
+// ^^^^^^^^^
+// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_FUNCTION
+ new _Class();
+ // ^^^^^^
+ // [analyzer] STATIC_WARNING.NEW_WITH_NON_TYPE
+ // [cfe] Method not found: '_Class'.
+ private._Class();
+//^
+// [cfe] Method not found: '_Class'.
+// ^^^^^^
+// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_FUNCTION
+ new Class._constructor();
+ // ^^^^^^^^^^^^
+ // [analyzer] STATIC_WARNING.NEW_WITH_UNDEFINED_CONSTRUCTOR
+ // [cfe] Method not found: 'Class._constructor'.
+ new private.Class._constructor();
+ // ^^^^^^^^^^^^
+ // [analyzer] STATIC_WARNING.NEW_WITH_UNDEFINED_CONSTRUCTOR
+ // [cfe] Method not found: 'Class._constructor'.
+}
diff --git a/tests/language/private/clash_lib.dart b/tests/language/private/clash_lib.dart
new file mode 100644
index 0000000..40dbc02
--- /dev/null
+++ b/tests/language/private/clash_lib.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2015, 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 a$_b;
+
+class B {
+ var _c$ = 10; // With library prefix: _a$_b$_c$
+
+ getValueA() {
+ try {} catch (e) {} // no inline
+ return this._c$;
+ }
+}
diff --git a/tests/language/private/clash_test.dart b/tests/language/private/clash_test.dart
new file mode 100644
index 0000000..dffbc26
--- /dev/null
+++ b/tests/language/private/clash_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2015, 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 a;
+
+import 'clash_lib.dart' as lib;
+import 'package:expect/expect.dart';
+
+class A extends lib.B {
+ var _b$_c$ = 100; // With library prefix: _a$_b$_c$
+
+ getValueB() {
+ try {} catch (e) {} // no inline
+ return this._b$_c$;
+ }
+}
+
+main() {
+ A a = new A();
+ Expect.equals(110, a.getValueA() + a.getValueB());
+}
diff --git a/tests/language/private/lib.dart b/tests/language/private/lib.dart
new file mode 100644
index 0000000..f0cac6a
--- /dev/null
+++ b/tests/language/private/lib.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2011, 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 for testing access to private fields.
+
+library PrivateLib;
+
+class PrivateLib {
+ final _myPrecious;
+
+ const PrivateLib() : this._myPrecious = "The Ring";
+}
diff --git a/tests/language/private/main.dart b/tests/language/private/main.dart
new file mode 100644
index 0000000..51eb3d8
--- /dev/null
+++ b/tests/language/private/main.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2011, 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 for testing access to private fields.
+
+part of Private3Test.dart;
+
+main() {
+ PrivateMain.main();
+}
+
+class PrivateMain {
+ static const _myPrecious = "A Ring";
+
+ static accessMyPrivates() {
+ var value;
+ value = 0;
+ try {
+ value = _myPrecious;
+ } catch (e) {
+ value = -1;
+ }
+ Expect.equals("A Ring", value);
+ }
+
+ static accessMyLibPrivates() {
+ var value;
+ value = 0;
+ var the_other = new PrivateOther();
+ try {
+ value = the_other._myPrecious;
+ } catch (e, trace) {
+ print(e);
+ print(trace);
+ Expect.equals(true, e is NoSuchMethodError);
+ value = -1;
+ }
+ Expect.equals("Another Ring", value);
+ }
+
+ static accessOtherLibPrivates() {
+ var value;
+ value = 0;
+ var the_other = new PrivateLib();
+ try {
+ value = (the_other as dynamic)._myPrecious;
+ } catch (e, trace) {
+ print(e);
+ print(trace);
+ Expect.equals(true, e is NoSuchMethodError);
+ value = -1;
+ }
+ Expect.equals(-1, value);
+ }
+
+ static main() {
+ accessMyPrivates();
+ accessMyLibPrivates();
+ accessOtherLibPrivates();
+ }
+}
diff --git a/tests/language/private/member1_lib.dart b/tests/language/private/member1_lib.dart
new file mode 100644
index 0000000..8afc255
--- /dev/null
+++ b/tests/language/private/member1_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2019, 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 'member1_test.dart';
+
+class B extends A {
+ bool _instanceField = false;
+}
diff --git a/tests/language/private/member1_test.dart b/tests/language/private/member1_test.dart
new file mode 100644
index 0000000..a542e48
--- /dev/null
+++ b/tests/language/private/member1_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2019, 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 'member1_lib.dart';
+
+class A {}
+
+class Test extends B {
+ test() {
+ _instanceField = true;
+// ^^^^^^^^^^^^^^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] The setter '_instanceField' isn't defined for the class 'Test'.
+ }
+}
+
+void main() {
+ Test().test();
+}
diff --git a/tests/language/private/member2_lib.dart b/tests/language/private/member2_lib.dart
new file mode 100644
index 0000000..c2a9ead
--- /dev/null
+++ b/tests/language/private/member2_lib.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2019, 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 'member2_test.dart';
+
+class B extends A {
+ static bool _staticField = false;
+}
diff --git a/tests/language/private/member2_test.dart b/tests/language/private/member2_test.dart
new file mode 100644
index 0000000..7c86d12
--- /dev/null
+++ b/tests/language/private/member2_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2019, 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 'member2_lib.dart';
+
+class A {}
+
+class Test extends B {
+ test() {
+ _staticField = true;
+// ^^^^^^^^^^^^
+// [analyzer] STATIC_WARNING.UNDEFINED_IDENTIFIER
+// [cfe] The setter '_staticField' isn't defined for the class 'Test'.
+ }
+}
+
+void main() {
+ Test().test();
+}
diff --git a/tests/language/private/member3_lib.dart b/tests/language/private/member3_lib.dart
new file mode 100644
index 0000000..c51338a
--- /dev/null
+++ b/tests/language/private/member3_lib.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2019, 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 'member3_test.dart';
+
+class B extends A {
+ bool _fun() {
+ return true;
+ }
+}
diff --git a/tests/language/private/member3_test.dart b/tests/language/private/member3_test.dart
new file mode 100644
index 0000000..eba3211
--- /dev/null
+++ b/tests/language/private/member3_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2019, 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 'member3_lib.dart';
+
+class A {}
+
+class Test extends B {
+ test() {
+ _fun();
+// ^^^^
+// [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
+// [cfe] The method '_fun' isn't defined for the class 'Test'.
+ }
+}
+
+void main() {
+ Test().test();
+}
diff --git a/tests/language/private/member_lib_b.dart b/tests/language/private/member_lib_b.dart
new file mode 100644
index 0000000..8a67676
--- /dev/null
+++ b/tests/language/private/member_lib_b.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2011, 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 PrivateMemberLibB;
+
+import 'member_test.dart';
+
+class B extends A {
+ bool _instanceField = false;
+ static bool _staticField = false;
+ bool _fun1(bool b) {
+ return true;
+ }
+
+ void _fun2() {}
+}
diff --git a/tests/language/private/member_test.dart b/tests/language/private/member_test.dart
new file mode 100644
index 0000000..d0c6b50
--- /dev/null
+++ b/tests/language/private/member_test.dart
@@ -0,0 +1,31 @@
+// 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.
+
+library PrivateMemberLibA;
+
+import 'member_lib_b.dart';
+
+class A {
+ int i = -1;
+ int _instanceField = -1;
+ static int _staticField = -1;
+ int _fun1() {
+ return 1;
+ }
+
+ void _fun2(int i) {}
+}
+
+class Test extends B {
+ test() {
+ i = _instanceField;
+ i = A._staticField;
+ i = _fun1();
+ _fun2(42);
+ }
+}
+
+void main() {
+ new Test().test();
+}
diff --git a/tests/language/private/method_tearoff_lib.dart b/tests/language/private/method_tearoff_lib.dart
new file mode 100644
index 0000000..344a3c6
--- /dev/null
+++ b/tests/language/private/method_tearoff_lib.dart
@@ -0,0 +1,13 @@
+// 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.
+
+// Companion library for private_method_tearoff_test.dart.
+
+class Bar {
+ void _f() {}
+}
+
+String baz(Bar bar) {
+ return bar._f.runtimeType.toString();
+}
diff --git a/tests/language/private/method_tearoff_test.dart b/tests/language/private/method_tearoff_test.dart
new file mode 100644
index 0000000..84f6bd7
--- /dev/null
+++ b/tests/language/private/method_tearoff_test.dart
@@ -0,0 +1,19 @@
+// 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 'method_tearoff_lib.dart';
+
+// `Bar' contains a private method `_f'. The function `baz' is declared in the
+// same library as `Bar'. Given an subtype of `Bar', it tearoffs `_f' and
+// returns a string representation of its runtime type. For this code to
+// evaluate correctly, the generated Kernel code for `Foo' must contain a no
+// such method forwarder for `_f'.
+
+class Foo implements Bar {}
+
+main() {
+ Expect.equals("() => void", baz(new Foo()));
+}
diff --git a/tests/language/private/mixin2_test.dart b/tests/language/private/mixin2_test.dart
new file mode 100644
index 0000000..848f838
--- /dev/null
+++ b/tests/language/private/mixin2_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2013, 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 for testing access to private fields on mixins.
+
+library private_mixin2;
+
+import 'package:expect/expect.dart';
+import 'other_mixin2.dart';
+
+void main() {
+ var c1;
+ c1 = new C1();
+ Expect.throwsNoSuchMethodError(() => c1._field);
+ Expect.throwsNoSuchMethodError(() => c1.field);
+
+ var c2;
+ c2 = new C2();
+ Expect.throwsNoSuchMethodError(() => c2._field);
+ Expect.equals(42, c2.field);
+}
diff --git a/tests/language/private/mixin_exception_throw_test.dart b/tests/language/private/mixin_exception_throw_test.dart
new file mode 100644
index 0000000..96570d7
--- /dev/null
+++ b/tests/language/private/mixin_exception_throw_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for http://dartbug.com/11637
+
+class _C {}
+
+class _E {
+ throwIt() => throw "it";
+}
+
+class _F {
+ throwIt() => throw "IT";
+}
+
+class _D extends _C with _E, _F {}
+
+main() {
+ var d = new _D();
+ try {
+ d.throwIt();
+ } catch (e, s) {
+ print("Exception: $e");
+ print("Stacktrace:\n$s");
+ }
+}
diff --git a/tests/language/private/other.dart b/tests/language/private/other.dart
new file mode 100644
index 0000000..88c3e28
--- /dev/null
+++ b/tests/language/private/other.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2011, 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 for testing access to private fields.
+
+part of Private3Test.dart;
+
+class PrivateOther {
+ final _myPrecious;
+
+ const PrivateOther() : this._myPrecious = "Another Ring";
+}
diff --git a/tests/language/private/other_lib.dart b/tests/language/private/other_lib.dart
new file mode 100644
index 0000000..0bcbb41
--- /dev/null
+++ b/tests/language/private/other_lib.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2011, 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 for testing access to private fields.
+library PrivateOther;
+
+import "private_test.dart";
+
+class LibOther3 {
+ static accessFieldA3(var a) => a.fieldA;
+ static accessFieldB3(var b) => b._fieldB;
+ static int c_field1b(c) => c._field1;
+ static int c_field2b(c) => c._field2;
+}
+
+class AImported extends AExposed {
+ AImported() : super();
+ getFieldA() => fieldA;
+}
+
+class C2 extends C1 {
+ int _field1;
+ C2()
+ : _field1 = 99,
+ super();
+
+ field1b() => _field1;
+}
+
+class C4 extends C3 {
+ int _field2;
+ C4()
+ : _field2 = 1024,
+ super();
+
+ field2b() => _field2;
+ field1d() => _field1;
+}
diff --git a/tests/language/private/other_library.dart b/tests/language/private/other_library.dart
new file mode 100644
index 0000000..f831462
--- /dev/null
+++ b/tests/language/private/other_library.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2013, 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 that inlining in the compiler works with privacy.
+
+library other_library;
+
+// Make [foo] small enough that is can be inlined. Make it call a
+// private method.
+foo(a) => a._bar();
+
+class A {
+ _bar() => 42;
+}
diff --git a/tests/language/private/other_mixin2.dart b/tests/language/private/other_mixin2.dart
new file mode 100644
index 0000000..a263279
--- /dev/null
+++ b/tests/language/private/other_mixin2.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2013, 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 for testing access to private fields on mixins.
+
+library private_mixin2_other;
+
+class C1 {
+ int _field = 42;
+}
+
+class C2 extends Object with C1 {
+ int get field => _field;
+}
diff --git a/tests/language/private/private1.dart b/tests/language/private/private1.dart
new file mode 100644
index 0000000..7bf3de3
--- /dev/null
+++ b/tests/language/private/private1.dart
@@ -0,0 +1,101 @@
+// 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.
+
+// Dart test for testing access to private fields.
+
+part of PrivateTest.dart;
+
+main() {
+ testPrivateTopLevel();
+ testPrivateClasses();
+}
+
+void expectCatch(f) {
+ bool threw = false;
+ try {
+ f();
+ } catch (e) {
+ threw = true;
+ }
+ Expect.equals(true, threw);
+}
+
+String _private1() => "private1";
+const String _private1Field = "private1Field";
+
+void testPrivateTopLevel() {
+ Expect.equals("private1", _private1());
+ Expect.equals("private2", _private2());
+ Expect.equals("private1Field", _private1Field);
+ Expect.equals("private2Field", _private2Field);
+}
+
+class _A {
+ _A() : fieldA = 499;
+
+ int fieldA;
+}
+
+class AExposed extends _A {
+ AExposed() : super();
+}
+
+class B {
+ int _fieldB;
+ B() : _fieldB = 42;
+}
+
+class C1 {
+ int _field1;
+ C1() : _field1 = 499;
+
+ field1a() => _field1;
+}
+
+class C3 extends C2 {
+ int _field2;
+ C3()
+ : _field2 = 42,
+ super();
+
+ field2a() => _field2;
+ field1c() => _field1;
+}
+
+int c_field1a(c) => c._field1;
+int c_field2a(c) => c._field2;
+
+int _field1FromNewC4() => new C4()._field1;
+int _field2FromNewC4() => new C4()._field2;
+
+void testPrivateClasses() {
+ _A a = new _A();
+ Expect.equals(499, a.fieldA);
+ Expect.equals(499, accessFieldA2(a));
+ Expect.equals(499, LibOther3.accessFieldA3(a));
+
+ var a2 = new AImported();
+ Expect.equals(499, a2.getFieldA());
+
+ B b = new B();
+ Expect.equals(42, b._fieldB);
+ Expect.equals(42, accessFieldB2(b));
+ expectCatch(() => LibOther3.accessFieldB3(b));
+
+ C4 c = new C4();
+ Expect.equals(499, c._field1);
+ Expect.equals(499, c_field1a(c));
+ Expect.equals(499, c.field1a());
+ Expect.equals(42, c._field2);
+ Expect.equals(42, c_field2a(c));
+ Expect.equals(42, c.field2a());
+ Expect.equals(99, LibOther3.c_field1b(c));
+ Expect.equals(99, c.field1b());
+ Expect.equals(1024, LibOther3.c_field2b(c));
+ Expect.equals(1024, c.field2b());
+ Expect.equals(499, c.field1c());
+ Expect.equals(99, c.field1d());
+ Expect.equals(499, _field1FromNewC4());
+ Expect.equals(42, _field2FromNewC4());
+}
diff --git a/tests/language/private/private2.dart b/tests/language/private/private2.dart
new file mode 100644
index 0000000..0dd65ac
--- /dev/null
+++ b/tests/language/private/private2.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2011, 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 for testing access to private fields.
+
+part of PrivateTest.dart;
+
+String _private2() {
+ return "private2";
+}
+
+const String _private2Field = "private2Field";
+
+accessFieldA2(_A a) {
+ return a.fieldA;
+}
+
+accessFieldB2(B b) {
+ return b._fieldB;
+}
diff --git a/tests/language/private/private2_lib.dart b/tests/language/private/private2_lib.dart
new file mode 100644
index 0000000..4e1fcee
--- /dev/null
+++ b/tests/language/private/private2_lib.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2011, 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 for testing access to private fields across class hierarchies.
+
+library Private2Lib;
+
+import "private2_test.dart";
+
+class B extends A {
+ B() : super();
+}
diff --git a/tests/language/private/private2_main.dart b/tests/language/private/private2_main.dart
new file mode 100644
index 0000000..d074dad
--- /dev/null
+++ b/tests/language/private/private2_main.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2011, 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 for testing access to private fields across class hierarchies.
+
+part of Private2Test;
+
+class A {
+ var _f;
+ var g;
+ A()
+ : _f = 42,
+ g = 43;
+}
+
+class C extends B {
+ C() : super();
+}
+
+main() {
+ var a = new A();
+ print(a.g);
+ print(a._f);
+ var o = new C();
+ print(o.g); // Access to public field in A.
+ print(o._f); // Access to private field in A is allowed.
+}
diff --git a/tests/language/private/private2_test.dart b/tests/language/private/private2_test.dart
new file mode 100644
index 0000000..368cb42
--- /dev/null
+++ b/tests/language/private/private2_test.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2011, 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 for testing access to private fields across class hierarchies.
+
+library Private2Test;
+
+import "private2_lib.dart";
+part "private2_main.dart";
diff --git a/tests/language/private/private3_test.dart b/tests/language/private/private3_test.dart
new file mode 100644
index 0000000..d0e0c78
--- /dev/null
+++ b/tests/language/private/private3_test.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2011, 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 for testing access to private fields.
+
+library Private3Test.dart;
+
+import "package:expect/expect.dart";
+import "lib.dart";
+
+part "main.dart";
+part "other.dart";
diff --git a/tests/language/private/private4_test.dart b/tests/language/private/private4_test.dart
new file mode 100644
index 0000000..ff5aec6
--- /dev/null
+++ b/tests/language/private/private4_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2013, 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 that inlining in the compiler works with privacy.
+
+library private4_test;
+
+import "package:expect/expect.dart";
+import 'other_library.dart';
+
+main() {
+ Expect.equals(42, foo(new A()));
+ Expect.throwsNoSuchMethodError(() => foo(new B()));
+}
+
+class B {
+ _bar() => 42;
+}
diff --git a/tests/language/private/private_test.dart b/tests/language/private/private_test.dart
new file mode 100644
index 0000000..e6ff096
--- /dev/null
+++ b/tests/language/private/private_test.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2011, 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 for testing access to private fields.
+
+library PrivateTest.dart;
+
+import "package:expect/expect.dart";
+import "other_lib.dart";
+part "private1.dart";
+part "private2.dart";
diff --git a/tests/language/private/selector_lib.dart b/tests/language/private/selector_lib.dart
new file mode 100644
index 0000000..0ca9560a
--- /dev/null
+++ b/tests/language/private/selector_lib.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2013, 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 private_selector_lib;
+
+import 'selector_test.dart';
+
+bool executed = false;
+
+class A {
+ public() {
+ new B()._private();
+ }
+
+ _private() {
+ executed = true;
+ }
+}
diff --git a/tests/language/private/selector_test.dart b/tests/language/private/selector_test.dart
new file mode 100644
index 0000000..8855f23
--- /dev/null
+++ b/tests/language/private/selector_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2013, 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 private_selector_test;
+
+import "package:expect/expect.dart";
+import 'selector_lib.dart';
+
+class B extends A {}
+
+main() {
+ new A().public();
+ Expect.isTrue(executed);
+}
diff --git a/tests/language/private/super_constructor_lib.dart b/tests/language/private/super_constructor_lib.dart
new file mode 100644
index 0000000..04b73d3
--- /dev/null
+++ b/tests/language/private/super_constructor_lib.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2015, 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 private_super_constructor_lib;
+
+class B {
+ B();
+ B._foo();
+}
diff --git a/tests/language/private/super_constructor_runtime_test.dart b/tests/language/private/super_constructor_runtime_test.dart
new file mode 100644
index 0000000..3b82c7d
--- /dev/null
+++ b/tests/language/private/super_constructor_runtime_test.dart
@@ -0,0 +1,16 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2015, 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 private_super_constructor_test;
+
+import 'super_constructor_lib.dart';
+
+class C extends B {
+
+}
+
+main() => new C();
diff --git a/tests/language/private/super_constructor_test.dart b/tests/language/private/super_constructor_test.dart
new file mode 100644
index 0000000..03ad4f3
--- /dev/null
+++ b/tests/language/private/super_constructor_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2015, 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 private_super_constructor_test;
+
+import 'super_constructor_lib.dart';
+
+class C extends B {
+ C() : super._foo();
+ // ^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER
+ // [cfe] Superclass has no constructor named 'B._foo'.
+}
+
+main() => new C();
diff --git a/tests/language/propagate/argument_type_check_test.dart b/tests/language/propagate/argument_type_check_test.dart
new file mode 100644
index 0000000..8962cb4
--- /dev/null
+++ b/tests/language/propagate/argument_type_check_test.dart
@@ -0,0 +1,27 @@
+// 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.
+
+import "package:expect/expect.dart";
+
+main() {
+ Expect.equals("str", foo("str"));
+}
+
+foo(y) {
+ dynamic x = 3;
+ for (int i = 0; i < 2; i++) {
+ // Make sure that we don't think that the type of x is necessarily
+ // a number and optimize the x + y expression based on that. The
+ // value of x changes later...
+ if (i == 1) return bar(x + y);
+ x = new A();
+ }
+}
+
+bar(t) => t;
+
+class A {
+ A() {}
+ operator +(x) => x;
+}
diff --git a/tests/language/propagate/assert_assignable_test.dart b/tests/language/propagate/assert_assignable_test.dart
new file mode 100644
index 0000000..1e34119
--- /dev/null
+++ b/tests/language/propagate/assert_assignable_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2013, 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.
+// Check that type of the AssertAssignable is recomputed correctly.
+// VMOptions=--optimization-counter-threshold=10 --no-use-osr
+
+import "package:expect/expect.dart";
+
+class A {
+ final p;
+ final _b;
+
+ b() {
+ try {
+ return _b;
+ } catch (e) {}
+ }
+
+ A(this.p, this._b);
+}
+
+class B extends A {
+ B(p, b) : super(p, b);
+}
+
+bar(v) {
+ for (var x = v; x != null; x = x.p) {
+ if (x.b()) {
+ return x;
+ }
+ }
+ return null;
+}
+
+foo(v) {
+ A x = bar(v);
+ return x != null;
+}
+
+main() {
+ final a = new A(new B(new A("haha", true), false), false);
+
+ for (var i = 0; i < 20; i++) {
+ Expect.isTrue(foo(a));
+ }
+ Expect.isTrue(foo(a));
+}
diff --git a/tests/language/propagate/in_for_update_test.dart b/tests/language/propagate/in_for_update_test.dart
new file mode 100644
index 0000000..058518e
--- /dev/null
+++ b/tests/language/propagate/in_for_update_test.dart
@@ -0,0 +1,28 @@
+// 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.
+// Check that phi type computation in the Dart2Js compiler does the
+// correct thing.
+
+import "package:expect/expect.dart";
+
+bar() => 'foo';
+
+main() {
+ Expect.throws(foo1);
+ Expect.throws(foo2);
+}
+
+foo1() {
+ var a = bar();
+ for (;; a = 1 + a) {
+ if (a != 'foo') return;
+ }
+}
+
+foo2() {
+ var a = bar();
+ for (;; a = 1 + a) {
+ if (a != 'foo') break;
+ }
+}
diff --git a/tests/language/propagate/past_constant_test.dart b/tests/language/propagate/past_constant_test.dart
new file mode 100644
index 0000000..095e706
--- /dev/null
+++ b/tests/language/propagate/past_constant_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2015, 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';
+
+foo(x) => x;
+
+check(y) {
+ Expect.equals('foo', y);
+}
+
+main() {
+ var x = foo('foo');
+ var y = foo(x);
+ x = 'constant';
+ check(
+ y); // 'y' should not propagate here unless reference to 'x' is rewritten
+ foo(x);
+ foo(x);
+}
diff --git a/tests/language/propagate/phi_test.dart b/tests/language/propagate/phi_test.dart
new file mode 100644
index 0000000..4c8e3e2
--- /dev/null
+++ b/tests/language/propagate/phi_test.dart
@@ -0,0 +1,23 @@
+// 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.
+// Check that phi type computation in the Dart2Js compiler does the
+// correct thing.
+
+import "package:expect/expect.dart";
+
+bar() => 490;
+bar2() => 0;
+
+foo(b) {
+ var x = bar();
+ var x2 = x;
+ if (b) x2 = bar2();
+ var x3 = 9 + x; // Guarantees that x is a number. Dart2js propagated the
+ // type information back to the phi (for x2).
+ return x2 + x3;
+}
+
+main() {
+ Expect.equals(499, foo(true));
+}
diff --git a/tests/language/propagate/propagate2_test.dart b/tests/language/propagate/propagate2_test.dart
new file mode 100644
index 0000000..a09041b9
--- /dev/null
+++ b/tests/language/propagate/propagate2_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to infinite loop on
+// speculatively propagating types.
+
+class Bar {
+ noSuchMethod(e) => null;
+}
+
+main() {
+ var d = new Bar();
+
+ while (false) {
+ // [input] will change from indexable to unknown: the use line 20
+ // changes its decision because [a2] changes its type from unknown to
+ // null.
+ var input = ((x) {})(null);
+ var p2 = input.keys.firstWhere(null);
+ var a2 = input.keys.firstWhere(null);
+ print(input[a2] == p2);
+ }
+}
diff --git a/tests/language/propagate/propagate3_test.dart b/tests/language/propagate/propagate3_test.dart
new file mode 100644
index 0000000..2848f9b
--- /dev/null
+++ b/tests/language/propagate/propagate3_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2013, 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.
+
+// Regression test for dart2js that used to generate wrong code for
+// it. The bug happened in the SSA type propagation.
+
+class A {
+ next() => new B();
+ doIt() => null;
+ bool get isEmpty => false;
+ foo() => 42;
+ bar() => 54;
+}
+
+bool entered = false;
+
+class B extends A {
+ foo() => 54;
+ doIt() => new A();
+ bool get isEmpty => true;
+ bar() => entered = true;
+}
+
+// (1) At initialization phase of the type propagation, [a] would be
+// marked as [exact A].
+// (2) Will make the loop phi [b] typed [null, exact A].
+// (3) Will create a [HTypeKnown] [exact A] for [b].
+// (4) Will create a [HTypeKnown] [exact A] for [b] and update users
+// of [b] to use this [HTypeKnown] instead.
+// (5) [a] will be updated to [subclass A].
+// (6) Will change the [HTypeKnown] of [b] from [exact A] to [subclass A].
+// (7) Receiver is [subclass A] and it will refine it to
+// [subclass A]. We used to wrongly assume there was
+// no need to update the [HTypeKnown] created in (3).
+// (8) Consider that bar is called on an [exact A] (the [HTypeKnown]
+// created in (3)) and remove the call because it does not have
+// any side effects.
+
+main() {
+ var a = new A();
+ for (var i in [42]) {
+ a = a.next();
+ }
+
+ // (1, 5)
+
+ var b = a;
+ while (b.isEmpty) {
+ // (4, 6)
+ b.foo(); // (3, 7)
+ b.bar(); // (8)
+ b = b.doIt(); // (2)
+ }
+
+ if (!entered) throw 'Test failed';
+}
diff --git a/tests/language/propagate/type_propagation_test.dart b/tests/language/propagate/type_propagation_test.dart
new file mode 100644
index 0000000..53501f1
--- /dev/null
+++ b/tests/language/propagate/type_propagation_test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2013, 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.
+
+// dart2js used to have an infinite loop in its type propagation
+// algorithm due to types becoming broader instead of narrower.
+
+import "package:expect/expect.dart";
+
+class A {
+ resolveSend(node) {
+ if (node == null) {
+ return [new B()][0];
+ } else {
+ return [new B(), new A()][1];
+ }
+ }
+
+ visitSend(node) {
+ var target = resolveSend(node);
+
+ if (false) {
+ if (false) {
+ target = target.getter;
+ if (false) {
+ target = new Object();
+ }
+ }
+ }
+ return true ? target : null;
+ }
+}
+
+var a = 43;
+
+class B {
+ var getter = a == 42 ? new A() : null;
+}
+
+main() {
+ Expect.isTrue(new A().visitSend(new A()) is A);
+ Expect.isTrue(new A().visitSend(null) is B);
+}
diff --git a/tests/language/redirecting/constructor_initializer_test.dart b/tests/language/redirecting/constructor_initializer_test.dart
new file mode 100644
index 0000000..6a2f451
--- /dev/null
+++ b/tests/language/redirecting/constructor_initializer_test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2015, 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";
+
+var string = '';
+
+append(x) {
+ string += x;
+ return x;
+}
+
+class A {
+ var x = append('x');
+ var y;
+ var z;
+
+ // Should append y but not yet x.
+ A() : this.foo(append('y'));
+
+ // Append x and z.
+ A.foo(this.y) : z = append('z');
+}
+
+class B extends A {
+ var w;
+
+ // Call the redirecting constructor using super.
+ B()
+ : w = append('w'),
+ super();
+}
+
+main() {
+ string = '';
+ new A();
+ Expect.equals('yxz', string);
+
+ string = '';
+ new B();
+ Expect.equals('wyxz', string);
+}
diff --git a/tests/language/redirecting/factory_bounds_test.dart b/tests/language/redirecting/factory_bounds_test.dart
new file mode 100644
index 0000000..694062e
--- /dev/null
+++ b/tests/language/redirecting/factory_bounds_test.dart
@@ -0,0 +1,50 @@
+// 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.
+
+// Bounds checking on redirecting factories.
+
+class Foo<T> {}
+
+class Baz<T> {}
+
+class Foobar<T> implements Foo<T> {}
+
+class Bar<
+ T // A comment to prevent dartfmt from joining the lines.
+ extends Foo<T> //# 00: ok
+ extends Baz<Foo<T>> //# 01: compile-time error
+ extends Foobar<T> //# 02: compile-time error
+ > {
+ Bar.named();
+ factory Bar() = Qux<T>;
+}
+
+class Qux<
+ T // A comment to prevent dartfmt from joining the lines.
+ extends Foo<T> //# 00: continued
+ extends Foo<T> //# 01: continued
+ extends Foo<T> //# 02: continued
+ > extends Bar<T> {
+ Qux() : super.named();
+}
+
+
+
+class A<T extends int> {
+ factory A() = B<
+ T // A comment to prevent dartfmt from joining the lines.
+ , int //# 03: compile-time error
+ , String //# 04: ok
+ >;
+}
+
+class B<T extends int
+ , S extends String //# 03: continued
+ , S extends String //# 04: continued
+ > implements A<T> {}
+
+void main() {
+ new Bar<Never>();
+ new A<int>();
+}
diff --git a/tests/language/redirecting/factory_default_values_runtime_test.dart b/tests/language/redirecting/factory_default_values_runtime_test.dart
new file mode 100644
index 0000000..a17a7d6
--- /dev/null
+++ b/tests/language/redirecting/factory_default_values_runtime_test.dart
@@ -0,0 +1,28 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2013, 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 that parameter default values are disallowed in a redirecting factory.
+
+import "package:expect/expect.dart";
+
+class A {
+ A(this.a, [this.b = 0]);
+ factory A.f(int a) = A;
+
+
+
+ int a;
+ int b;
+}
+
+main() {
+ var x = new A.f(42);
+ Expect.equals(x.a, 42);
+ Expect.equals(x.b, 0);
+
+
+}
diff --git a/tests/language/redirecting/factory_default_values_test.dart b/tests/language/redirecting/factory_default_values_test.dart
new file mode 100644
index 0000000..0b24876
--- /dev/null
+++ b/tests/language/redirecting/factory_default_values_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2013, 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 that parameter default values are disallowed in a redirecting factory.
+
+import "package:expect/expect.dart";
+
+class A {
+ A(this.a, [this.b = 0]);
+ factory A.f(int a) = A;
+ factory A.g(int a, [int b = 0]) = A;
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR
+ // ^
+ // [cfe] Can't have a default value here because any default values of 'A' would be used instead.
+ factory A.h(int a, {int b: 0}) = A;
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR
+ // ^
+ // [cfe] Can't have a default value here because any default values of 'A' would be used instead.
+ // ^
+ // [analyzer] STATIC_WARNING.REDIRECT_TO_INVALID_FUNCTION_TYPE
+ // [cfe] The constructor function type 'A Function(int, [int])' isn't a subtype of 'A Function(int, {int b})'.
+
+ int a;
+ int b;
+}
+
+main() {
+ var x = new A.f(42);
+ Expect.equals(x.a, 42);
+ Expect.equals(x.b, 0);
+
+ var y = new A.f(42, 43);
+ // ^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS
+ // [cfe] Too many positional arguments: 1 allowed, but 2 found.
+}
diff --git a/tests/language/redirecting/factory_incompatible_signature_runtime_test.dart b/tests/language/redirecting/factory_incompatible_signature_runtime_test.dart
new file mode 100644
index 0000000..b565714
--- /dev/null
+++ b/tests/language/redirecting/factory_incompatible_signature_runtime_test.dart
@@ -0,0 +1,20 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2013, 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 that incompatible signatures in a forwarding factory
+// constructor leads to a compile-time error.
+
+import "package:expect/expect.dart";
+
+class A {
+ A(a, b);
+
+}
+
+main() {
+
+}
diff --git a/tests/language/redirecting/factory_incompatible_signature_test.dart b/tests/language/redirecting/factory_incompatible_signature_test.dart
new file mode 100644
index 0000000..7a77f18
--- /dev/null
+++ b/tests/language/redirecting/factory_incompatible_signature_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2013, 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 that incompatible signatures in a forwarding factory
+// constructor leads to a compile-time error.
+
+import "package:expect/expect.dart";
+
+class A {
+ A(a, b);
+ factory A.f() = A;
+ // ^
+ // [analyzer] STATIC_WARNING.REDIRECT_TO_INVALID_FUNCTION_TYPE
+ // [cfe] The constructor function type 'A Function(dynamic, dynamic)' isn't a subtype of 'A Function()'.
+}
+
+main() {
+ new A.f();
+}
diff --git a/tests/language/redirecting/factory_infinite_steps_test.dart b/tests/language/redirecting/factory_infinite_steps_test.dart
new file mode 100644
index 0000000..d70a86f
--- /dev/null
+++ b/tests/language/redirecting/factory_infinite_steps_test.dart
@@ -0,0 +1,25 @@
+// 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.
+
+// From Dart Language Specification, 0.12 M1, "7.6.2 Factories": It is
+// a compile-time error if a redirecting factory constructor does not
+// redirect to a non-redirecting factory constructor or to a
+// generative constructor in a finite number of steps.
+
+// TODO(ahe): The above specification will probably change to
+// something like: "It is a compile-time error if a redirecting
+// factory constructor redirects to itself, either directly or
+// indirectly via a sequence of redirections."
+
+class Foo extends Bar {
+ factory Foo() = Bar; //# 01: compile-time error
+}
+
+class Bar {
+ factory Bar() = Foo; //# 02: compile-time error
+}
+
+main() {
+ new Foo();
+}
diff --git a/tests/language/redirecting/factory_long_test.dart b/tests/language/redirecting/factory_long_test.dart
new file mode 100644
index 0000000..5066dc7
--- /dev/null
+++ b/tests/language/redirecting/factory_long_test.dart
@@ -0,0 +1,81 @@
+// Copyright (c) 2013, 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 long substitution of long redirection chains.
+
+import 'package:expect/expect.dart';
+
+class C {
+ const factory C() = D<int>;
+}
+
+class D<T> implements C {
+ const factory D() = E<double, T>;
+}
+
+class E<S, T> implements D<T> {
+ final field = 42;
+ const E();
+}
+
+class X<T> {
+ const factory X() = Y<T>;
+}
+
+class X1<T1> {
+ const factory X1() = Y<T1>;
+}
+
+class X2 {
+ const factory X2() = Y<int>;
+}
+
+class Y<S> implements X<S>, X1<S>, X2 {
+ const factory Y() = Y1<S>;
+}
+
+class Y1<U> implements Y<U> {
+ const factory Y1() = Z<U>;
+}
+
+class Z<V> implements Y1<V> {
+ final field = 87;
+ const Z();
+}
+
+void main() {
+ testC(new C());
+ testC(const C());
+ testZ(new X<int>());
+ testZ(new X1<int>());
+ testZ(new X2());
+ testZ(const X<int>());
+ testZ(const X1<int>());
+ testZ(const X2());
+}
+
+void testC(var c) {
+ Expect.isTrue(c is C);
+ Expect.isTrue(c is D<int>);
+ Expect.isTrue(c is! D<String>);
+ Expect.isTrue(c is E<double, int>);
+ Expect.isTrue(c is! E<String, int>);
+ Expect.isTrue(c is! E<double, String>);
+ Expect.equals(42, c.field);
+}
+
+void testZ(var z) {
+ Expect.isTrue(z is X<int>);
+ Expect.isTrue(z is! X<String>);
+ Expect.isTrue(z is X1<int>);
+ Expect.isTrue(z is! X1<String>);
+ Expect.isTrue(z is X2);
+ Expect.isTrue(z is Y<int>);
+ Expect.isTrue(z is! Y<String>);
+ Expect.isTrue(z is Y1<int>);
+ Expect.isTrue(z is! Y1<String>);
+ Expect.isTrue(z is Z<int>);
+ Expect.isTrue(z is! Z<String>);
+ Expect.equals(87, z.field);
+}
diff --git a/tests/language/redirecting/factory_malbounded_runtime_test.dart b/tests/language/redirecting/factory_malbounded_runtime_test.dart
new file mode 100644
index 0000000..8cfc36b
--- /dev/null
+++ b/tests/language/redirecting/factory_malbounded_runtime_test.dart
@@ -0,0 +1,26 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2013, 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 Foo<T> {
+ factory Foo() = Bar<T>;
+ Foo.create() {}
+}
+
+class Bar<
+ T
+
+ > extends Foo<T> {
+ factory Bar() {
+ return new Bar<T>.create();
+ }
+
+ Bar.create() : super.create() {}
+}
+
+main() {
+ new Foo<String>();
+}
diff --git a/tests/language/redirecting/factory_malbounded_test.dart b/tests/language/redirecting/factory_malbounded_test.dart
new file mode 100644
index 0000000..29dd27875
--- /dev/null
+++ b/tests/language/redirecting/factory_malbounded_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2013, 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 Foo<T> {
+ factory Foo() = Bar<T>;
+ // ^
+ // [cfe] The type 'T' doesn't extend 'num'.
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
+ Foo.create() {}
+}
+
+class Bar<
+ T
+ extends num
+ > extends Foo<T> {
+ factory Bar() {
+ return new Bar<T>.create();
+ }
+
+ Bar.create() : super.create() {}
+}
+
+main() {
+ new Foo<String>();
+ // ^
+ // [cfe] Type argument 'String' doesn't conform to the bound 'num' of the type variable 'T' on 'Bar'.
+}
diff --git a/tests/language/redirecting/factory_upcast_test.dart b/tests/language/redirecting/factory_upcast_test.dart
new file mode 100644
index 0000000..ff3ad11
--- /dev/null
+++ b/tests/language/redirecting/factory_upcast_test.dart
@@ -0,0 +1,16 @@
+// 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 implements B {
+ var x;
+ A(Object this.x);
+}
+
+class B {
+ factory B(String s) = A;
+}
+
+main() {
+ B(42 as dynamic); //# 01: runtime error
+}
diff --git a/tests/standalone/io/file_copy_test.dart b/tests/standalone/io/file_copy_test.dart
index 2302a4a..8176d93 100644
--- a/tests/standalone/io/file_copy_test.dart
+++ b/tests/standalone/io/file_copy_test.dart
@@ -30,6 +30,14 @@
Expect.equals(FILE_CONTENT2, file1.readAsStringSync());
Expect.equals(FILE_CONTENT2, file2.readAsStringSync());
+ // Check there is no temporary files existing.
+ var list = tmp.listSync();
+ Expect.equals(2, list.length);
+ for (var file in list) {
+ final fileName = file.path.toString();
+ Expect.isTrue(fileName.contains("file1") || fileName.contains("file2"));
+ }
+
// Fail when coping to directory.
var dir = new Directory('${tmp.path}/dir')..createSync();
Expect.throws(() => file1.copySync(dir.path));
diff --git a/tests/standalone/io/unix_socket_test.dart b/tests/standalone/io/unix_socket_test.dart
index 7f91a9c..0193a5c 100644
--- a/tests/standalone/io/unix_socket_test.dart
+++ b/tests/standalone/io/unix_socket_test.dart
@@ -163,6 +163,23 @@
await completer.future;
}
+Future testExistingFile(String name) async {
+ // Test that a leftover file(In case of previous process being killed and
+ // finalizer doesn't clean up the file) will be cleaned up and bind() should
+ // be able to bind to the socket.
+ var address = InternetAddress('$name/sock', type: InternetAddressType.unix);
+ // Create a file with the same name
+ File(address.address).createSync();
+ try {
+ ServerSocket server = await ServerSocket.bind(address, 0);
+ server.close();
+ } catch (e) {
+ Expect.type<SocketException>(e);
+ return;
+ }
+ Expect.fail("bind should fail with existing file");
+}
+
// Create socket in temp directory
Future withTempDir(String prefix, Future<void> test(Directory dir)) async {
var tempDir = Directory.systemTemp.createTempSync(prefix);
@@ -191,9 +208,12 @@
await testSourceAddressConnect('${dir.path}');
});
await testAbstractAddress();
+ await withTempDir('unix_socket_test', (Directory dir) async {
+ await testExistingFile('${dir.path}');
+ });
} catch (e) {
if (Platform.isMacOS || Platform.isLinux || Platform.isAndroid) {
- Expect.fail("Unexpected exceptions are thrown");
+ Expect.fail("Unexpected exception $e is thrown");
} else {
Expect.isTrue(e is SocketException);
}
diff --git a/tests/standalone_2/io/file_copy_test.dart b/tests/standalone_2/io/file_copy_test.dart
index 2302a4a..8176d93 100644
--- a/tests/standalone_2/io/file_copy_test.dart
+++ b/tests/standalone_2/io/file_copy_test.dart
@@ -30,6 +30,14 @@
Expect.equals(FILE_CONTENT2, file1.readAsStringSync());
Expect.equals(FILE_CONTENT2, file2.readAsStringSync());
+ // Check there is no temporary files existing.
+ var list = tmp.listSync();
+ Expect.equals(2, list.length);
+ for (var file in list) {
+ final fileName = file.path.toString();
+ Expect.isTrue(fileName.contains("file1") || fileName.contains("file2"));
+ }
+
// Fail when coping to directory.
var dir = new Directory('${tmp.path}/dir')..createSync();
Expect.throws(() => file1.copySync(dir.path));
diff --git a/tests/standalone_2/io/unix_socket_test.dart b/tests/standalone_2/io/unix_socket_test.dart
index 7f91a9c..0193a5c 100644
--- a/tests/standalone_2/io/unix_socket_test.dart
+++ b/tests/standalone_2/io/unix_socket_test.dart
@@ -163,6 +163,23 @@
await completer.future;
}
+Future testExistingFile(String name) async {
+ // Test that a leftover file(In case of previous process being killed and
+ // finalizer doesn't clean up the file) will be cleaned up and bind() should
+ // be able to bind to the socket.
+ var address = InternetAddress('$name/sock', type: InternetAddressType.unix);
+ // Create a file with the same name
+ File(address.address).createSync();
+ try {
+ ServerSocket server = await ServerSocket.bind(address, 0);
+ server.close();
+ } catch (e) {
+ Expect.type<SocketException>(e);
+ return;
+ }
+ Expect.fail("bind should fail with existing file");
+}
+
// Create socket in temp directory
Future withTempDir(String prefix, Future<void> test(Directory dir)) async {
var tempDir = Directory.systemTemp.createTempSync(prefix);
@@ -191,9 +208,12 @@
await testSourceAddressConnect('${dir.path}');
});
await testAbstractAddress();
+ await withTempDir('unix_socket_test', (Directory dir) async {
+ await testExistingFile('${dir.path}');
+ });
} catch (e) {
if (Platform.isMacOS || Platform.isLinux || Platform.isAndroid) {
- Expect.fail("Unexpected exceptions are thrown");
+ Expect.fail("Unexpected exception $e is thrown");
} else {
Expect.isTrue(e is SocketException);
}
diff --git a/tools/VERSION b/tools/VERSION
index eda72ea..7654d58 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -33,7 +33,7 @@
MAJOR 2
MINOR 9
PATCH 0
-PRERELEASE 14
+PRERELEASE 15
PRERELEASE_PATCH 0
-ABI_VERSION 34
-OLDEST_SUPPORTED_ABI_VERSION 34
+ABI_VERSION 35
+OLDEST_SUPPORTED_ABI_VERSION 35
diff --git a/tools/bots/bot_utils.py b/tools/bots/bot_utils.py
index 9e79caf..2c16826 100755
--- a/tools/bots/bot_utils.py
+++ b/tools/bots/bot_utils.py
@@ -79,11 +79,6 @@
- /VERSION
- /api-docs/dartdocs-gen-api.zip
- /sdk/dartsdk-{linux,macos,windows}-{ia32,x64}-release.zip
- - /editor/darteditor-{linux,macos,windows}-{ia32,x64}.zip
- - /editor/darteditor-installer-macos-{ia32,x64}.dmg
- - /editor/darteditor-installer-windows-{ia32,x64}.msi
- - /editor-eclipse-update
- /{index.html,features/,plugins/,artifacts.jar,content.jar}
"""
def __init__(self,
@@ -106,24 +101,6 @@
return '%s/channels/%s/%s/%s/VERSION' % (self.bucket, self.channel,
self.release_type, revision)
- def editor_zipfilepath(self, revision, system, arch):
- return '/'.join([
- self.editor_directory(revision),
- self.editor_zipfilename(system, arch)
- ])
-
- def editor_installer_filepath(self, revision, system, arch, extension):
- return '/'.join([
- self.editor_directory(revision),
- self.editor_installer_filename(system, arch, extension)
- ])
-
- def editor_android_zipfilepath(self, revision):
- return '/'.join([
- self.editor_directory(revision),
- self.editor_android_zipfilename()
- ])
-
def sdk_zipfilepath(self, revision, system, arch, mode):
return '/'.join([
self.sdk_directory(revision),
@@ -156,12 +133,6 @@
def src_directory(self, revision):
return self._variant_directory('src', revision)
- def editor_directory(self, revision):
- return self._variant_directory('editor', revision)
-
- def editor_eclipse_update_directory(self, revision):
- return self._variant_directory('editor-eclipse-update', revision)
-
def apidocs_directory(self, revision):
return self._variant_directory('api-docs', revision)
@@ -176,18 +147,6 @@
def dartdocs_zipfilename(self):
return 'dartdocs-gen-api.zip'
- def editor_zipfilename(self, system, arch):
- return 'darteditor-%s-%s.zip' % (SYSTEM_RENAMES[system],
- ARCH_RENAMES[arch])
-
- def editor_android_zipfilename(self):
- return 'android.zip'
-
- def editor_installer_filename(self, system, arch, extension):
- assert extension in ['dmg', 'msi']
- return 'darteditor-installer-%s-%s.%s' % (SYSTEM_RENAMES[system],
- ARCH_RENAMES[arch], extension)
-
def sdk_zipfilename(self, system, arch, mode):
assert mode in Mode.ALL_MODES
return 'dartsdk-%s-%s-%s.zip' % (SYSTEM_RENAMES[system],
diff --git a/tools/bots/linux_distribution_support.py b/tools/bots/linux_distribution_support.py
index 8b51f9a..e0f05bf 100644
--- a/tools/bots/linux_distribution_support.py
+++ b/tools/bots/linux_distribution_support.py
@@ -136,10 +136,6 @@
# run as root)
Run(['cp', '/usr/bin/dart', 'out/ReleaseX64/dart'])
- # We currently can't run the testing script on wheezy since the checked in
- # binary is built on precise, see issue 18742
- # TODO(18742): Run './tools/test.py' '-mrelease' 'standalone'
-
# Sanity check dart2js and the analyzer against a hello world program
with utils.TempDir() as temp_dir:
test_file = CreateDartTestFile(temp_dir)
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 2baab41..fe21204 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -371,13 +371,17 @@
"tests/co19_2/co19_2-kernel.status",
"tests/co19_2/co19_2-runtime.status",
"tests/compiler/",
+ "tests/corelib/",
"tests/corelib_2/",
"tests/dart/",
"tests/kernel/",
+ "tests/language/",
"tests/language_2/",
+ "tests/lib/",
"tests/lib_2/",
"tests/light_unittest.dart",
"tests/search/",
+ "tests/standalone/",
"tests/standalone_2/",
"tests/ffi/",
"tests/ffi_2/",
@@ -405,88 +409,6 @@
".dart_tool/package_config.json",
".packages",
".vpython"
- ],
- "vm-kernel-nnbd": [
- "benchmarks/",
- "out/DebugIA32/",
- "out/DebugX64/",
- "out/DebugSIMARM/",
- "out/DebugSIMARM64/",
- "out/DebugSIMARM_X64/",
- "out/DebugAndroidARM/",
- "out/DebugAndroidARM_X64/",
- "out/DebugAndroidARM64/",
- "out/ReleaseIA32/",
- "out/ReleaseX64/",
- "out/ReleaseSIMARM/",
- "out/ReleaseSIMARM64/",
- "out/ReleaseSIMARM_X64/",
- "out/ReleaseAndroidARM/",
- "out/ReleaseAndroidARM_X64/",
- "out/ReleaseAndroidARM64/",
- "out/ReleaseXARM64/",
- "out/ProductIA32/",
- "out/ProductX64/",
- "out/ProductSIMARM/",
- "out/ProductSIMARM64/",
- "out/ProductSIMARM_X64/",
- "out/ProductAndroidARM/",
- "out/ProductAndroidARM64/",
- "xcodebuild/DebugIA32/",
- "xcodebuild/DebugSIMARM/",
- "xcodebuild/DebugSIMARM64/",
- "xcodebuild/DebugX64/",
- "xcodebuild/ProductX64/",
- "xcodebuild/ReleaseIA32/",
- "xcodebuild/ReleaseSIMARM/",
- "xcodebuild/ReleaseSIMARM64/",
- "xcodebuild/ReleaseX64/",
- "samples/",
- "samples-dev/",
- "tools/",
- "third_party/android_tools/sdk/platform-tools/adb",
- "third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip",
- "third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip",
- "third_party/pkg/",
- "third_party/pkg_tested/",
- "tests/.dart_tool/package_config.json",
- "tests/angular/",
- "tests/co19/co19-analyzer.status",
- "tests/co19/co19-co19.status",
- "tests/co19/co19-dart2js.status",
- "tests/co19/co19-dartdevc.status",
- "tests/co19/co19-kernel.status",
- "tests/co19/co19-runtime.status",
- "tests/compiler/",
- "tests/dart/",
- "tests/kernel/",
- "tests/light_unittest.dart",
- "tests/search/",
- "tests/ffi/",
- "pkg/_fe_analyzer_shared/",
- "pkg/async_helper/",
- "pkg/build_integration/",
- "pkg/dart_internal/",
- "pkg/dart2native/",
- "pkg/dart2js_tools/",
- "pkg/dds/",
- "pkg/expect/",
- "pkg/front_end/",
- "pkg/js/",
- "pkg/kernel/",
- "pkg/meta/",
- "pkg/native_stack_traces/",
- "pkg/pkg.status",
- "pkg/smith/",
- "pkg/status_file/",
- "pkg/test_runner/",
- "pkg/vm/",
- "runtime/",
- "sdk/",
- "sdk_nnbd/",
- ".dart_tool/package_config.json",
- ".packages",
- ".vpython"
]
},
"configurations": {
@@ -1474,7 +1396,9 @@
"lib",
"standalone/io",
"vm"
- ]
+ ],
+ "fileset": "vm-kernel",
+ "shards": 3
},
{
"name": "vm nnbd tests in strong mode",
@@ -2452,8 +2376,7 @@
"arguments": [
"-ndart2js-hostasserts-linux-ia32-d8",
"--dart2js-batch",
- "dart2js_2",
- "dart2js_native"
+ "dart2js_2"
]
}
]
@@ -2482,8 +2405,7 @@
"--dart2js-batch",
"language_2",
"corelib_2",
- "dart2js_2",
- "dart2js_native"
+ "dart2js_2"
],
"shards": 6,
"fileset": "dart2js_hostasserts_prennbd"
@@ -2558,8 +2480,7 @@
"-ndart2js-${system}-${runtime}",
"--dart2js-batch",
"--reset-browser-configuration",
- "dart2js_2",
- "dart2js_native"
+ "dart2js_2"
]
}
]
@@ -2610,8 +2531,7 @@
"arguments": [
"-ndart2js-minified-linux-d8",
"--dart2js-batch",
- "dart2js_2",
- "dart2js_native"
+ "dart2js_2"
]
},
{
@@ -2629,8 +2549,7 @@
"arguments": [
"-ndart2js-production-linux-d8",
"--dart2js-batch",
- "dart2js_2",
- "dart2js_native"
+ "dart2js_2"
]
}
]
@@ -2684,8 +2603,7 @@
"arguments": [
"-ndart2js-minified-csp-linux-chrome",
"--dart2js-batch",
- "dart2js_2",
- "dart2js_native"
+ "dart2js_2"
]
}
]
@@ -2724,7 +2642,6 @@
"language",
"corelib",
"dart2js_2",
- "dart2js_native",
"kernel"
],
"shards": 6,
@@ -2758,7 +2675,6 @@
"language",
"corelib",
"dart2js_2",
- "dart2js_native",
"kernel"
],
"shards": 6,
diff --git a/tools/create_debian_chroot.sh b/tools/create_debian_chroot.sh
index 4f2f25e..4376f3b 100755
--- a/tools/create_debian_chroot.sh
+++ b/tools/create_debian_chroot.sh
@@ -4,7 +4,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.
#
-# Script to create a Debian wheezy chroot environment for building Dart
+# Script to create a Debian jessie chroot environment for building Dart
# Debian packages.
#
@@ -67,9 +67,9 @@
SRC_URI=$SVN_REPRO$SVN_PATH
fi
-# Create Debian wheezy chroot.
+# Create Debian jessie chroot.
debootstrap --arch=$ARCH --components=main,restricted,universe,multiverse \
- wheezy $CHROOT http://http.us.debian.org/debian/
+ jessie $CHROOT http://http.us.debian.org/debian/
chroot $CHROOT apt-get update
chroot $CHROOT apt-get -y install \
debhelper python git gcc sudo make
diff --git a/tools/download_chromium_sysroot.sh b/tools/download_chromium_sysroot.sh
index 75b3744..d21251b 100755
--- a/tools/download_chromium_sysroot.sh
+++ b/tools/download_chromium_sysroot.sh
@@ -4,7 +4,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.
-# Downloads the ia32 and x64 Debian wheezy sysroot that chromium uses,
+# Downloads the ia32 and x64 Debian jessie sysroot that chromium uses,
# Only tested and used on Ubuntu trusty linux. Used to keep glibc version low.
# Creates directories called "build" and "tools" in the current directory.
# After running this, source set_ia32_sysroot.sh or set_x64_sysroot.sh, in
diff --git a/tools/gn.py b/tools/gn.py
index 7d2f7b6..f0cd314 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -458,16 +458,6 @@
type=str,
help='Comma-separated list of arch=/path/to/toolchain-prefix mappings')
other_group.add_argument(
- '--wheezy',
- help='This flag is deprecated.',
- default=True,
- action='store_true')
- other_group.add_argument(
- '--no-wheezy',
- help='This flag is deprecated',
- dest='wheezy',
- action='store_false')
- other_group.add_argument(
'--workers',
'-w',
type=int,
diff --git a/tools/migration/bin/progress.dart b/tools/migration/bin/progress.dart
index d14b838..625d3c8 100644
--- a/tools/migration/bin/progress.dart
+++ b/tools/migration/bin/progress.dart
@@ -29,6 +29,8 @@
var totalLines = 0;
var totalMigratedFiles = 0;
var totalMigratedLines = 0;
+ var languageDirs = 0;
+ var migratedLanguageDirs = 0;
var skipCompleteSubfolders = arguments.contains("--incomplete");
@@ -68,12 +70,21 @@
totalLines += lines;
totalMigratedFiles += migratedFiles;
totalMigratedLines += migratedLines;
+
+ if (dir.startsWith("language_2/")) {
+ languageDirs++;
+ if (migratedLines == lines) {
+ migratedLanguageDirs++;
+ }
+ }
}
}
print("");
_show(
"total", totalMigratedFiles, totalFiles, totalMigratedLines, totalLines);
+ print("");
+ print("Finished $migratedLanguageDirs/$languageDirs language directories.");
}
void _show(
diff --git a/tools/promote.py b/tools/promote.py
index d88039d..7b57fb3 100644
--- a/tools/promote.py
+++ b/tools/promote.py
@@ -168,7 +168,7 @@
to_loc = release_namer.apidocs_zipfilepath(to_revision)
Gsutil(['-m', 'cp', '-a', 'public-read', from_loc, to_loc])
- # Copy wheezy linux deb and src packages.
+ # Copy linux deb and src packages.
from_loc = raw_namer.linux_packages_directory(revision)
to_loc = release_namer.linux_packages_directory(to_revision)
remove_gs_directory(to_loc)