Version 2.17.0-140.0.dev
Merge commit '1d9fff9128f90cdea6b6499d96b919c8ca63f302' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.txt b/pkg/analysis_server/lib/src/services/correction/error_fix_status.txt
index 0c07171..33ffa22 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.txt
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.txt
@@ -5,12 +5,13 @@
* "fixes infeasible", if it has been deemed infeasible to write a fix for this code
Stats:
-* 793 "needs evaluation"
+* 809 "needs evaluation"
* 19 "needs fix"
* 253 "has fix(es)"
+* 2 "fixes infeasible"
-AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR: needs evaluation
-AnalysisOptionsErrorCode.PARSE_ERROR: needs evaluation
+AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR: fixes infeasible
+AnalysisOptionsErrorCode.PARSE_ERROR: fixes infeasible
AnalysisOptionsHintCode.PREVIEW_DART_2_SETTING_DEPRECATED: needs evaluation
AnalysisOptionsHintCode.STRONG_MODE_SETTING_DEPRECATED: needs evaluation
AnalysisOptionsHintCode.SUPER_MIXINS_SETTING_DEPRECATED: needs evaluation
@@ -60,6 +61,7 @@
CompileTimeErrorCode.CLASS_INSTANTIATION_ACCESS_TO_INSTANCE_MEMBER: needs evaluation; new in 2.15
CompileTimeErrorCode.CLASS_INSTANTIATION_ACCESS_TO_STATIC_MEMBER: needs evaluation; new in 2.15
CompileTimeErrorCode.CLASS_INSTANTIATION_ACCESS_TO_UNKNOWN_MEMBER: needs evaluation; new in 2.15
+CompileTimeErrorCode.CONCRETE_CLASS_HAS_ENUM_SUPERINTERFACE: needs evaluation; new in 2.17
CompileTimeErrorCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER: has fix(es)
CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_AND_STATIC_FIELD: needs evaluation
CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_AND_STATIC_GETTER: needs evaluation; new in 2.15
@@ -70,8 +72,10 @@
CompileTimeErrorCode.CONFLICTING_METHOD_AND_FIELD: needs evaluation
CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE: needs evaluation
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS: needs evaluation
+CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_ENUM: needs evaluation; new in 2.17
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION: needs evaluation
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS: needs evaluation
+CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_ENUM: needs evaluation; new in 2.17
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION: needs evaluation
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_MIXIN: needs evaluation
CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MIXIN: needs evaluation
@@ -124,6 +128,10 @@
CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT: needs evaluation
CompileTimeErrorCode.DUPLICATE_PART: needs evaluation
CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING: needs evaluation
+CompileTimeErrorCode.ENUM_CONSTANT_WITH_NON_CONST_CONSTRUCTOR: needs evaluation; new in 2.17
+CompileTimeErrorCode.ENUM_INSTANTIATED_TO_BOUNDS_IS_NOT_WELL_BOUNDED: needs evaluation; new in 2.17
+CompileTimeErrorCode.ENUM_MIXIN_WITH_INSTANCE_VARIABLE: needs evaluation; new in 2.17
+CompileTimeErrorCode.ENUM_WITH_ABSTRACT_MEMBER: needs evaluation; new in 2.17
CompileTimeErrorCode.EQUAL_ELEMENTS_IN_CONST_SET: needs evaluation
CompileTimeErrorCode.EQUAL_KEYS_IN_CONST_MAP: needs evaluation
CompileTimeErrorCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS: needs evaluation
@@ -173,6 +181,10 @@
CompileTimeErrorCode.IF_ELEMENT_CONDITION_FROM_DEFERRED_LIBRARY: needs evaluation
CompileTimeErrorCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE: has fix(es)
CompileTimeErrorCode.ILLEGAL_ASYNC_RETURN_TYPE: has fix(es)
+CompileTimeErrorCode.ILLEGAL_ENUM_VALUES_DECLARATION: needs evaluation; new in 2.17
+CompileTimeErrorCode.ILLEGAL_ENUM_VALUES_INHERITANCE: needs evaluation; new in 2.17
+CompileTimeErrorCode.ILLEGAL_LANGUAGE_VERSION_OVERRIDE: needs evaluation; new in 2.17
+CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX: needs evaluation; new in 2.17
CompileTimeErrorCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE: has fix(es)
CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS: needs evaluation
CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS: needs evaluation
@@ -181,8 +193,7 @@
CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS: needs evaluation
CompileTimeErrorCode.IMPLEMENTS_TYPE_ALIAS_EXPANDS_TO_TYPE_PARAMETER: needs evaluation
CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER: needs evaluation
-CompileTimeErrorCode.IMPLICIT_UNNAMED_SUPER_CONSTRUCTOR_INVOCATION_MISSING_REQUIRED_ARGUMENT: has fix(es)
-CompileTimeErrorCode.IMPLICIT_UNNAMED_SUPER_CONSTRUCTOR_INVOCATION_NOT_ENOUGH_POSITIONAL_ARGUMENTS: has fix(es)
+CompileTimeErrorCode.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS: has fix(es)
CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY: needs evaluation
CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY: needs evaluation
CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES: needs evaluation
@@ -221,6 +232,7 @@
CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR: needs evaluation
CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER: needs evaluation
CompileTimeErrorCode.INVALID_OVERRIDE: has fix(es)
+CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR: needs evaluation; new in 2.17
CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS: needs evaluation
CompileTimeErrorCode.INVALID_SUPER_FORMAL_PARAMETER_LOCATION: needs fix; new in 2.17
CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST: needs evaluation
@@ -286,6 +298,7 @@
CompileTimeErrorCode.NON_BOOL_EXPRESSION: needs evaluation
CompileTimeErrorCode.NON_BOOL_NEGATION_EXPRESSION: needs evaluation
CompileTimeErrorCode.NON_BOOL_OPERAND: needs evaluation
+CompileTimeErrorCode.NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR: needs evaluation; new in 2.17
CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT: needs evaluation
CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR: needs evaluation
CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION: needs evaluation
@@ -370,6 +383,7 @@
CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_TYPE_IS_NOT_SUBTYPE_OF_ASSOCIATED: needs fix; new in 2.17
CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_NAMED: needs evaluation; new in 2.17
CompileTimeErrorCode.SUPER_FORMAL_PARAMETER_WITHOUT_ASSOCIATED_POSITIONAL: needs fix; https://github.com/dart-lang/sdk/issues/48359
+CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR: needs evaluation; new in 2.17
CompileTimeErrorCode.SUPER_IN_EXTENSION: needs evaluation
CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT: needs evaluation
CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR: needs evaluation
@@ -401,6 +415,8 @@
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER: needs evaluation
CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT: has fix(es)
CompileTimeErrorCode.UNDEFINED_ENUM_CONSTANT: needs evaluation
+CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_NAMED: needs evaluation; new in 2.17
+CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_UNNAMED: needs evaluation; new in 2.17
CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER: has fix(es)
CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD: has fix(es)
CompileTimeErrorCode.UNDEFINED_EXTENSION_OPERATOR: needs evaluation
@@ -428,6 +444,7 @@
CompileTimeErrorCode.URI_WITH_INTERPOLATION: needs evaluation
CompileTimeErrorCode.USE_OF_NATIVE_EXTENSION: needs evaluation; compile-time error as of ~2.15
CompileTimeErrorCode.USE_OF_VOID_RESULT: needs evaluation
+CompileTimeErrorCode.VALUES_DECLARATION_IN_ENUM: needs evaluation; new in 2.17
CompileTimeErrorCode.VARIABLE_TYPE_MISMATCH: needs evaluation
CompileTimeErrorCode.WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE: needs evaluation
CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR: needs evaluation
@@ -436,6 +453,7 @@
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS: has fix(es)
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION: needs fix; new in 2.15
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR: has fix(es)
+CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_ENUM: needs evaluation; new in 2.17
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_EXTENSION: has fix(es)
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION: needs fix; new in ~2.15
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD: has fix(es)
@@ -881,6 +899,7 @@
ParserErrorCode.DUPLICATE_PREFIX: needs evaluation
ParserErrorCode.DUPLICATED_MODIFIER: needs evaluation
ParserErrorCode.EMPTY_ENUM_BODY: needs evaluation
+ParserErrorCode.ENUM_CONSTANT_WITH_TYPE_ARGUMENTS_WITHOUT_ARGUMENTS: needs evaluation; new in 2.17
ParserErrorCode.ENUM_IN_CLASS: needs evaluation
ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND: needs evaluation
ParserErrorCode.EXPECTED_BODY: needs evaluation
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 0696e46..11a88a6 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -218,7 +218,8 @@
CompileTimeErrorCode.ILLEGAL_ENUM_VALUES_DECLARATION,
CompileTimeErrorCode.ILLEGAL_ENUM_VALUES_INHERITANCE,
CompileTimeErrorCode.ILLEGAL_LANGUAGE_VERSION_OVERRIDE,
- CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX,
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION,
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE,
CompileTimeErrorCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE,
CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS,
CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
diff --git a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
index 16e5f20..dfa4a1e 100644
--- a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
@@ -225,16 +225,13 @@
void _resolveTypes(AssignmentExpressionImpl node,
{required Map<DartType, NonPromotionReason> Function()? whyNotPromoted}) {
DartType assignedType;
- DartType? implicitCallContext;
var rightHandSide = node.rightHandSide;
var operator = node.operator.type;
if (operator == TokenType.EQ) {
assignedType = rightHandSide.typeOrThrow;
- implicitCallContext = node.writeType;
} else if (operator == TokenType.QUESTION_QUESTION_EQ) {
assignedType = rightHandSide.typeOrThrow;
- implicitCallContext = node.writeType;
} else if (operator == TokenType.AMPERSAND_AMPERSAND_EQ ||
operator == TokenType.BAR_BAR_EQ) {
assignedType = _typeProvider.boolType;
@@ -255,11 +252,6 @@
}
}
- var callInsertion = _resolver.insertImplicitCallReference(rightHandSide,
- context: implicitCallContext);
- if (callInsertion != null) {
- assignedType = callInsertion.staticType;
- }
DartType nodeType;
if (operator == TokenType.QUESTION_QUESTION_EQ) {
var leftType = node.readType!;
diff --git a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
index 5c56ff1..dcde026 100644
--- a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
@@ -119,7 +119,6 @@
node.typeArguments?.accept(_resolver);
_resolveElements(node.elements, context);
- _insertImplicitCallReferences(node);
_resolveListLiteral2(node);
}
@@ -179,7 +178,6 @@
node.typeArguments?.accept(_resolver);
_resolveElements(node.elements, context);
- _insertImplicitCallReferences(node);
_resolveSetOrMapLiteral2(node);
}
@@ -623,34 +621,6 @@
);
}
- void _insertImplicitCallReference(CollectionElement? node) {
- if (node is Expression) {
- _resolver.insertImplicitCallReference(node);
- } else if (node is MapLiteralEntry) {
- _insertImplicitCallReference(node.key);
- _insertImplicitCallReference(node.value);
- } else if (node is IfElement) {
- _insertImplicitCallReference(node.thenElement);
- _insertImplicitCallReference(node.elseElement);
- } else if (node is ForElement) {
- _insertImplicitCallReference(node.body);
- }
- // Nothing to do for [SpreadElement] as analyzer does not desugar this
- // element.
- }
-
- void _insertImplicitCallReferences(TypedLiteral node) {
- if (node is ListLiteral) {
- for (var element in node.elements) {
- _insertImplicitCallReference(element);
- }
- } else if (node is SetOrMapLiteral) {
- for (var element in node.elements) {
- _insertImplicitCallReference(element);
- }
- }
- }
-
void _resolveElements(
List<CollectionElement> elements, CollectionLiteralContext? context) {
for (var element in elements) {
diff --git a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
index 6ae7fe4..17d7f04 100644
--- a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
@@ -64,11 +64,6 @@
_resolver.flowAnalysis.flow?.lateInitializer_end();
}
- var callInsertion = _resolver.insertImplicitCallReference(initializer);
- if (callInsertion != null) {
- initializer = callInsertion.expression;
- }
-
// Initializers of top-level variables and fields are already included
// into elements during linking.
if (element is ConstLocalVariableElementImpl) {
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index 1b03e56..ff21e56 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -5759,6 +5759,33 @@
hasPublishedDocs: true,
);
+ /**
+ * Parameters:
+ * 0: the name of member that cannot be declared
+ */
+ static const CompileTimeErrorCode ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION =
+ CompileTimeErrorCode(
+ 'ILLEGAL_CONCRETE_ENUM_MEMBER',
+ "A concrete instance member named '{0}' can't be declared in a class that "
+ "implements 'Enum'.",
+ correctionMessage: "Try using a different name.",
+ uniqueName: 'ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION',
+ );
+
+ /**
+ * Parameters:
+ * 0: the name of member that cannot be inherited
+ * 1: the name of the class that declares the member
+ */
+ static const CompileTimeErrorCode ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE =
+ CompileTimeErrorCode(
+ 'ILLEGAL_CONCRETE_ENUM_MEMBER',
+ "A concrete instance member named '{0}' can't be inherited from '{1}' in a "
+ "class that implements 'Enum'.",
+ correctionMessage: "Try using a different name.",
+ uniqueName: 'ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE',
+ );
+
static const CompileTimeErrorCode ILLEGAL_ENUM_VALUES_DECLARATION =
CompileTimeErrorCode(
'ILLEGAL_ENUM_VALUES',
@@ -5789,14 +5816,6 @@
"Try removing the language version override and migrating the code.",
);
- static const CompileTimeErrorCode ILLEGAL_NON_ABSTRACT_ENUM_INDEX =
- CompileTimeErrorCode(
- 'ILLEGAL_NON_ABSTRACT_ENUM_INDEX',
- "A non-abstract instance member named 'index' can't be declared in a class "
- "that implements 'Enum'.",
- correctionMessage: "Try using a different name.",
- );
-
/**
* No parameters.
*/
diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart
index d8c9d62..b55e65d 100644
--- a/pkg/analyzer/lib/src/error/inheritance_override.dart
+++ b/pkg/analyzer/lib/src/error/inheritance_override.dart
@@ -201,7 +201,7 @@
_checkIllegalEnumValuesDeclaration(field.name);
}
if (!member.isStatic) {
- _checkIllegalNonAbstractEnumIndex(field.name);
+ _checkIllegalConcreteEnumMemberDeclaration(field.name);
}
}
} else if (member is MethodDeclaration) {
@@ -212,15 +212,16 @@
_checkDeclaredMember(member.name, libraryUri, member.declaredElement,
methodParameterNodes: member.parameters?.parameters);
+ if (!(member.isStatic || member.isAbstract || member.isSetter)) {
+ _checkIllegalConcreteEnumMemberDeclaration(member.name);
+ }
if (!member.isStatic && !classElement.isEnum) {
_checkIllegalEnumValuesDeclaration(member.name);
}
- if (!(member.isStatic || member.isAbstract || member.isSetter)) {
- _checkIllegalNonAbstractEnumIndex(member.name);
- }
}
}
+ _checkIllegalConcreteEnumMemberInheritance();
_checkIllegalEnumValuesInheritance();
GetterSetterTypesVerifier(
@@ -639,6 +640,44 @@
return false;
}
+ void _checkIllegalConcreteEnumMemberDeclaration(SimpleIdentifier name) {
+ if (implementsDartCoreEnum &&
+ const {'index', 'hashCode', '=='}.contains(name.name)) {
+ reporter.reportErrorForNode(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION,
+ name,
+ [name.name],
+ );
+ }
+ }
+
+ void _checkIllegalConcreteEnumMemberInheritance() {
+ // We ignore mixins because they don't inherit and members.
+ // But to support `super.foo()` invocations we put members from superclass
+ // constraints into the `superImplemented` bucket, the same we look below.
+ if (classElement.isMixin) {
+ return;
+ }
+
+ if (implementsDartCoreEnum) {
+ var concreteMap = inheritance.getInheritedConcreteMap2(classElement);
+ for (var memberName in const ['hashCode', '==']) {
+ var member = concreteMap[Name(libraryUri, memberName)];
+ if (member != null) {
+ var enclosingClass = member.enclosingElement;
+ if (enclosingClass is ClassElement &&
+ !enclosingClass.isDartCoreObject) {
+ reporter.reportErrorForNode(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE,
+ classNameNode,
+ [memberName, enclosingClass.name],
+ );
+ }
+ }
+ }
+ }
+ }
+
void _checkIllegalEnumValuesDeclaration(SimpleIdentifier name) {
if (implementsDartCoreEnum && name.name == 'values') {
reporter.reportErrorForNode(
@@ -669,15 +708,6 @@
}
}
- void _checkIllegalNonAbstractEnumIndex(SimpleIdentifier name) {
- if (implementsDartCoreEnum && name.name == 'index') {
- reporter.reportErrorForNode(
- CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX,
- name,
- );
- }
- }
-
/// Return the error code that should be used when the given class [element]
/// references itself directly.
ErrorCode _getRecursiveErrorCode(ClassElement element) {
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 4e32f72..97dc545 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -8,6 +8,7 @@
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/syntactic_entity.dart';
+import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
@@ -78,18 +79,6 @@
/// promoted.
typedef WhyNotPromotedGetter = Map<DartType, NonPromotionReason> Function();
-/// Data structure describing the result of inserting an implicit call reference
-/// into the AST.
-class ImplicitCallInsertionResult {
- /// The expression that was inserted.
- final ImplicitCallReferenceImpl expression;
-
- /// The type of the implicit call tear-off.
- final FunctionType staticType;
-
- ImplicitCallInsertionResult(this.expression, this.staticType);
-}
-
/// Maintains and manages contextual type information used for
/// inferring types.
class InferenceContext {
@@ -541,13 +530,6 @@
/// See [CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE].
void checkForArgumentTypesNotAssignableInList(ArgumentList argumentList,
List<WhyNotPromotedGetter> whyNotPromotedList) {
- for (var argument in argumentList.arguments) {
- if (argument is NamedExpression) {
- insertImplicitCallReference(argument.expression);
- } else {
- insertImplicitCallReference(argument);
- }
- }
var arguments = argumentList.arguments;
for (int i = 0; i < arguments.length; i++) {
checkForArgumentTypeNotAssignableForArgument(arguments[i],
@@ -809,66 +791,6 @@
return genericFunctionInstantiation;
}
- /// If `expression` should be treated as `expression.call`, inserts an
- /// [ImplicitCallReference] node which wraps [expression].
- ///
- /// If an [ImplicitCallReference] is inserted, returns an
- /// [ImplicitCallInsertionResult] describing what was changed; otherwise,
- /// returns `null`.
- ImplicitCallInsertionResult? insertImplicitCallReference(
- Expression expression,
- {DartType? context}) {
- expression as ExpressionImpl;
- var parent = expression.parent;
- if (parent is CascadeExpression && parent.target == expression) {
- // Do not perform an "implicit tear-off conversion" here. It should only
- // be performed on [parent]. See
- // https://github.com/dart-lang/language/issues/1873.
- return null;
- }
- context ??= InferenceContext.getContext(expression);
- var callMethod =
- getImplicitCallMethod(expression.typeOrThrow, context, expression);
- if (callMethod == null || context == null) {
- return null;
- }
-
- // `expression` is to be treated as `expression.call`.
- context = typeSystem.flatten(context);
- var callMethodType = callMethod.type;
- List<DartType> typeArgumentTypes;
- if (isConstructorTearoffsEnabled &&
- callMethodType.typeFormals.isNotEmpty &&
- context is FunctionType) {
- typeArgumentTypes = typeSystem.inferFunctionTypeInstantiation(
- context,
- callMethodType,
- errorReporter: errorReporter,
- errorNode: expression,
- // If the constructor-tearoffs feature is enabled, then so is
- // generic-metadata.
- genericMetadataIsEnabled: true,
- )!;
- if (typeArgumentTypes.isNotEmpty) {
- callMethodType = callMethodType.instantiate(typeArgumentTypes);
- }
- } else {
- typeArgumentTypes = [];
- }
-
- var callReference = astFactory.implicitCallReference(
- expression: expression,
- staticElement: callMethod,
- typeArguments: null,
- typeArgumentTypes: typeArgumentTypes,
- );
- NodeReplacer.replace(expression, callReference, parent: parent);
-
- callReference.staticType = callMethodType;
-
- return ImplicitCallInsertionResult(callReference, callMethodType);
- }
-
/// If we reached a null-shorting termination, and the [node] has null
/// shorting, make the type of the [node] nullable.
void nullShortingTermination(ExpressionImpl node,
@@ -1176,7 +1098,7 @@
node.visitChildren(this);
typeAnalyzer.visitAsExpression(node as AsExpressionImpl);
flowAnalysis.asExpression(node);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
@@ -1210,7 +1132,7 @@
@override
void visitAssignmentExpression(AssignmentExpression node) {
_assignmentExpressionResolver.resolve(node as AssignmentExpressionImpl);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
@@ -1223,7 +1145,7 @@
checkUnreachableNode(node);
analyzeExpression(node.expression, futureUnion);
typeAnalyzer.visitAwaitExpression(node as AwaitExpressionImpl);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
@@ -1234,7 +1156,7 @@
node, InferenceContext.getContext(node));
}
_binaryExpressionResolver.resolve(node as BinaryExpressionImpl);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
@@ -1291,6 +1213,7 @@
typeAnalyzer.visitCascadeExpression(node);
nullShortingTermination(node);
+ _insertImplicitCallReference(node);
}
@override
@@ -1386,6 +1309,7 @@
elseExpression = node.elseExpression;
typeAnalyzer.visitConditionalExpression(node as ConditionalExpressionImpl);
+ _insertImplicitCallReference(node);
}
@override
@@ -1447,13 +1371,6 @@
elementResolver.visitConstructorFieldInitializer(
node as ConstructorFieldInitializerImpl);
if (fieldElement != null) {
- if (fieldType != null && expression.staticType != null) {
- var callReference = insertImplicitCallReference(expression)?.expression;
- if (callReference != null) {
- checkForInvalidAssignment(node.fieldName, callReference,
- whyNotPromoted: whyNotPromoted);
- }
- }
var enclosingConstructor = enclosingFunction as ConstructorElement;
checkForFieldInitializerNotAssignable(node, fieldElement,
isConstConstructor: enclosingConstructor.isConst,
@@ -1470,6 +1387,7 @@
@override
void visitConstructorReference(covariant ConstructorReferenceImpl node) {
_constructorReferenceResolver.resolve(node);
+ _insertImplicitCallReference(node);
}
@override
@@ -1674,7 +1592,6 @@
node.expression,
inferenceContext.bodyContext!.contextType,
);
- insertImplicitCallReference(node.expression);
flowAnalysis.flow?.handleExit();
@@ -1845,9 +1762,10 @@
_functionExpressionInvocationResolver.resolve(
node as FunctionExpressionInvocationImpl, whyNotPromotedList);
nullShortingTermination(node);
- insertGenericFunctionInstantiation(node);
+ var replacement = insertGenericFunctionInstantiation(node);
checkForArgumentTypesNotAssignableInList(
node.argumentList, whyNotPromotedList);
+ _insertImplicitCallReference(replacement);
}
@override
@@ -1989,15 +1907,17 @@
type = DynamicTypeImpl.instance;
}
inferenceHelper.recordStaticType(node, type);
- insertGenericFunctionInstantiation(node);
+ var replacement = insertGenericFunctionInstantiation(node);
nullShortingTermination(node);
+ _insertImplicitCallReference(replacement);
}
@override
void visitInstanceCreationExpression(
covariant InstanceCreationExpressionImpl node) {
_instanceCreationExpressionResolver.resolve(node);
+ _insertImplicitCallReference(node);
}
@override
@@ -2132,9 +2052,10 @@
} else {
nullShortingTermination(node);
}
- insertGenericFunctionInstantiation(node);
+ var replacement = insertGenericFunctionInstantiation(node);
checkForArgumentTypesNotAssignableInList(
node.argumentList, whyNotPromotedList);
+ _insertImplicitCallReference(replacement);
}
@override
@@ -2229,19 +2150,19 @@
@override
void visitPostfixExpression(PostfixExpression node) {
_postfixExpressionResolver.resolve(node as PostfixExpressionImpl);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
void visitPrefixedIdentifier(covariant PrefixedIdentifierImpl node) {
_prefixedIdentifierResolver.resolve(node);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
void visitPrefixExpression(PrefixExpression node) {
_prefixExpressionResolver.resolve(node as PrefixExpressionImpl);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
@@ -2283,9 +2204,10 @@
inferenceHelper.recordStaticType(propertyName, type);
inferenceHelper.recordStaticType(node, type);
- insertGenericFunctionInstantiation(node);
+ var replacement = insertGenericFunctionInstantiation(node);
nullShortingTermination(node);
+ _insertImplicitCallReference(replacement);
}
@override
@@ -2328,10 +2250,6 @@
inferenceContext.bodyContext?.addReturnExpression(expression);
flowAnalysis.flow?.handleExit();
-
- if (expression != null) {
- insertImplicitCallReference(expression);
- }
}
@override
@@ -2353,7 +2271,7 @@
@override
void visitSimpleIdentifier(covariant SimpleIdentifierImpl node) {
_simpleIdentifierResolver.resolve(node);
- insertGenericFunctionInstantiation(node);
+ _insertImplicitCallReference(insertGenericFunctionInstantiation(node));
}
@override
@@ -2494,6 +2412,7 @@
checkUnreachableNode(node);
node.visitChildren(this);
typeAnalyzer.visitThisExpression(node as ThisExpressionImpl);
+ _insertImplicitCallReference(node);
}
@override
@@ -2658,6 +2577,62 @@
return typeProvider.futureOrType(type);
}
+ /// If `expression` should be treated as `expression.call`, inserts an
+ /// [ImplicitCallReference] node which wraps [expression].
+ void _insertImplicitCallReference(ExpressionImpl expression) {
+ var parent = expression.parent;
+ if (_shouldSkipImplicitCallReferenceDueToForm(expression, parent)) {
+ return;
+ }
+ var staticType = expression.staticType;
+ if (staticType == null) {
+ return;
+ }
+ DartType? context;
+ if (parent is AssignmentExpression) {
+ context = parent.writeType;
+ } else {
+ context = InferenceContext.getContext(expression);
+ }
+ var callMethod = getImplicitCallMethod(staticType, context, expression);
+ if (callMethod == null || context == null) {
+ return;
+ }
+
+ // `expression` is to be treated as `expression.call`.
+ context = typeSystem.flatten(context);
+ var callMethodType = callMethod.type;
+ List<DartType> typeArgumentTypes;
+ if (isConstructorTearoffsEnabled &&
+ callMethodType.typeFormals.isNotEmpty &&
+ context is FunctionType) {
+ typeArgumentTypes = typeSystem.inferFunctionTypeInstantiation(
+ context,
+ callMethodType,
+ errorReporter: errorReporter,
+ errorNode: expression,
+ // If the constructor-tearoffs feature is enabled, then so is
+ // generic-metadata.
+ genericMetadataIsEnabled: true,
+ )!;
+ if (typeArgumentTypes.isNotEmpty) {
+ callMethodType = callMethodType.instantiate(typeArgumentTypes);
+ }
+ } else {
+ typeArgumentTypes = [];
+ }
+
+ var callReference = astFactory.implicitCallReference(
+ expression: expression,
+ staticElement: callMethod,
+ typeArguments: null,
+ typeArgumentTypes: typeArgumentTypes,
+ );
+ NodeReplacer.replace(expression, callReference, parent: parent);
+
+ callReference.staticType = callMethodType;
+ }
+
/// Continues resolution of a [FunctionExpressionInvocation] that was created
/// from a rewritten [MethodInvocation]. The target function is already
/// resolved.
@@ -2702,6 +2677,34 @@
}
}
+ bool _shouldSkipImplicitCallReferenceDueToForm(
+ Expression expression, AstNode? parent) {
+ while (parent is ParenthesizedExpression) {
+ expression = parent;
+ parent = expression.parent;
+ }
+ if (parent is CascadeExpression && parent.target == expression) {
+ // Do not perform an "implicit tear-off conversion" here. It should only
+ // be performed on [parent]. See
+ // https://github.com/dart-lang/language/issues/1873.
+ return true;
+ }
+ if (parent is ConditionalExpression &&
+ (parent.thenExpression == expression ||
+ parent.elseExpression == expression)) {
+ // Do not perform an "implicit tear-off conversion" on the branches of a
+ // conditional expression.
+ return true;
+ }
+ if (parent is BinaryExpression &&
+ parent.operator.type == TokenType.QUESTION_QUESTION) {
+ // Do not perform an "implicit tear-off conversion" on the branches of a
+ // `??` operator.
+ return true;
+ }
+ return false;
+ }
+
/// Given an [argumentList] and the [parameters] related to the element that
/// will be invoked using those arguments, compute the list of parameters that
/// correspond to the list of arguments.
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index 78f3e39..9884045 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -5041,9 +5041,21 @@
ILLEGAL_LANGUAGE_VERSION_OVERRIDE:
problemMessage: The language version must be {0}.
correctionMessage: Try removing the language version override and migrating the code.
- ILLEGAL_NON_ABSTRACT_ENUM_INDEX:
- problemMessage: A non-abstract instance member named 'index' can't be declared in a class that implements 'Enum'.
+ ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION:
+ sharedName: ILLEGAL_CONCRETE_ENUM_MEMBER
+ problemMessage: A concrete instance member named '{0}' can't be declared in a class that implements 'Enum'.
correctionMessage: Try using a different name.
+ comment: |-
+ Parameters:
+ 0: the name of member that cannot be declared
+ ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE:
+ sharedName: ILLEGAL_CONCRETE_ENUM_MEMBER
+ problemMessage: A concrete instance member named '{0}' can't be inherited from '{1}' in a class that implements 'Enum'.
+ correctionMessage: Try using a different name.
+ comment: |-
+ Parameters:
+ 0: the name of member that cannot be inherited
+ 1: the name of the class that declares the member
ILLEGAL_SYNC_GENERATOR_RETURN_TYPE:
problemMessage: "Functions marked 'sync*' must have a return type that is a supertype of 'Iterable<T>' for some type 'T'."
correctionMessage: "Try fixing the return type of the function, or removing the modifier 'sync*' from the function body."
diff --git a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
index 50d0ec5..77954c0 100644
--- a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
@@ -47,6 +47,38 @@
);
}
+ test_conditional_else() async {
+ await assertNoErrorsInCode('''
+abstract class A {}
+abstract class C extends A {
+ void call();
+}
+void Function() f(A a, bool b, C c, dynamic d) => b ? d : (b ? a : c);
+''');
+ // `c` is in the "else" position of a conditional expression, so implicit
+ // call tearoff logic should not apply to it.
+ var expr = findNode.conditionalExpression('b ? a : c');
+ expect(expr.thenExpression, TypeMatcher<SimpleIdentifier>());
+ // Therefore the type of `b ? a : c` should be `A`.
+ assertType(expr, 'A');
+ }
+
+ test_conditional_then() async {
+ await assertNoErrorsInCode('''
+abstract class A {}
+abstract class C extends A {
+ void call();
+}
+void Function() f(A a, bool b, C c, dynamic d) => b ? d : (b ? c : a);
+''');
+ // `c` is in the "then" position of a conditional expression, so implicit
+ // call tearoff logic should not apply to it.
+ var expr = findNode.conditionalExpression('b ? c : a');
+ expect(expr.thenExpression, TypeMatcher<SimpleIdentifier>());
+ // Therefore the type of `b ? c : a` should be `A`.
+ assertType(expr, 'A');
+ }
+
test_explicitTypeArguments() async {
await assertNoErrorsInCode('''
class C {
@@ -66,7 +98,26 @@
);
}
- test_ifNull() async {
+ test_ifNull_lhs() async {
+ await assertErrorsInCode('''
+abstract class A {}
+abstract class C extends A {
+ void call();
+}
+
+void Function() f(A a, bool b, C c, dynamic d) => b ? d : c ?? a;
+''', [
+ error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 130, 1),
+ ]);
+ // `c` is on the LHS of an if-null expression, so implicit call tearoff
+ // logic should not apply to it.
+ var expr = findNode.binary('c ?? a');
+ expect(expr.leftOperand, TypeMatcher<SimpleIdentifier>());
+ // Therefore the type of `c ?? a` should be `A`.
+ assertType(expr, 'A');
+ }
+
+ test_ifNull_rhs() async {
await assertNoErrorsInCode('''
abstract class C {
void call(int t) => t;
@@ -163,6 +214,16 @@
);
}
+ test_parenthesized_cascade_target() async {
+ await assertNoErrorsInCode('''
+abstract class C {
+ void call();
+ void m();
+}
+void Function() f(C c) => (c)..m();
+''');
+ }
+
test_prefixedIdentifier() async {
await assertNoErrorsInCode('''
abstract class C {
diff --git a/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart b/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
index 6cb3570..3456bd6 100644
--- a/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/function_reference_test.dart
@@ -28,10 +28,71 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('as void Function<T>(T);'),
- null,
- 'void Function(int)');
+ assertResolvedNodeText(
+ findNode.functionReference('as void Function<T>(T);'), r'''
+FunctionReference
+ function: AsExpression
+ expression: ParenthesizedExpression
+ leftParenthesis: (
+ expression: AsExpression
+ expression: SimpleIdentifier
+ token: f
+ staticElement: f@43
+ staticType: void Function<T>(T)
+ asOperator: as
+ type: NamedType
+ name: SimpleIdentifier
+ token: dynamic
+ staticElement: dynamic@-1
+ staticType: null
+ type: dynamic
+ staticType: dynamic
+ rightParenthesis: )
+ staticType: dynamic
+ asOperator: as
+ type: GenericFunctionType
+ returnType: NamedType
+ name: SimpleIdentifier
+ token: void
+ staticElement: <null>
+ staticType: null
+ type: void
+ functionKeyword: Function
+ typeParameters: TypeParameterList
+ leftBracket: <
+ typeParameters
+ TypeParameter
+ name: SimpleIdentifier
+ token: T
+ staticElement: T@89
+ staticType: null
+ declaredElement: T@89
+ rightBracket: >
+ parameters: FormalParameterList
+ leftParenthesis: (
+ parameter: SimpleFormalParameter
+ type: NamedType
+ name: SimpleIdentifier
+ token: T
+ staticElement: T@89
+ staticType: null
+ type: T
+ declaredElement: @-1
+ declaredElementType: T
+ rightParenthesis: )
+ declaredElement: GenericFunctionTypeElement
+ parameters
+ <empty>
+ kind: required positional
+ type: T
+ returnType: void
+ type: void Function<T>(T)
+ type: void Function<T>(T)
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_assignmentExpression() async {
@@ -42,8 +103,28 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('g = f;'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('g = f;'), r'''
+FunctionReference
+ function: AssignmentExpression
+ leftHandSide: SimpleIdentifier
+ token: g
+ staticElement: <null>
+ staticType: null
+ operator: =
+ rightHandSide: SimpleIdentifier
+ token: f
+ staticElement: f@71
+ staticType: void Function<T>(T)
+ readElement: <null>
+ readType: null
+ writeElement: self::@setter::g
+ writeType: void Function<T>(T)
+ staticElement: <null>
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_assignmentExpression_compound() async {
@@ -59,8 +140,27 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('f += 1'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('f += 1'), r'''
+FunctionReference
+ function: AssignmentExpression
+ leftHandSide: SimpleIdentifier
+ token: f
+ staticElement: f@144
+ staticType: null
+ operator: +=
+ rightHandSide: IntegerLiteral
+ literal: 1
+ staticType: int
+ readElement: f@144
+ readType: void Function<T>(T)
+ writeElement: f@144
+ writeType: void Function<T>(T)
+ staticElement: self::@extension::extension-0::@method::+
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_awaitExpression() async {
@@ -70,8 +170,19 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('await f'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('await f'), r'''
+FunctionReference
+ function: AwaitExpression
+ awaitKeyword: await
+ expression: SimpleIdentifier
+ token: f
+ staticElement: f@59
+ staticType: Future<void Function<T>(T)>
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_binaryExpression() async {
@@ -87,8 +198,24 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('c + 1'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('c + 1'), r'''
+FunctionReference
+ function: BinaryExpression
+ leftOperand: SimpleIdentifier
+ token: c
+ staticElement: c@108
+ staticType: C
+ operator: +
+ rightOperand: IntegerLiteral
+ literal: 1
+ staticType: int
+ staticElement: self::@class::C::@method::+
+ staticInvokeType: void Function<T>(T) Function(int)
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_cascadeExpression() async {
@@ -98,8 +225,16 @@
}
''');
- assertFunctionReference(findNode.functionReference('f..toString()'), null,
- 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('f..toString()'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: f
+ staticElement: f@43
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_constructorReference() async {
@@ -128,8 +263,45 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('<T>(T a) {};'), null, 'Null Function(int)');
+ assertResolvedNodeText(findNode.functionReference('<T>(T a) {};'), r'''
+FunctionReference
+ function: FunctionExpression
+ typeParameters: TypeParameterList
+ leftBracket: <
+ typeParameters
+ TypeParameter
+ name: SimpleIdentifier
+ token: T
+ staticElement: T@37
+ staticType: null
+ declaredElement: T@37
+ rightBracket: >
+ parameters: FormalParameterList
+ leftParenthesis: (
+ parameter: SimpleFormalParameter
+ type: NamedType
+ name: SimpleIdentifier
+ token: T
+ staticElement: T@37
+ staticType: null
+ type: T
+ identifier: SimpleIdentifier
+ token: a
+ staticElement: a@42
+ staticType: null
+ declaredElement: a@42
+ declaredElementType: T
+ rightParenthesis: )
+ body: BlockFunctionBody
+ block: Block
+ leftBracket: {
+ rightBracket: }
+ declaredElement: @36
+ staticType: Null Function<T>(T)
+ staticType: Null Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_functionExpressionInvocation() async {
@@ -139,8 +311,27 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('(f)()'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('(f)()'), r'''
+FunctionReference
+ function: FunctionExpressionInvocation
+ function: ParenthesizedExpression
+ leftParenthesis: (
+ expression: SimpleIdentifier
+ token: f
+ staticElement: f@54
+ staticType: void Function<T>(T) Function()
+ rightParenthesis: )
+ staticType: void Function<T>(T) Function()
+ argumentList: ArgumentList
+ leftParenthesis: (
+ rightParenthesis: )
+ staticElement: <null>
+ staticInvokeType: void Function<T>(T) Function()
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_functionReference() async {
@@ -152,8 +343,16 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('f;'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('f;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: f
+ staticElement: f@61
+ staticType: void Function<U>(U)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_implicitCallReference() async {
@@ -178,8 +377,26 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('f[0];'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('f[0];'), r'''
+FunctionReference
+ function: IndexExpression
+ target: SimpleIdentifier
+ token: f
+ staticElement: f@49
+ staticType: List<void Function<T>(T)>
+ leftBracket: [
+ index: IntegerLiteral
+ literal: 0
+ staticType: int
+ rightBracket: ]
+ staticElement: MethodMember
+ base: dart:core::@class::List::@method::[]
+ substitution: {E: void Function<T>(T)}
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_methodInvocation() async {
@@ -194,8 +411,27 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('c.m();'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('c.m();'), r'''
+FunctionReference
+ function: MethodInvocation
+ target: SimpleIdentifier
+ token: c
+ staticElement: c@100
+ staticType: C
+ operator: .
+ methodName: SimpleIdentifier
+ token: m
+ staticElement: self::@class::C::@method::m
+ staticType: void Function<T>(T) Function()
+ argumentList: ArgumentList
+ leftParenthesis: (
+ rightParenthesis: )
+ staticInvokeType: void Function<T>(T) Function()
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_postfixExpression_compound() async {
@@ -211,8 +447,24 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('f++'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('f++'), r'''
+FunctionReference
+ function: PostfixExpression
+ operand: SimpleIdentifier
+ token: f
+ staticElement: f@144
+ staticType: null
+ operator: ++
+ readElement: f@144
+ readType: void Function<T>(T)
+ writeElement: f@144
+ writeType: void Function<T>(T)
+ staticElement: self::@extension::extension-0::@method::+
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_prefixedIdentifier() async {
@@ -226,8 +478,24 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('c.f;'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('c.f;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: c
+ staticElement: c@68
+ staticType: C
+ period: .
+ identifier: SimpleIdentifier
+ token: f
+ staticElement: self::@class::C::@getter::f
+ staticType: void Function<T>(T)
+ staticElement: self::@class::C::@getter::f
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_prefixExpression_compound() async {
@@ -243,8 +511,24 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('++f'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('++f'), r'''
+FunctionReference
+ function: PrefixExpression
+ operator: ++
+ operand: SimpleIdentifier
+ token: f
+ staticElement: f@144
+ staticType: null
+ readElement: f@144
+ readType: void Function<T>(T)
+ writeElement: f@144
+ writeType: void Function<T>(T)
+ staticElement: self::@extension::extension-0::@method::+
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_propertyAccess() async {
@@ -258,8 +542,27 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('(c).f;'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('(c).f;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: ParenthesizedExpression
+ leftParenthesis: (
+ expression: SimpleIdentifier
+ token: c
+ staticElement: c@68
+ staticType: C
+ rightParenthesis: )
+ staticType: C
+ operator: .
+ propertyName: SimpleIdentifier
+ token: f
+ staticElement: self::@class::C::@getter::f
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_simpleIdentifier() async {
@@ -269,8 +572,16 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('f;'), null, 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('f;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: f
+ staticElement: f@43
+ staticType: void Function<T>(T)
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
}
@@ -285,8 +596,41 @@
var x = (A.foo)<int>;
''');
- assertFunctionReference(findNode.functionReference('(A.foo)<int>;'),
- findElement.constructor('foo'), 'A<int> Function()');
+ assertResolvedNodeText(findNode.functionReference('(A.foo)<int>;'), r'''
+FunctionReference
+ function: ParenthesizedExpression
+ leftParenthesis: (
+ expression: ConstructorReference
+ constructorName: ConstructorName
+ type: NamedType
+ name: SimpleIdentifier
+ token: A
+ staticElement: self::@class::A
+ staticType: null
+ type: null
+ period: .
+ name: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@constructor::foo
+ staticType: null
+ staticElement: self::@class::A::@constructor::foo
+ staticType: A<T> Function<T>()
+ rightParenthesis: )
+ staticType: A<T> Function<T>()
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: A<int> Function()
+ typeArgumentTypes
+ int
+''');
}
test_constructorFunction_unnamed() async {
@@ -298,8 +642,41 @@
var x = (A.new)<int>;
''');
- assertFunctionReference(findNode.functionReference('(A.new)<int>;'),
- findElement.unnamedConstructor('A'), 'A<int> Function()');
+ assertResolvedNodeText(findNode.functionReference('(A.new)<int>;'), r'''
+FunctionReference
+ function: ParenthesizedExpression
+ leftParenthesis: (
+ expression: ConstructorReference
+ constructorName: ConstructorName
+ type: NamedType
+ name: SimpleIdentifier
+ token: A
+ staticElement: self::@class::A
+ staticType: null
+ type: null
+ period: .
+ name: SimpleIdentifier
+ token: new
+ staticElement: self::@class::A::@constructor::•
+ staticType: null
+ staticElement: self::@class::A::@constructor::•
+ staticType: A<T> Function<T>()
+ rightParenthesis: )
+ staticType: A<T> Function<T>()
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: A<int> Function()
+ typeArgumentTypes
+ int
+''');
}
test_constructorReference() async {
@@ -315,8 +692,35 @@
messageContains: ["'A.foo'"]),
]);
- assertFunctionReference(findNode.functionReference('A.foo<int>;'),
- findElement.constructor('foo'), 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('A.foo<int>;'), r'''
+FunctionReference
+ function: ConstructorReference
+ constructorName: ConstructorName
+ type: NamedType
+ name: SimpleIdentifier
+ token: A
+ staticElement: self::@class::A
+ staticType: null
+ type: null
+ period: .
+ name: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@constructor::foo
+ staticType: null
+ staticElement: self::@class::A::@constructor::foo
+ staticType: A<T> Function<T>()
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_constructorReference_prefixed() async {
@@ -328,14 +732,44 @@
5,
messageContains: ["'a.Future.delayed'"]),
]);
- assertFunctionReference(
- findNode.functionReference('a.Future.delayed<int>;'),
- findElement
- .import('dart:async')
- .importedLibrary!
- .getType('Future')!
- .getNamedConstructor('delayed'),
- 'dynamic');
+ assertResolvedNodeText(
+ findNode.functionReference('a.Future.delayed<int>;'), r'''
+FunctionReference
+ function: ConstructorReference
+ constructorName: ConstructorName
+ type: NamedType
+ name: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@prefix::a
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: Future
+ staticElement: dart:async::@class::Future
+ staticType: null
+ staticElement: dart:async::@class::Future
+ staticType: null
+ type: null
+ period: .
+ name: SimpleIdentifier
+ token: delayed
+ staticElement: dart:async::@class::Future::@constructor::delayed
+ staticType: null
+ staticElement: dart:async::@class::Future::@constructor::delayed
+ staticType: Future<T> Function<T>(Duration, [FutureOr<T> Function()?])
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_dynamicTyped() async {
@@ -350,8 +784,24 @@
CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION, 31, 1),
]);
- assertFunctionReference(findNode.functionReference('i<int>;'),
- findElement.topGet('i'), 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('i<int>;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: i
+ staticElement: self::@getter::i
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_dynamicTyped_targetOfMethodCall() async {
@@ -366,8 +816,24 @@
CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION, 31, 1),
]);
- assertFunctionReference(findNode.functionReference('i<int>.foo();'),
- findElement.topGet('i'), 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('i<int>.foo();'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: i
+ staticElement: self::@getter::i
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_explicitReceiver_dynamicTyped() async {
@@ -382,10 +848,38 @@
29, 23),
]);
- assertFunctionReference(
- findNode.functionReference('f().instanceMethod<int>;'),
- null,
- 'dynamic');
+ assertResolvedNodeText(
+ findNode.functionReference('f().instanceMethod<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: MethodInvocation
+ methodName: SimpleIdentifier
+ token: f
+ staticElement: self::@function::f
+ staticType: dynamic Function()
+ argumentList: ArgumentList
+ leftParenthesis: (
+ rightParenthesis: )
+ staticInvokeType: dynamic Function()
+ staticType: dynamic
+ operator: .
+ propertyName: SimpleIdentifier
+ token: instanceMethod
+ staticElement: <null>
+ staticType: dynamic
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_explicitReceiver_unknown() async {
@@ -397,8 +891,32 @@
error(CompileTimeErrorCode.UNDEFINED_IDENTIFIER, 10, 1),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: <null>
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_explicitReceiver_unknown_multipleProperties() async {
@@ -414,8 +932,39 @@
error(CompileTimeErrorCode.UNDEFINED_IDENTIFIER, 10, 1),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: <null>
+ staticType: dynamic
+ period: .
+ identifier: SimpleIdentifier
+ token: b
+ staticElement: <null>
+ staticType: dynamic
+ staticElement: <null>
+ staticType: dynamic
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_extension() async {
@@ -431,11 +980,24 @@
]);
var reference = findNode.functionReference('E<int>;');
- assertFunctionReference(
- reference,
- findElement.extension_('E'),
- 'dynamic',
- );
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: E
+ staticElement: self::@extension::E
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_extension_prefixed() async {
@@ -455,11 +1017,32 @@
assertImportPrefix(findNode.simple('a.E'), findElement.prefix('a'));
var reference = findNode.functionReference('E<int>;');
- assertFunctionReference(
- reference,
- findElement.importFind('package:test/a.dart').extension_('E'),
- 'dynamic',
- );
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@prefix::a
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: E
+ staticElement: package:test/a.dart::@extension::E
+ staticType: dynamic
+ staticElement: package:test/a.dart::@extension::E
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_extensionGetter_extensionOverride() async {
@@ -478,8 +1061,42 @@
CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION, 67, 8),
]);
- assertFunctionReference(findNode.functionReference('foo<int>;'),
- findElement.getter('foo'), 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: ExtensionOverride
+ extensionName: SimpleIdentifier
+ token: E
+ staticElement: self::@extension::E
+ staticType: null
+ argumentList: ArgumentList
+ leftParenthesis: (
+ arguments
+ SimpleIdentifier
+ token: a
+ staticElement: a@60
+ staticType: A
+ rightParenthesis: )
+ extendedType: A
+ staticType: null
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::E::@getter::foo
+ staticType: int
+ staticType: int
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_extensionMethod() async {
@@ -496,8 +1113,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::E::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_extensionMethod_explicitReceiver_this() async {
@@ -514,8 +1149,32 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: ThisExpression
+ thisKeyword: this
+ staticType: A
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::E::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_extensionMethod_extensionOverride() async {
@@ -534,8 +1193,44 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: ExtensionOverride
+ extensionName: SimpleIdentifier
+ token: E
+ staticElement: self::@extension::E
+ staticType: null
+ argumentList: ArgumentList
+ leftParenthesis: (
+ arguments
+ SimpleIdentifier
+ token: a
+ staticElement: a@78
+ staticType: A
+ rightParenthesis: )
+ extendedType: A
+ staticType: null
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::E::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_extensionMethod_extensionOverride_cascade() async {
@@ -556,8 +1251,29 @@
]);
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ operator: ..
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::E::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_extensionMethod_extensionOverride_static() async {
@@ -577,8 +1293,44 @@
]);
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: ExtensionOverride
+ extensionName: SimpleIdentifier
+ token: E
+ staticElement: self::@extension::E
+ staticType: null
+ argumentList: ArgumentList
+ leftParenthesis: (
+ arguments
+ SimpleIdentifier
+ token: a
+ staticElement: a@69
+ staticType: A
+ rightParenthesis: )
+ extendedType: A
+ staticType: null
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::E::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_extensionMethod_extensionOverride_unknown() async {
@@ -594,8 +1346,42 @@
error(CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER, 51, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: ExtensionOverride
+ extensionName: SimpleIdentifier
+ token: E
+ staticElement: self::@extension::E
+ staticType: null
+ argumentList: ArgumentList
+ leftParenthesis: (
+ arguments
+ SimpleIdentifier
+ token: a
+ staticElement: a@39
+ staticType: A
+ rightParenthesis: )
+ extendedType: A
+ staticType: null
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_extensionMethod_fromClassDeclaration() async {
@@ -612,8 +1398,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::E::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_extensionMethod_unknown() async {
@@ -629,8 +1433,24 @@
messageContains: ["for the type 'double'"]),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_function_call() async {
@@ -642,8 +1462,34 @@
}
''');
- assertFunctionReference(findNode.functionReference('foo.call<int>;'), null,
- 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo.call<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T>(T)
+ period: .
+ identifier: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: null
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_function_call_tooFewTypeArgs() async {
@@ -658,8 +1504,35 @@
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION, 52, 5),
]);
- assertFunctionReference(findNode.functionReference('foo.call<int>;'), null,
- 'void Function(dynamic, dynamic)');
+ assertResolvedNodeText(findNode.functionReference('foo.call<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T, U>(T, U)
+ period: .
+ identifier: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: null
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(dynamic, dynamic)
+ typeArgumentTypes
+ dynamic
+ dynamic
+''');
}
test_function_call_tooManyTypeArgs() async {
@@ -674,8 +1547,32 @@
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_FUNCTION, 46, 5),
]);
- assertFunctionReference(findNode.functionReference('foo.call<int>;'), null,
- 'void Function(String)');
+ assertResolvedNodeText(findNode.functionReference('foo.call<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function(String)
+ period: .
+ identifier: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: null
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(String)
+''');
}
test_function_call_typeArgNotMatchingBound() async {
@@ -687,8 +1584,34 @@
}
''');
- assertFunctionReference(findNode.functionReference('foo.call<String>;'),
- null, 'void Function(String)');
+ assertResolvedNodeText(findNode.functionReference('foo.call<String>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T extends num>(T)
+ period: .
+ identifier: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: null
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: String
+ staticElement: dart:core::@class::String
+ staticType: null
+ type: String
+ rightBracket: >
+ staticType: void Function(String)
+ typeArgumentTypes
+ String
+''');
}
test_function_extensionOnFunction() async {
@@ -706,8 +1629,34 @@
}
''');
- assertFunctionReference(findNode.functionReference('foo.m<int>;'),
- findElement.method('m'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo.m<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T>(T)
+ period: .
+ identifier: SimpleIdentifier
+ token: m
+ staticElement: self::@extension::extension-0::@method::m
+ staticType: null
+ staticElement: self::@extension::extension-0::@method::m
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_function_extensionOnFunction_static() async {
@@ -729,8 +1678,34 @@
1),
]);
- assertFunctionReference(findNode.functionReference('foo.m<int>;'),
- findElement.method('m'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo.m<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T>(T)
+ period: .
+ identifier: SimpleIdentifier
+ token: m
+ staticElement: self::@extension::extension-0::@method::m
+ staticType: null
+ staticElement: self::@extension::extension-0::@method::m
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_implicitCallTearoff() async {
@@ -836,8 +1811,34 @@
}
''');
- assertFunctionReference(findNode.functionReference('foo<int>;'),
- findElement.getter('foo'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: a@51
+ staticType: A
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@getter::foo
+ staticType: null
+ staticElement: self::@class::A::@getter::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceGetter_functionTyped() async {
@@ -852,8 +1853,26 @@
''');
- assertFunctionReference(findNode.functionReference('foo<int>;'),
- findElement.getter('foo'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@getter::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceGetter_functionTyped_inherited() async {
@@ -869,8 +1888,26 @@
''');
- assertFunctionReference(findNode.functionReference('foo<int>;'),
- findElement.getter('foo'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@getter::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod() async {
@@ -885,8 +1922,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_call() async {
@@ -904,7 +1959,34 @@
// TODO(srawlins): PropertyElementResolver does not return an element for
// `.call`. If we want `findElement.method('foo')` here, we must change the
// policy over there.
- assertFunctionReference(reference, null, 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::C::@method::foo
+ staticType: void Function<T>(T)
+ period: .
+ identifier: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_call() async {
@@ -922,7 +2004,41 @@
// TODO(srawlins): PropertyElementResolver does not return an element for
// `.call`. If we want `findElement.method('foo')` here, we must change the
// policy over there.
- assertFunctionReference(reference, null, 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: c
+ staticElement: c@46
+ staticType: C
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::C::@method::foo
+ staticType: void Function<T>(T)
+ staticElement: self::@class::C::@method::foo
+ staticType: void Function<T>(T)
+ operator: .
+ propertyName: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_field() async {
@@ -941,8 +2057,34 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@class::B::@getter::a
+ staticType: A
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: null
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_getter_wrongNumberOfTypeArguments() async {
@@ -958,7 +2100,35 @@
''');
var reference = findNode.functionReference('foo<double>');
- assertFunctionReference(reference, null, 'dynamic');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: ParenthesizedExpression
+ leftParenthesis: (
+ expression: SimpleIdentifier
+ token: a
+ staticElement: a@42
+ staticType: A
+ rightParenthesis: )
+ staticType: A
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@getter::foo
+ staticType: int
+ staticType: int
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: double
+ staticElement: dart:core::@class::double
+ staticType: null
+ type: double
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_instanceMethod_explicitReceiver_otherExpression() async {
@@ -972,8 +2142,47 @@
}
''');
- assertFunctionReference(findNode.functionReference('(a ?? b).foo<int>;'),
- findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(
+ findNode.functionReference('(a ?? b).foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: ParenthesizedExpression
+ leftParenthesis: (
+ expression: BinaryExpression
+ leftOperand: SimpleIdentifier
+ token: a
+ staticElement: a@45
+ staticType: A?
+ operator: ??
+ rightOperand: SimpleIdentifier
+ token: b
+ staticElement: b@50
+ staticType: A
+ staticElement: <null>
+ staticInvokeType: null
+ staticType: A
+ rightParenthesis: )
+ staticType: A
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_receiverIsNotIdentifier_call() async {
@@ -989,7 +2198,40 @@
// TODO(srawlins): PropertyElementResolver does not return an element for
// `.call`. If we want `findElement.method('foo')` here, we must change the
// policy over there.
- assertFunctionReference(reference, null, 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: PropertyAccess
+ target: ListLiteral
+ leftBracket: [
+ rightBracket: ]
+ staticType: List<dynamic>
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@extension::extension-0::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ operator: .
+ propertyName: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_super() async {
@@ -1005,8 +2247,32 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: SuperExpression
+ superKeyword: super
+ staticType: B
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_super_noMethod() async {
@@ -1022,8 +2288,30 @@
error(CompileTimeErrorCode.UNDEFINED_SUPER_GETTER, 30, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: SuperExpression
+ superKeyword: super
+ staticType: A
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_instanceMethod_explicitReceiver_super_noSuper() async {
@@ -1037,8 +2325,30 @@
error(CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, 10, 5),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: SuperExpression
+ superKeyword: super
+ staticType: dynamic
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_instanceMethod_explicitReceiver_targetOfFunctionCall() async {
@@ -1056,8 +2366,34 @@
''');
var reference = findNode.functionReference('foo<int>');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: a@81
+ staticType: A
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: null
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_this() async {
@@ -1072,8 +2408,32 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: ThisExpression
+ thisKeyword: this
+ staticType: A
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_topLevelVariable() async {
@@ -1090,8 +2450,34 @@
assertIdentifierTopGetRef(findNode.simple('a.'), 'a');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@getter::a
+ staticType: A
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: null
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_topLevelVariable_prefix() async {
@@ -1112,10 +2498,41 @@
assertImportPrefix(
findNode.simple('prefix.'), findElement.prefix('prefix'));
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference,
- findElement.importFind('package:test/a.dart').method('foo'),
- 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix
+ staticElement: self::@prefix::prefix
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: a
+ staticElement: package:test/a.dart::@getter::a
+ staticType: A
+ staticElement: package:test/a.dart::@getter::a
+ staticType: A
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: package:test/a.dart::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_topLevelVariable_prefix_unknown() async {
@@ -1135,8 +2552,39 @@
assertImportPrefix(
findNode.simple('prefix.'), findElement.prefix('prefix'));
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix
+ staticElement: self::@prefix::prefix
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: a
+ staticElement: package:test/a.dart::@getter::a
+ staticType: A
+ staticElement: package:test/a.dart::@getter::a
+ staticType: A
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_instanceMethod_explicitReceiver_typeParameter() async {
@@ -1148,8 +2596,32 @@
error(CompileTimeErrorCode.UNDEFINED_GETTER, 15, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: T
+ staticElement: T@4
+ staticType: Type
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_instanceMethod_explicitReceiver_variable() async {
@@ -1164,8 +2636,34 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: a@41
+ staticType: A
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: null
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_explicitReceiver_variable_cascade() async {
@@ -1180,8 +2678,29 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ operator: ..
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_inherited() async {
@@ -1198,8 +2717,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_targetOfFunctionCall() async {
@@ -1217,8 +2754,26 @@
''');
var reference = findNode.functionReference('foo<int>');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_instanceMethod_unknown() async {
@@ -1233,8 +2788,24 @@
messageContains: ["for the type 'A'"]),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_localFunction() async {
@@ -1247,8 +2818,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.localFunction('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: foo@20
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_localVariable() async {
@@ -1259,8 +2848,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.parameter('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: foo@31
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_localVariable_call() async {
@@ -1277,7 +2884,34 @@
// TODO(srawlins): PropertyElementResolver does not return an element for
// `.call`. If we want `findElement.method('foo')` here, we must change the
// policy over there.
- assertFunctionReference(reference, null, 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: fn
+ staticElement: fn@40
+ staticType: void Function<T>(T)
+ period: .
+ identifier: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_localVariable_call_tooManyTypeArgs() async {
@@ -1297,7 +2931,32 @@
// TODO(srawlins): PropertyElementResolver does not return an element for
// `.call`. If we want `findElement.method('fn')` here, we must change the
// policy over there.
- assertFunctionReference(reference, null, 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: fn
+ staticElement: fn@55
+ staticType: void Function(int)
+ period: .
+ identifier: SimpleIdentifier
+ token: call
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: void Function(int)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+''');
}
test_localVariable_typeVariable_boundToFunction() async {
@@ -1311,7 +2970,24 @@
]);
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(reference, findElement.parameter('foo'), 'dynamic');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: foo@31
+ staticType: T
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_localVariable_typeVariable_functionTyped() async {
@@ -1322,8 +2998,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.parameter('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: foo@42
+ staticType: T
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_localVariable_typeVariable_nonFunction() async {
@@ -1337,7 +3031,24 @@
]);
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(reference, findElement.parameter('foo'), 'dynamic');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: foo@14
+ staticType: T
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_neverTyped() async {
@@ -1352,8 +3063,24 @@
CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION, 38, 1),
]);
- assertFunctionReference(findNode.functionReference('i<int>;'),
- findElement.topGet('i'), 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('i<int>;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: i
+ staticElement: self::@getter::i
+ staticType: Never
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_nonGenericFunction() async {
@@ -1371,8 +3098,24 @@
]);
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function()');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function()
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function()
+''');
}
test_otherExpression() async {
@@ -1416,8 +3159,32 @@
19, 5),
]);
- assertFunctionReference(
- findNode.functionReference('a.foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('a.foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: a@12
+ staticType: dynamic
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: null
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_staticMethod() async {
@@ -1432,8 +3199,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_staticMethod_explicitReceiver() async {
@@ -1448,8 +3233,34 @@
''');
assertClassRef(findNode.simple('A.'), findElement.class_('A'));
- assertFunctionReference(findNode.functionReference('foo<int>;'),
- findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: A
+ staticElement: self::@class::A
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: null
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_staticMethod_explicitReceiver_importPrefix() async {
@@ -1470,10 +3281,41 @@
assertClassRef(findNode.simple('A.'),
findElement.importFind('package:test/a.dart').class_('A'));
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference,
- findElement.importFind('package:test/a.dart').method('foo'),
- 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@prefix::a
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: A
+ staticElement: package:test/a.dart::@class::A
+ staticType: null
+ staticElement: package:test/a.dart::@class::A
+ staticType: null
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: package:test/a.dart::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_staticMethod_explicitReceiver_prefix_typeAlias() async {
@@ -1494,10 +3336,41 @@
assertImportPrefix(
findNode.simple('prefix.'), findElement.prefix('prefix'));
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference,
- findElement.importFind('package:test/a.dart').method('foo'),
- 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix
+ staticElement: self::@prefix::prefix
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: TA
+ staticElement: package:test/a.dart::@typeAlias::TA
+ staticType: Type
+ staticElement: package:test/a.dart::@typeAlias::TA
+ staticType: Type
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: package:test/a.dart::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_staticMethod_explicitReceiver_typeAlias() async {
@@ -1514,8 +3387,34 @@
assertTypeAliasRef(findNode.simple('TA.'), findElement.typeAlias('TA'));
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: TA
+ staticElement: self::@typeAlias::TA
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: null
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_staticMethod_explicitReciver_prefix() async {
@@ -1535,10 +3434,41 @@
assertImportPrefix(
findNode.simple('prefix.'), findElement.prefix('prefix'));
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference,
- findElement.importFind('package:test/a.dart').method('foo'),
- 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix
+ staticElement: self::@prefix::prefix
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: A
+ staticElement: package:test/a.dart::@class::A
+ staticType: null
+ staticElement: package:test/a.dart::@class::A
+ staticType: null
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: package:test/a.dart::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_tooFewTypeArguments() async {
@@ -1556,8 +3486,27 @@
]);
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(reference, findElement.method('foo'),
- 'void Function(dynamic, dynamic)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T, U>(T, U)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(dynamic, dynamic)
+ typeArgumentTypes
+ dynamic
+ dynamic
+''');
}
test_tooManyTypeArguments() async {
@@ -1575,8 +3524,32 @@
]);
var reference = findNode.functionReference('foo<int, int>;');
- assertFunctionReference(
- reference, findElement.method('foo'), 'void Function(dynamic)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@class::A::@method::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(dynamic)
+ typeArgumentTypes
+ dynamic
+''');
}
test_topLevelFunction() async {
@@ -1589,8 +3562,26 @@
''');
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.topFunction('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_topLevelFunction_importPrefix() async {
@@ -1607,11 +3598,34 @@
assertImportPrefix(findNode.simple('a.f'), findElement.prefix('a'));
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference,
- findElement.importFind('package:test/a.dart').topFunction('foo'),
- 'void Function(int)',
- );
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@prefix::a
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: package:test/a.dart::@function::foo
+ staticType: void Function<T>(T)
+ staticElement: package:test/a.dart::@function::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_topLevelFunction_importPrefix_asTargetOfFunctionCall() async {
@@ -1631,11 +3645,34 @@
assertImportPrefix(findNode.simple('a.f'), findElement.prefix('a'));
var reference = findNode.functionReference('foo<int>');
- assertFunctionReference(
- reference,
- findElement.importFind('package:test/a.dart').topFunction('foo'),
- 'void Function(int)',
- );
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@prefix::a
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: package:test/a.dart::@function::foo
+ staticType: void Function<T>(T)
+ staticElement: package:test/a.dart::@function::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_topLevelFunction_prefix_unknownPrefix() async {
@@ -1647,8 +3684,32 @@
error(CompileTimeErrorCode.UNDEFINED_IDENTIFIER, 10, 6),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix
+ staticElement: <null>
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_topLevelFunction_targetOfCall() async {
@@ -1660,8 +3721,26 @@
}
''');
- assertFunctionReference(findNode.functionReference('foo<int>.call;'),
- findElement.topFunction('foo'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo<int>.call;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
assertSimpleIdentifier(findNode.simple('call;'),
element: null, type: 'void Function(int)');
}
@@ -1678,8 +3757,26 @@
}
''');
- assertFunctionReference(findNode.functionReference('foo<int>'),
- findElement.topFunction('foo'), 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo<int>'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: self::@function::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_topLevelVariable_prefix() async {
@@ -1696,10 +3793,34 @@
assertImportPrefix(
findNode.simple('prefix.'), findElement.prefix('prefix'));
- assertFunctionReference(
- findNode.functionReference('foo<int>;'),
- findElement.importFind('package:test/a.dart').topGet('foo'),
- 'void Function(int)');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix
+ staticElement: self::@prefix::prefix
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: package:test/a.dart::@getter::foo
+ staticType: void Function<T>(T)
+ staticElement: package:test/a.dart::@getter::foo
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
test_topLevelVariable_prefix_unknownIdentifier() async {
@@ -1718,8 +3839,39 @@
assertImportPrefix(
findNode.simple('prefix.'), findElement.prefix('prefix'));
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PropertyAccess
+ target: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: prefix
+ staticElement: self::@prefix::prefix
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: a
+ staticElement: <null>
+ staticType: dynamic
+ staticElement: <null>
+ staticType: dynamic
+ operator: .
+ propertyName: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_typeAlias_function_unknownProperty() async {
@@ -1731,8 +3883,32 @@
error(CompileTimeErrorCode.UNDEFINED_GETTER, 42, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: Cb
+ staticElement: self::@typeAlias::Cb
+ staticType: Type
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_typeAlias_typeVariable_unknownProperty() async {
@@ -1744,8 +3920,32 @@
error(CompileTimeErrorCode.UNDEFINED_GETTER, 29, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: T
+ staticElement: self::@typeAlias::T
+ staticType: Type
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_unknownIdentifier() async {
@@ -1757,8 +3957,24 @@
error(CompileTimeErrorCode.UNDEFINED_IDENTIFIER, 15, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_unknownIdentifier_explicitReceiver() async {
@@ -1774,8 +3990,32 @@
error(CompileTimeErrorCode.UNDEFINED_GETTER, 41, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: a@30
+ staticType: A
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: dynamic
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
test_unknownIdentifier_importPrefix() async {
@@ -1790,8 +4030,32 @@
error(CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME, 40, 3),
]);
- assertFunctionReference(
- findNode.functionReference('foo<int>;'), null, 'dynamic');
+ assertResolvedNodeText(findNode.functionReference('foo<int>;'), r'''
+FunctionReference
+ function: PrefixedIdentifier
+ prefix: SimpleIdentifier
+ token: a
+ staticElement: self::@prefix::a
+ staticType: null
+ period: .
+ identifier: SimpleIdentifier
+ token: foo
+ staticElement: <null>
+ staticType: null
+ staticElement: <null>
+ staticType: dynamic
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: dynamic
+''');
}
}
@@ -1811,7 +4075,25 @@
]);
var reference = findNode.functionReference('foo<int>;');
- assertFunctionReference(
- reference, findElement.parameter('foo'), 'void Function(int)');
+ assertResolvedNodeText(reference, r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: foo
+ staticElement: foo@31
+ staticType: void Function<T>(T)
+ typeArguments: TypeArgumentList
+ leftBracket: <
+ arguments
+ NamedType
+ name: SimpleIdentifier
+ token: int
+ staticElement: dart:core::@class::int
+ staticType: null
+ type: int
+ rightBracket: >
+ staticType: void Function(int)
+ typeArgumentTypes
+ int
+''');
}
}
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index 614adf29..77f3669 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -391,14 +391,6 @@
assertType(node, type);
}
- void assertFunctionReference(
- FunctionReference node, Element? expectedElement, String expectedType) {
- if (expectedElement != null) {
- assertElement(node, expectedElement);
- }
- assertType(node, expectedType);
- }
-
void assertHasTestErrors() {
expect(result.errors, isNotEmpty);
}
diff --git a/pkg/analyzer/test/src/diagnostics/illegal_concrete_enum_member_declaration_test.dart b/pkg/analyzer/test/src/diagnostics/illegal_concrete_enum_member_declaration_test.dart
new file mode 100644
index 0000000..c829d5a
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/illegal_concrete_enum_member_declaration_test.dart
@@ -0,0 +1,218 @@
+// 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:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/context_collection_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(IllegalConcreteEnumMemberDeclarationClassTest);
+ defineReflectiveTests(IllegalConcreteEnumMemberDeclarationEnumTest);
+ defineReflectiveTests(IllegalConcreteEnumMemberDeclarationMixinTest);
+ });
+}
+
+@reflectiveTest
+class IllegalConcreteEnumMemberDeclarationClassTest
+ extends PubPackageResolutionTest {
+ test_hashCode_field() async {
+ await assertErrorsInCode(r'''
+abstract class A implements Enum {
+ int hashCode = 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 41, 8),
+ ]);
+ }
+
+ test_hashCode_getter() async {
+ await assertErrorsInCode(r'''
+abstract class A implements Enum {
+ int get hashCode => 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 45, 8),
+ ]);
+ }
+
+ test_hashCode_getter_abstract() async {
+ await assertNoErrorsInCode(r'''
+abstract class A implements Enum {
+ int get hashCode;
+}
+''');
+ }
+
+ test_hashCode_setter() async {
+ await assertNoErrorsInCode(r'''
+abstract class A implements Enum {
+ set hashCode(int _) {}
+}
+''');
+ }
+
+ test_index_field() async {
+ await assertErrorsInCode(r'''
+abstract class A implements Enum {
+ int index = 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 41, 5),
+ ]);
+ }
+
+ test_index_getter() async {
+ await assertErrorsInCode(r'''
+abstract class A implements Enum {
+ int get index => 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 45, 5),
+ ]);
+ }
+
+ test_index_getter_abstract() async {
+ await assertNoErrorsInCode(r'''
+abstract class A implements Enum {
+ int get index;
+}
+''');
+ }
+
+ test_index_setter() async {
+ await assertNoErrorsInCode(r'''
+abstract class A implements Enum {
+ set index(int _) {}
+}
+''');
+ }
+
+ test_operatorEqEq() async {
+ await assertErrorsInCode(r'''
+abstract class A implements Enum {
+ bool operator ==(Object other) => false;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 51, 2),
+ ]);
+ }
+}
+
+@reflectiveTest
+class IllegalConcreteEnumMemberDeclarationEnumTest
+ extends PubPackageResolutionTest {
+ test_index_field() async {
+ await assertErrorsInCode(r'''
+enum E {
+ v;
+ final int index = 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 26, 5),
+ ]);
+ }
+
+ test_index_getter() async {
+ await assertErrorsInCode(r'''
+enum E {
+ v;
+ int get index => 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 24, 5),
+ ]);
+ }
+
+ test_index_getter_abstract() async {
+ await assertNoErrorsInCode(r'''
+enum E {
+ v;
+ int get index;
+}
+''');
+ }
+
+ test_index_setter() async {
+ await assertNoErrorsInCode(r'''
+enum E {
+ v;
+ set index(int _) {}
+}
+''');
+ }
+
+ test_operatorEqEq() async {
+ await assertErrorsInCode(r'''
+enum E {
+ v;
+ bool operator ==(Object other) => false;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 30, 2),
+ ]);
+ }
+}
+
+@reflectiveTest
+class IllegalConcreteEnumMemberDeclarationMixinTest
+ extends PubPackageResolutionTest {
+ test_index_field() async {
+ await assertErrorsInCode(r'''
+mixin M on Enum {
+ int index = 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 24, 5),
+ ]);
+ }
+
+ test_index_getter() async {
+ await assertErrorsInCode(r'''
+mixin M on Enum {
+ int get index => 0;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 28, 5),
+ ]);
+ }
+
+ test_index_getter_abstract() async {
+ await assertNoErrorsInCode(r'''
+mixin M on Enum {
+ int get index;
+}
+''');
+ }
+
+ test_index_setter() async {
+ await assertNoErrorsInCode(r'''
+mixin M on Enum {
+ set index(int _) {}
+}
+''');
+ }
+
+ test_operatorEqEq() async {
+ await assertErrorsInCode(r'''
+mixin M on Enum {
+ bool operator ==(Object other) => false;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION, 34, 2),
+ ]);
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/illegal_concrete_enum_member_inheritance_test.dart b/pkg/analyzer/test/src/diagnostics/illegal_concrete_enum_member_inheritance_test.dart
new file mode 100644
index 0000000..ecfecef
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/illegal_concrete_enum_member_inheritance_test.dart
@@ -0,0 +1,239 @@
+// 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:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/context_collection_resolution.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(IllegalConcreteEnumMemberDeclarationClassTest);
+ defineReflectiveTests(IllegalConcreteEnumMemberDeclarationEnumTest);
+ defineReflectiveTests(IllegalConcreteEnumMemberDeclarationMixinTest);
+ });
+}
+
+@reflectiveTest
+class IllegalConcreteEnumMemberDeclarationClassTest
+ extends PubPackageResolutionTest {
+ test_hashCode_field_fromExtends() async {
+ await assertErrorsInCode(r'''
+class A {
+ int hashCode = 0;
+}
+
+abstract class B extends A implements Enum {}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE, 48, 1),
+ ]);
+ }
+
+ test_hashCode_field_fromImplements() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ int hashCode = 0;
+}
+
+abstract class B implements A, Enum {}
+''');
+ }
+
+ test_hashCode_field_fromWith() async {
+ await assertErrorsInCode(r'''
+mixin M {
+ int hashCode = 0;
+}
+
+abstract class B with M implements Enum {}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE, 48, 1),
+ ]);
+ }
+
+ test_hashCode_getter() async {
+ await assertErrorsInCode(r'''
+class A {
+ int get hashCode => 0;
+}
+
+abstract class B extends A implements Enum {}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE, 53, 1),
+ ]);
+ }
+
+ test_hashCode_getter_abstract() async {
+ await assertNoErrorsInCode(r'''
+mixin M {
+ int get hashCode;
+}
+
+abstract class B with M implements Enum {}
+''');
+ }
+
+ test_hashCode_setter() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ set hashCode(int _) {}
+}
+
+abstract class B extends A implements Enum {}
+''');
+ }
+
+ test_operatorEqEq_fromExtends() async {
+ await assertErrorsInCode(r'''
+class A {
+ bool operator ==(Object other) => false;
+}
+
+abstract class B extends A implements Enum {}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE, 71, 1),
+ ]);
+ }
+
+ test_operatorEqEq_fromImplements() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ bool operator ==(Object other) => false;
+}
+
+abstract class B implements A, Enum {}
+''');
+ }
+
+ test_operatorEqEq_fromWith() async {
+ await assertErrorsInCode(r'''
+mixin M {
+ bool operator ==(Object other) => false;
+}
+
+abstract class B with M implements Enum {}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE, 71, 1),
+ ]);
+ }
+}
+
+@reflectiveTest
+class IllegalConcreteEnumMemberDeclarationEnumTest
+ extends PubPackageResolutionTest {
+ test_hashCode_getter_fromImplements() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ int get hashCode => 0;
+}
+
+enum E implements A {
+ v;
+}
+''');
+ }
+
+ test_hashCode_getter_fromWith() async {
+ await assertErrorsInCode(r'''
+mixin M {
+ int get hashCode => 0;
+}
+
+enum E with M {
+ v;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE, 43, 1),
+ ]);
+ }
+
+ test_hashCode_setter_fromWith() async {
+ await assertNoErrorsInCode(r'''
+mixin M {
+ set hashCode(int _) {}
+}
+
+enum E with M {
+ v;
+}
+''');
+ }
+
+ test_operatorEqEq_fromImplements() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ bool operator ==(Object other) => false;
+}
+
+enum E implements A {
+ v;
+}
+''');
+ }
+
+ test_operatorEqEq_fromWith() async {
+ await assertErrorsInCode(r'''
+mixin M {
+ bool operator ==(Object other) => false;
+}
+
+enum E with M {
+ v;
+}
+''', [
+ error(
+ CompileTimeErrorCode.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE, 61, 1),
+ ]);
+ }
+}
+
+@reflectiveTest
+class IllegalConcreteEnumMemberDeclarationMixinTest
+ extends PubPackageResolutionTest {
+ test_hashCode_getter() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ int get hashCode => 0;
+}
+
+mixin M on A implements Enum {}
+''');
+ }
+
+ test_hashCode_getter_abstract() async {
+ await assertNoErrorsInCode(r'''
+abstract class A {
+ int get hashCode;
+}
+
+mixin M on A implements Enum {}
+''');
+ }
+
+ test_hashCode_setter() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ set hashCode(int _) {}
+}
+
+mixin M on A implements Enum {}
+''');
+ }
+
+ test_operatorEqEq() async {
+ await assertNoErrorsInCode(r'''
+class A {
+ bool operator ==(Object other) => false;
+}
+
+mixin M on A implements Enum {}
+''');
+ }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/illegal_non_abstract_enum_index_test.dart b/pkg/analyzer/test/src/diagnostics/illegal_non_abstract_enum_index_test.dart
deleted file mode 100644
index a2b7413..0000000
--- a/pkg/analyzer/test/src/diagnostics/illegal_non_abstract_enum_index_test.dart
+++ /dev/null
@@ -1,129 +0,0 @@
-// 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:analyzer/src/error/codes.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../dart/resolution/context_collection_resolution.dart';
-
-main() {
- defineReflectiveSuite(() {
- defineReflectiveTests(IllegalNonAbstractEnumIndexTest);
- });
-}
-
-@reflectiveTest
-class IllegalNonAbstractEnumIndexTest extends PubPackageResolutionTest {
- test_class_field() async {
- await assertErrorsInCode(r'''
-abstract class A implements Enum {
- int index = 0;
-}
-''', [
- error(CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX, 41, 5),
- ]);
- }
-
- test_class_getter() async {
- await assertErrorsInCode(r'''
-abstract class A implements Enum {
- int get index => 0;
-}
-''', [
- error(CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX, 45, 5),
- ]);
- }
-
- test_class_getter_abstract() async {
- await assertNoErrorsInCode(r'''
-abstract class A implements Enum {
- int get index;
-}
-''');
- }
-
- test_class_setter() async {
- await assertNoErrorsInCode(r'''
-abstract class A implements Enum {
- set index(int _) {}
-}
-''');
- }
-
- test_enum_field() async {
- await assertErrorsInCode(r'''
-enum E {
- v;
- final int index = 0;
-}
-''', [
- error(CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX, 26, 5),
- ]);
- }
-
- test_enum_getter() async {
- await assertErrorsInCode(r'''
-enum E {
- v;
- int get index => 0;
-}
-''', [
- error(CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX, 24, 5),
- ]);
- }
-
- test_enum_getter_abstract() async {
- await assertNoErrorsInCode(r'''
-enum E {
- v;
- int get index;
-}
-''');
- }
-
- test_enum_setter() async {
- await assertNoErrorsInCode(r'''
-enum E {
- v;
- set index(int _) {}
-}
-''');
- }
-
- test_mixin_field() async {
- await assertErrorsInCode(r'''
-mixin M on Enum {
- int index = 0;
-}
-''', [
- error(CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX, 24, 5),
- ]);
- }
-
- test_mixin_getter() async {
- await assertErrorsInCode(r'''
-mixin M on Enum {
- int get index => 0;
-}
-''', [
- error(CompileTimeErrorCode.ILLEGAL_NON_ABSTRACT_ENUM_INDEX, 28, 5),
- ]);
- }
-
- test_mixin_getter_abstract() async {
- await assertNoErrorsInCode(r'''
-mixin M on Enum {
- int get index;
-}
-''');
- }
-
- test_mixin_setter() async {
- await assertNoErrorsInCode(r'''
-mixin M on Enum {
- set index(int _) {}
-}
-''');
- }
-}
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
index 6144c42..babc082 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_assignment_test.dart
@@ -383,11 +383,16 @@
}
''');
- assertFunctionReference(
- findNode.functionReference('f;'),
- findElement.parameter('f'),
- 'int Function()',
- );
+ assertResolvedNodeText(findNode.functionReference('f;'), r'''
+FunctionReference
+ function: SimpleIdentifier
+ token: f
+ staticElement: f@49
+ staticType: int Function<T extends int>()
+ staticType: int Function()
+ typeArgumentTypes
+ int
+''');
}
test_functionTearoff_inferredTypeArgs() async {
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 0b6a9b6..0584d0e 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -260,14 +260,16 @@
import 'illegal_async_generator_return_type_test.dart'
as illegal_async_generator_return_type;
import 'illegal_async_return_type_test.dart' as illegal_async_return_type;
+import 'illegal_concrete_enum_member_declaration_test.dart'
+ as illegal_concrete_enum_member_declaration;
+import 'illegal_concrete_enum_member_inheritance_test.dart'
+ as illegal_concrete_enum_member_inheritance;
import 'illegal_enum_values_declaration_test.dart'
as illegal_enum_values_declaration;
import 'illegal_enum_values_inheritance_test.dart'
as illegal_enum_values_inheritance;
import 'illegal_language_version_override_test.dart'
as illegal_language_version_override;
-import 'illegal_non_abstract_enum_index_test.dart'
- as illegal_non_abstract_enum_index;
import 'illegal_sync_generator_return_type_test.dart'
as illegal_sync_generator_return_type;
import 'implements_deferred_class_test.dart' as implements_deferred_class;
@@ -964,10 +966,11 @@
if_element_condition_from_deferred_library.main();
illegal_async_generator_return_type.main();
illegal_async_return_type.main();
+ illegal_concrete_enum_member_declaration.main();
+ illegal_concrete_enum_member_inheritance.main();
illegal_enum_values_declaration.main();
illegal_enum_values_inheritance.main();
illegal_language_version_override.main();
- illegal_non_abstract_enum_index.main();
illegal_sync_generator_return_type.main();
implements_deferred_class.main();
implements_disallowed_class.main();
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index f36e4dc..8978bb1 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -1459,7 +1459,8 @@
_writelnWithIndent('parameters');
_withIndent(() {
for (var parameter in parameters) {
- _writelnWithIndent(parameter.name);
+ var name = parameter.name;
+ _writelnWithIndent(name.isNotEmpty ? name : '<empty>');
_withIndent(() {
_writeParameterKind(parameter);
_writeType('type', parameter.type);
diff --git a/pkg/compiler/lib/src/backend_strategy.dart b/pkg/compiler/lib/src/backend_strategy.dart
deleted file mode 100644
index a3ce46d..0000000
--- a/pkg/compiler/lib/src/backend_strategy.dart
+++ /dev/null
@@ -1,87 +0,0 @@
-// 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 dart2js.backend_strategy;
-
-import 'common.dart';
-import 'common/codegen.dart';
-import 'common/tasks.dart';
-import 'deferred_load/output_unit.dart' show OutputUnitData;
-import 'enqueue.dart';
-import 'elements/entities.dart';
-import 'inferrer/types.dart';
-import 'io/source_information.dart';
-import 'js_backend/backend.dart';
-import 'js_backend/enqueuer.dart';
-import 'js_backend/inferred_data.dart';
-import 'js_emitter/code_emitter_task.dart';
-import 'js_model/locals.dart';
-import 'kernel/kernel_world.dart';
-import 'serialization/serialization.dart';
-import 'ssa/ssa.dart';
-import 'universe/codegen_world_builder.dart';
-import 'world.dart';
-
-/// Strategy pattern that defines the element model used in type inference
-/// and code generation.
-abstract class BackendStrategy {
- List<CompilerTask> get tasks;
-
- FunctionCompiler get functionCompiler;
-
- CodeEmitterTask get emitterTask;
-
- /// Create the [JClosedWorld] from [closedWorld].
- JClosedWorld createJClosedWorld(
- KClosedWorld closedWorld, OutputUnitData outputUnitData);
-
- /// Registers [closedWorld] as the current closed world used by this backend
- /// strategy.
- ///
- /// This is used to support serialization after type inference.
- void registerJClosedWorld(JClosedWorld closedWorld);
-
- /// Called when the compiler starts running the codegen.
- ///
- /// Returns the [CodegenInputs] objects with the needed data.
- CodegenInputs onCodegenStart(
- GlobalTypeInferenceResults globalTypeInferenceResults);
-
- /// Creates an [Enqueuer] for code generation specific to this backend.
- CodegenEnqueuer createCodegenEnqueuer(
- CompilerTask task,
- JClosedWorld closedWorld,
- GlobalTypeInferenceResults globalInferenceResults,
- CodegenInputs codegen,
- CodegenResults codegenResults);
-
- /// Called when code generation has been completed.
- void onCodegenEnd(CodegenInputs codegen);
-
- /// Creates the [SsaBuilder] used for the element model.
- SsaBuilder createSsaBuilder(
- CompilerTask task, SourceInformationStrategy sourceInformationStrategy);
-
- /// Creates a [SourceSpan] from [spannable] in context of [currentElement].
- SourceSpan spanFromSpannable(Spannable spannable, Entity currentElement);
-
- /// Creates the [TypesInferrer] used by this strategy.
- TypesInferrer createTypesInferrer(JClosedWorld closedWorld,
- GlobalLocalsMap globalLocalsMap, InferredDataBuilder inferredDataBuilder);
-
- /// Calls [f] for every member that needs to be serialized for modular code
- /// generation and returns an [EntityWriter] for encoding these members in
- /// the serialized data.
- ///
- /// The needed members include members computed on demand during non-modular
- /// code generation, such as constructor bodies and and generator bodies.
- EntityWriter forEachCodegenMember(void Function(MemberEntity member) f);
-
- /// Prepare [source] to deserialize modular code generation data.
- void prepareCodegenReader(DataSource source);
-
- /// Generates the output and returns the total size of the generated code.
- int assembleProgram(JClosedWorld closedWorld, InferredData inferredData,
- CodegenInputs codegenInputs, CodegenWorld codegenWorld);
-}
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 8ff980a3..998e90f 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -10,7 +10,6 @@
import 'package:kernel/ast.dart' as ir;
import '../compiler.dart' as api;
-import 'backend_strategy.dart';
import 'common.dart';
import 'common/codegen.dart';
import 'common/elements.dart' show ElementEnvironment;
@@ -71,7 +70,7 @@
final api.CompilerDiagnostics handler;
KernelFrontendStrategy frontendStrategy;
- BackendStrategy backendStrategy;
+ JsBackendStrategy backendStrategy;
CompilerDiagnosticReporter _reporter;
Map<Entity, WorldImpact> _impactCache;
GenericTask userHandlerTask;
@@ -197,7 +196,7 @@
/// Creates the backend strategy.
///
/// Override this to mock the backend strategy for testing.
- BackendStrategy createBackendStrategy() {
+ JsBackendStrategy createBackendStrategy() {
return JsBackendStrategy(this);
}
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index 9832432..06b64b7 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -12,7 +12,6 @@
import 'package:dart2js_info/binary_serialization.dart' as dump_info;
import '../compiler.dart';
-import 'backend_strategy.dart';
import 'common.dart';
import 'common/elements.dart' show JElementEnvironment;
import 'common/names.dart';
@@ -25,6 +24,7 @@
import 'inferrer/types.dart'
show GlobalTypeInferenceMemberResult, GlobalTypeInferenceResults;
import 'js/js.dart' as jsAst;
+import 'js_model/js_strategy.dart';
import 'js_backend/field_analysis.dart';
import 'universe/codegen_world_builder.dart';
import 'universe/world_impact.dart' show WorldImpact, WorldImpactVisitorImpl;
@@ -369,7 +369,7 @@
return _outputToInfo.putIfAbsent(outputUnit, () {
// Dump-info currently only works with the full emitter. If another
// emitter is used it will fail here.
- BackendStrategy backendStrategy = compiler.backendStrategy;
+ JsBackendStrategy backendStrategy = compiler.backendStrategy;
assert(outputUnit.name != null || outputUnit.isMainOutput);
var filename = outputUnit.isMainOutput
? compiler.options.outputUri.pathSegments.last
diff --git a/pkg/compiler/lib/src/ir/modular.dart b/pkg/compiler/lib/src/ir/modular.dart
index e9df381..31e2752 100644
--- a/pkg/compiler/lib/src/ir/modular.dart
+++ b/pkg/compiler/lib/src/ir/modular.dart
@@ -12,7 +12,7 @@
import '../diagnostics/diagnostic_listener.dart';
import '../diagnostics/messages.dart';
import '../diagnostics/source_span.dart';
-import '../kernel/element_map_impl.dart';
+import '../kernel/element_map.dart';
import '../environment.dart';
import '../ir/static_type.dart';
import '../js_backend/annotations.dart';
@@ -97,7 +97,7 @@
CompilerOptions options,
DiagnosticReporter reporter,
Environment environment,
- KernelToElementMapImpl elementMap) {
+ KernelToElementMap elementMap) {
var classHierarchy = elementMap.classHierarchy;
var typeEnvironment = elementMap.typeEnvironment;
var constantEvaluator = elementMap.constantEvaluator;
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index e07ef90..f470a14 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -66,11 +66,7 @@
// Copies the own properties from [from] to [to] (specialized version of
// `mixinPropertiesHard` when it is known the properties are disjoint).
function mixinPropertiesEasy(from, to) {
- if (#legacyJavaScript) {
- copyProperties(from, to);
- } else {
- Object.assign(to, from);
- }
+ Object.assign(to, from);
}
// Only use direct proto access to construct the prototype chain (instead of
@@ -801,8 +797,6 @@
'call0selector': js.quoteName(call0Name),
'call1selector': js.quoteName(call1Name),
'call2selector': js.quoteName(call2Name),
-
- 'legacyJavaScript': _options.features.legacyJavaScript.isEnabled,
});
// We assume emitMainFragment will be the last piece of code we emit.
finalizeCode(mainResourceName, mainCode, holderCode, finalizeHolders: true);
@@ -912,9 +906,7 @@
for (StaticMethod method in library.statics) {
Map<js.Name, js.Expression> propertyMap = emitStaticMethod(method);
propertyMap.forEach((js.Name key, js.Expression value) {
- var property = _options.features.legacyJavaScript.isEnabled
- ? js.Property(js.quoteName(key), value)
- : js.MethodDefinition(js.quoteName(key), value);
+ var property = js.MethodDefinition(js.quoteName(key), value);
Entity holderKey;
if (method is StaticStubMethod) {
// [StaticStubMethod]s should only be created for interceptors.
@@ -1105,25 +1097,15 @@
// to `inherit(P.Object, null)` in the generated code. See if we can
// remove that.
- if (_options.features.legacyJavaScript.isEnabled) {
- // IE11 might require us to set 'constructor' but we aren't 100% sure.
- properties
- .add(js.Property(js.string("constructor"), classReference(cls)));
- }
properties.add(js.Property(_namer.operatorIs(cls.element), js.number(1)));
}
allMethods.forEach((Method method) {
emitInstanceMethod(method)
.forEach((js.Expression name, js.Expression code) {
- js.Property property;
- if (_options.features.legacyJavaScript.isEnabled) {
- property = js.Property(name, code);
- } else {
- property = code is js.Fun
- ? js.MethodDefinition(name, code)
- : js.Property(name, code);
- }
+ js.Property property = code is js.Fun
+ ? js.MethodDefinition(name, code)
+ : js.Property(name, code);
registerEntityAst(method.element, property);
properties.add(property);
});
@@ -1688,8 +1670,7 @@
: locals.find('_lazy', 'hunkHelpers.lazy')
: locals.find('_lazyOld', 'hunkHelpers.lazyOld');
js.Expression staticFieldCode = field.code;
- if (!_options.features.legacyJavaScript.isEnabled &&
- staticFieldCode is js.Fun) {
+ if (staticFieldCode is js.Fun) {
js.Fun fun = staticFieldCode;
staticFieldCode = js.ArrowFunction(fun.params, fun.body,
asyncModifier: fun.asyncModifier)
@@ -1905,14 +1886,8 @@
globals.add(js.Property(js.string(LEAF_TAGS), js.LiteralNull()));
}
- globals.add(js.Property(
- js.string(ARRAY_RTI_PROPERTY),
- _options.features.legacyJavaScript.isEnabled
- ? js.js(
- r'typeof Symbol == "function" && typeof Symbol() == "symbol"'
- r' ? Symbol("$ti")'
- r' : "$ti"')
- : js.js(r'Symbol("$ti")')));
+ globals.add(
+ js.Property(js.string(ARRAY_RTI_PROPERTY), js.js(r'Symbol("$ti")')));
if (_closedWorld.backendUsage.requiresStartupMetrics) {
// Copy the metrics object that was stored on the main unit IIFE.
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 48f715e..aac7e7e 100644
--- a/pkg/compiler/lib/src/js_model/element_map_impl.dart
+++ b/pkg/compiler/lib/src/js_model/element_map_impl.dart
@@ -37,7 +37,7 @@
import '../js_backend/annotations.dart';
import '../js_backend/native_data.dart';
import '../kernel/dart2js_target.dart' show allowedNativeTest;
-import '../kernel/element_map_impl.dart';
+import '../kernel/element_map.dart';
import '../kernel/env.dart';
import '../kernel/kelements.dart';
import '../native/behavior.dart';
@@ -130,7 +130,7 @@
JsKernelToElementMap(
this.reporter,
this._environment,
- KernelToElementMapImpl _elementMap,
+ KernelToElementMap _elementMap,
Map<MemberEntity, MemberUsage> liveMemberUsage,
AnnotationsData annotations)
: this.options = _elementMap.options {
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 51028eb..e262869 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -6,7 +6,6 @@
import 'package:kernel/ast.dart' as ir;
-import '../backend_strategy.dart';
import '../common.dart';
import '../common/codegen.dart';
import '../common/elements.dart' show CommonElements, ElementEnvironment;
@@ -62,7 +61,9 @@
import 'js_world_builder.dart';
import 'locals.dart';
-class JsBackendStrategy implements BackendStrategy {
+/// JS Strategy pattern that defines the element model used in type inference
+/// and code generation.
+class JsBackendStrategy {
final Compiler _compiler;
JsKernelToElementMap _elementMap;
@@ -103,17 +104,14 @@
sourceInformationStrategy);
}
- @override
List<CompilerTask> get tasks {
List<CompilerTask> result = functionCompiler.tasks;
result.add(emitterTask);
return result;
}
- @override
FunctionCompiler get functionCompiler => _functionCompiler;
- @override
CodeEmitterTask get emitterTask => _emitterTask;
Namer get namerForTesting => _namer;
@@ -159,7 +157,7 @@
return _rtiChecksBuilder;
}
- @override
+ /// Create the [JClosedWorld] from [closedWorld].
JClosedWorld createJClosedWorld(
KClosedWorld closedWorld, OutputUnitData outputUnitData) {
KernelFrontendStrategy strategy = _compiler.frontendStrategy;
@@ -180,12 +178,17 @@
return jClosedWorld;
}
- @override
+ /// Registers [closedWorld] as the current closed world used by this backend
+ /// strategy.
+ ///
+ /// This is used to support serialization after type inference.
void registerJClosedWorld(covariant JsClosedWorld closedWorld) {
_elementMap = closedWorld.elementMap;
}
- @override
+ /// Called when the compiler starts running the codegen.
+ ///
+ /// Returns the [CodegenInputs] objects with the needed data.
CodegenInputs onCodegenStart(
GlobalTypeInferenceResults globalTypeInferenceResults) {
JClosedWorld closedWorld = globalTypeInferenceResults.closedWorld;
@@ -217,7 +220,7 @@
return codegen;
}
- @override
+ /// Creates an [Enqueuer] for code generation specific to this backend.
CodegenEnqueuer createCodegenEnqueuer(
CompilerTask task,
JClosedWorld closedWorld,
@@ -342,13 +345,13 @@
return worldImpact;
}
- @override
+ /// Called when code generation has been completed.
void onCodegenEnd(CodegenInputs codegen) {
sourceInformationStrategy.onComplete();
codegen.tracer.close();
}
- @override
+ /// Generates the output and returns the total size of the generated code.
int assembleProgram(JClosedWorld closedWorld, InferredData inferredData,
CodegenInputs codegenInputs, CodegenWorld codegenWorld) {
int programSize = emitterTask.assembleProgram(
@@ -357,7 +360,7 @@
return programSize;
}
- @override
+ /// Creates the [SsaBuilder] used for the element model.
SsaBuilder createSsaBuilder(
CompilerTask task, SourceInformationStrategy sourceInformationStrategy) {
return KernelSsaBuilder(
@@ -370,12 +373,12 @@
sourceInformationStrategy);
}
- @override
+ /// Creates a [SourceSpan] from [spannable] in context of [currentElement].
SourceSpan spanFromSpannable(Spannable spannable, Entity currentElement) {
return _elementMap.getSourceSpan(spannable, currentElement);
}
- @override
+ /// Creates the [TypesInferrer] used by this strategy.
TypesInferrer createTypesInferrer(
JClosedWorld closedWorld,
GlobalLocalsMap globalLocalsMap,
@@ -384,7 +387,7 @@
_compiler, closedWorld, globalLocalsMap, inferredDataBuilder);
}
- @override
+ /// Prepare [source] to deserialize modular code generation data.
void prepareCodegenReader(DataSource source) {
source.registerEntityReader(ClosedEntityReader(_elementMap));
source.registerEntityLookup(ClosedEntityLookup(_elementMap));
@@ -392,7 +395,12 @@
ComponentLookup(_elementMap.programEnv.mainComponent));
}
- @override
+ /// Calls [f] for every member that needs to be serialized for modular code
+ /// generation and returns an [EntityWriter] for encoding these members in
+ /// the serialized data.
+ ///
+ /// The needed members include members computed on demand during non-modular
+ /// code generation, such as constructor bodies and and generator bodies.
EntityWriter forEachCodegenMember(void Function(MemberEntity member) f) {
int earlyMemberIndexLimit = _elementMap.prepareForCodegenSerialization();
ClosedEntityWriter entityWriter = ClosedEntityWriter(earlyMemberIndexLimit);
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index ac578ee..3f30198 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -3,174 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:kernel/ast.dart' as ir;
-import 'package:kernel/core_types.dart' as ir;
-import 'package:kernel/class_hierarchy.dart' as ir;
-import 'package:kernel/type_environment.dart' as ir;
-import '../common/elements.dart' show KCommonElements, KElementEnvironment;
-import '../constants/values.dart';
-import '../elements/entities.dart';
-import '../elements/names.dart';
-import '../elements/types.dart';
-import '../js/js.dart' as js;
-import '../js_backend/namer.dart';
-import '../js_backend/native_data.dart';
-import '../native/behavior.dart';
-import '../universe/call_structure.dart';
-import '../universe/selector.dart';
-
-/// Interface that translates between Kernel IR nodes and entities used for
-/// computing the [WorldImpact] for members.
-abstract class KernelToElementMap {
- KElementEnvironment get elementEnvironment;
- NativeBasicData get nativeBasicData;
-
- /// Access to the commonly used elements and types.
- KCommonElements get commonElements;
-
- /// Access to the [DartTypes] object.
- DartTypes get types;
-
- /// Returns the core types for the underlying kernel model.
- ir.CoreTypes get coreTypes;
-
- /// Returns the type environment for the underlying kernel model.
- ir.TypeEnvironment get typeEnvironment;
-
- /// Returns the class hierarchy for the underlying kernel model.
- ir.ClassHierarchy get classHierarchy;
-
- /// Returns the [DartType] corresponding to [type].
- DartType getDartType(ir.DartType type);
-
- /// Returns the [InterfaceType] corresponding to [type].
- InterfaceType getInterfaceType(ir.InterfaceType type);
-
- /// Returns the [TypeVariableType] corresponding to [type].
- TypeVariableType getTypeVariableType(ir.TypeParameterType type);
-
- /// Returns the [FunctionType] of the [node].
- FunctionType getFunctionType(ir.FunctionNode node);
-
- /// Return the [InterfaceType] corresponding to the [cls] with the given
- /// [typeArguments] and [nullability].
- InterfaceType createInterfaceType(
- ir.Class cls, List<ir.DartType> typeArguments);
-
- /// Returns the [CallStructure] corresponding to the [arguments].
- CallStructure getCallStructure(ir.Arguments arguments);
-
- /// Returns the [Selector] corresponding to the invocation of [name] with
- /// [arguments].
- Selector getInvocationSelector(ir.Name name, int positionalArguments,
- List<String> namedArguments, int typeArguments);
-
- /// Returns the [MemberEntity] corresponding to the member [node].
- MemberEntity getMember(ir.Member node);
-
- /// Returns the [FunctionEntity] corresponding to the procedure [node].
- FunctionEntity getMethod(ir.Procedure node);
-
- /// Returns the [ConstructorEntity] corresponding to the generative or factory
- /// constructor [node].
- ConstructorEntity getConstructor(ir.Member node);
-
- /// Returns the [FieldEntity] corresponding to the field [node].
- FieldEntity getField(ir.Field node);
-
- /// Returns the [ClassEntity] corresponding to the class [node].
- ClassEntity getClass(ir.Class node);
-
- /// Returns the `noSuchMethod` [FunctionEntity] call from a
- /// `super.noSuchMethod` invocation within [cls].
- FunctionEntity getSuperNoSuchMethod(ClassEntity cls);
-
- /// Returns the [Name] corresponding to [name].
- Name getName(ir.Name name);
-
- /// Computes the [NativeBehavior] for a call to the [JS] function.
- NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node);
-
- /// Computes the [NativeBehavior] for a call to the [JS_BUILTIN]
- /// function.
- NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node);
-
- /// Computes the [NativeBehavior] for a call to the
- /// [JS_EMBEDDED_GLOBAL] function.
- NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
- ir.StaticInvocation node);
-
- /// Returns the [js.Name] for the `JsGetName` [constant] value.
- js.Name getNameForJsGetName(ConstantValue constant, Namer namer);
-
- /// Computes the [ConstantValue] for the constant [expression].
- ConstantValue getConstantValue(
- ir.StaticTypeContext staticTypeContext, ir.Expression expression,
- {bool requireConstant = true, bool implicitNull = false});
-
- /// Return the [ImportEntity] corresponding to [node].
- ImportEntity getImport(ir.LibraryDependency node);
-
- /// Returns the defining node for [cls].
- ir.Class getClassNode(covariant ClassEntity cls);
-
- /// Adds libraries in [component] to the set of libraries.
- ///
- /// The main method of the first component is used as the main method for the
- /// compilation.
- void addComponent(ir.Component component);
-
- /// Returns the [ConstructorEntity] corresponding to a super initializer in
- /// [constructor].
- ///
- /// The IR resolves super initializers to a [target] up in the type hierarchy.
- /// Most of the time, the result of this function will be the entity
- /// corresponding to that target. In the presence of unnamed mixins, this
- /// function returns an entity for an intermediate synthetic constructor that
- /// kernel doesn't explicitly represent.
- ///
- /// For example:
- /// class M {}
- /// class C extends Object with M {}
- ///
- /// Kernel will say that C()'s super initializer resolves to Object(), but
- /// this function will return an entity representing the unnamed mixin
- /// application "Object+M"'s constructor.
- ConstructorEntity getSuperConstructor(
- ir.Constructor constructor, ir.Member target);
-
- /// Computes the native behavior for reading the native [field].
- NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
- Iterable<String> createsAnnotations, Iterable<String> returnsAnnotations,
- {bool isJsInterop});
-
- /// Computes the native behavior for writing to the native [field].
- NativeBehavior getNativeBehaviorForFieldStore(ir.Field field);
-
- /// Computes the native behavior for calling the function or constructor
- /// [member].
- NativeBehavior getNativeBehaviorForMethod(ir.Member member,
- Iterable<String> createsAnnotations, Iterable<String> returnsAnnotations,
- {bool isJsInterop});
-
- /// Compute the kind of foreign helper function called by [node], if any.
- ForeignKind getForeignKind(ir.StaticInvocation node);
-
- /// Computes the [InterfaceType] referenced by a call to the
- /// [JS_INTERCEPTOR_CONSTANT] function, if any.
- InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node);
-
- /// Returns the [Local] corresponding to the local function [node].
- Local getLocalFunction(ir.LocalFunction node);
-
- /// Returns the [ir.Library] corresponding to [library].
- ir.Library getLibraryNode(LibraryEntity library);
-
- /// Returns the defining node for [member].
- ir.Member getMemberNode(covariant MemberEntity member);
-
- ir.StaticTypeContext getStaticTypeContext(MemberEntity member);
-}
+// TODO(joshualitt): Merge the contents of element_map_impl.dart into this file.
+export 'element_map_impl.dart';
/// Kinds of foreign functions.
enum ForeignKind {
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index c4d6943..403ff04 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -41,11 +41,9 @@
import '../kernel/kernel_strategy.dart';
import '../kernel/dart2js_target.dart';
import '../native/behavior.dart';
-import '../native/resolver.dart';
import '../options.dart';
import '../ordered_typeset.dart';
import '../universe/call_structure.dart';
-import '../universe/class_hierarchy.dart';
import '../universe/selector.dart';
import 'element_map.dart';
@@ -53,9 +51,9 @@
import 'kelements.dart';
import 'kernel_impact.dart';
-/// Implementation of [KernelToElementMap] that only supports world
+/// Implementation of [IrToElementMap] that only supports world
/// impact computation.
-class KernelToElementMapImpl implements KernelToElementMap, IrToElementMap {
+class KernelToElementMap implements IrToElementMap {
final CompilerOptions options;
@override
final DiagnosticReporter reporter;
@@ -107,7 +105,7 @@
Map<KMember, Map<ir.Expression, TypeMap>> typeMapsForTesting;
- KernelToElementMapImpl(
+ KernelToElementMap(
this.reporter, this._environment, this._frontendStrategy, this.options) {
_elementEnvironment = KernelElementEnvironment(this);
_typeConverter = DartTypeConverter(this);
@@ -116,12 +114,12 @@
_constantValuefier = ConstantValuefier(this);
}
- @override
+ /// Access to the [DartTypes] object.
DartTypes get types => _types;
- @override
KernelElementEnvironment get elementEnvironment => _elementEnvironment;
+ /// Access to the commonly used elements and types.
@override
KCommonElements get commonElements => _commonElements;
@@ -244,6 +242,8 @@
return classEnv.lookupConstructor(this, name);
}
+ /// Return the [InterfaceType] corresponding to the [cls] with the given
+ /// [typeArguments] and [nullability].
@override
InterfaceType createInterfaceType(
ir.Class cls, List<ir.DartType> typeArguments) {
@@ -252,6 +252,7 @@
LibraryEntity getLibrary(ir.Library node) => getLibraryInternal(node);
+ /// Returns the [ClassEntity] corresponding to the class [node].
@override
ClassEntity getClass(ir.Class node) => getClassInternal(node);
@@ -263,6 +264,11 @@
return data.supertype;
}
+ /// Returns the superclass of [cls] if any.
+ ClassEntity getSuperClass(ClassEntity cls) {
+ return getSuperType(cls)?.element;
+ }
+
void _ensureCallType(ClassEntity cls, KClassData data) {
assert(checkFamily(cls));
if (data is KClassDataImpl && !data.isCallTypeComputed) {
@@ -429,6 +435,7 @@
}
}
+ /// Returns the [MemberEntity] corresponding to the member [node].
@override
MemberEntity getMember(ir.Member node) {
if (node is ir.Field) {
@@ -445,11 +452,28 @@
throw UnsupportedError("Unexpected member: $node");
}
+ /// Returns the [ConstructorEntity] corresponding to the generative or factory
+ /// constructor [node].
@override
ConstructorEntity getConstructor(ir.Member node) =>
getConstructorInternal(node);
- @override
+ /// Returns the [ConstructorEntity] corresponding to a super initializer in
+ /// [constructor].
+ ///
+ /// The IR resolves super initializers to a [target] up in the type hierarchy.
+ /// Most of the time, the result of this function will be the entity
+ /// corresponding to that target. In the presence of unnamed mixins, this
+ /// function returns an entity for an intermediate synthetic constructor that
+ /// kernel doesn't explicitly represent.
+ ///
+ /// For example:
+ /// class M {}
+ /// class C extends Object with M {}
+ ///
+ /// Kernel will say that C()'s super initializer resolves to Object(), but
+ /// this function will return an entity representing the unnamed mixin
+ /// application "Object+M"'s constructor.
ConstructorEntity getSuperConstructor(
ir.Constructor sourceNode, ir.Member targetNode) {
ConstructorEntity source = getConstructor(sourceNode);
@@ -471,16 +495,19 @@
throw failedAt(source, "Super constructor for $source not found.");
}
+ /// Returns the [FunctionEntity] corresponding to the procedure [node].
@override
FunctionEntity getMethod(ir.Procedure node) => getMethodInternal(node);
+ /// Returns the [FieldEntity] corresponding to the field [node].
@override
FieldEntity getField(ir.Field node) => getFieldInternal(node);
+ /// Returns the [DartType] corresponding to [type].
@override
DartType getDartType(ir.DartType type) => _typeConverter.convert(type);
- @override
+ /// Returns the [TypeVariableType] corresponding to [type].
TypeVariableType getTypeVariableType(ir.TypeParameterType type) =>
getDartType(type).withoutNullability;
@@ -492,10 +519,11 @@
return list;
}
- @override
+ /// Returns the [InterfaceType] corresponding to [type].
InterfaceType getInterfaceType(ir.InterfaceType type) =>
_typeConverter.convert(type).withoutNullability;
+ /// Returns the [FunctionType] of the [node].
@override
FunctionType getFunctionType(ir.FunctionNode node) {
DartType returnType;
@@ -658,6 +686,12 @@
return data.getVariances();
}
+ /// Returns the class mixed into [cls] if any.
+ // TODO(johnniwinther): Replace this by a `getAppliedMixins` function that
+ // return transitively mixed in classes like in:
+ // class A {}
+ // class B = Object with A;
+ // class C = Object with B;
ClassEntity getAppliedMixin(IndexedClass cls) {
assert(checkFamily(cls));
KClassData data = classes.getData(cls);
@@ -752,6 +786,12 @@
return data.orderedTypeSet;
}
+ /// Returns all supertypes of [cls].
+ Iterable<InterfaceType> getSuperTypes(ClassEntity cls) {
+ return getOrderedTypeSet(cls).supertypes;
+ }
+
+ /// Returns the hierarchy depth of [cls].
@override
int getHierarchyDepth(IndexedClass cls) {
assert(checkFamily(cls));
@@ -768,19 +808,19 @@
return data.interfaces;
}
- @override
+ /// Returns the defining node for [member].
ir.Member getMemberNode(covariant IndexedMember member) {
assert(checkFamily(member));
return members.getData(member).node;
}
- @override
+ /// Returns the defining node for [cls].
ir.Class getClassNode(covariant IndexedClass cls) {
assert(checkFamily(cls));
return classes.getData(cls).node;
}
- @override
+ /// Return the [ImportEntity] corresponding to [node].
ImportEntity getImport(ir.LibraryDependency node) {
if (node == null) return null;
ir.Library library = node.parent;
@@ -788,18 +828,18 @@
return data.imports[node];
}
+ /// Returns the core types for the underlying kernel model.
@override
ir.CoreTypes get coreTypes => _coreTypes ??= ir.CoreTypes(env.mainComponent);
- @override
+ /// Returns the type environment for the underlying kernel model.
ir.TypeEnvironment get typeEnvironment =>
_typeEnvironment ??= ir.TypeEnvironment(coreTypes, classHierarchy);
- @override
+ /// Returns the class hierarchy for the underlying kernel model.
ir.ClassHierarchy get classHierarchy =>
_classHierarchy ??= ir.ClassHierarchy(env.mainComponent, coreTypes);
- @override
ir.StaticTypeContext getStaticTypeContext(MemberEntity member) {
// TODO(johnniwinther): Cache the static type context.
return ir.StaticTypeContext(getMemberNode(member), typeEnvironment);
@@ -817,11 +857,12 @@
: ir.EvaluationMode.strong);
}
- @override
+ /// Returns the [Name] corresponding to [name].
Name getName(ir.Name name) {
return Name(name.text, name.isPrivate ? getLibrary(name.library) : null);
}
+ /// Returns the [CallStructure] corresponding to the [arguments].
@override
CallStructure getCallStructure(ir.Arguments arguments) {
int argumentCount = arguments.positional.length + arguments.named.length;
@@ -855,7 +896,8 @@
includeTypeParameters ? typeParameters : 0);
}
- @override
+ /// Returns the [Selector] corresponding to the invocation of [name] with
+ /// [arguments].
Selector getInvocationSelector(ir.Name irName, int positionalArguments,
List<String> namedArguments, int typeArguments) {
Name name = getName(irName);
@@ -962,8 +1004,8 @@
return node.arguments.positional[index].accept(Stringifier());
}
- // TODO(johnniwinther): Cache this for later use.
- @override
+ /// Computes the [NativeBehavior] for a call to the [JS] function.
+ /// TODO(johnniwinther): Cache this for later use.
NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 2 ||
node.arguments.named.isNotEmpty) {
@@ -994,8 +1036,9 @@
commonElements);
}
- // TODO(johnniwinther): Cache this for later use.
- @override
+ /// TODO(johnniwinther): Cache this for later use.
+ /// Computes the [NativeBehavior] for a call to the [JS_BUILTIN]
+ /// function.
NativeBehavior getNativeBehaviorForJsBuiltinCall(ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
reporter.internalError(
@@ -1021,8 +1064,9 @@
commonElements);
}
- // TODO(johnniwinther): Cache this for later use.
- @override
+ /// Computes the [NativeBehavior] for a call to the
+ /// [JS_EMBEDDED_GLOBAL] function.
+ /// TODO(johnniwinther): Cache this for later use.
NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
ir.StaticInvocation node) {
if (node.arguments.positional.length < 1) {
@@ -1055,7 +1099,7 @@
commonElements);
}
- @override
+ /// Returns the [js.Name] for the `JsGetName` [constant] value.
js.Name getNameForJsGetName(ConstantValue constant, Namer namer) {
int index = extractEnumIndexFromConstantValue(
constant, commonElements.jsGetNameEnum);
@@ -1078,7 +1122,7 @@
return null;
}
- @override
+ /// Computes the [ConstantValue] for the constant [expression].
ConstantValue getConstantValue(
ir.StaticTypeContext staticTypeContext, ir.Expression node,
{bool requireConstant = true,
@@ -1123,7 +1167,8 @@
return metadata;
}
- @override
+ /// Returns the `noSuchMethod` [FunctionEntity] call from a
+ /// `super.noSuchMethod` invocation within [cls].
FunctionEntity getSuperNoSuchMethod(ClassEntity cls) {
while (cls != null) {
cls = elementEnvironment.getSuperClass(cls);
@@ -1377,16 +1422,18 @@
}
/// NativeBasicData is need for computation of the default super class.
- @override
NativeBasicData get nativeBasicData => _frontendStrategy.nativeBasicData;
- @override
+ /// Adds libraries in [component] to the set of libraries.
+ ///
+ /// The main method of the first component is used as the main method for the
+ /// compilation.
void addComponent(ir.Component component) {
env.addComponent(component);
}
BehaviorBuilder get nativeBehaviorBuilder =>
- _nativeBehaviorBuilder ??= KernelBehaviorBuilder(elementEnvironment,
+ _nativeBehaviorBuilder ??= BehaviorBuilder(elementEnvironment,
commonElements, nativeBasicData, reporter, options);
ResolutionImpact computeWorldImpact(KMember member,
@@ -1449,12 +1496,12 @@
return members.getData(method).node;
}
- @override
+ /// Returns the [ir.Library] corresponding to [library].
ir.Library getLibraryNode(LibraryEntity library) {
return libraries.getData(library).library;
}
- @override
+ /// Returns the [Local] corresponding to the local function [node].
Local getLocalFunction(ir.LocalFunction node) {
KLocalFunction localFunction = localFunctionMap[node];
if (localFunction == null) {
@@ -1503,7 +1550,9 @@
return localFunction;
}
- bool _implementsFunction(IndexedClass cls) {
+ /// Returns `true` if [cls] implements `Function` either explicitly or through
+ /// a `call` method.
+ bool implementsFunction(IndexedClass cls) {
assert(checkFamily(cls));
KClassData data = classes.getData(cls);
OrderedTypeSet orderedTypeSet = data.orderedTypeSet;
@@ -1516,7 +1565,7 @@
return data.callType?.withoutNullability is FunctionType;
}
- @override
+ /// Compute the kind of foreign helper function called by [node], if any.
ForeignKind getForeignKind(ir.StaticInvocation node) {
if (commonElements.isForeignHelper(getMember(node.target))) {
switch (node.target.name.text) {
@@ -1533,7 +1582,8 @@
return ForeignKind.NONE;
}
- @override
+ /// Computes the [InterfaceType] referenced by a call to the
+ /// [JS_INTERCEPTOR_CONSTANT] function, if any.
InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node) {
if (node.arguments.positional.length != 1 ||
node.arguments.named.isNotEmpty) {
@@ -1553,8 +1603,8 @@
return null;
}
- // TODO(johnniwinther): Cache this for later use.
- @override
+ /// Computes the native behavior for reading the native [field].
+ /// TODO(johnniwinther): Cache this for later use.
NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field,
Iterable<String> createsAnnotations, Iterable<String> returnsAnnotations,
{bool isJsInterop}) {
@@ -1564,15 +1614,16 @@
isJsInterop: isJsInterop);
}
- // TODO(johnniwinther): Cache this for later use.
- @override
+ /// Computes the native behavior for writing to the native [field].
+ /// TODO(johnniwinther): Cache this for later use.
NativeBehavior getNativeBehaviorForFieldStore(ir.Field field) {
DartType type = getDartType(field.type);
return nativeBehaviorBuilder.buildFieldStoreBehavior(type);
}
- // TODO(johnniwinther): Cache this for later use.
- @override
+ /// Computes the native behavior for calling the function or constructor
+ /// [member].
+ /// TODO(johnniwinther): Cache this for later use.
NativeBehavior getNativeBehaviorForMethod(ir.Member member,
Iterable<String> createsAnnotations, Iterable<String> returnsAnnotations,
{bool isJsInterop}) {
@@ -1660,7 +1711,7 @@
class KernelElementEnvironment extends ElementEnvironment
implements KElementEnvironment {
- final KernelToElementMapImpl elementMap;
+ final KernelToElementMap elementMap;
KernelElementEnvironment(this.elementMap);
@@ -1894,34 +1945,17 @@
}
}
-/// [BehaviorBuilder] for kernel based elements.
-class KernelBehaviorBuilder extends BehaviorBuilder {
- @override
- final ElementEnvironment elementEnvironment;
- @override
- final CommonElements commonElements;
- @override
- final DiagnosticReporter reporter;
- @override
- final NativeBasicData nativeBasicData;
- @override
- final CompilerOptions options;
-
- KernelBehaviorBuilder(this.elementEnvironment, this.commonElements,
- this.nativeBasicData, this.reporter, this.options);
-}
-
-class KernelNativeMemberResolver implements NativeMemberResolver {
+class KernelNativeMemberResolver {
static final RegExp _identifier = RegExp(r'^[a-zA-Z_$][a-zA-Z0-9_$]*$');
- final KernelToElementMapImpl _elementMap;
+ final KernelToElementMap _elementMap;
final NativeBasicData _nativeBasicData;
final NativeDataBuilder _nativeDataBuilder;
KernelNativeMemberResolver(
this._elementMap, this._nativeBasicData, this._nativeDataBuilder);
- @override
+ /// Computes whether [node] is native or JsInterop.
void resolveNativeMember(ir.Member node, IrAnnotationData annotationData) {
assert(annotationData != null);
bool isJsInterop = _isJsInteropMember(node);
@@ -2100,42 +2134,6 @@
}
}
-class KernelClassQueries extends ClassQueries {
- final KernelToElementMapImpl elementMap;
-
- KernelClassQueries(this.elementMap);
-
- @override
- ClassEntity getDeclaration(ClassEntity cls) {
- return cls;
- }
-
- @override
- Iterable<InterfaceType> getSupertypes(ClassEntity cls) {
- return elementMap.getOrderedTypeSet(cls).supertypes;
- }
-
- @override
- ClassEntity getSuperClass(ClassEntity cls) {
- return elementMap.getSuperType(cls)?.element;
- }
-
- @override
- bool implementsFunction(ClassEntity cls) {
- return elementMap._implementsFunction(cls);
- }
-
- @override
- int getHierarchyDepth(ClassEntity cls) {
- return elementMap.getHierarchyDepth(cls);
- }
-
- @override
- ClassEntity getAppliedMixin(ClassEntity cls) {
- return elementMap.getAppliedMixin(cls);
- }
-}
-
DiagnosticMessage _createDiagnosticMessage(
DiagnosticReporter reporter, ir.LocatedMessage message) {
SourceSpan sourceSpan = SourceSpan(
diff --git a/pkg/compiler/lib/src/kernel/env.dart b/pkg/compiler/lib/src/kernel/env.dart
index 6943a31..2fe73fc 100644
--- a/pkg/compiler/lib/src/kernel/env.dart
+++ b/pkg/compiler/lib/src/kernel/env.dart
@@ -24,7 +24,6 @@
import '../ssa/type_builder.dart';
import '../universe/member_usage.dart';
import 'element_map.dart';
-import 'element_map_impl.dart';
/// Environment for fast lookup of component libraries.
class KProgramEnv {
@@ -198,14 +197,14 @@
KLibraryData(this.library);
- Iterable<ConstantValue> getMetadata(KernelToElementMapImpl elementMap) {
+ Iterable<ConstantValue> getMetadata(KernelToElementMap elementMap) {
return _metadata ??= elementMap.getMetadata(
ir.StaticTypeContext.forAnnotations(
library, elementMap.typeEnvironment),
library.annotations);
}
- Iterable<ImportEntity> getImports(KernelToElementMapImpl elementMap) {
+ Iterable<ImportEntity> getImports(KernelToElementMap elementMap) {
if (imports == null) {
List<ir.LibraryDependency> dependencies = library.dependencies;
if (dependencies.isEmpty) {
@@ -247,7 +246,7 @@
bool get isMixinApplicationWithMembers;
/// Ensures that all members have been computed for [cls].
- void ensureMembers(KernelToElementMapImpl elementMap);
+ void ensureMembers(KernelToElementMap elementMap);
/// Return the [MemberEntity] for the member [name] in the class. If [setter]
/// is `true`, the setter or assignable field corresponding to [name] is
@@ -328,11 +327,11 @@
}
@override
- void ensureMembers(KernelToElementMapImpl elementMap) {
+ void ensureMembers(KernelToElementMap elementMap) {
_ensureMaps(elementMap);
}
- void _ensureMaps(KernelToElementMapImpl elementMap) {
+ void _ensureMaps(KernelToElementMap elementMap) {
if (_memberMap != null) return;
_memberMap = <String, ir.Member>{};
@@ -592,8 +591,7 @@
bool isCallTypeComputed = false;
@override
- Iterable<ConstantValue> getMetadata(
- covariant KernelToElementMapImpl elementMap) {
+ Iterable<ConstantValue> getMetadata(covariant KernelToElementMap elementMap) {
return _metadata ??= elementMap.getMetadata(
ir.StaticTypeContext.forAnnotations(
node.enclosingLibrary, elementMap.typeEnvironment),
@@ -637,8 +635,7 @@
KMemberDataImpl(this.node);
@override
- Iterable<ConstantValue> getMetadata(
- covariant KernelToElementMapImpl elementMap) {
+ Iterable<ConstantValue> getMetadata(covariant KernelToElementMap elementMap) {
return _metadata ??= elementMap.getMetadata(
ir.StaticTypeContext(node, elementMap.typeEnvironment),
node.annotations);
@@ -670,7 +667,7 @@
@override
List<TypeVariableType> getFunctionTypeVariables(
- covariant KernelToElementMapImpl elementMap) {
+ covariant KernelToElementMap elementMap) {
if (_typeVariables == null) {
if (functionNode.typeParameters.isEmpty) {
_typeVariables = const <TypeVariableType>[];
@@ -705,7 +702,7 @@
KFunctionDataImpl(ir.Member node, this.functionNode) : super(node);
@override
- FunctionType getFunctionType(covariant KernelToElementMapImpl elementMap) {
+ FunctionType getFunctionType(covariant KernelToElementMap elementMap) {
return _type ??= elementMap.getFunctionType(functionNode);
}
@@ -788,7 +785,7 @@
ir.Field get node => super.node;
@override
- DartType getFieldType(covariant KernelToElementMapImpl elementMap) {
+ DartType getFieldType(covariant KernelToElementMap elementMap) {
return _type ??= elementMap.getDartType(node.type);
}
diff --git a/pkg/compiler/lib/src/kernel/kernel_strategy.dart b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
index 336ead7..64f3b3c 100644
--- a/pkg/compiler/lib/src/kernel/kernel_strategy.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_strategy.dart
@@ -44,7 +44,6 @@
import '../universe/world_impact.dart';
import '../util/enumset.dart';
import 'element_map.dart';
-import 'element_map_impl.dart';
import 'loader.dart';
import 'native_basic_data.dart';
@@ -56,7 +55,7 @@
NativeBasicData _nativeBasicData;
final CompilerOptions _options;
final CompilerTask _compilerTask;
- KernelToElementMapImpl _elementMap;
+ KernelToElementMap _elementMap;
RuntimeTypesNeedBuilder _runtimeTypesNeedBuilder;
KernelAnnotationProcessor _annotationProcessor;
@@ -85,7 +84,7 @@
KernelFrontendStrategy(this._compilerTask, this._options,
DiagnosticReporter reporter, env.Environment environment) {
assert(_compilerTask != null);
- _elementMap = KernelToElementMapImpl(reporter, environment, this, _options);
+ _elementMap = KernelToElementMap(reporter, environment, this, _options);
_modularStrategy = KernelModularStrategy(_compilerTask, _elementMap);
_backendUsageBuilder = BackendUsageBuilderImpl(this);
noSuchMethodRegistry =
@@ -141,7 +140,7 @@
elementEnvironment,
commonElements,
_elementMap.types,
- BaseNativeClassFinder(elementEnvironment, nativeBasicData));
+ NativeClassFinder(elementEnvironment, nativeBasicData));
_nativeDataBuilder = NativeDataBuilderImpl(nativeBasicData);
_customElementsResolutionAnalysis = CustomElementsResolutionAnalysis(
elementEnvironment,
@@ -149,9 +148,8 @@
nativeBasicData,
_backendUsageBuilder);
_fieldAnalysis = KFieldAnalysis(this);
- ClassQueries classQueries = KernelClassQueries(elementMap);
ClassHierarchyBuilder classHierarchyBuilder =
- ClassHierarchyBuilder(commonElements, classQueries);
+ ClassHierarchyBuilder(commonElements, elementMap);
AnnotationsDataBuilder annotationsDataBuilder = AnnotationsDataBuilder();
// TODO(johnniwinther): This is a hack. The annotation data is built while
// using it. With CFE constants the annotations data can be built fully
@@ -203,8 +201,7 @@
noSuchMethodRegistry,
annotationsDataBuilder,
const StrongModeWorldStrategy(),
- classHierarchyBuilder,
- classQueries),
+ classHierarchyBuilder),
KernelWorkItemBuilder(
_compilerTask,
elementMap,
@@ -301,9 +298,9 @@
class KernelWorkItemBuilder implements WorkItemBuilder {
final CompilerTask _compilerTask;
- final KernelToElementMapImpl _elementMap;
+ final KernelToElementMap _elementMap;
final JavaScriptImpactTransformer _impactTransformer;
- final NativeMemberResolver _nativeMemberResolver;
+ final KernelNativeMemberResolver _nativeMemberResolver;
final AnnotationsDataBuilder _annotationsDataBuilder;
final Map<MemberEntity, ClosureScopeModel> _closureModels;
final Map<Entity, WorldImpact> _impactCache;
@@ -345,9 +342,9 @@
class KernelWorkItem implements WorkItem {
final CompilerTask _compilerTask;
- final KernelToElementMapImpl _elementMap;
+ final KernelToElementMap _elementMap;
final JavaScriptImpactTransformer _impactTransformer;
- final NativeMemberResolver _nativeMemberResolver;
+ final KernelNativeMemberResolver _nativeMemberResolver;
final AnnotationsDataBuilder _annotationsDataBuilder;
@override
final MemberEntity element;
@@ -425,7 +422,7 @@
class KernelModularStrategy extends ModularStrategy {
final CompilerTask _compilerTask;
- final KernelToElementMapImpl _elementMap;
+ final KernelToElementMap _elementMap;
KernelModularStrategy(this._compilerTask, this._elementMap);
@@ -457,7 +454,7 @@
class DeserializedModularStrategy extends ModularStrategy {
final CompilerTask _compilerTask;
- final KernelToElementMapImpl _elementMap;
+ final KernelToElementMap _elementMap;
final Map<ir.Member, ImpactBuilderData> _cache = {};
DeserializedModularStrategy(
diff --git a/pkg/compiler/lib/src/kernel/kernel_world.dart b/pkg/compiler/lib/src/kernel/kernel_world.dart
index 7928607..484ab9a 100644
--- a/pkg/compiler/lib/src/kernel/kernel_world.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_world.dart
@@ -20,11 +20,11 @@
import '../universe/selector.dart';
import '../world.dart';
-import 'element_map_impl.dart';
+import 'element_map.dart';
/// The immutable result of the [ResolutionWorldBuilder].
class KClosedWorld implements BuiltWorld {
- final KernelToElementMapImpl elementMap;
+ final KernelToElementMap elementMap;
final KElementEnvironment elementEnvironment;
final DartTypes dartTypes;
final KCommonElements commonElements;
diff --git a/pkg/compiler/lib/src/kernel/native_basic_data.dart b/pkg/compiler/lib/src/kernel/native_basic_data.dart
index ed4a83d..df000a3 100644
--- a/pkg/compiler/lib/src/kernel/native_basic_data.dart
+++ b/pkg/compiler/lib/src/kernel/native_basic_data.dart
@@ -12,10 +12,10 @@
import '../js_backend/native_data.dart';
import '../native/resolver.dart';
-import 'element_map_impl.dart';
+import 'element_map.dart';
class KernelAnnotationProcessor {
- final KernelToElementMapImpl elementMap;
+ final KernelToElementMap elementMap;
final NativeBasicDataBuilder _nativeBasicDataBuilder;
final IrAnnotationData annotationData;
diff --git a/pkg/compiler/lib/src/kernel/no_such_method_resolver.dart b/pkg/compiler/lib/src/kernel/no_such_method_resolver.dart
index 2da943b..6b44875 100644
--- a/pkg/compiler/lib/src/kernel/no_such_method_resolver.dart
+++ b/pkg/compiler/lib/src/kernel/no_such_method_resolver.dart
@@ -8,12 +8,12 @@
import '../common/names.dart';
import '../elements/entities.dart';
-import 'element_map_impl.dart';
+import 'element_map.dart';
import 'kelements.dart';
/// Interface for determining the form of a `noSuchMethod` implementation.
class NoSuchMethodResolver {
- final KernelToElementMapImpl elementMap;
+ final KernelToElementMap elementMap;
NoSuchMethodResolver(this.elementMap);
diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart
index eabde14..bfd1de6 100644
--- a/pkg/compiler/lib/src/native/behavior.dart
+++ b/pkg/compiler/lib/src/native/behavior.dart
@@ -731,16 +731,19 @@
}
}
-abstract class BehaviorBuilder {
- CommonElements get commonElements;
- DiagnosticReporter get reporter;
- NativeBasicData get nativeBasicData;
- ElementEnvironment get elementEnvironment;
- CompilerOptions get options;
+class BehaviorBuilder {
+ final ElementEnvironment elementEnvironment;
+ final CommonElements commonElements;
+ final DiagnosticReporter reporter;
+ final NativeBasicData nativeBasicData;
+ final CompilerOptions options;
DartTypes get dartTypes => commonElements.dartTypes;
NativeBehavior _behavior;
+ BehaviorBuilder(this.elementEnvironment, this.commonElements,
+ this.nativeBasicData, this.reporter, this.options);
+
void _overrideWithAnnotations(Iterable<String> createsAnnotations,
Iterable<String> returnsAnnotations, TypeLookup lookupType) {
if (createsAnnotations.isEmpty && returnsAnnotations.isEmpty) return;
diff --git a/pkg/compiler/lib/src/native/resolver.dart b/pkg/compiler/lib/src/native/resolver.dart
index 99f0ab8..b579393 100644
--- a/pkg/compiler/lib/src/native/resolver.dart
+++ b/pkg/compiler/lib/src/native/resolver.dart
@@ -2,37 +2,23 @@
// for 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:kernel/ast.dart' as ir;
-
import '../common.dart';
import '../common/elements.dart' show KElementEnvironment;
import '../constants/values.dart';
import '../elements/entities.dart';
import '../elements/types.dart';
-import '../ir/annotations.dart';
import '../js_backend/native_data.dart';
-/// Interface for computing native members.
-abstract class NativeMemberResolver {
- /// Computes whether [node] is native or JsInterop.
- void resolveNativeMember(ir.Member node, IrAnnotationData annotationData);
-}
-
/// Determines all native classes in a set of libraries.
-abstract class NativeClassFinder {
- /// Returns the set of all native classes declared in [libraries].
- Iterable<ClassEntity> computeNativeClasses(Iterable<Uri> libraries);
-}
-
-class BaseNativeClassFinder implements NativeClassFinder {
+class NativeClassFinder {
final KElementEnvironment _elementEnvironment;
final NativeBasicData _nativeBasicData;
final Map<String, ClassEntity> _tagOwner = {};
- BaseNativeClassFinder(this._elementEnvironment, this._nativeBasicData);
+ NativeClassFinder(this._elementEnvironment, this._nativeBasicData);
- @override
+ /// Returns the set of all native classes declared in [libraries].
Iterable<ClassEntity> computeNativeClasses(Iterable<Uri> libraries) {
Set<ClassEntity> nativeClasses = {};
libraries.forEach((uri) => _processNativeClassesInLibrary(
diff --git a/pkg/compiler/lib/src/serialization/task.dart b/pkg/compiler/lib/src/serialization/task.dart
index 0e6e7d5..15889be 100644
--- a/pkg/compiler/lib/src/serialization/task.dart
+++ b/pkg/compiler/lib/src/serialization/task.dart
@@ -8,7 +8,6 @@
import 'package:kernel/binary/ast_to_binary.dart' as ir;
import 'package:front_end/src/fasta/util/bytes_sink.dart';
import '../../compiler.dart' as api;
-import '../backend_strategy.dart';
import '../commandline_options.dart' show Flags;
import '../common/codegen.dart';
import '../common/tasks.dart';
@@ -22,6 +21,7 @@
import '../js_backend/inferred_data.dart';
import '../js_model/js_world.dart';
import '../js_model/element_map_impl.dart';
+import '../js_model/js_strategy.dart';
import '../js_model/locals.dart';
import '../options.dart';
import '../util/sink_adapter.dart';
@@ -287,7 +287,7 @@
});
}
- void serializeCodegen(BackendStrategy backendStrategy,
+ void serializeCodegen(JsBackendStrategy backendStrategy,
CodegenResults codegenResults, DataSourceIndices indices) {
GlobalTypeInferenceResults globalTypeInferenceResults =
codegenResults.globalTypeInferenceResults;
@@ -321,7 +321,7 @@
}
Future<CodegenResults> deserializeCodegen(
- BackendStrategy backendStrategy,
+ JsBackendStrategy backendStrategy,
GlobalTypeInferenceResults globalTypeInferenceResults,
CodegenInputs codegenInputs,
DataSourceIndices indices) async {
@@ -346,7 +346,7 @@
}
void _deserializeCodegenInput(
- BackendStrategy backendStrategy,
+ JsBackendStrategy backendStrategy,
JClosedWorld closedWorld,
Uri uri,
api.Input<List<int>> dataInput,
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index ac66787..26c0537 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -368,8 +368,6 @@
return options.enableVariance;
case 'LEGACY':
return options.useLegacySubtyping;
- case 'LEGACY_JAVASCRIPT':
- return options.features.legacyJavaScript.isEnabled;
case 'PRINT_LEGACY_STARS':
return options.printLegacyStars;
default:
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart
index 4986815..40243ad 100644
--- a/pkg/compiler/lib/src/ssa/ssa.dart
+++ b/pkg/compiler/lib/src/ssa/ssa.dart
@@ -4,7 +4,6 @@
library ssa;
-import '../backend_strategy.dart';
import '../common.dart';
import '../common/codegen.dart' show CodegenResult, CodegenRegistry;
import '../common/elements.dart' show CommonElements, JElementEnvironment;
@@ -22,6 +21,7 @@
import '../js_emitter/startup_emitter/emitter.dart' show ModularEmitterImpl;
import '../js_model/elements.dart';
import '../js_model/type_recipe.dart' show TypeExpressionRecipe;
+import '../js_model/js_strategy.dart';
import '../options.dart';
import '../universe/call_structure.dart' show CallStructure;
import '../universe/use.dart' show StaticUse;
@@ -44,7 +44,7 @@
SsaFunctionCompiler(
this._options,
this._reporter,
- BackendStrategy backendStrategy,
+ JsBackendStrategy backendStrategy,
Measurer measurer,
this.sourceInformationStrategy)
: generator =
@@ -319,7 +319,7 @@
}
class SsaBuilderTask extends CompilerTask {
- final BackendStrategy _backendStrategy;
+ final JsBackendStrategy _backendStrategy;
final SourceInformationStrategy _sourceInformationFactory;
SsaBuilder _builder;
diff --git a/pkg/compiler/lib/src/universe/class_hierarchy.dart b/pkg/compiler/lib/src/universe/class_hierarchy.dart
index 295204e..24cc4ce 100644
--- a/pkg/compiler/lib/src/universe/class_hierarchy.dart
+++ b/pkg/compiler/lib/src/universe/class_hierarchy.dart
@@ -6,6 +6,7 @@
import '../common/elements.dart';
import '../elements/entities.dart';
import '../elements/types.dart' show InterfaceType;
+import '../kernel/element_map.dart' show KernelToElementMap;
import '../serialization/serialization.dart';
import 'class_set.dart';
@@ -574,9 +575,9 @@
final Map<ClassEntity, Set<ClassEntity>> mixinUses = {};
final CommonElements _commonElements;
- final ClassQueries _classQueries;
+ final KernelToElementMap _elementMap;
- ClassHierarchyBuilder(this._commonElements, this._classQueries);
+ ClassHierarchyBuilder(this._commonElements, this._elementMap);
ClassHierarchy close() {
assert(
@@ -589,18 +590,18 @@
}
void registerClass(ClassEntity cls) {
- _ensureClassSet(_classQueries.getDeclaration(cls));
+ _ensureClassSet(cls);
}
ClassHierarchyNode _ensureClassHierarchyNode(ClassEntity cls) {
return _classHierarchyNodes.putIfAbsent(cls, () {
ClassHierarchyNode parentNode;
- ClassEntity superclass = _classQueries.getSuperClass(cls);
+ ClassEntity superclass = _elementMap.getSuperClass(cls);
if (superclass != null) {
parentNode = _ensureClassHierarchyNode(superclass);
}
return ClassHierarchyNode(
- parentNode, cls, _classQueries.getHierarchyDepth(cls));
+ parentNode, cls, _elementMap.getHierarchyDepth(cls));
});
}
@@ -609,14 +610,14 @@
ClassHierarchyNode node = _ensureClassHierarchyNode(cls);
ClassSet classSet = ClassSet(node);
- for (InterfaceType type in _classQueries.getSupertypes(cls)) {
+ for (InterfaceType type in _elementMap.getSuperTypes(cls)) {
// TODO(johnniwinther): Optimization: Avoid adding [cls] to
// superclasses.
ClassSet subtypeSet = _ensureClassSet(type.element);
subtypeSet.addSubtype(node);
}
- ClassEntity appliedMixin = _classQueries.getAppliedMixin(cls);
+ ClassEntity appliedMixin = _elementMap.getAppliedMixin(cls);
while (appliedMixin != null) {
// TODO(johnniwinther): Use the data stored in [ClassSet].
registerMixinUse(cls, appliedMixin);
@@ -630,7 +631,7 @@
// class C = Object with B;
//
// we need to register that C not only mixes in B but also A.
- appliedMixin = _classQueries.getAppliedMixin(appliedMixin);
+ appliedMixin = _elementMap.getAppliedMixin(appliedMixin);
}
return classSet;
});
@@ -641,7 +642,7 @@
// subtype set.
ClassEntity cls = node.cls;
if (cls != _commonElements.functionClass &&
- _classQueries.implementsFunction(cls)) {
+ _elementMap.implementsFunction(cls)) {
ClassSet subtypeSet = _ensureClassSet(_commonElements.functionClass);
subtypeSet.addSubtype(node);
}
@@ -912,32 +913,6 @@
}
}
-abstract class ClassQueries {
- /// Returns the declaration of [cls].
- ClassEntity getDeclaration(covariant ClassEntity cls);
-
- /// Returns the class mixed into [cls] if any.
- // TODO(johnniwinther): Replace this by a `getAppliedMixins` function that
- // return transitively mixed in classes like in:
- // class A {}
- // class B = Object with A;
- // class C = Object with B;
- ClassEntity getAppliedMixin(covariant ClassEntity cls);
-
- /// Returns the hierarchy depth of [cls].
- int getHierarchyDepth(covariant ClassEntity cls);
-
- /// Returns `true` if [cls] implements `Function` either explicitly or through
- /// a `call` method.
- bool implementsFunction(covariant ClassEntity cls);
-
- /// Returns the superclass of [cls] if any.
- ClassEntity getSuperClass(covariant ClassEntity cls);
-
- /// Returns all supertypes of [cls].
- Iterable<InterfaceType> getSupertypes(covariant ClassEntity cls);
-}
-
/// Enum values defining subset of classes included in queries.
enum ClassQuery {
/// Only the class itself is included.
diff --git a/pkg/compiler/lib/src/universe/resolution_world_builder.dart b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
index 2d04eae..3f31e7b 100644
--- a/pkg/compiler/lib/src/universe/resolution_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
@@ -17,7 +17,7 @@
import '../js_backend/native_data.dart' show NativeBasicData, NativeDataBuilder;
import '../js_backend/no_such_method_registry.dart';
import '../js_backend/runtime_types_resolution.dart';
-import '../kernel/element_map_impl.dart';
+import '../kernel/element_map.dart';
import '../kernel/kernel_world.dart';
import '../native/enqueue.dart' show NativeResolutionEnqueuer;
import '../options.dart';
@@ -25,7 +25,7 @@
import '../util/util.dart';
import '../world.dart' show World;
import 'call_structure.dart';
-import 'class_hierarchy.dart' show ClassHierarchyBuilder, ClassQueries;
+import 'class_hierarchy.dart' show ClassHierarchyBuilder;
import 'class_set.dart';
import 'member_usage.dart';
import 'selector.dart' show Selector;
@@ -263,7 +263,6 @@
final SelectorConstraintsStrategy _selectorConstraintsStrategy;
final ClassHierarchyBuilder _classHierarchyBuilder;
- final ClassQueries _classQueries;
bool _closed = false;
KClosedWorld _closedWorldCache;
@@ -277,7 +276,7 @@
bool get isClosed => _closed;
- final KernelToElementMapImpl _elementMap;
+ final KernelToElementMap _elementMap;
ResolutionWorldBuilder(
this._options,
@@ -295,8 +294,7 @@
this._noSuchMethodRegistry,
this._annotationsDataBuilder,
this._selectorConstraintsStrategy,
- this._classHierarchyBuilder,
- this._classQueries);
+ this._classHierarchyBuilder);
/// Returns the classes registered as directly or indirectly instantiated.
Iterable<ClassEntity> get processedClasses => _processedClasses.keys
@@ -857,14 +855,14 @@
// Walk through the superclasses, and record the types
// implemented by that type on the superclasses.
- ClassEntity superclass = _classQueries.getSuperClass(cls);
+ ClassEntity superclass = _elementMap.getSuperClass(cls);
while (superclass != null) {
Set<ClassEntity> typesImplementedBySubclassesOfCls =
typesImplementedBySubclasses.putIfAbsent(superclass, () => {});
- for (InterfaceType current in _classQueries.getSupertypes(cls)) {
+ for (InterfaceType current in _elementMap.getSuperTypes(cls)) {
typesImplementedBySubclassesOfCls.add(current.element);
}
- superclass = _classQueries.getSuperClass(superclass);
+ superclass = _elementMap.getSuperClass(superclass);
}
}
diff --git a/pkg/compiler/test/end_to_end/exit_code_test.dart b/pkg/compiler/test/end_to_end/exit_code_test.dart
index ee7a324..be0974f 100644
--- a/pkg/compiler/test/end_to_end/exit_code_test.dart
+++ b/pkg/compiler/test/end_to_end/exit_code_test.dart
@@ -12,7 +12,6 @@
import 'package:expect/expect.dart';
import 'package:compiler/compiler.dart' as api;
-import 'package:compiler/src/backend_strategy.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/codegen.dart';
import 'package:compiler/src/common/work.dart';
@@ -55,7 +54,7 @@
}
@override
- BackendStrategy createBackendStrategy() {
+ JsBackendStrategy createBackendStrategy() {
return new TestBackendStrategy(this);
}
diff --git a/pkg/compiler/test/equivalence/id_equivalence_helper.dart b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
index d09b6c0..037cf61 100644
--- a/pkg/compiler/test/equivalence/id_equivalence_helper.dart
+++ b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
@@ -14,7 +14,7 @@
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
+import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
import 'package:expect/expect.dart';
import 'package:kernel/ast.dart' as ir;
@@ -254,7 +254,7 @@
ir.Library getIrLibrary(LibraryEntity library) {
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
LibraryEntity kLibrary =
elementMap.elementEnvironment.lookupLibrary(library.canonicalUri);
return elementMap.getLibraryNode(kLibrary);
diff --git a/pkg/compiler/test/equivalence/id_testing_test.dart b/pkg/compiler/test/equivalence/id_testing_test.dart
index 5789c7c..1f9bfe35 100644
--- a/pkg/compiler/test/equivalence/id_testing_test.dart
+++ b/pkg/compiler/test/equivalence/id_testing_test.dart
@@ -9,7 +9,7 @@
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
+import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
import 'package:front_end/src/testing/id_testing_utils.dart';
import 'package:kernel/ast.dart' as ir;
@@ -31,7 +31,7 @@
Map<Id, ActualData<String>> actualMap,
{bool verbose: false}) {
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
ir.Member node = elementMap.getMemberNode(member);
new IdTestingDataExtractor(compiler.reporter, actualMap, elementMap)
.run(node);
@@ -42,7 +42,7 @@
Compiler compiler, ClassEntity cls, Map<Id, ActualData<String>> actualMap,
{bool verbose}) {
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
ir.Class node = elementMap.getClassNode(cls);
new IdTestingDataExtractor(compiler.reporter, actualMap, elementMap)
.computeForClass(node);
@@ -53,7 +53,7 @@
Map<Id, ActualData<String>> actualMap,
{bool verbose}) {
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
ir.Library node = elementMap.getLibraryNode(library);
new IdTestingDataExtractor(compiler.reporter, actualMap, elementMap)
.computeForLibrary(node);
@@ -77,7 +77,7 @@
/// IR visitor for computing inference data for a member.
class IdTestingDataExtractor extends IrDataExtractor<String> {
- final KernelToElementMapImpl elementMap;
+ final KernelToElementMap elementMap;
IdTestingDataExtractor(DiagnosticReporter reporter,
Map<Id, ActualData<String>> actualMap, this.elementMap)
diff --git a/pkg/compiler/test/model/cfe_annotations_test.dart b/pkg/compiler/test/model/cfe_annotations_test.dart
index e6e164a..4377903 100644
--- a/pkg/compiler/test/model/cfe_annotations_test.dart
+++ b/pkg/compiler/test/model/cfe_annotations_test.dart
@@ -12,7 +12,6 @@
import 'package:compiler/src/js_backend/native_data.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
import 'package:expect/expect.dart';
import 'package:front_end/src/api_prototype/lowering_predicates.dart';
import 'package:kernel/ast.dart' as ir;
@@ -198,7 +197,7 @@
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
ir.Component component = elementMap.env.mainComponent;
IrAnnotationData annotationData =
frontendStrategy.irAnnotationDataForTesting;
diff --git a/pkg/compiler/test/model/cfe_constant_evaluation_test.dart b/pkg/compiler/test/model/cfe_constant_evaluation_test.dart
index ae213d2..a3d52f9 100644
--- a/pkg/compiler/test/model/cfe_constant_evaluation_test.dart
+++ b/pkg/compiler/test/model/cfe_constant_evaluation_test.dart
@@ -20,7 +20,7 @@
import 'package:compiler/src/ir/constants.dart';
import 'package:compiler/src/ir/visitors.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
+import 'package:compiler/src/kernel/element_map.dart';
import 'package:front_end/src/api_prototype/constant_evaluator.dart' as ir;
import 'package:front_end/src/api_unstable/dart2js.dart' as ir;
import 'package:kernel/ast.dart' as ir;
@@ -574,7 +574,7 @@
options: [Flags.enableAsserts]);
Compiler compiler = result.compiler;
KernelFrontendStrategy frontEndStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontEndStrategy.elementMap;
+ KernelToElementMap elementMap = frontEndStrategy.elementMap;
DartTypes dartTypes = elementMap.types;
ir.TypeEnvironment typeEnvironment = elementMap.typeEnvironment;
KElementEnvironment elementEnvironment =
diff --git a/pkg/compiler/test/model/cfe_constant_test.dart b/pkg/compiler/test/model/cfe_constant_test.dart
index d9dfbf0..d4ab111 100644
--- a/pkg/compiler/test/model/cfe_constant_test.dart
+++ b/pkg/compiler/test/model/cfe_constant_test.dart
@@ -9,7 +9,7 @@
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
+import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/class_hierarchy.dart' as ir;
@@ -31,7 +31,7 @@
class ConstantDataComputer extends DataComputer<String> {
ir.TypeEnvironment _typeEnvironment;
- ir.TypeEnvironment getTypeEnvironment(KernelToElementMapImpl elementMap) {
+ ir.TypeEnvironment getTypeEnvironment(KernelToElementMap elementMap) {
if (_typeEnvironment == null) {
ir.Component component = elementMap.env.mainComponent;
ir.CoreTypes coreTypes = new ir.CoreTypes(component);
@@ -49,7 +49,7 @@
Map<Id, ActualData<String>> actualMap,
{bool verbose: false}) {
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
ir.Member node = elementMap.getMemberNode(member);
new ConstantDataExtractor(compiler.reporter, actualMap, elementMap, member)
.run(node);
@@ -73,7 +73,7 @@
/// IR visitor for computing inference data for a member.
class ConstantDataExtractor extends IrDataExtractor<String> {
- final KernelToElementMapImpl elementMap;
+ final KernelToElementMap elementMap;
final MemberEntity member;
ConstantDataExtractor(DiagnosticReporter reporter,
diff --git a/pkg/compiler/test/static_type/static_type_test.dart b/pkg/compiler/test/static_type/static_type_test.dart
index 0123144..0498952 100644
--- a/pkg/compiler/test/static_type/static_type_test.dart
+++ b/pkg/compiler/test/static_type/static_type_test.dart
@@ -12,7 +12,7 @@
import 'package:compiler/src/ir/cached_static_type.dart';
import 'package:compiler/src/ir/static_type_base.dart';
import 'package:compiler/src/ir/static_type_cache.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
+import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/class_hierarchy.dart' as ir;
@@ -34,7 +34,7 @@
ir.TypeEnvironment _typeEnvironment;
ir.StaticTypeContext getStaticTypeContext(
- KernelToElementMapImpl elementMap, ir.Member node) {
+ KernelToElementMap elementMap, ir.Member node) {
if (_typeEnvironment == null) {
ir.Component component = elementMap.env.mainComponent;
ir.CoreTypes coreTypes = new ir.CoreTypes(component);
@@ -52,7 +52,7 @@
Map<Id, ActualData<String>> actualMap,
{bool verbose: false}) {
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
StaticTypeCache staticTypeCache = elementMap.getCachedStaticTypes(member);
ir.Member node = elementMap.getMemberNode(member);
new StaticTypeIrComputer(
diff --git a/pkg/compiler/test/static_type/type_promotion_test.dart b/pkg/compiler/test/static_type/type_promotion_test.dart
index 9584f53..c6ab8a8 100644
--- a/pkg/compiler/test/static_type/type_promotion_test.dart
+++ b/pkg/compiler/test/static_type/type_promotion_test.dart
@@ -10,7 +10,7 @@
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/ir/static_type.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
+import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/class_hierarchy.dart' as ir;
@@ -31,7 +31,7 @@
class TypePromotionDataComputer extends DataComputer<String> {
ir.TypeEnvironment _typeEnvironment;
- ir.TypeEnvironment getTypeEnvironment(KernelToElementMapImpl elementMap) {
+ ir.TypeEnvironment getTypeEnvironment(KernelToElementMap elementMap) {
if (_typeEnvironment == null) {
ir.Component component = elementMap.env.mainComponent;
ir.CoreTypes coreTypes = new ir.CoreTypes(component);
@@ -49,7 +49,7 @@
Map<Id, ActualData<String>> actualMap,
{bool verbose: false}) {
KernelFrontendStrategy frontendStrategy = compiler.frontendStrategy;
- KernelToElementMapImpl elementMap = frontendStrategy.elementMap;
+ KernelToElementMap elementMap = frontendStrategy.elementMap;
Map<ir.Expression, TypeMap> typeMaps =
elementMap.getTypeMapsForTesting(member);
ir.Member node = elementMap.getMemberNode(member);
diff --git a/pkg/nnbd_migration/test/migration_cli_test.dart b/pkg/nnbd_migration/test/migration_cli_test.dart
index 48c7c49..c0523f6 100644
--- a/pkg/nnbd_migration/test/migration_cli_test.dart
+++ b/pkg/nnbd_migration/test/migration_cli_test.dart
@@ -1661,10 +1661,10 @@
}
test_option_sdk_default() {
- var cli = MigrationCli(binaryName: 'nnbd_migration');
+ var cli = _createCli();
var cliRunner = cli.decodeCommandLineArgs(_parseArgs([]))!;
- expect(Directory(path.join(cliRunner.options.sdkPath, 'bin')).existsSync(),
- isTrue);
+ expect(cliRunner.options.sdkPath,
+ cli._test.resourceProvider.convertPath(sdkRootPathPosix));
}
test_option_sdk_hidden() {
diff --git a/runtime/vm/compiler/assembler/assembler_arm64_test.cc b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
index 97ce2ab..4c40284 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64_test.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
@@ -349,8 +349,8 @@
"movn r2, #0x0\n"
"movz r1, #0x1\n"
"movz r0, #0x0\n"
- "adds ip0, r2, r1\n"
- "adcs ip0, r2, r0\n"
+ "adds tmp, r2, r1\n"
+ "adcs tmp, r2, r0\n"
"adc r0, r0, r0\n"
"ret\n");
}
@@ -370,8 +370,8 @@
EXPECT_DISASSEMBLY(
"movz r1, #0x1\n"
"movz r0, #0x0\n"
- "subs ip0, r0, r1\n"
- "sbcs ip0, r0, r0\n"
+ "subs tmp, r0, r1\n"
+ "sbcs tmp, r0, r0\n"
"sbc r0, r0, r0\n"
"ret\n");
}
@@ -395,8 +395,8 @@
"movz r1, #0x1\n"
"movn r2, #0x0\n"
"mov r3, 0x7fffffffffffffff\n"
- "adds ip0, r2, r1\n"
- "adcs ip0, r3, r0\n"
+ "adds tmp, r2, r1\n"
+ "adcs tmp, r3, r0\n"
"csinc r0, r0, r0, vs\n"
"ret\n");
}
@@ -418,8 +418,8 @@
"movn r2, #0x0\n"
"movz r1, #0x1\n"
"movz r0, #0x0\n"
- "addws ip0, r2, r1\n"
- "adcws ip0, r2, r0\n"
+ "addws tmp, r2, r1\n"
+ "adcws tmp, r2, r0\n"
"adcw r0, r0, r0\n"
"ret\n");
}
@@ -439,8 +439,8 @@
EXPECT_DISASSEMBLY(
"movz r1, #0x1\n"
"movz r0, #0x0\n"
- "subws ip0, r0, r1\n"
- "sbcws ip0, r0, r0\n"
+ "subws tmp, r0, r1\n"
+ "sbcws tmp, r0, r0\n"
"sbcw r0, r0, r0\n"
"ret\n");
}
@@ -464,8 +464,8 @@
"movz r1, #0x1\n"
"mov r2, 0xffffffff\n"
"mov r3, 0x7fffffff\n"
- "addws ip0, r2, r1\n"
- "adcws ip0, r3, r0\n"
+ "addws tmp, r2, r1\n"
+ "adcws tmp, r3, r0\n"
"csinc r0, r0, r0, vs\n"
"ret\n");
}
@@ -489,14 +489,14 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x10\n"
"movz r0, #0x2b\n"
"movz r1, #0x2a\n"
- "str r1, [r15, #-8]!\n"
- "ldr r0, [r15], #8 !\n"
- "mov csp, r15\n"
+ "str r1, [sp, #-8]!\n"
+ "ldr r0, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -515,14 +515,14 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x2b\n"
"movz r1, #0x2a\n"
- "add r2, r15, #0x1\n"
+ "add r2, sp, #0x1\n"
"str r1, [r2, #-1]\n"
"ldr r0, [r2, #-1]\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -548,15 +548,15 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x100\n"
"movz r0, #0x2b\n"
"movz r1, #0x2a\n"
- "str r1, [r15, #-256]!\n"
- "ldr r0, [r15], #248 !\n"
- "add r15, r15, #0x8\n"
- "mov csp, r15\n"
+ "str r1, [sp, #-256]!\n"
+ "ldr r0, [sp], #248 !\n"
+ "add sp, sp, #0x8\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -577,16 +577,16 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x2b\n"
"movz r1, #0x2a\n"
- "sub r15, r15, #0x1000\n"
- "and csp, r15, 0xfffffffffffffff0\n"
- "str r1, [r15, #4096]\n"
- "add r15, r15, #0x1000\n"
- "ldr r0, [r15]\n"
- "mov csp, r15\n"
+ "sub sp, sp, #0x1000\n"
+ "and csp, sp, 0xfffffffffffffff0\n"
+ "str r1, [sp, #4096]\n"
+ "add sp, sp, #0x1000\n"
+ "ldr r0, [sp]\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -611,18 +611,18 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x2b\n"
"movz r1, #0x2a\n"
"movz r2, #0xfff8\n"
"movk r2, #0xffff lsl 16\n"
- "str r1, [r15, r2 sxtw]\n"
- "sub r15, r15, #0x8\n"
- "and csp, r15, 0xfffffffffffffff0\n"
- "ldr r0, [r15]\n"
- "add r15, r15, #0x8\n"
- "mov csp, r15\n"
+ "str r1, [sp, r2 sxtw]\n"
+ "sub sp, sp, #0x8\n"
+ "and csp, sp, 0xfffffffffffffff0\n"
+ "ldr r0, [sp]\n"
+ "add sp, sp, #0x8\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -645,17 +645,17 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x2b\n"
"movz r1, #0x2a\n"
"movz r2, #0xa\n"
- "sub r15, r15, #0x50\n"
- "and csp, r15, 0xfffffffffffffff0\n"
- "str r1, [r15, r2 uxtx scaled]\n"
- "ldr r0, [r15, r2 uxtx scaled]\n"
- "add r15, r15, #0x50\n"
- "mov csp, r15\n"
+ "sub sp, sp, #0x50\n"
+ "and csp, sp, 0xfffffffffffffff0\n"
+ "str r1, [sp, r2 uxtx scaled]\n"
+ "ldr r0, [sp, r2 uxtx scaled]\n"
+ "add sp, sp, #0x50\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -677,14 +677,14 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x10\n"
"mov r1, 0xffffffff\n"
- "strw r1, [r15, #-4]!\n"
- "ldrsw r0, [r15]\n"
- "ldrsw r1, [r15], #4 !\n"
- "mov csp, r15\n"
+ "strw r1, [sp, #-4]!\n"
+ "ldrsw r0, [sp]\n"
+ "ldrsw r1, [sp], #4 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -707,15 +707,15 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x10\n"
"movz r2, #0x2b\n"
"movz r3, #0x2a\n"
- "stp r2, r3, [r15, #-16]!\n"
- "ldp r0, r1, [r15], #16 !\n"
+ "stp r2, r3, [sp, #-16]!\n"
+ "ldp r0, r1, [sp], #16 !\n"
"sub r0, r0, r1\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -737,17 +737,17 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r2, #0x2b\n"
"movz r3, #0x2a\n"
- "sub r15, r15, #0x20\n"
- "and csp, r15, 0xfffffffffffffff0\n"
- "stp r2, r3, [r15, #16]\n"
- "ldp r0, r1, [r15, #16]\n"
- "add r15, r15, #0x20\n"
+ "sub sp, sp, #0x20\n"
+ "and csp, sp, 0xfffffffffffffff0\n"
+ "stp r2, r3, [sp, #16]\n"
+ "ldp r0, r1, [sp, #16]\n"
+ "add sp, sp, #0x20\n"
"sub r0, r0, r1\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -767,14 +767,14 @@
typedef int (*PushRegisterPair)() DART_UNUSED;
EXPECT_EQ(12, EXECUTE_TEST_CODE_INT64(PushRegisterPair, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r2, #0xc\n"
"movz r3, #0x15\n"
- "stp r2, r3, [r15, #-16]!\n"
- "ldr r0, [r15], #8 !\n"
- "ldr r1, [r15], #8 !\n"
- "mov csp, r15\n"
+ "stp r2, r3, [sp, #-16]!\n"
+ "ldr r0, [sp], #8 !\n"
+ "ldr r1, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -795,14 +795,14 @@
EXPECT_EQ(12,
EXECUTE_TEST_CODE_INT64(PushRegisterPairReversed, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r3, #0xc\n"
"movz r2, #0x15\n"
- "stp r3, r2, [r15, #-16]!\n"
- "ldr r0, [r15], #8 !\n"
- "ldr r1, [r15], #8 !\n"
- "mov csp, r15\n"
+ "stp r3, r2, [sp, #-16]!\n"
+ "ldr r0, [sp], #8 !\n"
+ "ldr r1, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -822,14 +822,14 @@
typedef int (*PopRegisterPair)() DART_UNUSED;
EXPECT_EQ(12, EXECUTE_TEST_CODE_INT64(PopRegisterPair, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r2, #0xc\n"
"movz r3, #0x15\n"
- "str r3, [r15, #-8]!\n"
- "str r2, [r15, #-8]!\n"
- "ldp r0, r1, [r15], #16 !\n"
- "mov csp, r15\n"
+ "str r3, [sp, #-8]!\n"
+ "str r2, [sp, #-8]!\n"
+ "ldp r0, r1, [sp], #16 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -850,14 +850,14 @@
EXPECT_EQ(12,
EXECUTE_TEST_CODE_INT64(PopRegisterPairReversed, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r3, #0xc\n"
"movz r2, #0x15\n"
- "str r3, [r15, #-8]!\n"
- "str r2, [r15, #-8]!\n"
- "ldp r1, r0, [r15], #16 !\n"
- "mov csp, r15\n"
+ "str r3, [sp, #-8]!\n"
+ "str r2, [sp, #-8]!\n"
+ "ldp r1, r0, [sp], #16 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -882,17 +882,17 @@
typedef intptr_t (*Semaphore)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Semaphore, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x28\n"
"movz r1, #0x2a\n"
- "str r0, [r15, #-8]!\n"
- "ldxr r0, r15\n"
- "stxr ip0, r1, r15\n"
- "cmp ip0, #0x0\n"
+ "str r0, [sp, #-8]!\n"
+ "ldxr r0, sp\n"
+ "stxr tmp, r1, sp\n"
+ "cmp tmp, #0x0\n"
"bne -12\n"
- "ldr r0, [r15], #8 !\n"
- "mov csp, r15\n"
+ "ldr r0, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -915,17 +915,17 @@
typedef intptr_t (*FailedSemaphore)() DART_UNUSED;
EXPECT_EQ(41, EXECUTE_TEST_CODE_INT64(FailedSemaphore, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x28\n"
"movz r1, #0x2a\n"
- "str r0, [r15, #-8]!\n"
- "ldxr r0, r15\n"
+ "str r0, [sp, #-8]!\n"
+ "ldxr r0, sp\n"
"clrex\n"
- "stxr ip0, r1, r15\n"
- "ldr r0, [r15], #8 !\n"
- "add r0, r0, ip0\n"
- "mov csp, r15\n"
+ "stxr tmp, r1, sp\n"
+ "ldr r0, [sp], #8 !\n"
+ "add r0, r0, tmp\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -959,19 +959,19 @@
EXPECT_EQ(42 + (DART_INT64_C(40) << 32),
EXECUTE_TEST_CODE_INT64(Semaphore32, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x28\n"
"add r0, r0, r0 lsl #32\n"
- "str r0, [r15, #-8]!\n"
+ "str r0, [sp, #-8]!\n"
"movz r0, #0x28\n"
"movz r1, #0x2a\n"
- "ldxrw r0, r15\n"
- "stxrw ip0, r1, r15\n"
- "cmp ip0, #0x0\n"
+ "ldxrw r0, sp\n"
+ "stxrw tmp, r1, sp\n"
+ "cmp tmp, #0x0\n"
"bne -12\n"
- "ldr r0, [r15], #8 !\n"
- "mov csp, r15\n"
+ "ldr r0, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -1001,19 +1001,19 @@
EXPECT_EQ(41 + (DART_INT64_C(40) << 32),
EXECUTE_TEST_CODE_INT64(FailedSemaphore32, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"movz r0, #0x28\n"
"add r0, r0, r0 lsl #32\n"
- "str r0, [r15, #-8]!\n"
+ "str r0, [sp, #-8]!\n"
"movz r0, #0x28\n"
"movz r1, #0x2a\n"
- "ldxrw r0, r15\n"
+ "ldxrw r0, sp\n"
"clrex\n"
- "stxrw ip0, r1, r15\n"
- "ldr r0, [r15], #8 !\n"
- "add r0, r0, ip0\n"
- "mov csp, r15\n"
+ "stxrw tmp, r1, sp\n"
+ "ldr r0, [sp], #8 !\n"
+ "add r0, r0, tmp\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -1072,66 +1072,66 @@
EXPECT_EQ(0x42,
EXECUTE_TEST_CODE_INT64(LoadAcquireStoreRelease, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "stp fp, lr, [r15, #-16]!\n"
- "mov fp, r15\n"
- "movz ip0, #0x7788\n"
- "movk ip0, #0x5566 lsl 16\n"
- "movk ip0, #0x3344 lsl 32\n"
- "movk ip0, #0x1122 lsl 48\n"
- "str ip0, [r15, #-8]!\n"
- "ldar r1, r15\n"
- "movz ip1, #0x7788\n"
- "movk ip1, #0x5566 lsl 16\n"
- "movk ip1, #0x3344 lsl 32\n"
- "movk ip1, #0x1122 lsl 48\n"
- "cmp r1, ip1\n"
+ "stp fp, lr, [sp, #-16]!\n"
+ "mov fp, sp\n"
+ "movz tmp, #0x7788\n"
+ "movk tmp, #0x5566 lsl 16\n"
+ "movk tmp, #0x3344 lsl 32\n"
+ "movk tmp, #0x1122 lsl 48\n"
+ "str tmp, [sp, #-8]!\n"
+ "ldar r1, sp\n"
+ "movz tmp2, #0x7788\n"
+ "movk tmp2, #0x5566 lsl 16\n"
+ "movk tmp2, #0x3344 lsl 32\n"
+ "movk tmp2, #0x1122 lsl 48\n"
+ "cmp r1, tmp2\n"
"bne +164\n"
- "add r15, r15, #0x8\n"
- "movz ip0, #0x7788\n"
- "movk ip0, #0x5566 lsl 16\n"
- "movk ip0, #0x3344 lsl 32\n"
- "movk ip0, #0x1122 lsl 48\n"
- "str ip0, [r15, #-8]!\n"
- "ldarw r1, r15\n"
- "movz ip1, #0x7788\n"
- "movk ip1, #0x5566 lsl 16\n"
- "cmp r1, ip1\n"
+ "add sp, sp, #0x8\n"
+ "movz tmp, #0x7788\n"
+ "movk tmp, #0x5566 lsl 16\n"
+ "movk tmp, #0x3344 lsl 32\n"
+ "movk tmp, #0x1122 lsl 48\n"
+ "str tmp, [sp, #-8]!\n"
+ "ldarw r1, sp\n"
+ "movz tmp2, #0x7788\n"
+ "movk tmp2, #0x5566 lsl 16\n"
+ "cmp r1, tmp2\n"
"bne +120\n"
- "add r15, r15, #0x8\n"
- "movz ip0, #0x0\n"
- "str ip0, [r15, #-8]!\n"
+ "add sp, sp, #0x8\n"
+ "movz tmp, #0x0\n"
+ "str tmp, [sp, #-8]!\n"
"movz r1, #0x7788\n"
"movk r1, #0x5566 lsl 16\n"
"movk r1, #0x3344 lsl 32\n"
"movk r1, #0x1122 lsl 48\n"
- "stlr r1, r15\n"
- "ldr r1, [r15], #8 !\n"
- "movz ip1, #0x7788\n"
- "movk ip1, #0x5566 lsl 16\n"
- "movk ip1, #0x3344 lsl 32\n"
- "movk ip1, #0x1122 lsl 48\n"
- "cmp r1, ip1\n"
+ "stlr r1, sp\n"
+ "ldr r1, [sp], #8 !\n"
+ "movz tmp2, #0x7788\n"
+ "movk tmp2, #0x5566 lsl 16\n"
+ "movk tmp2, #0x3344 lsl 32\n"
+ "movk tmp2, #0x1122 lsl 48\n"
+ "cmp r1, tmp2\n"
"bne +60\n"
- "movz ip0, #0x0\n"
- "str ip0, [r15, #-8]!\n"
+ "movz tmp, #0x0\n"
+ "str tmp, [sp, #-8]!\n"
"movz r1, #0x7788\n"
"movk r1, #0x5566 lsl 16\n"
"movk r1, #0x3344 lsl 32\n"
"movk r1, #0x1122 lsl 48\n"
- "stlrw r1, r15\n"
- "ldr r1, [r15], #8 !\n"
- "movz ip1, #0x7788\n"
- "movk ip1, #0x5566 lsl 16\n"
- "cmp r1, ip1\n"
+ "stlrw r1, sp\n"
+ "ldr r1, [sp], #8 !\n"
+ "movz tmp2, #0x7788\n"
+ "movk tmp2, #0x5566 lsl 16\n"
+ "cmp r1, tmp2\n"
"bne +12\n"
"movz r0, #0x42\n"
"b +8\n"
"movz r0, #0x84\n"
- "mov r15, fp\n"
- "ldp fp, lr, [r15], #16 !\n"
- "mov csp, r15\n"
+ "mov sp, fp\n"
+ "ldp fp, lr, [sp], #16 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -1762,12 +1762,12 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "mov ip0, csp\n"
- "sub ip1, csp, #0x1f\n"
- "and csp, ip1, 0xfffffffffffffff0\n"
+ "mov tmp, csp\n"
+ "sub tmp2, csp, #0x1f\n"
+ "and csp, tmp2, 0xfffffffffffffff0\n"
"mov r0, csp\n"
- "sub r0, ip0, r0\n"
- "mov csp, ip0\n"
+ "sub r0, tmp, r0\n"
+ "mov csp, tmp\n"
"ret\n");
}
@@ -2439,18 +2439,18 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v1, ip0\n"
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v2, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v2, tmp\n"
"fcmpd v1, v2\n"
"beq +12\n"
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
"ret\n");
}
@@ -2546,18 +2546,18 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x2000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v1, ip0\n"
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v2, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x2000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v2, tmp\n"
"fcmpd v1, v2\n"
"beq +12\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"ret\n");
}
@@ -2598,18 +2598,18 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x6000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v1, ip0\n"
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v2, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x6000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v2, tmp\n"
"fcmpd v1, v2\n"
"blt +12\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"ret\n");
}
@@ -2632,19 +2632,19 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x6000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x2000 lsl 32\n"
- "movk ip0, #0x406d lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x6000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x2000 lsl 32\n"
+ "movk tmp, #0x406d lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcmpd v1, #0.0\n"
"bgt +16\n"
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
"ret\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"ret\n");
}
@@ -4276,11 +4276,11 @@
EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()),
0.0001f);
EXPECT_DISASSEMBLY(
- "movz ip0, #0xa19c\n"
- "movk ip0, #0xdc87 lsl 16\n"
- "movk ip0, #0x6c87 lsl 32\n"
- "movk ip0, #0x419d lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0xa19c\n"
+ "movk tmp, #0xdc87 lsl 16\n"
+ "movk tmp, #0x6c87 lsl 32\n"
+ "movk tmp, #0x419d lsl 48\n"
+ "fmovdr v0, tmp\n"
"ret\n");
}
@@ -4372,14 +4372,14 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x10\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
- "fstrd v1, [r15, #-8]!\n"
- "fldrd v0, [r15], #8 !\n"
- "mov csp, r15\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "fstrd v1, [sp, #-8]!\n"
+ "fldrd v0, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -4402,16 +4402,16 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x10\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v2, v1\n"
- "fstrs v2, [r15, #-8]!\n"
- "fldrs v3, [r15], #8 !\n"
+ "fstrs v2, [sp, #-8]!\n"
+ "fldrs v3, [sp], #8 !\n"
"fcvtds v0, v3\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -4441,22 +4441,22 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x10\n"
"fmovd v1, 21.000000\n"
"fmovd v2, 21.000000\n"
"movz r1, #0x2a\n"
- "str r1, [r15, #-8]!\n"
- "fstrd v1, [r15, #-8]!\n"
- "fstrd v2, [r15, #-8]!\n"
- "fldrq v3, [r15], #16 !\n"
- "ldr r0, [r15], #8 !\n"
- "fstrq v3, [r15, #-16]!\n"
- "fldrd v0, [r15], #8 !\n"
- "fldrd v1, [r15], #8 !\n"
+ "str r1, [sp, #-8]!\n"
+ "fstrd v1, [sp, #-8]!\n"
+ "fstrd v2, [sp, #-8]!\n"
+ "fldrq v3, [sp], #16 !\n"
+ "ldr r0, [sp], #8 !\n"
+ "fstrq v3, [sp, #-16]!\n"
+ "fldrd v0, [sp], #8 !\n"
+ "fldrd v1, [sp], #8 !\n"
"faddd v0, v0, v1\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -4470,9 +4470,9 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtzs r0, v0\n"
"ret\n");
}
@@ -4488,9 +4488,9 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0xc045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0xc045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtzsw r0, v0\n"
"sxtw r0, r0\n"
"ret\n");
@@ -4517,11 +4517,11 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMinInt64, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x8c40\n"
- "movk ip0, #0x78b5 lsl 16\n"
- "movk ip0, #0xaf1d lsl 32\n"
- "movk ip0, #0xc415 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x8c40\n"
+ "movk tmp, #0x78b5 lsl 16\n"
+ "movk tmp, #0xaf1d lsl 32\n"
+ "movk tmp, #0xc415 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtzs r0, v0\n"
"ret\n");
}
@@ -4536,10 +4536,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMaxInt32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x2000 lsl 16\n"
- "movk ip0, #0xa05f lsl 32\n"
- "movk ip0, #0x4202 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x2000 lsl 16\n"
+ "movk tmp, #0xa05f lsl 32\n"
+ "movk tmp, #0x4202 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtzsw r0, v0\n"
"ret\n");
}
@@ -4555,10 +4555,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMinInt32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x2000 lsl 16\n"
- "movk ip0, #0xa05f lsl 32\n"
- "movk ip0, #0xc202 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x2000 lsl 16\n"
+ "movk tmp, #0xa05f lsl 32\n"
+ "movk tmp, #0xc202 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtzsw r0, v0\n"
"sxtw r0, r0\n"
"ret\n");
@@ -4574,9 +4574,9 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(43, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtps r0, v0\n"
"ret\n");
}
@@ -4592,9 +4592,9 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0xc045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0xc045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtpsw r0, v0\n"
"sxtw r0, r0\n"
"ret\n");
@@ -4610,11 +4610,11 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMaxInt64, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x8c40\n"
- "movk ip0, #0x78b5 lsl 16\n"
- "movk ip0, #0xaf1d lsl 32\n"
- "movk ip0, #0x4415 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x8c40\n"
+ "movk tmp, #0x78b5 lsl 16\n"
+ "movk tmp, #0xaf1d lsl 32\n"
+ "movk tmp, #0x4415 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtps r0, v0\n"
"ret\n");
}
@@ -4629,11 +4629,11 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMinInt64, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x8c40\n"
- "movk ip0, #0x78b5 lsl 16\n"
- "movk ip0, #0xaf1d lsl 32\n"
- "movk ip0, #0xc415 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x8c40\n"
+ "movk tmp, #0x78b5 lsl 16\n"
+ "movk tmp, #0xaf1d lsl 32\n"
+ "movk tmp, #0xc415 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtps r0, v0\n"
"ret\n");
}
@@ -4648,10 +4648,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMaxInt32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x2000 lsl 16\n"
- "movk ip0, #0xa05f lsl 32\n"
- "movk ip0, #0x4202 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x2000 lsl 16\n"
+ "movk tmp, #0xa05f lsl 32\n"
+ "movk tmp, #0x4202 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtpsw r0, v0\n"
"ret\n");
}
@@ -4667,10 +4667,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMinInt32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x2000 lsl 16\n"
- "movk ip0, #0xa05f lsl 32\n"
- "movk ip0, #0xc202 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x2000 lsl 16\n"
+ "movk tmp, #0xa05f lsl 32\n"
+ "movk tmp, #0xc202 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtpsw r0, v0\n"
"sxtw r0, r0\n"
"ret\n");
@@ -4686,9 +4686,9 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(42, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtms r0, v0\n"
"ret\n");
}
@@ -4704,9 +4704,9 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-43, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0xc045 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0xc045 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtmsw r0, v0\n"
"sxtw r0, r0\n"
"ret\n");
@@ -4722,11 +4722,11 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMaxInt64, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x8c40\n"
- "movk ip0, #0x78b5 lsl 16\n"
- "movk ip0, #0xaf1d lsl 32\n"
- "movk ip0, #0x4415 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x8c40\n"
+ "movk tmp, #0x78b5 lsl 16\n"
+ "movk tmp, #0xaf1d lsl 32\n"
+ "movk tmp, #0x4415 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtms r0, v0\n"
"ret\n");
}
@@ -4741,11 +4741,11 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMinInt64, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x8c40\n"
- "movk ip0, #0x78b5 lsl 16\n"
- "movk ip0, #0xaf1d lsl 32\n"
- "movk ip0, #0xc415 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x8c40\n"
+ "movk tmp, #0x78b5 lsl 16\n"
+ "movk tmp, #0xaf1d lsl 32\n"
+ "movk tmp, #0xc415 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtms r0, v0\n"
"ret\n");
}
@@ -4760,10 +4760,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMaxInt32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x2000 lsl 16\n"
- "movk ip0, #0xa05f lsl 32\n"
- "movk ip0, #0x4202 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x2000 lsl 16\n"
+ "movk tmp, #0xa05f lsl 32\n"
+ "movk tmp, #0x4202 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtmsw r0, v0\n"
"ret\n");
}
@@ -4779,10 +4779,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(kMinInt32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x2000 lsl 16\n"
- "movk ip0, #0xa05f lsl 32\n"
- "movk ip0, #0xc202 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x2000 lsl 16\n"
+ "movk tmp, #0xa05f lsl 32\n"
+ "movk tmp, #0xc202 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtmsw r0, v0\n"
"sxtw r0, r0\n"
"ret\n");
@@ -4831,8 +4831,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fabsd v0, v1\n"
"ret\n");
}
@@ -4847,8 +4847,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0xc045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0xc045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fabsd v0, v1\n"
"ret\n");
}
@@ -4863,8 +4863,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(-42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fnegd v0, v1\n"
"ret\n");
}
@@ -4879,8 +4879,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0xc045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0xc045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fnegd v0, v1\n"
"ret\n");
}
@@ -4895,8 +4895,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(8.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4050 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4050 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fsqrtd v0, v1\n"
"ret\n");
}
@@ -4912,8 +4912,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4055 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4055 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fmovd v2, 0.500000\n"
"fmuld v0, v1, v2\n"
"ret\n");
@@ -4930,8 +4930,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4055 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4055 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fmovd v2, 2.000000\n"
"fdivd v0, v1, v2\n"
"ret\n");
@@ -4948,9 +4948,9 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0xc000 lsl 32\n"
- "movk ip0, #0x4044 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0xc000 lsl 32\n"
+ "movk tmp, #0x4044 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fmovd v2, 0.500000\n"
"faddd v0, v1, v2\n"
"ret\n");
@@ -4967,9 +4967,9 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fmovd v2, 0.500000\n"
"fsubd v0, v1, v2\n"
"ret\n");
@@ -4992,19 +4992,19 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
- "sub r15, r15, #0x8\n"
- "add r2, r15, #0x1\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "sub sp, sp, #0x8\n"
+ "add r2, sp, #0x1\n"
"fstrd v1, [r2, #-1]\n"
"fldrd v0, [r2, #-1]\n"
- "add r15, r15, #0x8\n"
- "mov csp, r15\n"
+ "add sp, sp, #0x8\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5030,18 +5030,18 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"sub csp, csp, #0x100\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
- "fstrd v1, [r15, #-256]!\n"
- "fldrd v0, [r15], #248 !\n"
- "add r15, r15, #0x8\n"
- "mov csp, r15\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "fstrd v1, [sp, #-256]!\n"
+ "fldrd v0, [sp], #248 !\n"
+ "add sp, sp, #0x8\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5062,19 +5062,19 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
- "sub r15, r15, #0x1000\n"
- "and csp, r15, 0xfffffffffffffff0\n"
- "fstrd v1, [r15, #4096]\n"
- "add r15, r15, #0x1000\n"
- "fldrd v0, [r15]\n"
- "mov csp, r15\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "sub sp, sp, #0x1000\n"
+ "and csp, sp, 0xfffffffffffffff0\n"
+ "fstrd v1, [sp, #4096]\n"
+ "add sp, sp, #0x1000\n"
+ "fldrd v0, [sp]\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5099,21 +5099,21 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"movz r2, #0xfff8\n"
"movk r2, #0xffff lsl 16\n"
- "fstrd v1, [r15, r2 sxtw]\n"
- "sub r15, r15, #0x8\n"
- "and csp, r15, 0xfffffffffffffff0\n"
- "fldrd v0, [r15]\n"
- "add r15, r15, #0x8\n"
- "mov csp, r15\n"
+ "fstrd v1, [sp, r2 sxtw]\n"
+ "sub sp, sp, #0x8\n"
+ "and csp, sp, 0xfffffffffffffff0\n"
+ "fldrd v0, [sp]\n"
+ "add sp, sp, #0x8\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5136,20 +5136,20 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"movz r2, #0xa\n"
- "sub r15, r15, #0x50\n"
- "and csp, r15, 0xfffffffffffffff0\n"
- "fstrd v1, [r15, r2 uxtx scaled]\n"
- "fldrd v0, [r15, r2 uxtx scaled]\n"
- "add r15, r15, #0x50\n"
- "mov csp, r15\n"
+ "sub sp, sp, #0x50\n"
+ "and csp, sp, 0xfffffffffffffff0\n"
+ "fstrd v1, [sp, r2 uxtx scaled]\n"
+ "fldrd v0, [sp, r2 uxtx scaled]\n"
+ "add sp, sp, #0x50\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5369,10 +5369,10 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
- "movz ip0, #0xc055 lsl 48\n"
- "fmovdr v2, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "movz tmp, #0xc055 lsl 48\n"
+ "fmovdr v2, tmp\n"
"fcvtsd v1, v1\n"
"fcvtsd v2, v2\n"
"veor v3, v3, v3\n"
@@ -5408,10 +5408,10 @@
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
""
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
- "movz ip0, #0xc055 lsl 48\n"
- "fmovdr v2, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
+ "movz tmp, #0xc055 lsl 48\n"
+ "fmovdr v2, tmp\n"
"vinsd v3[0], v1[0]\n"
"vinsd v3[1], v2[0]\n"
"vnegd v4, v3\n"
@@ -5459,8 +5459,8 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(12.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
@@ -5527,13 +5527,13 @@
EXPECT_EQ(-6.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
""
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
- "movz ip0, #0x0\n"
- "fmovdr v5, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v5, tmp\n"
"fcvtsd v0, v0\n"
"fcvtsd v1, v1\n"
"fcvtsd v2, v2\n"
@@ -5596,8 +5596,8 @@
EXPECT_EQ(14.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
""
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
@@ -5663,8 +5663,8 @@
EXPECT_EQ(4.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
""
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
"fmovd v1, 1.000000\n"
"fmovd v2, 2.000000\n"
"fmovd v3, 3.000000\n"
@@ -5746,8 +5746,8 @@
EXPECT_DISASSEMBLY(
"fmovd v0, 2.000000\n"
"fmovd v1, 3.000000\n"
- "movz ip0, #0x0\n"
- "fmovdr v5, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v5, tmp\n"
"vinsd v4[0], v0[0]\n"
"vinsd v4[1], v1[0]\n"
"vsubd v5, v5, v4\n"
@@ -5845,16 +5845,16 @@
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
""
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"fmovd v0, 21.000000\n"
"vdupd v1, v0[0]\n"
"sub csp, csp, #0x10\n"
- "fstrq v1, [r15, #-16]!\n"
- "fldrd v2, [r15], #8 !\n"
- "fldrd v3, [r15], #8 !\n"
+ "fstrq v1, [sp, #-16]!\n"
+ "fldrd v2, [sp], #8 !\n"
+ "fldrd v3, [sp], #8 !\n"
"faddd v0, v2, v3\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5893,17 +5893,17 @@
EXPECT_EQ(84.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
""
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"fmovd v0, 21.000000\n"
"fcvtsd v0, v0\n"
"vdups v1, v0[0]\n"
"sub csp, csp, #0x10\n"
- "fstrq v1, [r15, #-16]!\n"
- "fldrs v3, [r15], #4 !\n"
- "fldrs v2, [r15], #4 !\n"
- "fldrs v1, [r15], #4 !\n"
- "fldrs v0, [r15], #4 !\n"
+ "fstrq v1, [sp, #-16]!\n"
+ "fldrs v3, [sp], #4 !\n"
+ "fldrs v2, [sp], #4 !\n"
+ "fldrs v1, [sp], #4 !\n"
+ "fldrs v0, [sp], #4 !\n"
"fcvtds v0, v0\n"
"fcvtds v1, v1\n"
"fcvtds v2, v2\n"
@@ -5911,7 +5911,7 @@
"faddd v0, v1, v1\n"
"faddd v0, v0, v2\n"
"faddd v0, v0, v3\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5940,17 +5940,17 @@
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
""
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v5, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v5, tmp\n"
"vinsd v1[1], v5[0]\n"
"sub csp, csp, #0x10\n"
- "fstrq v1, [r15, #-16]!\n"
- "fldrd v2, [r15], #8 !\n"
- "fldrd v3, [r15], #8 !\n"
+ "fstrq v1, [sp, #-16]!\n"
+ "fldrd v2, [sp], #8 !\n"
+ "fldrd v3, [sp], #8 !\n"
"fmovdd v0, v3\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -5996,23 +5996,23 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
"fmovd v0, 21.000000\n"
"fcvtsd v0, v0\n"
"vinss v1[3], v0[0]\n"
"vinss v1[1], v0[0]\n"
- "movz ip0, #0x0\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x0\n"
+ "fmovdr v0, tmp\n"
"fcvtsd v0, v0\n"
"vinss v1[2], v0[0]\n"
"vinss v1[0], v0[0]\n"
"sub csp, csp, #0x10\n"
- "fstrq v1, [r15, #-16]!\n"
- "fldrs v3, [r15], #4 !\n"
- "fldrs v2, [r15], #4 !\n"
- "fldrs v1, [r15], #4 !\n"
- "fldrs v0, [r15], #4 !\n"
+ "fstrq v1, [sp, #-16]!\n"
+ "fldrs v3, [sp], #4 !\n"
+ "fldrs v2, [sp], #4 !\n"
+ "fldrs v1, [sp], #4 !\n"
+ "fldrs v0, [sp], #4 !\n"
"fcvtds v0, v0\n"
"fcvtds v1, v1\n"
"fcvtds v2, v2\n"
@@ -6020,7 +6020,7 @@
"faddd v0, v0, v1\n"
"faddd v0, v0, v2\n"
"faddd v0, v0, v3\n"
- "mov csp, r15\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -6350,10 +6350,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0xc045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0xc045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v0, v0\n"
"fcvtsd v1, v1\n"
"vdups v2, v0[0]\n"
@@ -6393,10 +6393,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0xc045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0xc045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"vdupd v2, v0[0]\n"
"vinsd v3[0], v0[0]\n"
"vinsd v3[1], v1[0]\n"
@@ -6437,10 +6437,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0xc045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0xc045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v0, v0\n"
"fcvtsd v1, v1\n"
"vdups v2, v0[0]\n"
@@ -6480,10 +6480,10 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0xc045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0xc045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"vdupd v2, v0[0]\n"
"vinsd v3[0], v0[0]\n"
"vinsd v3[1], v1[0]\n"
@@ -6524,11 +6524,11 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(0xfffffffe, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v0, v0\n"
"fcvtsd v1, v1\n"
"vdups v2, v0[0]\n"
@@ -6568,11 +6568,11 @@
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(-1, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4045 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4045 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4045 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4045 lsl 48\n"
+ "fmovdr v1, tmp\n"
"vdupd v2, v0[0]\n"
"vinsd v3[0], v0[0]\n"
"vinsd v3[1], v1[0]\n"
@@ -6664,9 +6664,9 @@
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
"fmovd v0, 21.000000\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4034 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4034 lsl 48\n"
+ "fmovdr v1, tmp\n"
"vdupd v2, v0[0]\n"
"vinsd v3[0], v0[0]\n"
"vinsd v3[1], v1[0]\n"
@@ -6758,9 +6758,9 @@
EXPECT_EQ(42.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
"fmovd v0, 21.000000\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4035 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4035 lsl 48\n"
+ "fmovdr v1, tmp\n"
"vdupd v2, v0[0]\n"
"vinsd v3[0], v0[0]\n"
"vinsd v3[1], v1[0]\n"
@@ -6798,11 +6798,11 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4050 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4048 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4050 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4048 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v0, v0\n"
"fcvtsd v1, v1\n"
"veor v3, v3, v3\n"
@@ -6837,11 +6837,11 @@
typedef double (*DoubleReturn)() DART_UNUSED;
EXPECT_EQ(15.0, EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry()));
EXPECT_DISASSEMBLY(
- "movz ip0, #0x4050 lsl 48\n"
- "fmovdr v0, ip0\n"
- "movz ip0, #0x8000 lsl 32\n"
- "movk ip0, #0x4048 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x4050 lsl 48\n"
+ "fmovdr v0, tmp\n"
+ "movz tmp, #0x8000 lsl 32\n"
+ "movk tmp, #0x4048 lsl 48\n"
+ "fmovdr v1, tmp\n"
"vinsd v3[0], v0[0]\n"
"vinsd v3[1], v1[0]\n"
"vsqrtd v4, v3\n"
@@ -6906,9 +6906,9 @@
float res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(arm_recip_estimate(147.0), res, 0.0001);
EXPECT_DISASSEMBLY(
- "movz ip0, #0x6000 lsl 32\n"
- "movk ip0, #0x4062 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x6000 lsl 32\n"
+ "movk tmp, #0x4062 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v1, v1\n"
"vinss v2[0], v1[0]\n"
"vinss v2[1], v1[0]\n"
@@ -6976,11 +6976,11 @@
double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(42.0, res, 0.0001);
EXPECT_DISASSEMBLY(
- "movz ip0, #0x8618\n"
- "movk ip0, #0x1861 lsl 16\n"
- "movk ip0, #0x6186 lsl 32\n"
- "movk ip0, #0x3fb8 lsl 48\n"
- "fmovdr v0, ip0\n"
+ "movz tmp, #0x8618\n"
+ "movk tmp, #0x1861 lsl 16\n"
+ "movk tmp, #0x6186 lsl 32\n"
+ "movk tmp, #0x3fb8 lsl 48\n"
+ "fmovdr v0, tmp\n"
"fcvtsd v0, v0\n"
"vdups v1, v0[0]\n"
"vrecpes v2, v1\n"
@@ -7072,9 +7072,9 @@
double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(arm_reciprocal_sqrt_estimate(147.0), res, 0.0001);
EXPECT_DISASSEMBLY(
- "movz ip0, #0x6000 lsl 32\n"
- "movk ip0, #0x4062 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0x6000 lsl 32\n"
+ "movk tmp, #0x4062 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v1, v1\n"
"vrsqrtes v0, v1\n"
"fcvtds v0, v0\n"
@@ -7125,9 +7125,9 @@
double res = EXECUTE_TEST_CODE_DOUBLE(DoubleReturn, test->entry());
EXPECT_FLOAT_EQ(1.0 / sqrt(147000.0), res, 0.0001);
EXPECT_DISASSEMBLY(
- "movz ip0, #0xf1c0 lsl 32\n"
- "movk ip0, #0x4101 lsl 48\n"
- "fmovdr v1, ip0\n"
+ "movz tmp, #0xf1c0 lsl 32\n"
+ "movk tmp, #0x4101 lsl 48\n"
+ "fmovdr v1, tmp\n"
"fcvtsd v1, v1\n"
"vrsqrtes v0, v1\n"
"vmuls v31, v0, v0\n"
@@ -7318,18 +7318,18 @@
EXPECT_EQ(123, EXECUTE_TEST_CODE_INTPTR_INTPTR(StoreReleaseLoadAcquire,
test->entry(), 123));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "str r1, [r15, #-8]!\n"
+ "str r1, [sp, #-8]!\n"
"movz r1, #0x0\n"
- "str r1, [r15, #-8]!\n"
+ "str r1, [sp, #-8]!\n"
"mov r1, r0\n"
"movz r0, #0x0\n"
- "stlr r1, r15\n"
- "ldar r0, r15\n"
- "ldr r1, [r15], #8 !\n"
- "ldr r1, [r15], #8 !\n"
- "mov csp, r15\n"
+ "stlr r1, sp\n"
+ "ldar r0, sp\n"
+ "ldr r1, [sp], #8 !\n"
+ "ldr r1, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
@@ -7355,22 +7355,22 @@
EXPECT_EQ(123, EXECUTE_TEST_CODE_INTPTR_INTPTR(StoreReleaseLoadAcquire1024,
test->entry(), 123));
EXPECT_DISASSEMBLY(
- "mov r15, csp\n"
+ "mov sp, csp\n"
"sub csp, csp, #0x1000\n"
- "str r1, [r15, #-8]!\n"
+ "str r1, [sp, #-8]!\n"
"movz r1, #0x0\n"
- "str r1, [r15, #-8]!\n"
+ "str r1, [sp, #-8]!\n"
"mov r1, r0\n"
"movz r0, #0x0\n"
- "sub r15, r15, #0x2000\n"
- "add ip0, r15, #0x400\n"
- "stlr r1, ip0\n"
- "add ip1, r15, #0x400\n"
- "ldar r0, ip1\n"
- "add r15, r15, #0x2000\n"
- "ldr r1, [r15], #8 !\n"
- "ldr r1, [r15], #8 !\n"
- "mov csp, r15\n"
+ "sub sp, sp, #0x2000\n"
+ "add tmp, sp, #0x400\n"
+ "stlr r1, tmp\n"
+ "add tmp2, sp, #0x400\n"
+ "ldar r0, tmp2\n"
+ "add sp, sp, #0x2000\n"
+ "ldr r1, [sp], #8 !\n"
+ "ldr r1, [sp], #8 !\n"
+ "mov csp, sp\n"
"ret\n");
}
#endif
diff --git a/runtime/vm/compiler/assembler/assembler_x64_test.cc b/runtime/vm/compiler/assembler/assembler_x64_test.cc
index 761a858..c0acbff 100644
--- a/runtime/vm/compiler/assembler/assembler_x64_test.cc
+++ b/runtime/vm/compiler/assembler/assembler_x64_test.cc
@@ -510,8 +510,8 @@
EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())());
EXPECT_DISASSEMBLY(
"movl rax,1\n"
- "movl r11,0xffffff11\n"
- "push r11\n"
+ "movl tmp,0xffffff11\n"
+ "push tmp\n"
"cmpb [rsp],0x11\n"
"jz +7\n"
"movl rax,0\n"
@@ -542,8 +542,8 @@
EXPECT_DISASSEMBLY(
"movl rax,1\n"
"movl rcx,0\n"
- "movl r11,0xffffff11\n"
- "push r11\n"
+ "movl tmp,0xffffff11\n"
+ "push tmp\n"
"testb [rsp],0x10\n"
"cmovzq rax,rcx\n"
"testb [rsp],0x20\n"
@@ -951,8 +951,8 @@
__ addq(RAX, R8);
__ movq(R10, Immediate(2));
- __ movq(R11, Immediate(4));
- __ imulq(R10, R11);
+ __ movq(TMP, Immediate(4));
+ __ imulq(R10, TMP);
__ addq(RAX, R10);
__ movq(R15, Immediate(2));
@@ -977,8 +977,8 @@
"pop r9\n"
"addq rax,r8\n"
"movl r10,2\n"
- "movl r11,4\n"
- "imulq r10,r11\n"
+ "movl tmp,4\n"
+ "imulq r10,tmp\n"
"addq rax,r10\n"
"movl pp,2\n"
"imulq pp,pp,4\n"
@@ -1012,8 +1012,8 @@
"movq rax,0x1234567887654321\n"
"movq rcx,0x0db4da5f7ef412b1\n"
"imulq rax,rcx\n"
- "movq r11,0x1234567887654321\n"
- "imulq rcx,r11\n"
+ "movq tmp,0x1234567887654321\n"
+ "imulq rcx,tmp\n"
"cmpq rax,rcx\n"
"jz +7\n"
"int3\n"
@@ -1327,8 +1327,8 @@
typedef intptr_t (*MoveExtend)();
EXPECT_EQ(0x7ffffffe, reinterpret_cast<MoveExtend>(test->entry())());
EXPECT_DISASSEMBLY(
- "movl r11,0xffffffff\n"
- "push r11\n"
+ "movl tmp,0xffffffff\n"
+ "push tmp\n"
"push 0x7fffffff\n"
"movsxdq rdx,[rsp+0x8]\n"
"movsxdq rax,[rsp]\n"
@@ -1770,10 +1770,10 @@
"addq r10,[rsp+0x10]\n"
"movq rax,[rsp+0x8]\n"
"adcq rax,[rsp+0x18]\n"
- "pop r11\n"
- "pop r11\n"
- "pop r11\n"
- "pop r11\n"
+ "pop tmp\n"
+ "pop tmp\n"
+ "pop tmp\n"
+ "pop tmp\n"
"ret\n");
}
@@ -1866,10 +1866,10 @@
"subq r10,[rsp+0x10]\n"
"movq rax,[rsp+0x8]\n"
"sbbq rax,[rsp+0x18]\n"
- "pop r11\n"
- "pop r11\n"
- "pop r11\n"
- "pop r11\n"
+ "pop tmp\n"
+ "pop tmp\n"
+ "pop tmp\n"
+ "pop tmp\n"
"ret\n");
}
@@ -2391,8 +2391,8 @@
"movl rcx,2\n"
"shlq rdx,cl\n"
"shldq rdx,r8,2\n"
- "movq r11,0xf000000000000003\n"
- "cmpq rdx,r11\n"
+ "movq tmp,0xf000000000000003\n"
+ "cmpq rdx,tmp\n"
"jz +7\n"
"int3\n"
"movq rdx,0xff00000000000000\n"
@@ -2400,8 +2400,8 @@
"movl rcx,2\n"
"shlq rdx,cl\n"
"shldq rdx,r8,cl\n"
- "movq r11,0xf000000000000003\n"
- "cmpq rdx,r11\n"
+ "movq tmp,0xf000000000000003\n"
+ "cmpq rdx,tmp\n"
"jz +7\n"
"int3\n"
"movq rdx,0xff00000000000000\n"
@@ -2409,8 +2409,8 @@
"movl rcx,2\n"
"shrq rdx,cl\n"
"shrdq rdx,r8,cl\n"
- "movq r11,0xcff0000000000000\n"
- "cmpq rdx,r11\n"
+ "movq tmp,0xcff0000000000000\n"
+ "cmpq rdx,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,0\n"
@@ -2697,31 +2697,31 @@
"movl rax,1\n"
"shlq rax,63\n"
"sarq rax,3\n"
- "movq r11,0xf000000000000000\n"
- "cmpq rax,r11\n"
+ "movq tmp,0xf000000000000000\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,1\n"
"movl rcx,3\n"
"shlq rax,63\n"
"sarq rax,cl\n"
- "movq r11,0xf000000000000000\n"
- "cmpq rax,r11\n"
+ "movq tmp,0xf000000000000000\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"push pp\n"
"movq pp,0xf000000000000001\n"
"andq pp,-1\n"
- "movq r11,0x8000000000000001\n"
- "andq pp,r11\n"
+ "movq tmp,0x8000000000000001\n"
+ "andq pp,tmp\n"
"orq pp,2\n"
- "movq r11,0xf800000000000000\n"
- "orq pp,r11\n"
+ "movq tmp,0xf800000000000000\n"
+ "orq pp,tmp\n"
"xorq pp,1\n"
- "movq r11,0x0800000000000000\n"
- "xorq pp,r11\n"
- "movq r11,0xf000000000000002\n"
- "cmpq pp,r11\n"
+ "movq tmp,0x0800000000000000\n"
+ "xorq pp,tmp\n"
+ "movq tmp,0xf000000000000002\n"
+ "cmpq pp,tmp\n"
"jz +7\n"
"int3\n"
"andl pp,2\n"
@@ -3080,7 +3080,7 @@
typedef int (*CallSimpleLeafCode)();
EXPECT_EQ(42 + 87, reinterpret_cast<CallSimpleLeafCode>(test->entry())());
EXPECT_DISASSEMBLY_ENDS_WITH(
- "call r11\n"
+ "call tmp\n"
"addq rsp,8\n"
"ret\n");
}
@@ -3100,7 +3100,7 @@
ASSEMBLER_TEST_RUN(JumpSimpleLeaf, test) {
typedef int (*JumpSimpleLeafCode)();
EXPECT_EQ(42, reinterpret_cast<JumpSimpleLeafCode>(test->entry())());
- EXPECT_DISASSEMBLY_ENDS_WITH("jmp r11\n");
+ EXPECT_DISASSEMBLY_ENDS_WITH("jmp tmp\n");
}
ASSEMBLER_TEST_GENERATE(JumpIndirect, assembler) {
@@ -3185,7 +3185,7 @@
"movss r8,xmm7\n"
"movss r9,xmm8\n"
"movss r10,xmm9\n"
- "movss r11,xmm10\n"
+ "movss tmp,xmm10\n"
"movss r12,xmm11\n"
"movss r13,xmm12\n"
"movss thr,xmm13\n"
@@ -3209,7 +3209,7 @@
"movss thr,xmm15\n"
"movss r13,xmm14\n"
"movss r12,xmm13\n"
- "movss r11,xmm12\n"
+ "movss tmp,xmm12\n"
"movss r10,xmm11\n"
"movss r9,xmm10\n"
"movss r8,xmm9\n"
@@ -3384,8 +3384,8 @@
EXPECT_FLOAT_EQ(-1.0, res, 0.000001f);
EXPECT_DISASSEMBLY_NOT_WINDOWS_ENDS_WITH(
"movups xmm10,[rax]\n"
- "movq r11,[thr+0x...]\n"
- "xorpd xmm10,[r11]\n"
+ "movq tmp,[thr+0x...]\n"
+ "xorpd xmm10,[tmp]\n"
"movaps xmm0,xmm10\n"
"pop thr\n"
"pop pp\n"
@@ -3413,8 +3413,8 @@
EXPECT_FLOAT_EQ(1.0, res, 0.000001f);
EXPECT_DISASSEMBLY_NOT_WINDOWS_ENDS_WITH(
"movups xmm10,[rax]\n"
- "movq r11,[thr+0x...]\n"
- "movups xmm0,[r11]\n"
+ "movq tmp,[thr+0x...]\n"
+ "movups xmm0,[tmp]\n"
"andpd xmm0,xmm10\n"
"pop thr\n"
"pop pp\n"
@@ -4066,8 +4066,8 @@
"movl rax,0x4144cccd\n"
"movd xmm0,rax\n"
"shufps xmm0,xmm0 [0]\n"
- "movq r11,[thr+0x...]\n"
- "xorps xmm0,[r11]\n"
+ "movq tmp,[thr+0x...]\n"
+ "xorps xmm0,[tmp]\n"
"shufps xmm0,xmm0 [aa]\n"
"pop thr\n"
"pop pp\n"
@@ -4103,8 +4103,8 @@
"movl rax,-0x3e8b3333\n"
"movd xmm0,rax\n"
"shufps xmm0,xmm0 [0]\n"
- "movq r11,[thr+0x...]\n"
- "andps xmm0,[r11]\n"
+ "movq tmp,[thr+0x...]\n"
+ "andps xmm0,[tmp]\n"
"shufps xmm0,xmm0 [aa]\n"
"pop thr\n"
"pop pp\n"
@@ -4138,8 +4138,8 @@
"movl rax,0x4144cccd\n"
"movd xmm0,rax\n"
"shufps xmm0,xmm0 [0]\n"
- "movq r11,[thr+0x...]\n"
- "andps xmm0,[r11]\n"
+ "movq tmp,[thr+0x...]\n"
+ "andps xmm0,[tmp]\n"
"shufps xmm0,xmm0 [ff]\n"
"pop thr\n"
"pop pp\n"
@@ -4288,8 +4288,8 @@
EXPECT_EQ(static_cast<uword>(0x0), res);
EXPECT_DISASSEMBLY_NOT_WINDOWS_ENDS_WITH(
"movups xmm9,[rax]\n"
- "movq r11,[thr+0x...]\n"
- "movups xmm0,[r11]\n"
+ "movq tmp,[thr+0x...]\n"
+ "movups xmm0,[tmp]\n"
"xorps xmm0,xmm9\n"
"push rax\n"
"movss [rsp],xmm0\n"
@@ -4756,10 +4756,10 @@
double res = reinterpret_cast<Int32ToDoubleConversion>(test->entry())();
EXPECT_FLOAT_EQ(-2.0, res, 0.001);
EXPECT_DISASSEMBLY(
- "movq r11,0x1111111100000006\n"
- "cvtsi2sd xmm0,r11\n"
- "movq r11,0x2222222200000008\n"
- "cvtsi2sd xmm8,r11\n"
+ "movq tmp,0x1111111100000006\n"
+ "cvtsi2sd xmm0,tmp\n"
+ "movq tmp,0x2222222200000008\n"
+ "cvtsi2sd xmm8,tmp\n"
"subsd xmm0,xmm8\n"
"ret\n");
}
@@ -4823,8 +4823,8 @@
"movsd xmm9,[rsp]\n"
"pop rax\n"
"cvttsd2siq rax,xmm9\n"
- "movq r11,0x8000000000000000\n"
- "cmpq rax,r11\n"
+ "movq tmp,0x8000000000000000\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movq rax,0x4258727cda000000\n"
@@ -4904,8 +4904,8 @@
"movsd xmm9,[rsp]\n"
"pop rax\n"
"cvttsd2sil rax,xmm9\n"
- "movl r11,0x80000000\n"
- "cmpq rax,r11\n"
+ "movl tmp,0x80000000\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movq rax,0xc045000000000000\n"
@@ -4914,8 +4914,8 @@
"pop rax\n"
"movq r10,-1\n"
"cvttsd2sil r10,xmm9\n"
- "movl r11,0xffffffd6\n"
- "cmpq r10,r11\n"
+ "movl tmp,0xffffffd6\n"
+ "cmpq r10,tmp\n"
"jz +7\n"
"int3\n"
"movq rax,0x4045000000000000\n"
@@ -4991,8 +4991,8 @@
"cmpq rcx,0x1e\n"
"jnz +63\n"
"push rax\n"
- "movq r11,[pp+0xf]\n"
- "movq [rsp],r11\n"
+ "movq tmp,[pp+0xf]\n"
+ "movq [rsp],tmp\n"
"pop rcx\n"
"cmpq rcx,[pp+0xf]\n"
"jnz +43\n"
@@ -5035,8 +5035,8 @@
"cmpl rcx,0x1e\n"
"jnz +62\n"
"push rax\n"
- "movq r11,[pp+0xf]\n"
- "movq [rsp],r11\n"
+ "movq tmp,[pp+0xf]\n"
+ "movq [rsp],tmp\n"
"pop rcx\n"
"cmpl rcx,[pp+0xf]\n"
"jnz +42\n"
@@ -5464,8 +5464,8 @@
"movq r12,[rdi+0x8]\n"
"movq thr,rsi\n"
"movq pp,[r12+0x27]\n"
- "movq r11,[thr+0x...]\n"
- "andpd xmm0,[r11]\n"
+ "movq tmp,[thr+0x...]\n"
+ "andpd xmm0,[tmp]\n"
"pop thr\n"
"pop pp\n"
"pop r12\n"
@@ -5832,8 +5832,8 @@
EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())());
EXPECT_DISASSEMBLY(
"movl rax,4\n"
- "movl r11,2\n"
- "btq rax,r11\n"
+ "movl tmp,2\n"
+ "btq rax,tmp\n"
"jc +7\n"
"int3\n"
"movl rax,1\n"
@@ -5855,8 +5855,8 @@
typedef int (*BitTestImmediate)();
EXPECT_EQ(1, reinterpret_cast<BitTestImmediate>(test->entry())());
EXPECT_DISASSEMBLY(
- "movl r11,0x20\n"
- "bt r11,5\n"
+ "movl tmp,0x20\n"
+ "bt tmp,5\n"
"jc +7\n"
"int3\n"
"movl rax,1\n"
@@ -6007,44 +6007,44 @@
EXPECT_DISASSEMBLY(
"movl rax,0x2a\n"
"imulq rax,rax,0x3b9aca00\n"
- "movq r11,0x00000009c7652400\n"
- "cmpq rax,r11\n"
+ "movq tmp,0x00000009c7652400\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,0x2a\n"
"imull rax,rax,0x3b9aca00\n"
- "movl r11,0xc7652400\n"
- "cmpq rax,r11\n"
+ "movl tmp,0xc7652400\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,0x3b9aca00\n"
- "movq r11,0x000000098bca5a00\n"
- "addq rax,r11\n"
- "movq r11,0x00000009c7652400\n"
- "cmpq rax,r11\n"
+ "movq tmp,0x000000098bca5a00\n"
+ "addq rax,tmp\n"
+ "movq tmp,0x00000009c7652400\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,0x3b9aca00\n"
"addl rax,0x3b9aca00\n"
"addl rax,0x3b9aca00\n"
"addl rax,0x3b9aca00\n"
- "movl r11,0xee6b2800\n"
- "cmpq rax,r11\n"
+ "movl tmp,0xee6b2800\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,0x3b9aca00\n"
"subl rax,0x4d2fa200\n"
"addl rax,0x3b9aca00\n"
"subl rax,0x3b9aca00\n"
- "movl r11,0xee6b2800\n"
- "cmpq rax,r11\n"
+ "movl tmp,0xee6b2800\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,0x3b9aca00\n"
- "movq r11,0x0000000a02ffee00\n"
- "subq rax,r11\n"
- "movq r11,0xfffffff6389adc00\n"
- "cmpq rax,r11\n"
+ "movq tmp,0x0000000a02ffee00\n"
+ "subq rax,tmp\n"
+ "movq tmp,0xfffffff6389adc00\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movq rax,-0x3b9aca00\n"
@@ -6058,8 +6058,8 @@
"subl rax,0x4d2fa200\n"
"subl rax,0x3b9aca00\n"
"addl rax,0x3b9aca00\n"
- "movl r11,0xee6b2800\n"
- "cmpq rax,r11\n"
+ "movl tmp,0xee6b2800\n"
+ "cmpq rax,tmp\n"
"jz +7\n"
"int3\n"
"movl rax,0x2a\n"
diff --git a/runtime/vm/compiler/ffi/native_location.cc b/runtime/vm/compiler/ffi/native_location.cc
index f757a31..7b362fd 100644
--- a/runtime/vm/compiler/ffi/native_location.cc
+++ b/runtime/vm/compiler/ffi/native_location.cc
@@ -277,14 +277,14 @@
void NativeRegistersLocation::PrintTo(BaseTextBuffer* f) const {
if (num_regs() == 1) {
- f->Printf("%s", RegisterNames::RegisterName(regs_->At(0)));
+ f->Printf("%s", RegisterNames::RegisterAbiName(regs_->At(0)));
} else {
f->AddString("(");
for (intptr_t i = 0; i < num_regs(); i++) {
if (i != 0) {
f->Printf(", ");
}
- f->Printf("%s", RegisterNames::RegisterName(regs_->At(i)));
+ f->Printf("%s", RegisterNames::RegisterAbiName(regs_->At(i)));
}
f->AddString(")");
}
diff --git a/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv32_linux.expect
index f5fde9e..5dcb075 100644
--- a/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv32_linux.expect
@@ -7,8 +7,8 @@
fa6 double
fa7 double
(a0, a1) int64[double]
-(a2, tmp) int64[double]
-(tmp2, pp) int64[double]
+(a2, a3) int64[double]
+(a4, a5) int64[double]
(a6, a7) int64[double]
S+0 double
S+8 double
diff --git a/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv64_linux.expect
index 810b278..a46f1fb 100644
--- a/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/doublex20/riscv64_linux.expect
@@ -9,9 +9,9 @@
a0 int64[double]
a1 int64[double]
a2 int64[double]
-tmp int64[double]
-tmp2 int64[double]
-pp int64[double]
+a3 int64[double]
+a4 int64[double]
+a5 int64[double]
a6 int64[double]
a7 int64[double]
S+0 double
diff --git a/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv32_linux.expect
index 663376f..edb61cc 100644
--- a/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv32_linux.expect
@@ -7,8 +7,8 @@
fa6 float
fa7 float
(a0, a1) int64[float]
-(a2, tmp) int64[float]
-(tmp2, pp) int64[float]
+(a2, a3) int64[float]
+(a4, a5) int64[float]
(a6, a7) int64[float]
S+0 float
S+4 float
diff --git a/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv64_linux.expect
index 4531dae..b8030e0 100644
--- a/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/floatx20/riscv64_linux.expect
@@ -9,9 +9,9 @@
a0 int64[float]
a1 int64[float]
a2 int64[float]
-tmp int64[float]
-tmp2 int64[float]
-pp int64[float]
+a3 int64[float]
+a4 int64[float]
+a5 int64[float]
a6 int64[float]
a7 int64[float]
S+0 float
diff --git a/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv32_linux.expect
index 84bc85d..71c8bd7 100644
--- a/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv32_linux.expect
@@ -1,9 +1,9 @@
a0 int32[int8]
a1 int32[int8]
a2 int32[int8]
-tmp int32[int8]
-tmp2 int32[int8]
-pp int32[int8]
+a3 int32[int8]
+a4 int32[int8]
+a5 int32[int8]
a6 int32[int8]
a7 int32[int8]
S+0 int8
diff --git a/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv64_linux.expect
index 84bc85d..71c8bd7 100644
--- a/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/int8x10/riscv64_linux.expect
@@ -1,9 +1,9 @@
a0 int32[int8]
a1 int32[int8]
a2 int32[int8]
-tmp int32[int8]
-tmp2 int32[int8]
-pp int32[int8]
+a3 int32[int8]
+a4 int32[int8]
+a5 int32[int8]
a6 int32[int8]
a7 int32[int8]
S+0 int8
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv32_linux.expect
index fda1302..2f0c36f 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv32_linux.expect
@@ -1,8 +1,8 @@
P(a0 uint32) Struct(size: 12)
P(a1 uint32) Struct(size: 12)
P(a2 uint32) Struct(size: 12)
-P(tmp uint32) Struct(size: 12)
-P(tmp2 uint32) Struct(size: 12)
-P(pp uint32) Struct(size: 12)
+P(a3 uint32) Struct(size: 12)
+P(a4 uint32) Struct(size: 12)
+P(a5 uint32) Struct(size: 12)
=>
(a0, a1) int64
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv64_linux.expect
index ad37cf7..c9dc492 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct12bytesFloatx6/riscv64_linux.expect
@@ -1,6 +1,6 @@
M(a0 int64, a1 int64) Struct(size: 12)
-M(a2 int64, tmp int64) Struct(size: 12)
-M(tmp2 int64, pp int64) Struct(size: 12)
+M(a2 int64, a3 int64) Struct(size: 12)
+M(a4 int64, a5 int64) Struct(size: 12)
M(a6 int64, a7 int64) Struct(size: 12)
M(S+0 int64, S+8 int64) Struct(size: 12)
M(S+16 int64, S+24 int64) Struct(size: 12)
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv32_linux.expect
index 664653c..4824868 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv32_linux.expect
@@ -1,9 +1,9 @@
P(a1 uint32) Struct(size: 16)
fa0 float
P(a2 uint32) Struct(size: 16)
-P(tmp uint32) Struct(size: 16)
-P(tmp2 uint32) Struct(size: 16)
-P(pp uint32) Struct(size: 16)
+P(a3 uint32) Struct(size: 16)
+P(a4 uint32) Struct(size: 16)
+P(a5 uint32) Struct(size: 16)
P(a6 uint32) Struct(size: 16)
P(a7 uint32) Struct(size: 16)
P(S+0 uint32) Struct(size: 16)
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv64_linux.expect
index 6f7ef5b..620273c 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct16bytesHomogenousx10/riscv64_linux.expect
@@ -1,7 +1,7 @@
M(a0 int64, a1 int64) Struct(size: 16)
fa0 float
-M(a2 int64, tmp int64) Struct(size: 16)
-M(tmp2 int64, pp int64) Struct(size: 16)
+M(a2 int64, a3 int64) Struct(size: 16)
+M(a4 int64, a5 int64) Struct(size: 16)
M(a6 int64, a7 int64) Struct(size: 16)
M(S+0 int64, S+8 int64) Struct(size: 16)
M(S+16 int64, S+24 int64) Struct(size: 16)
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv32_linux.expect
index d326d70..39e23b8c 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv32_linux.expect
@@ -1,9 +1,9 @@
M(a0 uint32) Struct(size: 3)
M(a1 uint32) Struct(size: 3)
M(a2 uint32) Struct(size: 3)
-M(tmp uint32) Struct(size: 3)
-M(tmp2 uint32) Struct(size: 3)
-M(pp uint32) Struct(size: 3)
+M(a3 uint32) Struct(size: 3)
+M(a4 uint32) Struct(size: 3)
+M(a5 uint32) Struct(size: 3)
M(a6 uint32) Struct(size: 3)
M(a7 uint32) Struct(size: 3)
M(S+0 uint32) Struct(size: 3)
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv64_linux.expect
index 3f71e45..b67660c 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct3bytesx10/riscv64_linux.expect
@@ -1,9 +1,9 @@
M(a0 int64) Struct(size: 3)
M(a1 int64) Struct(size: 3)
M(a2 int64) Struct(size: 3)
-M(tmp int64) Struct(size: 3)
-M(tmp2 int64) Struct(size: 3)
-M(pp int64) Struct(size: 3)
+M(a3 int64) Struct(size: 3)
+M(a4 int64) Struct(size: 3)
+M(a5 int64) Struct(size: 3)
M(a6 int64) Struct(size: 3)
M(a7 int64) Struct(size: 3)
M(S+0 int64) Struct(size: 3)
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv32_linux.expect
index 8c5778d..14ea892 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv32_linux.expect
@@ -1,6 +1,6 @@
M(a0 uint32, a1 uint32) Struct(size: 8)
-M(a2 uint32, tmp uint32) Struct(size: 8)
-M(tmp2 uint32, pp uint32) Struct(size: 8)
+M(a2 uint32, a3 uint32) Struct(size: 8)
+M(a4 uint32, a5 uint32) Struct(size: 8)
M(a6 uint32, a7 uint32) Struct(size: 8)
M(S+0 uint32, S+4 uint32) Struct(size: 8)
M(S+8 uint32, S+12 uint32) Struct(size: 8)
diff --git a/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv64_linux.expect
index 7bd998e..b0e7ecb 100644
--- a/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/struct8bytesPackedx10/riscv64_linux.expect
@@ -1,9 +1,9 @@
M(a0 int64) Struct(size: 8)
M(a1 int64) Struct(size: 8)
M(a2 int64) Struct(size: 8)
-M(tmp int64) Struct(size: 8)
-M(tmp2 int64) Struct(size: 8)
-M(pp int64) Struct(size: 8)
+M(a3 int64) Struct(size: 8)
+M(a4 int64) Struct(size: 8)
+M(a5 int64) Struct(size: 8)
M(a6 int64) Struct(size: 8)
M(a7 int64) Struct(size: 8)
M(S+0 int64) Struct(size: 8)
diff --git a/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv32_linux.expect
index da14e5c..d84073a 100644
--- a/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv32_linux.expect
@@ -1,9 +1,9 @@
M(a0 int32[int8], fa0 double) Struct(size: 9)
M(a1 int32[int8], fa1 double) Struct(size: 9)
M(a2 int32[int8], fa2 double) Struct(size: 9)
-M(tmp int32[int8], fa3 double) Struct(size: 9)
-M(tmp2 int32[int8], fa4 double) Struct(size: 9)
-M(pp int32[int8], fa5 double) Struct(size: 9)
+M(a3 int32[int8], fa3 double) Struct(size: 9)
+M(a4 int32[int8], fa4 double) Struct(size: 9)
+M(a5 int32[int8], fa5 double) Struct(size: 9)
M(a6 int32[int8], fa6 double) Struct(size: 9)
M(a7 int32[int8], fa7 double) Struct(size: 9)
P(S+0 uint32) Struct(size: 9)
diff --git a/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv64_linux.expect
index d4389d5..eee3c90 100644
--- a/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/structPacked/riscv64_linux.expect
@@ -1,9 +1,9 @@
M(a0 int32[int8], fa0 double) Struct(size: 9)
M(a1 int32[int8], fa1 double) Struct(size: 9)
M(a2 int32[int8], fa2 double) Struct(size: 9)
-M(tmp int32[int8], fa3 double) Struct(size: 9)
-M(tmp2 int32[int8], fa4 double) Struct(size: 9)
-M(pp int32[int8], fa5 double) Struct(size: 9)
+M(a3 int32[int8], fa3 double) Struct(size: 9)
+M(a4 int32[int8], fa4 double) Struct(size: 9)
+M(a5 int32[int8], fa5 double) Struct(size: 9)
M(a6 int32[int8], fa6 double) Struct(size: 9)
M(a7 int32[int8], fa7 double) Struct(size: 9)
M(S+0 int64, S+8 int64) Struct(size: 9)
diff --git a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv32_linux.expect
index 7a6a9ef..f60a8fe 100644
--- a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv32_linux.expect
@@ -1,8 +1,8 @@
P(a1 uint32) Union(size: 16)
P(a2 uint32) Union(size: 16)
-P(tmp uint32) Union(size: 16)
-P(tmp2 uint32) Union(size: 16)
-P(pp uint32) Union(size: 16)
+P(a3 uint32) Union(size: 16)
+P(a4 uint32) Union(size: 16)
+P(a5 uint32) Union(size: 16)
P(a6 uint32) Union(size: 16)
P(a7 uint32) Union(size: 16)
P(S+0 uint32) Union(size: 16)
diff --git a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv64_linux.expect
index 35d836b..94bc67b 100644
--- a/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/union16bytesHomogenousx10/riscv64_linux.expect
@@ -1,6 +1,6 @@
M(a0 int64, a1 int64) Union(size: 16)
-M(a2 int64, tmp int64) Union(size: 16)
-M(tmp2 int64, pp int64) Union(size: 16)
+M(a2 int64, a3 int64) Union(size: 16)
+M(a4 int64, a5 int64) Union(size: 16)
M(a6 int64, a7 int64) Union(size: 16)
M(S+0 int64, S+8 int64) Union(size: 16)
M(S+16 int64, S+24 int64) Union(size: 16)
diff --git a/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv32_linux.expect b/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv32_linux.expect
index 95a498c..9ac54e5 100644
--- a/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv32_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv32_linux.expect
@@ -1,6 +1,6 @@
M(a0 uint32, a1 uint32) Union(size: 5)
-M(a2 uint32, tmp uint32) Union(size: 5)
-M(tmp2 uint32, pp uint32) Union(size: 5)
+M(a2 uint32, a3 uint32) Union(size: 5)
+M(a4 uint32, a5 uint32) Union(size: 5)
M(a6 uint32, a7 uint32) Union(size: 5)
M(S+0 uint32, S+4 uint32) Union(size: 5)
M(S+8 uint32, S+12 uint32) Union(size: 5)
diff --git a/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv64_linux.expect b/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv64_linux.expect
index 9165726..6116be3 100644
--- a/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv64_linux.expect
+++ b/runtime/vm/compiler/ffi/unit_tests/union5bytesPackedx10/riscv64_linux.expect
@@ -1,9 +1,9 @@
M(a0 int64) Union(size: 5)
M(a1 int64) Union(size: 5)
M(a2 int64) Union(size: 5)
-M(tmp int64) Union(size: 5)
-M(tmp2 int64) Union(size: 5)
-M(pp int64) Union(size: 5)
+M(a3 int64) Union(size: 5)
+M(a4 int64) Union(size: 5)
+M(a5 int64) Union(size: 5)
M(a6 int64) Union(size: 5)
M(a7 int64) Union(size: 5)
M(S+0 int64) Union(size: 5)
diff --git a/runtime/vm/constants.h b/runtime/vm/constants.h
index 26514bf..b56c7e1 100644
--- a/runtime/vm/constants.h
+++ b/runtime/vm/constants.h
@@ -41,6 +41,10 @@
ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters));
return cpu_reg_names[reg];
}
+ static const char* RegisterAbiName(Register reg) {
+ ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters));
+ return cpu_reg_abi_names[reg];
+ }
static const char* FpuRegisterName(FpuRegister reg) {
ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
return fpu_reg_names[reg];
diff --git a/runtime/vm/constants_arm.cc b/runtime/vm/constants_arm.cc
index 03e790f..b0e289a 100644
--- a/runtime/vm/constants_arm.cc
+++ b/runtime/vm/constants_arm.cc
@@ -14,11 +14,21 @@
const char* const cpu_reg_names[kNumberOfCpuRegisters] = {
#if defined(DART_TARGET_OS_MACOS) || defined(DART_TARGET_OS_MACOS_IOS)
- "r0", "r1", "r2", "r3", "r4", "pp", "r6", "fp",
- "r8", "r9", "thr", "r11", "ip", "sp", "lr", "pc",
+ "r0", "r1", "r2", "r3", "r4", "pp", "r6", "fp",
+ "r8", "r9", "thr", "r11", "tmp", "sp", "lr", "pc",
#else
- "r0", "r1", "r2", "r3", "r4", "pp", "r6", "r7",
- "r8", "r9", "thr", "fp", "ip", "sp", "lr", "pc",
+ "r0", "r1", "r2", "r3", "r4", "pp", "r6", "r7",
+ "r8", "r9", "thr", "fp", "tmp", "sp", "lr", "pc",
+#endif
+};
+
+const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = {
+#if defined(DART_TARGET_OS_MACOS) || defined(DART_TARGET_OS_MACOS_IOS)
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "fp",
+ "r8", "r9", "r10", "r11", "ip", "sp", "lr", "pc",
+#else
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "fp", "ip", "sp", "lr", "pc",
#endif
};
diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h
index b7f2374..d560e44 100644
--- a/runtime/vm/constants_arm.h
+++ b/runtime/vm/constants_arm.h
@@ -294,6 +294,7 @@
const FpuRegister kNoFpuRegister = kNoQRegister;
extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
+extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
extern const char* const fpu_reg_names[kNumberOfFpuRegisters];
extern const char* const fpu_s_reg_names[kNumberOfSRegisters];
extern const char* const fpu_d_reg_names[kNumberOfDRegisters];
diff --git a/runtime/vm/constants_arm64.cc b/runtime/vm/constants_arm64.cc
index c10999b..111e74e 100644
--- a/runtime/vm/constants_arm64.cc
+++ b/runtime/vm/constants_arm64.cc
@@ -11,9 +11,16 @@
namespace dart {
const char* const cpu_reg_names[kNumberOfCpuRegisters] = {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "sp",
+ "tmp", "tmp2", "r18", "r19", "r20", "r21", "nr", "r23",
+ "r24", "r25", "thr", "pp", "mask", "fp", "lr", "csp",
+};
+
+const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
- "r11", "r12", "r13", "r14", "r15", "ip0", "ip1", "r18", "r19", "r20", "r21",
- "nr", "r23", "r24", "r25", "r26", "pp", "r28", "fp", "lr", "r31",
+ "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21",
+ "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "sp",
};
const char* const fpu_reg_names[kNumberOfFpuRegisters] = {
diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h
index b2f4e6e..9b4df71 100644
--- a/runtime/vm/constants_arm64.h
+++ b/runtime/vm/constants_arm64.h
@@ -129,6 +129,7 @@
const FpuRegister kNoFpuRegister = kNoVRegister;
extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
+extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
extern const char* const fpu_reg_names[kNumberOfFpuRegisters];
// Register aliases.
diff --git a/runtime/vm/constants_ia32.cc b/runtime/vm/constants_ia32.cc
index bbe4feb..057264d 100644
--- a/runtime/vm/constants_ia32.cc
+++ b/runtime/vm/constants_ia32.cc
@@ -13,6 +13,9 @@
const char* const cpu_reg_names[kNumberOfCpuRegisters] = {
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"};
+const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = {
+ "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"};
+
const char* const fpu_reg_names[kNumberOfXmmRegisters] = {
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"};
diff --git a/runtime/vm/constants_ia32.h b/runtime/vm/constants_ia32.h
index d06f97f..061771d 100644
--- a/runtime/vm/constants_ia32.h
+++ b/runtime/vm/constants_ia32.h
@@ -67,6 +67,7 @@
const FpuRegister kNoFpuRegister = kNoXmmRegister;
extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
+extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
extern const char* const fpu_reg_names[kNumberOfXmmRegisters];
// Register aliases.
diff --git a/runtime/vm/constants_riscv.cc b/runtime/vm/constants_riscv.cc
index 6f694e9..7c9b6ed 100644
--- a/runtime/vm/constants_riscv.cc
+++ b/runtime/vm/constants_riscv.cc
@@ -23,6 +23,12 @@
"s6", "s7", "s8", "s9", "null", "mask", "t3", "t4", "t5", "t6",
};
+const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = {
+ "zero", "ra", "sp", "gp", "tp", "t0", "t1", "t2", "s0", "s1", "a0",
+ "a1", "a2", "a3", "a4", "a5", "a6", "a7", "s2", "s3", "s4", "s5",
+ "s6", "s7", "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6",
+};
+
const char* const fpu_reg_names[kNumberOfFpuRegisters] = {
"ft0", "ft1", "ft2", "ft3", "ft4", "ft5", "ft6", "ft7",
"fs0", "fs1", "fa0", "fa1", "fa2", "fa3", "fa4", "fa5",
diff --git a/runtime/vm/constants_riscv.h b/runtime/vm/constants_riscv.h
index a03694c..645b69e 100644
--- a/runtime/vm/constants_riscv.h
+++ b/runtime/vm/constants_riscv.h
@@ -143,6 +143,7 @@
typedef double fpu_register_t;
extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
+extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
extern const char* const fpu_reg_names[kNumberOfFpuRegisters];
// Register aliases.
diff --git a/runtime/vm/constants_x64.cc b/runtime/vm/constants_x64.cc
index b80a77a..7e03cb6 100644
--- a/runtime/vm/constants_x64.cc
+++ b/runtime/vm/constants_x64.cc
@@ -12,7 +12,11 @@
const char* const cpu_reg_names[kNumberOfCpuRegisters] = {
"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
- "r8", "r9", "r10", "r11", "r12", "r13", "thr", "pp"};
+ "r8", "r9", "r10", "tmp", "r12", "r13", "thr", "pp"};
+
+const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = {
+ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"};
const char* const fpu_reg_names[kNumberOfXmmRegisters] = {
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h
index aae0a4c..a880647 100644
--- a/runtime/vm/constants_x64.h
+++ b/runtime/vm/constants_x64.h
@@ -99,6 +99,7 @@
const FpuRegister kNoFpuRegister = kNoXmmRegister;
extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
+extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
extern const char* const fpu_reg_names[kNumberOfXmmRegisters];
enum RexBits {
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 5fd54ae..ad7098c 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -276,19 +276,6 @@
}
static Object _computeIdentityHashCodeProperty() =>
- JS_GET_FLAG('LEGACY_JAVASCRIPT')
- ? _computeIdentityHashCodePropertyLegacy()
- : _computeIdentityHashCodePropertyModern();
-
- static Object _computeIdentityHashCodePropertyLegacy() {
- if (JS<bool>('bool', 'typeof Symbol == "function"') ||
- JS<bool>('bool', 'typeof Symbol() == "symbol"')) {
- return _computeIdentityHashCodePropertyModern();
- }
- return r'$identityHashCode';
- }
-
- static Object _computeIdentityHashCodePropertyModern() =>
JS('', 'Symbol("identityHashCode")');
static int? parseInt(String source, int? radix) {
diff --git a/tests/language/enum/enhanced_enums_error_test.dart b/tests/language/enum/enhanced_enums_error_test.dart
index 169b538..8ea51fe 100644
--- a/tests/language/enum/enhanced_enums_error_test.dart
+++ b/tests/language/enum/enhanced_enums_error_test.dart
@@ -603,7 +603,7 @@
e1;
int get index => 42;
// ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_NON_ABSTRACT_ENUM_INDEX
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
@@ -641,7 +641,7 @@
Never get index => throw "Never!";
// ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_NON_ABSTRACT_ENUM_INDEX
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
diff --git a/tests/language/enum/enhanced_enums_subtype_error_test.dart b/tests/language/enum/enhanced_enums_subtype_error_test.dart
index c34d6b6..83236b8 100644
--- a/tests/language/enum/enhanced_enums_subtype_error_test.dart
+++ b/tests/language/enum/enhanced_enums_subtype_error_test.dart
@@ -44,28 +44,28 @@
abstract class AbstractImplementsWithIndex implements Enum {
int get index => 42;
// ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_NON_ABSTRACT_ENUM_INDEX
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
abstract class AbstractExtendsWithIndex extends Enum {
int get index => 42;
// ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_NON_ABSTRACT_ENUM_INDEX
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
mixin MixinWithIndex on Enum {
int get index => 42;
// ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_NON_ABSTRACT_ENUM_INDEX
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
mixin MixinWithIndex2 implements Enum {
int get index => 42;
// ^^^^^
- // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_NON_ABSTRACT_ENUM_INDEX
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
@@ -86,29 +86,31 @@
// Can't implement Enum and declare hashCode/==.
abstract class ClassWithEquals implements Enum {
bool operator ==(Object other) => true;
+ // ^^
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// ^^^^^^^^
- // [analyzer] unspecified
// [cfe] unspecified
}
mixin MixinWithEquals implements Enum {
bool operator ==(Object other) => true;
+ // ^^
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// ^^^^^^^^
- // [analyzer] unspecified
// [cfe] unspecified
}
abstract class ClassWithHashCode implements Enum {
int get hashCode => 0;
// ^^^^^^^^
- // [analyzer] unspecified
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
mixin MixinWithHashCode implements Enum {
int get hashCode => 0;
// ^^^^^^^^
- // [analyzer] unspecified
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_DECLARATION
// [cfe] unspecified
}
@@ -123,13 +125,13 @@
// Can't implement `Enum` and inherit concrete hashCode/==.
abstract class ClassSuperEquals extends SuperclassWithEquals implements Enum {
// ^^^^^^^^^^^^^^^^
- // [analyzer] unspecified
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE
// [cfe] unspecified
}
abstract class ClassSuperHash extends SuperclassWithHashCode implements Enum {
// ^^^^^^^^^^^^^^
- // [analyzer] unspecified
+ // [analyzer] COMPILE_TIME_ERROR.ILLEGAL_CONCRETE_ENUM_MEMBER_INHERITANCE
// [cfe] unspecified
}
diff --git a/tools/VERSION b/tools/VERSION
index 4edaf3c..aae6b02 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 17
PATCH 0
-PRERELEASE 139
+PRERELEASE 140
PRERELEASE_PATCH 0
\ No newline at end of file