Version 2.17.0-64.0.dev
Merge commit 'dfcd594ebd80b5f63c640cc5da259d393e3342f8' into 'dev'
diff --git a/DEPS b/DEPS
index a59dfd6..1fbea5c 100644
--- a/DEPS
+++ b/DEPS
@@ -44,7 +44,7 @@
# 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": "73fa4da0cb5a6fec136a2ac045503770eed2b58f",
+ "co19_rev": "1247f4096b835f31465e8f71dece427e95b51534",
# This line prevents conflicts when both packages are rolled simultaneously.
"co19_2_rev": "995745937abffe9fc3a6441f9f0db27b2d706e4c",
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/bootstrap.dart b/pkg/_fe_analyzer_shared/lib/src/macros/bootstrap.dart
index 5841315..f604c80 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/bootstrap.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/bootstrap.dart
@@ -122,7 +122,7 @@
for (MapEntry<String, Object?> entry in request.arguments.named.entries)
new Symbol(entry.key): entry.value,
}) as Macro;
- var identifier = new MacroInstanceIdentifierImpl();
+ var identifier = new MacroInstanceIdentifierImpl(instance);
_macroInstances[identifier] = instance;
return new SerializableResponse(
responseType: MessageType.macroInstanceIdentifier,
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart
index 9778950..a4c2df3 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart
@@ -227,7 +227,16 @@
/// [MacroExecutor.instantiateMacro].
///
/// Used to execute or reload this macro in the future.
-abstract class MacroInstanceIdentifier implements Serializable {}
+abstract class MacroInstanceIdentifier implements Serializable {
+ /// Whether or not this instance should run in [phase] on [declarationKind].
+ ///
+ /// Attempting to execute a macro in a phase it doesn't support, or on a
+ /// declaration kind it doesn't support is an error.
+ bool shouldExecute(DeclarationKind declarationKind, Phase phase);
+
+ /// Whether or not this macro supports [declarationKind] in any phase.
+ bool supportsDeclarationKind(DeclarationKind declarationKind);
+}
/// A summary of the results of running a macro in a given phase.
///
@@ -242,6 +251,16 @@
Iterable<DeclarationCode> get augmentations;
}
+/// Each of the possible types of declarations a macro can be applied to
+enum DeclarationKind {
+ clazz,
+ constructor,
+ field,
+ function,
+ method,
+ variable,
+}
+
/// Each of the different macro execution phases.
enum Phase {
/// Only new types are added in this phase.
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/response_impls.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/response_impls.dart
index f829357..eb4e5ae 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/response_impls.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/response_impls.dart
@@ -25,20 +25,184 @@
/// Implementation of [MacroInstanceIdentifier].
class MacroInstanceIdentifierImpl implements MacroInstanceIdentifier {
+ /// A single int where each bit indicates whether a specific macro interface
+ /// is implemented by this macro.
+ final int _interfaces;
+
static int _next = 0;
final int id;
- MacroInstanceIdentifierImpl() : id = _next++;
+ MacroInstanceIdentifierImpl._(this._interfaces) : id = _next++;
+
+ factory MacroInstanceIdentifierImpl(Macro macro) {
+ // Build up the interfaces value, there is a bit for each declaration/phase
+ // combination (as there is an interface for each).
+ int interfaces = 0;
+ for (DeclarationKind declarationKind in DeclarationKind.values) {
+ for (Phase phase in Phase.values) {
+ int interfaceMask = _interfaceMask(declarationKind, phase);
+ switch (declarationKind) {
+ case DeclarationKind.clazz:
+ switch (phase) {
+ case Phase.types:
+ if (macro is ClassTypesMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.declarations:
+ if (macro is ClassDeclarationsMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.definitions:
+ if (macro is ClassDefinitionMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ }
+ break;
+ case DeclarationKind.constructor:
+ switch (phase) {
+ case Phase.types:
+ if (macro is ConstructorTypesMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.declarations:
+ if (macro is ConstructorDeclarationsMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.definitions:
+ if (macro is ConstructorDefinitionMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ }
+ break;
+ case DeclarationKind.field:
+ switch (phase) {
+ case Phase.types:
+ if (macro is FieldTypesMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.declarations:
+ if (macro is FieldDeclarationsMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.definitions:
+ if (macro is FieldDefinitionMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ }
+ break;
+ case DeclarationKind.function:
+ switch (phase) {
+ case Phase.types:
+ if (macro is FunctionTypesMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.declarations:
+ if (macro is FunctionDeclarationsMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.definitions:
+ if (macro is FunctionDefinitionMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ }
+ break;
+ case DeclarationKind.method:
+ switch (phase) {
+ case Phase.types:
+ if (macro is MethodTypesMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.declarations:
+ if (macro is MethodDeclarationsMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.definitions:
+ if (macro is MethodDefinitionMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ }
+ break;
+ case DeclarationKind.variable:
+ switch (phase) {
+ case Phase.types:
+ if (macro is VariableTypesMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.declarations:
+ if (macro is VariableDeclarationsMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ case Phase.definitions:
+ if (macro is VariableDefinitionMacro) {
+ interfaces |= interfaceMask;
+ }
+ break;
+ }
+ break;
+ }
+ }
+ }
+
+ return new MacroInstanceIdentifierImpl._(interfaces);
+ }
MacroInstanceIdentifierImpl.deserialize(Deserializer deserializer)
- : id = (deserializer..moveNext()).expectNum();
+ : id = (deserializer..moveNext()).expectNum(),
+ _interfaces = (deserializer..moveNext()).expectNum();
- void serialize(Serializer serializer) => serializer.addNum(id);
+ void serialize(Serializer serializer) => serializer
+ ..addNum(id)
+ ..addNum(_interfaces);
operator ==(other) => other is MacroInstanceIdentifierImpl && id == other.id;
int get hashCode => id;
+
+ @override
+ bool shouldExecute(DeclarationKind declarationKind, Phase phase) {
+ int mask = _interfaceMask(declarationKind, phase);
+ if (declarationKind == DeclarationKind.method) {
+ // Apply function macros to methods.
+ mask |= _interfaceMask(DeclarationKind.function, phase);
+ } else if (declarationKind == DeclarationKind.field) {
+ // Apply variable macros to fields.
+ mask |= _interfaceMask(DeclarationKind.variable, phase);
+ }
+ return _interfaces & mask != 0x0;
+ }
+
+ @override
+ bool supportsDeclarationKind(DeclarationKind declarationKind) {
+ for (Phase phase in Phase.values) {
+ if (shouldExecute(declarationKind, phase)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// The mask for a particular interface, which is a combination of a kind of
+ /// declaration and a phase.
+ static int _interfaceMask(DeclarationKind declarationKind, Phase phase) =>
+ 0x1 << (declarationKind.index * Phase.values.length) << phase.index;
}
/// Implementation of [MacroExecutionResult].
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/isolate_mirrors_executor/isolate_mirrors_impl.dart b/pkg/_fe_analyzer_shared/lib/src/macros/isolate_mirrors_executor/isolate_mirrors_impl.dart
index e1e12fe..4c435f6 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/isolate_mirrors_executor/isolate_mirrors_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/isolate_mirrors_executor/isolate_mirrors_impl.dart
@@ -73,7 +73,8 @@
for (MapEntry<String, Object?> entry in request.arguments.named.entries)
new Symbol(entry.key): entry.value,
}).reflectee as Macro;
- MacroInstanceIdentifierImpl identifier = new MacroInstanceIdentifierImpl();
+ MacroInstanceIdentifierImpl identifier =
+ new MacroInstanceIdentifierImpl(instance);
_macroInstances[identifier] = instance;
return new Response(
response: identifier,
diff --git a/pkg/_fe_analyzer_shared/test/macros/executor_shared/response_impls_test.dart b/pkg/_fe_analyzer_shared/test/macros/executor_shared/response_impls_test.dart
new file mode 100644
index 0000000..da0c02e
--- /dev/null
+++ b/pkg/_fe_analyzer_shared/test/macros/executor_shared/response_impls_test.dart
@@ -0,0 +1,153 @@
+// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+// for 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:test/fake.dart';
+import 'package:test/test.dart';
+
+import 'package:_fe_analyzer_shared/src/macros/executor_shared/response_impls.dart';
+import 'package:_fe_analyzer_shared/src/macros/executor.dart';
+import 'package:_fe_analyzer_shared/src/macros/api.dart';
+
+void main() {
+ group('MacroInstanceIdentifierImpl', () {
+ test('shouldExecute', () {
+ for (var kind in DeclarationKind.values) {
+ for (var phase in Phase.values) {
+ var instance = instancesByKindAndPhase[kind]![phase]!;
+ for (var otherKind in DeclarationKind.values) {
+ for (var otherPhase in Phase.values) {
+ var expected = false;
+ if (otherPhase == phase) {
+ if (kind == otherKind) {
+ expected = true;
+ } else if (kind == DeclarationKind.function &&
+ otherKind == DeclarationKind.method) {
+ expected = true;
+ } else if (kind == DeclarationKind.variable &&
+ otherKind == DeclarationKind.field) {
+ expected = true;
+ }
+ }
+ expect(instance.shouldExecute(otherKind, otherPhase), expected,
+ reason: 'Expected a $kind macro in $phase to '
+ '${expected ? '' : 'not '}be applied to a $otherKind '
+ 'in $otherPhase');
+ }
+ }
+ }
+ }
+ });
+
+ test('supportsDeclarationKind', () {
+ for (var kind in DeclarationKind.values) {
+ for (var phase in Phase.values) {
+ var instance = instancesByKindAndPhase[kind]![phase]!;
+ for (var otherKind in DeclarationKind.values) {
+ var expected = false;
+ if (kind == otherKind) {
+ expected = true;
+ } else if (kind == DeclarationKind.function &&
+ otherKind == DeclarationKind.method) {
+ expected = true;
+ } else if (kind == DeclarationKind.variable &&
+ otherKind == DeclarationKind.field) {
+ expected = true;
+ }
+ expect(instance.supportsDeclarationKind(otherKind), expected,
+ reason: 'Expected a $kind macro to ${expected ? '' : 'not '}'
+ 'support a $otherKind');
+ }
+ }
+ }
+ });
+ });
+}
+
+final Map<DeclarationKind, Map<Phase, MacroInstanceIdentifierImpl>>
+ instancesByKindAndPhase = {
+ DeclarationKind.clazz: {
+ Phase.types: MacroInstanceIdentifierImpl(FakeClassTypesMacro()),
+ Phase.declarations:
+ MacroInstanceIdentifierImpl(FakeClassDeclarationsMacro()),
+ Phase.definitions: MacroInstanceIdentifierImpl(FakeClassDefinitionMacro()),
+ },
+ DeclarationKind.constructor: {
+ Phase.types: MacroInstanceIdentifierImpl(FakeConstructorTypesMacro()),
+ Phase.declarations:
+ MacroInstanceIdentifierImpl(FakeConstructorDeclarationsMacro()),
+ Phase.definitions:
+ MacroInstanceIdentifierImpl(FakeConstructorDefinitionMacro()),
+ },
+ DeclarationKind.field: {
+ Phase.types: MacroInstanceIdentifierImpl(FakeFieldTypesMacro()),
+ Phase.declarations:
+ MacroInstanceIdentifierImpl(FakeFieldDeclarationsMacro()),
+ Phase.definitions: MacroInstanceIdentifierImpl(FakeFieldDefinitionMacro()),
+ },
+ DeclarationKind.function: {
+ Phase.types: MacroInstanceIdentifierImpl(FakeFunctionTypesMacro()),
+ Phase.declarations:
+ MacroInstanceIdentifierImpl(FakeFunctionDeclarationsMacro()),
+ Phase.definitions:
+ MacroInstanceIdentifierImpl(FakeFunctionDefinitionMacro()),
+ },
+ DeclarationKind.method: {
+ Phase.types: MacroInstanceIdentifierImpl(FakeMethodTypesMacro()),
+ Phase.declarations:
+ MacroInstanceIdentifierImpl(FakeMethodDeclarationsMacro()),
+ Phase.definitions: MacroInstanceIdentifierImpl(FakeMethodDefinitionMacro()),
+ },
+ DeclarationKind.variable: {
+ Phase.types: MacroInstanceIdentifierImpl(FakeVariableTypesMacro()),
+ Phase.declarations:
+ MacroInstanceIdentifierImpl(FakeVariableDeclarationsMacro()),
+ Phase.definitions:
+ MacroInstanceIdentifierImpl(FakeVariableDefinitionMacro()),
+ },
+};
+
+class FakeClassTypesMacro extends Fake implements ClassTypesMacro {}
+
+class FakeClassDeclarationsMacro extends Fake
+ implements ClassDeclarationsMacro {}
+
+class FakeClassDefinitionMacro extends Fake implements ClassDefinitionMacro {}
+
+class FakeConstructorTypesMacro extends Fake implements ConstructorTypesMacro {}
+
+class FakeConstructorDeclarationsMacro extends Fake
+ implements ConstructorDeclarationsMacro {}
+
+class FakeConstructorDefinitionMacro extends Fake
+ implements ConstructorDefinitionMacro {}
+
+class FakeFieldTypesMacro extends Fake implements FieldTypesMacro {}
+
+class FakeFieldDeclarationsMacro extends Fake
+ implements FieldDeclarationsMacro {}
+
+class FakeFieldDefinitionMacro extends Fake implements FieldDefinitionMacro {}
+
+class FakeFunctionTypesMacro extends Fake implements FunctionTypesMacro {}
+
+class FakeFunctionDeclarationsMacro extends Fake
+ implements FunctionDeclarationsMacro {}
+
+class FakeFunctionDefinitionMacro extends Fake
+ implements FunctionDefinitionMacro {}
+
+class FakeMethodTypesMacro extends Fake implements MethodTypesMacro {}
+
+class FakeMethodDeclarationsMacro extends Fake
+ implements MethodDeclarationsMacro {}
+
+class FakeMethodDefinitionMacro extends Fake implements MethodDefinitionMacro {}
+
+class FakeVariableTypesMacro extends Fake implements VariableTypesMacro {}
+
+class FakeVariableDeclarationsMacro extends Fake
+ implements VariableDeclarationsMacro {}
+
+class FakeVariableDefinitionMacro extends Fake
+ implements VariableDefinitionMacro {}
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 8542b60..2aabaff 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -1737,10 +1737,18 @@
packageLanguageVersion:
new ImplicitLanguageVersion(libraryBuilder.library.languageVersion),
loader: lastGoodKernelTarget.loader,
- scope: libraryBuilder.scope.createNestedScope("expression"),
nameOrigin: libraryBuilder,
isUnsupported: libraryBuilder.isUnsupported,
);
+ libraryBuilder.scope.forEachLocalMember((name, member) {
+ debugLibrary.scope.addLocalMember(name, member, setter: false);
+ });
+ libraryBuilder.scope.forEachLocalSetter((name, member) {
+ debugLibrary.scope.addLocalMember(name, member, setter: true);
+ });
+ libraryBuilder.scope.forEachLocalExtension((member) {
+ debugLibrary.scope.addExtension(member);
+ });
_ticker.logMs("Created debug library");
if (libraryBuilder is DillLibraryBuilder) {
diff --git a/pkg/front_end/lib/src/fasta/scope.dart b/pkg/front_end/lib/src/fasta/scope.dart
index cc9eb28..2ccd860 100644
--- a/pkg/front_end/lib/src/fasta/scope.dart
+++ b/pkg/front_end/lib/src/fasta/scope.dart
@@ -424,6 +424,10 @@
_setters.forEach(f);
}
+ void forEachLocalExtension(void Function(ExtensionBuilder member) f) {
+ _extensions?.forEach(f);
+ }
+
Iterable<Builder> get localMembers => _local.values;
Iterable<MemberBuilder> get localSetters => _setters.values;
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 c67945d..bbcbbca 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
@@ -4576,8 +4576,10 @@
assert(currentTypeParameterScopeBuilder.kind ==
TypeParameterScopeKind.library);
- for (SourceExtensionBuilder extensionBuilder
+ for (ExtensionBuilder _extensionBuilder
in currentTypeParameterScopeBuilder.extensions!) {
+ ExtensionBuilder extensionBuilder = _extensionBuilder;
+ if (extensionBuilder is! SourceExtensionBuilder) continue;
DartType onType = extensionBuilder.extension.onType;
if (onType is InterfaceType) {
ExtensionTypeShowHideClause showHideClause =
@@ -4924,7 +4926,7 @@
final Map<String, MemberBuilder>? setters;
- final Set<SourceExtensionBuilder>? extensions;
+ final Set<ExtensionBuilder>? extensions;
final List<NamedTypeBuilder> unresolvedNamedTypes = <NamedTypeBuilder>[];
@@ -4965,7 +4967,7 @@
<String, Builder>{},
<String, MemberBuilder>{},
null, // No support for constructors in library scopes.
- <SourceExtensionBuilder>{},
+ <ExtensionBuilder>{},
"<library>",
-1,
null);
diff --git a/pkg/front_end/test/fasta/expression_suite.dart b/pkg/front_end/test/fasta/expression_suite.dart
index 371e8ef..03eeb59 100644
--- a/pkg/front_end/test/fasta/expression_suite.dart
+++ b/pkg/front_end/test/fasta/expression_suite.dart
@@ -8,6 +8,8 @@
import "dart:io" show File, IOSink;
+import 'dart:typed_data' show Uint8List;
+
import 'package:_fe_analyzer_shared/src/util/colors.dart' as colors;
import "package:front_end/src/api_prototype/compiler_options.dart"
@@ -48,7 +50,7 @@
import "package:yaml/yaml.dart" show YamlMap, YamlList, loadYamlNode;
import '../../lib/src/fasta/kernel/utils.dart'
- show writeComponentToFile, serializeProcedure;
+ show serializeComponent, serializeProcedure;
import '../utils/kernel_chain.dart' show runDiff, openWrite;
@@ -375,17 +377,16 @@
Component component = sourceCompilerResult.component;
var errors = context.takeErrors();
if (!errors.isEmpty) {
- return fail(tests, "Couldn't compile entry-point: $errors");
+ return fail(
+ tests,
+ "Couldn't compile entry-point: "
+ "${errors.map((e) => e.plainTextFormatted.first).toList()}");
}
Uri dillFileUri = new Uri(
scheme: test.entryPoint!.scheme,
path: test.entryPoint!.path + ".dill");
- File dillFile = new File.fromUri(dillFileUri);
- if (!await dillFile.exists()) {
- await writeComponentToFile(component, dillFileUri);
- context.fileSystem.entityForUri(dillFileUri).writeAsBytesSync(
- await new File.fromUri(dillFileUri).readAsBytes());
- }
+ Uint8List dillData = await serializeComponent(component);
+ context.fileSystem.entityForUri(dillFileUri).writeAsBytesSync(dillData);
await compileExpression(test, sourceCompiler, component, context);
var dillCompiler =
@@ -394,7 +395,6 @@
await dillCompiler.computeDelta(entryPoints: [test.entryPoint!]);
component = dillCompilerResult.component;
component.computeCanonicalNames();
- await dillFile.delete();
errors = context.takeErrors();
// Since it compiled successfully from source, the bootstrap-from-Dill
diff --git a/pkg/front_end/test/macros/macro_test.dart b/pkg/front_end/test/macros/macro_test.dart
index 25ee5db..26aef58 100644
--- a/pkg/front_end/test/macros/macro_test.dart
+++ b/pkg/front_end/test/macros/macro_test.dart
@@ -343,6 +343,14 @@
@override
void serialize(Serializer serializer) => throw UnimplementedError();
+
+ @override
+ bool shouldExecute(DeclarationKind declarationKind, Phase phase) =>
+ throw new UnimplementedError();
+
+ @override
+ bool supportsDeclarationKind(DeclarationKind declarationKind) =>
+ throw new UnimplementedError();
}
class _MacroExecutionResult implements MacroExecutionResult {
diff --git a/pkg/front_end/testcases/expression/a.dart b/pkg/front_end/testcases/expression/a.dart
new file mode 100644
index 0000000..63db95e
--- /dev/null
+++ b/pkg/front_end/testcases/expression/a.dart
@@ -0,0 +1,13 @@
+import "b.dart";
+
+main() {
+ Foo foo = new Foo();
+ print(foo.foo);
+}
+
+class Foo<E1> {
+ E1 get foo => null;
+ String get bar => "hello";
+}
+
+class Bar {}
diff --git a/pkg/front_end/testcases/expression/b.dart b/pkg/front_end/testcases/expression/b.dart
new file mode 100644
index 0000000..dc9ed0a
--- /dev/null
+++ b/pkg/front_end/testcases/expression/b.dart
@@ -0,0 +1,4 @@
+class Foo<E2> {
+ E2 get foo => null;
+ int get bar => 42;
+}
diff --git a/pkg/front_end/testcases/expression/inside_class_with_import_1.expression.yaml b/pkg/front_end/testcases/expression/inside_class_with_import_1.expression.yaml
new file mode 100644
index 0000000..30dce60
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_import_1.expression.yaml
@@ -0,0 +1,10 @@
+# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+entry_point: "a.dart"
+import: "b.dart"
+definitions: []
+position: "a.dart#Foo"
+expression: |
+ foo
diff --git a/pkg/front_end/testcases/expression/inside_class_with_import_1.expression.yaml.expect b/pkg/front_end/testcases/expression/inside_class_with_import_1.expression.yaml.expect
new file mode 100644
index 0000000..e9f21d4
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_import_1.expression.yaml.expect
@@ -0,0 +1,4 @@
+Errors: {
+}
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return this.{#lib1::Foo::foo}{#lib1::Foo::E1*};
diff --git a/pkg/front_end/testcases/expression/inside_class_with_import_2.expression.yaml b/pkg/front_end/testcases/expression/inside_class_with_import_2.expression.yaml
new file mode 100644
index 0000000..2fba111
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_import_2.expression.yaml
@@ -0,0 +1,10 @@
+# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+entry_point: "a.dart"
+import: "b.dart"
+definitions: []
+position: "a.dart#Foo"
+expression: |
+ bar.length
diff --git a/pkg/front_end/testcases/expression/inside_class_with_import_2.expression.yaml.expect b/pkg/front_end/testcases/expression/inside_class_with_import_2.expression.yaml.expect
new file mode 100644
index 0000000..bdeb445
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_import_2.expression.yaml.expect
@@ -0,0 +1,4 @@
+Errors: {
+}
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return this.{#lib1::Foo::bar}{dart.core::String*}.{dart.core::String::length}{dart.core::int*};
diff --git a/pkg/front_end/testcases/expression/inside_class_with_import_3.expression.yaml b/pkg/front_end/testcases/expression/inside_class_with_import_3.expression.yaml
new file mode 100644
index 0000000..f8eb3a8
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_import_3.expression.yaml
@@ -0,0 +1,10 @@
+# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+entry_point: "a.dart"
+import: "b.dart"
+definitions: []
+position: "a.dart#Bar"
+expression: |
+ new Foo().bar.length
diff --git a/pkg/front_end/testcases/expression/inside_class_with_import_3.expression.yaml.expect b/pkg/front_end/testcases/expression/inside_class_with_import_3.expression.yaml.expect
new file mode 100644
index 0000000..01c5a65
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_import_3.expression.yaml.expect
@@ -0,0 +1,4 @@
+Errors: {
+}
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return new #lib1::Foo::•<dynamic>().{#lib1::Foo::bar}{dart.core::String*}.{dart.core::String::length}{dart.core::int*};
diff --git a/pkg/front_end/testcases/expression/inside_class_with_t.expression.yaml b/pkg/front_end/testcases/expression/inside_class_with_t.expression.yaml
new file mode 100644
index 0000000..23272e3
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_t.expression.yaml
@@ -0,0 +1,9 @@
+# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+entry_point: "main.dart"
+definitions: []
+position: "main.dart#E"
+expression: |
+ t
diff --git a/pkg/front_end/testcases/expression/inside_class_with_t.expression.yaml.expect b/pkg/front_end/testcases/expression/inside_class_with_t.expression.yaml.expect
new file mode 100644
index 0000000..d7463a7
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_t.expression.yaml.expect
@@ -0,0 +1,4 @@
+Errors: {
+}
+method /* from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return this.{main::E::t}{main::E::T*};
diff --git a/pkg/front_end/testcases/expression/inside_class_with_t_in_dart_collection.expression.yaml b/pkg/front_end/testcases/expression/inside_class_with_t_in_dart_collection.expression.yaml
new file mode 100644
index 0000000..343d2ba
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_t_in_dart_collection.expression.yaml
@@ -0,0 +1,9 @@
+# Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+entry_point: "main.dart"
+definitions: []
+position: "dart:collection#LinkedList"
+expression: |
+ first
diff --git a/pkg/front_end/testcases/expression/inside_class_with_t_in_dart_collection.expression.yaml.expect b/pkg/front_end/testcases/expression/inside_class_with_t_in_dart_collection.expression.yaml.expect
new file mode 100644
index 0000000..9625a0d
--- /dev/null
+++ b/pkg/front_end/testcases/expression/inside_class_with_t_in_dart_collection.expression.yaml.expect
@@ -0,0 +1,4 @@
+Errors: {
+}
+method /*isLegacy, from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic
+ return this.{dart.collection::LinkedList::first}{dart.collection::LinkedList::E*};
diff --git a/pkg/front_end/testcases/expression/main.dart b/pkg/front_end/testcases/expression/main.dart
index f65db93..0c25d47 100644
--- a/pkg/front_end/testcases/expression/main.dart
+++ b/pkg/front_end/testcases/expression/main.dart
@@ -5,6 +5,9 @@
library main;
import 'dart:io' show File, Process, exit;
+import 'dart:collection';
+
+class Entry extends LinkedListEntry<Entry> {}
List<String> listOfStrings = ["hello"];
@@ -92,3 +95,8 @@
return 42;
}
}
+
+class E<T> {
+ T _t;
+ T get t => _t;
+}
diff --git a/pkg/front_end/tool/dart_doctest_impl.dart b/pkg/front_end/tool/dart_doctest_impl.dart
index 61a4aaa..6481a4c 100644
--- a/pkg/front_end/tool/dart_doctest_impl.dart
+++ b/pkg/front_end/tool/dart_doctest_impl.dart
@@ -829,6 +829,8 @@
packageLanguageVersion:
new ImplicitLanguageVersion(libraryBuilder.library.languageVersion),
loader: loader,
+ // TODO(jensj): Should probably set up scopes the same was as it's done
+ // (now) for expression compilation.
scope: libraryBuilder.scope.createNestedScope("dartdoctest"),
nameOrigin: libraryBuilder,
isUnsupported: false,
diff --git a/runtime/lib/math.cc b/runtime/lib/math.cc
index 9346d1e..59e2305 100644
--- a/runtime/lib/math.cc
+++ b/runtime/lib/math.cc
@@ -13,57 +13,6 @@
namespace dart {
-DEFINE_NATIVE_ENTRY(Math_sqrt, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(sqrt(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_sin, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(sin(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_cos, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(cos(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_tan, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(tan(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_asin, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(asin(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_acos, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(acos(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_atan, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(atan(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_atan2, 0, 2) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand1, arguments->NativeArgAt(0));
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand2, arguments->NativeArgAt(1));
- return Double::New(atan2_ieee(operand1.value(), operand2.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_exp, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(exp(operand.value()));
-}
-
-DEFINE_NATIVE_ENTRY(Math_log, 0, 1) {
- GET_NON_NULL_NATIVE_ARGUMENT(Double, operand, arguments->NativeArgAt(0));
- return Double::New(log(operand.value()));
-}
-
DEFINE_NATIVE_ENTRY(Math_doublePow, 0, 2) {
const double operand =
Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index 2b7a470..f3efce1 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -299,14 +299,6 @@
return unit.IssueLoad();
}
-DEFINE_NATIVE_ENTRY(Internal_has63BitSmis, 0, 0) {
-#if defined(ARCH_IS_64_BIT) && !defined(DART_COMPRESSED_POINTERS)
- return Bool::True().ptr();
-#else
- return Bool::False().ptr();
-#endif // defined(ARCH_IS_64_BIT)
-}
-
DEFINE_NATIVE_ENTRY(Internal_unsafeCast, 0, 1) {
UNREACHABLE(); // Should be erased at Kernel translation time.
return arguments->NativeArgAt(0);
@@ -316,10 +308,6 @@
UNREACHABLE();
}
-DEFINE_NATIVE_ENTRY(Internal_reachabilityFence, 0, 1) {
- UNREACHABLE();
-}
-
DEFINE_NATIVE_ENTRY(Internal_collectAllGarbage, 0, 0) {
isolate->group()->heap()->CollectAllGarbage();
return Object::null();
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 4c86f33..20a2d74e 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -138,16 +138,6 @@
V(String_toLowerCase, 1) \
V(String_toUpperCase, 1) \
V(String_concatRange, 3) \
- V(Math_sqrt, 1) \
- V(Math_sin, 1) \
- V(Math_cos, 1) \
- V(Math_tan, 1) \
- V(Math_asin, 1) \
- V(Math_acos, 1) \
- V(Math_atan, 1) \
- V(Math_atan2, 2) \
- V(Math_exp, 1) \
- V(Math_log, 1) \
V(Math_doublePow, 2) \
V(Random_nextState, 1) \
V(Random_setupSeed, 1) \
@@ -330,11 +320,9 @@
V(GrowableList_setData, 2) \
V(Internal_unsafeCast, 1) \
V(Internal_nativeEffect, 1) \
- V(Internal_reachabilityFence, 1) \
V(Internal_collectAllGarbage, 0) \
V(Internal_makeListFixedLength, 1) \
V(Internal_makeFixedListUnmodifiable, 1) \
- V(Internal_has63BitSmis, 0) \
V(Internal_extractTypeArguments, 2) \
V(Internal_prependTypeArguments, 4) \
V(Internal_boundsCheckForPartialInstantiation, 2) \
diff --git a/runtime/vm/compiler/backend/inliner.cc b/runtime/vm/compiler/backend/inliner.cc
index 38de868..dd1e62c 100644
--- a/runtime/vm/compiler/backend/inliner.cc
+++ b/runtime/vm/compiler/backend/inliner.cc
@@ -1040,7 +1040,8 @@
// Abort if the inlinable bit on the function is low.
if (!function.CanBeInlined()) {
- TRACE_INLINING(THR_Print(" Bailout: not inlinable\n"));
+ TRACE_INLINING(THR_Print(
+ " Bailout: not inlinable due to !function.CanBeInlined()\n"));
PRINT_INLINING_TREE("Not inlinable", &call_data->caller, &function,
call_data->call);
return false;
@@ -1165,6 +1166,9 @@
// As a side effect of parsing the function, it may be marked
// as not inlinable. This happens for async and async* functions
// when causal stack traces are being tracked.
+ TRACE_INLINING(
+ THR_Print(" Bailout: not inlinable due to "
+ "!function.CanBeInlined()\n"));
return false;
}
}
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index eb93990..9dc2df9 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -99,16 +99,16 @@
V(::, max, MathMax, 0xead7161a) \
V(::, _doublePow, MathDoublePow, 0x989f3334) \
V(::, _intPow, MathIntPow, 0x68b6021e) \
- V(::, _sin, MathSin, 0x17dacdc4) \
- V(::, _cos, MathCos, 0xf4948106) \
- V(::, _tan, MathTan, 0xeb1a58f8) \
- V(::, _asin, MathAsin, 0x29e4d95f) \
- V(::, _acos, MathAcos, 0x200aa49c) \
- V(::, _atan, MathAtan, 0x10fa64b3) \
- V(::, _atan2, MathAtan2, 0x58d4f514) \
- V(::, _sqrt, MathSqrt, 0x03183751) \
- V(::, _exp, MathExp, 0x00f50391) \
- V(::, _log, MathLog, 0x09ae8823) \
+ V(::, _sin, MathSin, 0x17daca03) \
+ V(::, _cos, MathCos, 0xf4947d45) \
+ V(::, _tan, MathTan, 0xeb1a5537) \
+ V(::, _asin, MathAsin, 0x29e4d59e) \
+ V(::, _acos, MathAcos, 0x200aa0db) \
+ V(::, _atan, MathAtan, 0x10fa60f2) \
+ V(::, _atan2, MathAtan2, 0x58d4f153) \
+ V(::, _sqrt, MathSqrt, 0x03183390) \
+ V(::, _exp, MathExp, 0x00f4ffd0) \
+ V(::, _log, MathLog, 0x09ae8462) \
V(Float32x4, _Float32x4FromDoubles, Float32x4FromDoubles, 0x1845792b) \
V(Float32x4, Float32x4.zero, Float32x4Zero, 0xd3b64002) \
V(Float32x4, _Float32x4Splat, Float32x4Splat, 0x13a552c3) \
@@ -187,7 +187,7 @@
V(_WeakProperty, get:value, WeakProperty_getValue, 0xd2f28aae) \
V(_WeakProperty, set:value, WeakProperty_setValue, 0x8b2bafab) \
V(::, _classRangeCheck, ClassRangeCheck, 0x00269620) \
- V(::, _abi, FfiAbi, 0x7c4ab775) \
+ V(::, _abi, FfiAbi, 0x7c4ab3b4) \
V(::, _asFunctionInternal, FfiAsFunctionInternal, 0x92ae104f) \
V(::, _nativeCallbackFunction, FfiNativeCallbackFunction, 0x3ff5ae9c) \
V(::, _nativeEffect, NativeEffect, 0x61e00b59) \
@@ -234,13 +234,13 @@
V(::, _asExternalTypedDataFloat, FfiAsExternalTypedDataFloat, 0x6f465e0c) \
V(::, _asExternalTypedDataDouble, FfiAsExternalTypedDataDouble, 0x40cdd9e1) \
V(::, _getNativeField, GetNativeField, 0xa0139b85) \
- V(::, reachabilityFence, ReachabilityFence, 0x619235c1) \
+ V(::, reachabilityFence, ReachabilityFence, 0x730f2b7f) \
V(_Utf8Decoder, _scan, Utf8DecoderScan, 0x1dcaf73d) \
V(_Future, timeout, FutureTimeout, 0x73041520) \
V(Future, wait, FutureWait, 0x495c83cd) \
V(_RootZone, runUnary, RootZoneRunUnary, 0xb607f8bf) \
V(_FutureListener, handleValue, FutureListenerHandleValue, 0x438115a8) \
- V(::, has63BitSmis, Has63BitSmis, 0xf61b5ab2) \
+ V(::, has63BitSmis, Has63BitSmis, 0xf61b56f1) \
// List of intrinsics:
// (class-name, function-name, intrinsification method, fingerprint).
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 093014b..3554f67 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -8165,7 +8165,7 @@
return false;
}
- return is_inlinable() && !is_external() && !is_generated_body();
+ return is_inlinable() && !is_generated_body();
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/sdk/lib/_internal/vm/lib/ffi_patch.dart b/sdk/lib/_internal/vm/lib/ffi_patch.dart
index 271af42..bbf8499 100644
--- a/sdk/lib/_internal/vm/lib/ffi_patch.dart
+++ b/sdk/lib/_internal/vm/lib/ffi_patch.dart
@@ -226,8 +226,6 @@
/// calculations. See pkg/vm/lib/transformations/ffi.dart.
@pragma("vm:recognized", "other")
@pragma('vm:prefer-inline')
-@pragma("vm:external-name",
- "Recognized method: IR graph is built in the flow graph builder.")
external int _abi();
@patch
diff --git a/sdk/lib/_internal/vm/lib/internal_patch.dart b/sdk/lib/_internal/vm/lib/internal_patch.dart
index 569b91c..b8141d6 100644
--- a/sdk/lib/_internal/vm/lib/internal_patch.dart
+++ b/sdk/lib/_internal/vm/lib/internal_patch.dart
@@ -104,7 +104,6 @@
@pragma("vm:recognized", "other")
@pragma('vm:prefer-inline')
-@pragma("vm:external-name", "Internal_has63BitSmis")
external bool get has63BitSmis;
@pragma("vm:recognized", "other")
@@ -168,8 +167,7 @@
// This function can be used to keep an object alive till that point.
@pragma("vm:recognized", "other")
@pragma('vm:prefer-inline')
-@pragma("vm:external-name", "Internal_reachabilityFence")
-external void reachabilityFence(Object object);
+external void reachabilityFence(Object? object);
// This function can be used to encode native side effects.
//
diff --git a/sdk/lib/_internal/vm/lib/math_patch.dart b/sdk/lib/_internal/vm/lib/math_patch.dart
index 270bbbc..ae7872c 100644
--- a/sdk/lib/_internal/vm/lib/math_patch.dart
+++ b/sdk/lib/_internal/vm/lib/math_patch.dart
@@ -164,43 +164,33 @@
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_atan2")
external double _atan2(double a, double b);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_sin")
external double _sin(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_cos")
external double _cos(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_tan")
external double _tan(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_acos")
external double _acos(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_asin")
external double _asin(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_atan")
external double _atan(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_sqrt")
external double _sqrt(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_exp")
external double _exp(double x);
@pragma("vm:recognized", "other")
@pragma("vm:prefer-inline")
-@pragma("vm:external-name", "Math_log")
external double _log(double x);
// TODO(iposva): Handle patch methods within a patch class correctly.
diff --git a/tools/VERSION b/tools/VERSION
index 9297733..9d9cc54 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 63
+PRERELEASE 64
PRERELEASE_PATCH 0
\ No newline at end of file