mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
All strong mode cleaning of dart2js.
Fixes https://github.com/dart-lang/sdk/issues/29886 Supersedes CLs 2939193003, 2950433002, and 2947583002. R=johnniwinther@google.com Review-Url: https://codereview.chromium.org/2944843002 .
This commit is contained in:
parent
4598e15f8b
commit
69d6e8e55a
|
@ -10,17 +10,3 @@ analyzer:
|
|||
todo: ignore
|
||||
|
||||
deprecated_member_use: ignore
|
||||
|
||||
# TODO(ahe): Fix these.
|
||||
strong_mode_could_not_infer: ignore
|
||||
strong_mode_invalid_cast_function: ignore
|
||||
strong_mode_invalid_cast_function_expr: ignore
|
||||
strong_mode_invalid_cast_literal_map: ignore
|
||||
strong_mode_invalid_cast_method: ignore
|
||||
strong_mode_invalid_method_override: ignore
|
||||
strong_mode_invalid_method_override_from_base: ignore
|
||||
strong_mode_invalid_method_override_from_mixin: ignore
|
||||
strong_mode_invalid_super_invocation: ignore
|
||||
strong_mode_not_instantiated_bound: ignore
|
||||
strong_mode_top_level_instance_getter: ignore
|
||||
strong_mode_top_level_type_arguments: ignore
|
||||
|
|
|
@ -41,7 +41,8 @@ abstract class ClosureDataLookup<T> {
|
|||
/// used inside the scope of [node].
|
||||
// TODO(johnniwinther): Split this up into two functions, one for members and
|
||||
// one for local functions.
|
||||
ClosureRepresentationInfo getClosureRepresentationInfo(Entity member);
|
||||
ClosureRepresentationInfo getClosureRepresentationInfo(
|
||||
covariant Entity member);
|
||||
|
||||
/// Look up information about a loop, in case any variables it declares need
|
||||
/// to be boxed/snapshotted.
|
||||
|
@ -352,7 +353,7 @@ class ClosureFieldElement extends ElementX
|
|||
|
||||
bool get hasNode => false;
|
||||
|
||||
Node get node {
|
||||
VariableDefinitions get node {
|
||||
throw new SpannableAssertionFailure(
|
||||
local, 'Should not access node of ClosureFieldElement.');
|
||||
}
|
||||
|
@ -388,7 +389,8 @@ class ClosureFieldElement extends ElementX
|
|||
return visitor.visitClosureFieldElement(this, arg);
|
||||
}
|
||||
|
||||
Element get analyzableElement => closureClass.methodElement.analyzableElement;
|
||||
AnalyzableElement get analyzableElement =>
|
||||
closureClass.methodElement.analyzableElement;
|
||||
|
||||
@override
|
||||
List<FunctionElement> get nestedClosures => const <FunctionElement>[];
|
||||
|
@ -527,7 +529,7 @@ class BoxFieldElement extends ElementX
|
|||
List<FunctionElement> get nestedClosures => const <FunctionElement>[];
|
||||
|
||||
@override
|
||||
Node get node {
|
||||
VariableDefinitions get node {
|
||||
throw new UnsupportedError("BoxFieldElement.node");
|
||||
}
|
||||
|
||||
|
@ -558,6 +560,7 @@ class ThisLocal extends Local {
|
|||
}
|
||||
|
||||
/// Call method of a closure class.
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class SynthesizedCallMethodElementX extends BaseFunctionElementX
|
||||
implements MethodElement {
|
||||
final LocalFunctionElement expression;
|
||||
|
@ -586,7 +589,8 @@ class SynthesizedCallMethodElementX extends BaseFunctionElementX
|
|||
|
||||
FunctionExpression parseNode(ParsingContext parsing) => node;
|
||||
|
||||
Element get analyzableElement => closureClass.methodElement.analyzableElement;
|
||||
AnalyzableElement get analyzableElement =>
|
||||
closureClass.methodElement.analyzableElement;
|
||||
|
||||
bool get hasResolvedAst => true;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class ConstantConstructorComputer extends SemanticVisitor
|
|||
internalError(node, template.replaceFirst('#', '$node'));
|
||||
}
|
||||
|
||||
internalError(Node node, String message) {
|
||||
internalError(Spannable node, String message) {
|
||||
throw new UnsupportedError(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,15 +39,19 @@ abstract class ConstantConstructor {
|
|||
abstract class ConstantConstructorVisitor<R, A> {
|
||||
const ConstantConstructorVisitor();
|
||||
|
||||
R visit(ConstantConstructor constantConstructor, A context) {
|
||||
R visit(
|
||||
covariant ConstantConstructor constantConstructor, covariant A context) {
|
||||
return constantConstructor.accept(this, context);
|
||||
}
|
||||
|
||||
R visitGenerative(GenerativeConstantConstructor constructor, A arg);
|
||||
R visitGenerative(
|
||||
covariant GenerativeConstantConstructor constructor, covariant A arg);
|
||||
R visitRedirectingGenerative(
|
||||
RedirectingGenerativeConstantConstructor constructor, A arg);
|
||||
covariant RedirectingGenerativeConstantConstructor constructor,
|
||||
covariant A arg);
|
||||
R visitRedirectingFactory(
|
||||
RedirectingFactoryConstantConstructor constructor, A arg);
|
||||
covariant RedirectingFactoryConstantConstructor constructor,
|
||||
covariant A arg);
|
||||
}
|
||||
|
||||
/// A generative constant constructor.
|
||||
|
|
|
@ -20,18 +20,20 @@ abstract class EvaluationEnvironment {
|
|||
String readFromEnvironment(String name);
|
||||
|
||||
/// Returns the [ConstantExpression] for the value of the constant [local].
|
||||
ConstantExpression getLocalConstant(Local local);
|
||||
ConstantExpression getLocalConstant(covariant Local local);
|
||||
|
||||
/// Returns the [ConstantExpression] for the value of the constant [field].
|
||||
ConstantExpression getFieldConstant(FieldEntity field);
|
||||
ConstantExpression getFieldConstant(covariant FieldEntity field);
|
||||
|
||||
/// Returns the [ConstantConstructor] corresponding to the constant
|
||||
/// [constructor].
|
||||
ConstantConstructor getConstructorConstant(ConstructorEntity constructor);
|
||||
ConstantConstructor getConstructorConstant(
|
||||
covariant ConstructorEntity constructor);
|
||||
|
||||
/// Performs the substitution of the type arguments of [target] for their
|
||||
/// corresponding type variables in [type].
|
||||
InterfaceType substByContext(InterfaceType base, InterfaceType target);
|
||||
InterfaceType substByContext(
|
||||
covariant InterfaceType base, covariant InterfaceType target);
|
||||
}
|
||||
|
||||
/// The normalized arguments passed to a const constructor computed from the
|
||||
|
|
|
@ -98,7 +98,7 @@ abstract class ConstantExpression {
|
|||
|
||||
int get hashCode => _hashCode ??= _computeHashCode();
|
||||
|
||||
bool _equals(ConstantExpression other);
|
||||
bool _equals(covariant ConstantExpression other);
|
||||
|
||||
bool operator ==(other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
|
|
@ -30,20 +30,22 @@ enum ConstantValueKind {
|
|||
abstract class ConstantValueVisitor<R, A> {
|
||||
const ConstantValueVisitor();
|
||||
|
||||
R visitFunction(FunctionConstantValue constant, A arg);
|
||||
R visitNull(NullConstantValue constant, A arg);
|
||||
R visitInt(IntConstantValue constant, A arg);
|
||||
R visitDouble(DoubleConstantValue constant, A arg);
|
||||
R visitBool(BoolConstantValue constant, A arg);
|
||||
R visitString(StringConstantValue constant, A arg);
|
||||
R visitList(ListConstantValue constant, A arg);
|
||||
R visitMap(MapConstantValue constant, A arg);
|
||||
R visitConstructed(ConstructedConstantValue constant, A arg);
|
||||
R visitType(TypeConstantValue constant, A arg);
|
||||
R visitInterceptor(InterceptorConstantValue constant, A arg);
|
||||
R visitSynthetic(SyntheticConstantValue constant, A arg);
|
||||
R visitDeferred(DeferredConstantValue constant, A arg);
|
||||
R visitNonConstant(NonConstantValue constant, A arg);
|
||||
R visitFunction(covariant FunctionConstantValue constant, covariant A arg);
|
||||
R visitNull(covariant NullConstantValue constant, covariant A arg);
|
||||
R visitInt(covariant IntConstantValue constant, covariant A arg);
|
||||
R visitDouble(covariant DoubleConstantValue constant, covariant A arg);
|
||||
R visitBool(covariant BoolConstantValue constant, covariant A arg);
|
||||
R visitString(covariant StringConstantValue constant, covariant A arg);
|
||||
R visitList(covariant ListConstantValue constant, covariant A arg);
|
||||
R visitMap(covariant MapConstantValue constant, covariant A arg);
|
||||
R visitConstructed(
|
||||
covariant ConstructedConstantValue constant, covariant A arg);
|
||||
R visitType(covariant TypeConstantValue constant, covariant A arg);
|
||||
R visitInterceptor(
|
||||
covariant InterceptorConstantValue constant, covariant A arg);
|
||||
R visitSynthetic(covariant SyntheticConstantValue constant, covariant A arg);
|
||||
R visitDeferred(covariant DeferredConstantValue constant, covariant A arg);
|
||||
R visitNonConstant(covariant NonConstantValue constant, covariant A arg);
|
||||
}
|
||||
|
||||
abstract class ConstantValue {
|
||||
|
|
|
@ -70,8 +70,9 @@ class OutputUnit {
|
|||
|
||||
String toString() => "OutputUnit($name)";
|
||||
|
||||
bool operator ==(OutputUnit other) {
|
||||
return imports.length == other.imports.length &&
|
||||
bool operator ==(other) {
|
||||
return other is OutputUnit &&
|
||||
imports.length == other.imports.length &&
|
||||
imports.containsAll(other.imports);
|
||||
}
|
||||
|
||||
|
|
|
@ -367,7 +367,7 @@ class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> {
|
|||
}
|
||||
|
||||
class Selection {
|
||||
final Element selectedElement;
|
||||
final Entity selectedElement;
|
||||
final ReceiverConstraint mask;
|
||||
Selection(this.selectedElement, this.mask);
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ class DumpInfoTask extends CompilerTask implements InfoReporter {
|
|||
new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) {
|
||||
selections.addAll(closedWorld
|
||||
.locateMembers(dynamicUse.selector, dynamicUse.mask)
|
||||
.map((MemberElement e) => new Selection(e, dynamicUse.mask)));
|
||||
.map((MemberEntity e) => new Selection(e, dynamicUse.mask)));
|
||||
}, visitStaticUse: (staticUse) {
|
||||
selections.add(new Selection(staticUse.element, null));
|
||||
}),
|
||||
|
|
|
@ -503,20 +503,20 @@ abstract class FunctionSignatureCommon implements FunctionSignature {
|
|||
|
||||
ResolutionDartType get returnType => type.returnType;
|
||||
|
||||
void forEachRequiredParameter(void function(Element parameter)) {
|
||||
void forEachRequiredParameter(void function(FormalElement parameter)) {
|
||||
requiredParameters.forEach(function);
|
||||
}
|
||||
|
||||
void forEachOptionalParameter(void function(Element parameter)) {
|
||||
void forEachOptionalParameter(void function(FormalElement parameter)) {
|
||||
optionalParameters.forEach(function);
|
||||
}
|
||||
|
||||
void forEachParameter(void function(Element parameter)) {
|
||||
void forEachParameter(void function(FormalElement parameter)) {
|
||||
forEachRequiredParameter(function);
|
||||
forEachOptionalParameter(function);
|
||||
}
|
||||
|
||||
void orderedForEachParameter(void function(Element parameter)) {
|
||||
void orderedForEachParameter(void function(FormalElement parameter)) {
|
||||
forEachRequiredParameter(function);
|
||||
orderedOptionalParameters.forEach(function);
|
||||
}
|
||||
|
|
|
@ -874,6 +874,7 @@ class Elements {
|
|||
/// Code that cannot not handle an [ErroneousElement] should use
|
||||
/// `Element.isUnresolved(element)` to check for unresolvable elements instead
|
||||
/// of `element == null`.
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
abstract class ErroneousElement extends Element implements ConstructorElement {
|
||||
MessageKind get messageKind;
|
||||
Map get messageArguments;
|
||||
|
@ -1339,7 +1340,8 @@ abstract class ConstructorElement extends MethodElement
|
|||
|
||||
/// Compute the type of the effective target of this constructor for an
|
||||
/// instantiation site with type [:newType:].
|
||||
ResolutionInterfaceType computeEffectiveTargetType(
|
||||
/// May return a malformed type.
|
||||
ResolutionDartType computeEffectiveTargetType(
|
||||
ResolutionInterfaceType newType);
|
||||
|
||||
/// If this is a synthesized constructor [definingConstructor] points to
|
||||
|
|
|
@ -36,5 +36,5 @@ abstract class JumpTarget<T> extends Local {
|
|||
void set isBreakTarget(bool value);
|
||||
void set isContinueTarget(bool value);
|
||||
|
||||
LabelDefinition<T> addLabel(T label, String labelName);
|
||||
LabelDefinition<T> addLabel(covariant T label, String labelName);
|
||||
}
|
||||
|
|
|
@ -250,8 +250,8 @@ class ErroneousElementX extends ElementX
|
|||
get functionSignature => unsupported();
|
||||
get parameterStructure => unsupported();
|
||||
get parameters => unsupported();
|
||||
get patch => null;
|
||||
get origin => this;
|
||||
Element get patch => null;
|
||||
Element get origin => this;
|
||||
get immediateRedirectionTarget => unsupported();
|
||||
get nestedClosures => unsupported();
|
||||
get memberContext => unsupported();
|
||||
|
@ -381,8 +381,7 @@ class ErroneousConstructorElementX extends ErroneousElementX
|
|||
}
|
||||
|
||||
@override
|
||||
void setEffectiveTarget(
|
||||
ConstructorElement target, ResolutionInterfaceType type,
|
||||
void setEffectiveTarget(ConstructorElement target, ResolutionDartType type,
|
||||
{bool isMalformed: false}) {
|
||||
throw new UnsupportedError("setEffectiveTarget");
|
||||
}
|
||||
|
@ -461,6 +460,21 @@ class ErroneousConstructorElementX extends ErroneousElementX
|
|||
set _redirectionDeferredPrefix(_) {
|
||||
throw new UnsupportedError("_redirectionDeferredPrefix=");
|
||||
}
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get declaration => super.declaration;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get implementation => super.implementation;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get origin => super.origin;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get patch => super.patch;
|
||||
|
||||
ResolutionFunctionType computeType(Resolution resolution) =>
|
||||
super.computeType(resolution);
|
||||
}
|
||||
|
||||
/// A message attached to a [WarnOnUseElementX].
|
||||
|
@ -814,7 +828,7 @@ class CompilationUnitElementX extends ElementX
|
|||
|
||||
bool get hasMembers => !localMembers.isEmpty;
|
||||
|
||||
Element get analyzableElement => library;
|
||||
AnalyzableElement get analyzableElement => library;
|
||||
|
||||
accept(ElementVisitor visitor, arg) {
|
||||
return visitor.visitCompilationUnitElement(this, arg);
|
||||
|
@ -1076,7 +1090,7 @@ class LibraryElementX extends ElementX
|
|||
|
||||
CompilationUnitElement get compilationUnit => entryCompilationUnit;
|
||||
|
||||
Element get analyzableElement => this;
|
||||
AnalyzableElement get analyzableElement => this;
|
||||
|
||||
void addCompilationUnit(CompilationUnitElement element) {
|
||||
compilationUnits = compilationUnits.prepend(element);
|
||||
|
@ -1264,9 +1278,17 @@ class LibraryElementX extends ElementX
|
|||
return visitor.visitLibraryElement(this, arg);
|
||||
}
|
||||
|
||||
// TODO(johnniwinther): Remove these when issue 18630 is fixed.
|
||||
LibraryElementX get patch => super.patch;
|
||||
// TODO(johnniwinther): Remove this.
|
||||
LibraryElementX get declaration => super.declaration;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
LibraryElementX get implementation => super.implementation;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
LibraryElementX get origin => super.origin;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
LibraryElementX get patch => super.patch;
|
||||
}
|
||||
|
||||
class PrefixElementX extends ElementX implements PrefixElement {
|
||||
|
@ -1312,10 +1334,7 @@ class PrefixElementX extends ElementX implements PrefixElement {
|
|||
}
|
||||
|
||||
class TypedefElementX extends ElementX
|
||||
with
|
||||
AstElementMixin,
|
||||
AnalyzableElementX,
|
||||
TypeDeclarationElementX<ResolutionTypedefType>
|
||||
with AstElementMixin, AnalyzableElementX, TypeDeclarationElementX
|
||||
implements TypedefElement {
|
||||
Typedef cachedNode;
|
||||
|
||||
|
@ -1392,6 +1411,10 @@ class TypedefElementX extends ElementX
|
|||
|
||||
// A typedef cannot be patched therefore defines itself.
|
||||
AstElement get definingElement => this;
|
||||
|
||||
ResolutionTypedefType get thisType => super.thisType;
|
||||
|
||||
ResolutionTypedefType get rawType => super.rawType;
|
||||
}
|
||||
|
||||
// This class holds common information for a list of variable or field
|
||||
|
@ -1907,6 +1930,8 @@ class InitializingFormalElementX extends ParameterElementX
|
|||
|
||||
@override
|
||||
bool get isLocal => true;
|
||||
|
||||
ConstructorElement get functionDeclaration => super.functionDeclaration;
|
||||
}
|
||||
|
||||
class ErroneousInitializingFormalElementX extends ParameterElementX
|
||||
|
@ -1929,6 +1954,8 @@ class ErroneousInitializingFormalElementX extends ParameterElementX
|
|||
bool get isMalformed => true;
|
||||
|
||||
ResolutionDynamicType get type => const ResolutionDynamicType();
|
||||
|
||||
ConstructorElement get functionDeclaration => super.functionDeclaration;
|
||||
}
|
||||
|
||||
class AbstractFieldElementX extends ElementX
|
||||
|
@ -1983,27 +2010,26 @@ class AbstractFieldElementX extends ElementX
|
|||
|
||||
// TODO(johnniwinther): [FunctionSignature] should be merged with
|
||||
// [FunctionType].
|
||||
// TODO(karlklose): all these lists should have element type [FormalElement].
|
||||
class FunctionSignatureX extends FunctionSignatureCommon
|
||||
implements FunctionSignature {
|
||||
final List<ResolutionDartType> typeVariables;
|
||||
final List<Element> requiredParameters;
|
||||
final List<Element> optionalParameters;
|
||||
final List<FormalElement> requiredParameters;
|
||||
final List<FormalElement> optionalParameters;
|
||||
final int requiredParameterCount;
|
||||
final int optionalParameterCount;
|
||||
final bool optionalParametersAreNamed;
|
||||
final List<Element> orderedOptionalParameters;
|
||||
final List<FormalElement> orderedOptionalParameters;
|
||||
final ResolutionFunctionType type;
|
||||
final bool hasOptionalParameters;
|
||||
|
||||
FunctionSignatureX(
|
||||
{this.typeVariables: const <ResolutionDartType>[],
|
||||
this.requiredParameters: const <Element>[],
|
||||
this.requiredParameters: const <FormalElement>[],
|
||||
this.requiredParameterCount: 0,
|
||||
List<Element> optionalParameters: const <Element>[],
|
||||
List<Element> optionalParameters: const <FormalElement>[],
|
||||
this.optionalParameterCount: 0,
|
||||
this.optionalParametersAreNamed: false,
|
||||
this.orderedOptionalParameters: const <Element>[],
|
||||
this.orderedOptionalParameters: const <FormalElement>[],
|
||||
this.type})
|
||||
: optionalParameters = optionalParameters,
|
||||
hasOptionalParameters = !optionalParameters.isEmpty;
|
||||
|
@ -2104,6 +2130,18 @@ abstract class BaseFunctionElementX extends ElementX
|
|||
|
||||
@override
|
||||
List<ResolutionDartType> get typeVariables => functionSignature.typeVariables;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
FunctionElement get declaration => super.declaration;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
FunctionElement get implementation => super.implementation;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
FunctionElement get origin => super.origin;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
FunctionElement get patch => super.patch;
|
||||
}
|
||||
|
||||
abstract class FunctionElementX extends BaseFunctionElementX
|
||||
|
@ -2279,8 +2317,6 @@ abstract class ConstructorElementX extends FunctionElementX
|
|||
ConstructorElement _immediateRedirectionTarget;
|
||||
PrefixElement _redirectionDeferredPrefix;
|
||||
|
||||
ConstructorElementX get patch => super.patch;
|
||||
|
||||
bool get isRedirectingGenerative {
|
||||
if (isPatched) return patch.isRedirectingGenerative;
|
||||
return isRedirectingGenerativeInternal;
|
||||
|
@ -2411,10 +2447,21 @@ abstract class ConstructorElementX extends FunctionElementX
|
|||
ConstructorElement get definingConstructor => null;
|
||||
|
||||
ClassElement get enclosingClass => enclosingElement.declaration;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get declaration => super.declaration;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get implementation => super.implementation;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get origin => super.origin;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ConstructorElementX get patch => super.patch;
|
||||
}
|
||||
|
||||
class DeferredLoaderGetterElementX extends GetterElementX
|
||||
implements GetterElement {
|
||||
class DeferredLoaderGetterElementX extends GetterElementX {
|
||||
final PrefixElement prefix;
|
||||
|
||||
DeferredLoaderGetterElementX(PrefixElement prefix)
|
||||
|
@ -2540,7 +2587,7 @@ class ConstructorBodyElementX extends BaseFunctionElementX
|
|||
|
||||
Element get outermostEnclosingMemberOrTopLevel => constructor;
|
||||
|
||||
Element get analyzableElement => constructor.analyzableElement;
|
||||
AnalyzableElement get analyzableElement => constructor.analyzableElement;
|
||||
|
||||
accept(ElementVisitor visitor, arg) {
|
||||
return visitor.visitConstructorBodyElement(this, arg);
|
||||
|
@ -2596,7 +2643,7 @@ class SynthesizedConstructorElementX extends ConstructorElementX {
|
|||
|
||||
ResolvedAst get resolvedAst => _resolvedAst;
|
||||
|
||||
ResolutionDartType get type {
|
||||
ResolutionFunctionType get type {
|
||||
if (isDefaultConstructor) {
|
||||
return super.type;
|
||||
} else {
|
||||
|
@ -2624,8 +2671,7 @@ class SynthesizedConstructorElementX extends ConstructorElementX {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class TypeDeclarationElementX<T extends GenericType>
|
||||
implements TypeDeclarationElement {
|
||||
abstract class TypeDeclarationElementX implements TypeDeclarationElement {
|
||||
/**
|
||||
* The `this type` for this type declaration.
|
||||
*
|
||||
|
@ -2637,7 +2683,7 @@ abstract class TypeDeclarationElementX<T extends GenericType>
|
|||
*
|
||||
* This type is computed in [computeType].
|
||||
*/
|
||||
T thisTypeCache;
|
||||
GenericType thisTypeCache;
|
||||
|
||||
/**
|
||||
* The raw type for this type declaration.
|
||||
|
@ -2657,21 +2703,21 @@ abstract class TypeDeclarationElementX<T extends GenericType>
|
|||
*
|
||||
* This type is computed together with [thisType] in [computeType].
|
||||
*/
|
||||
T rawTypeCache;
|
||||
GenericType rawTypeCache;
|
||||
|
||||
T get thisType {
|
||||
GenericType get thisType {
|
||||
assert(thisTypeCache != null,
|
||||
failedAt(this, 'This type has not been computed for $this'));
|
||||
return thisTypeCache;
|
||||
}
|
||||
|
||||
T get rawType {
|
||||
GenericType get rawType {
|
||||
assert(rawTypeCache != null,
|
||||
failedAt(this, 'Raw type has not been computed for $this'));
|
||||
return rawTypeCache;
|
||||
}
|
||||
|
||||
T createType(List<ResolutionDartType> typeArguments);
|
||||
GenericType createType(List<ResolutionDartType> typeArguments);
|
||||
|
||||
void setThisAndRawTypes(List<ResolutionDartType> typeParameters) {
|
||||
assert(thisTypeCache == null,
|
||||
|
@ -2725,7 +2771,7 @@ abstract class BaseClassElementX extends ElementX
|
|||
AstElementMixin,
|
||||
AnalyzableElementX,
|
||||
ClassElementCommon,
|
||||
TypeDeclarationElementX<ResolutionInterfaceType>,
|
||||
TypeDeclarationElementX,
|
||||
PatchMixin<ClassElement>,
|
||||
ClassMemberMixin
|
||||
implements ClassElement {
|
||||
|
@ -2823,12 +2869,24 @@ abstract class BaseClassElementX extends ElementX
|
|||
return supertype == null ? null : supertype.element;
|
||||
}
|
||||
|
||||
// TODO(johnniwinther): Remove these when issue 18630 is fixed.
|
||||
ClassElement get patch => super.patch;
|
||||
ClassElement get origin => super.origin;
|
||||
|
||||
// A class declaration is defined by the declaration element.
|
||||
AstElement get definingElement => declaration;
|
||||
|
||||
ResolutionInterfaceType get thisType => super.thisType;
|
||||
|
||||
ResolutionInterfaceType get rawType => super.rawType;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ClassElement get declaration => super.declaration;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ClassElement get implementation => super.implementation;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ClassElement get origin => super.origin;
|
||||
|
||||
// TODO(johnniwinther): Remove this.
|
||||
ClassElement get patch => super.patch;
|
||||
}
|
||||
|
||||
abstract class ClassElementX extends BaseClassElementX {
|
||||
|
@ -2935,7 +2993,7 @@ abstract class ClassElementX extends BaseClassElementX {
|
|||
class EnumClassElementX extends ClassElementX
|
||||
implements EnumClassElement, DeclarationSite {
|
||||
final Enum node;
|
||||
List<FieldElement> _enumValues;
|
||||
List<EnumConstantElement> _enumValues;
|
||||
|
||||
EnumClassElementX(String name, Element enclosing, int id, this.node)
|
||||
: super(name, enclosing, id, STATE_NOT_STARTED);
|
||||
|
@ -2960,13 +3018,13 @@ class EnumClassElementX extends ClassElementX
|
|||
List<ResolutionDartType> computeTypeParameters(ParsingContext parsing) =>
|
||||
const <ResolutionDartType>[];
|
||||
|
||||
List<FieldElement> get enumValues {
|
||||
List<EnumConstantElement> get enumValues {
|
||||
assert(_enumValues != null,
|
||||
failedAt(this, "enumValues has not been computed for $this."));
|
||||
return _enumValues;
|
||||
}
|
||||
|
||||
void set enumValues(List<FieldElement> values) {
|
||||
void set enumValues(List<EnumConstantElement> values) {
|
||||
assert(_enumValues == null,
|
||||
failedAt(this, "enumValues has already been computed for $this."));
|
||||
_enumValues = values;
|
||||
|
@ -3187,6 +3245,8 @@ class EnumConstantElementX extends EnumFieldElementX
|
|||
return new SourceSpan(enclosingClass.sourcePosition.uri,
|
||||
position.charOffset, position.charEnd);
|
||||
}
|
||||
|
||||
EnumClassElement get enclosingClass => super.enclosingClass;
|
||||
}
|
||||
|
||||
abstract class MixinApplicationElementX extends BaseClassElementX
|
||||
|
@ -3463,11 +3523,11 @@ class ParameterMetadataAnnotation extends MetadataAnnotationX {
|
|||
|
||||
/// Mixin for the implementation of patched elements.
|
||||
///
|
||||
/// See [:patch_parser.dart:] for a description of the terminology.
|
||||
/// See `patch_parser.dart` for a description of the terminology.
|
||||
abstract class PatchMixin<E extends Element> implements Element {
|
||||
// TODO(johnniwinther): Use type variables when issue 18630 is fixed.
|
||||
Element /*E*/ patch = null;
|
||||
Element /*E*/ origin = null;
|
||||
// TODO(johnniwinther): Use type variables.
|
||||
Element /* E */ patch = null;
|
||||
Element /* E */ origin = null;
|
||||
|
||||
bool get isPatch => origin != null;
|
||||
bool get isPatched => patch != null;
|
||||
|
@ -3475,8 +3535,8 @@ abstract class PatchMixin<E extends Element> implements Element {
|
|||
bool get isImplementation => !isPatched;
|
||||
bool get isDeclaration => !isPatch;
|
||||
|
||||
Element /*E*/ get implementation => isPatched ? patch : this;
|
||||
Element /*E*/ get declaration => isPatch ? origin : this;
|
||||
Element /* E */ get implementation => isPatched ? patch : this;
|
||||
Element /* E */ get declaration => isPatch ? origin : this;
|
||||
|
||||
/// Applies a patch to this element. This method must be called at most once.
|
||||
void applyPatch(PatchMixin<E> patch) {
|
||||
|
|
|
@ -59,8 +59,8 @@ abstract class ResolutionDartType implements DartType {
|
|||
*
|
||||
* Invariant: There must be the same number of [arguments] and [parameters].
|
||||
*/
|
||||
ResolutionDartType subst(
|
||||
List<ResolutionDartType> arguments, List<ResolutionDartType> parameters);
|
||||
ResolutionDartType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters);
|
||||
|
||||
/// Performs the substitution of the type arguments of [type] for their
|
||||
/// corresponding type variables in this type.
|
||||
|
@ -162,12 +162,13 @@ abstract class ResolutionDartType implements DartType {
|
|||
return new TypeDeclarationFormatter().format(this, name);
|
||||
}
|
||||
|
||||
R accept<R, A>(ResolutionDartTypeVisitor<R, A> visitor, A argument);
|
||||
R accept<R, A>(covariant ResolutionDartTypeVisitor<R, A> visitor, A argument);
|
||||
|
||||
void visitChildren<R, A>(ResolutionDartTypeVisitor visitor, var argument) {}
|
||||
void visitChildren<R, A>(
|
||||
ResolutionDartTypeVisitor<R, A> visitor, A argument) {}
|
||||
|
||||
static void visitList<R, A>(
|
||||
List<ResolutionDartType> types, DartTypeVisitor visitor, var argument) {
|
||||
static void visitList<R, A>(List<ResolutionDartType> types,
|
||||
ResolutionDartTypeVisitor<R, A> visitor, A argument) {
|
||||
for (ResolutionDartType type in types) {
|
||||
type.accept(visitor, argument);
|
||||
}
|
||||
|
@ -216,8 +217,8 @@ class ResolutionTypeVariableType extends ResolutionDartType
|
|||
|
||||
String get name => element.name;
|
||||
|
||||
ResolutionDartType subst(
|
||||
List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
|
||||
ResolutionDartType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters) {
|
||||
assert(arguments.length == parameters.length);
|
||||
if (parameters.isEmpty) {
|
||||
// Return fast on empty substitutions.
|
||||
|
@ -283,8 +284,8 @@ class ResolutionVoidType extends ResolutionDartType implements VoidType {
|
|||
|
||||
Element get element => null;
|
||||
|
||||
ResolutionDartType subst(
|
||||
List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
|
||||
ResolutionDartType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters) {
|
||||
// Void cannot be substituted.
|
||||
return this;
|
||||
}
|
||||
|
@ -331,8 +332,8 @@ class MalformedType extends ResolutionDartType {
|
|||
|
||||
String get name => element.name;
|
||||
|
||||
ResolutionDartType subst(
|
||||
List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
|
||||
ResolutionDartType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters) {
|
||||
// Malformed types are not substitutable.
|
||||
return this;
|
||||
}
|
||||
|
@ -343,7 +344,8 @@ class MalformedType extends ResolutionDartType {
|
|||
@override
|
||||
bool get isMalformed => true;
|
||||
|
||||
R accept<R, A>(ResolutionDartTypeVisitor<R, A> visitor, A argument) {
|
||||
R accept<R, A>(
|
||||
covariant ResolutionDartTypeVisitor<R, A> visitor, A argument) {
|
||||
return visitor.visitMalformedType(this, argument);
|
||||
}
|
||||
|
||||
|
@ -367,8 +369,7 @@ class MalformedType extends ResolutionDartType {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class GenericType<T extends GenericType<T>>
|
||||
extends ResolutionDartType {
|
||||
abstract class GenericType extends ResolutionDartType {
|
||||
final TypeDeclarationElement element;
|
||||
final List<ResolutionDartType> typeArguments;
|
||||
|
||||
|
@ -398,10 +399,10 @@ abstract class GenericType<T extends GenericType<T>>
|
|||
}
|
||||
|
||||
/// Creates a new instance of this type using the provided type arguments.
|
||||
T createInstantiation(List<ResolutionDartType> newTypeArguments);
|
||||
GenericType createInstantiation(List<ResolutionDartType> newTypeArguments);
|
||||
|
||||
T subst(
|
||||
List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
|
||||
GenericType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters) {
|
||||
if (typeArguments.isEmpty) {
|
||||
// Return fast on non-generic types.
|
||||
return this;
|
||||
|
@ -430,7 +431,8 @@ abstract class GenericType<T extends GenericType<T>>
|
|||
}
|
||||
}
|
||||
|
||||
void visitChildren(DartTypeVisitor visitor, var argument) {
|
||||
void visitChildren<R, A>(
|
||||
ResolutionDartTypeVisitor<R, A> visitor, var argument) {
|
||||
ResolutionDartType.visitList(typeArguments, visitor, argument);
|
||||
}
|
||||
|
||||
|
@ -489,9 +491,7 @@ abstract class GenericType<T extends GenericType<T>>
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: INCONSISTENT_METHOD_INHERITANCE
|
||||
class ResolutionInterfaceType extends GenericType<ResolutionInterfaceType>
|
||||
implements InterfaceType {
|
||||
class ResolutionInterfaceType extends GenericType implements InterfaceType {
|
||||
int _hashCode;
|
||||
|
||||
ResolutionInterfaceType(ClassElement element,
|
||||
|
@ -565,6 +565,11 @@ class ResolutionInterfaceType extends GenericType<ResolutionInterfaceType>
|
|||
ResolutionFunctionType type = element.callType;
|
||||
return type != null && isGeneric ? type.substByContext(this) : type;
|
||||
}
|
||||
|
||||
ResolutionInterfaceType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters) {
|
||||
return super.subst(arguments, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/// Special subclass of [ResolutionInterfaceType] used for generic interface
|
||||
|
@ -696,8 +701,8 @@ class ResolutionFunctionType extends ResolutionDartType
|
|||
return null;
|
||||
}
|
||||
|
||||
ResolutionDartType subst(
|
||||
List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
|
||||
ResolutionDartType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters) {
|
||||
if (parameters.isEmpty) {
|
||||
assert(arguments.isEmpty);
|
||||
// Return fast on empty substitutions.
|
||||
|
@ -757,11 +762,12 @@ class ResolutionFunctionType extends ResolutionDartType
|
|||
});
|
||||
}
|
||||
|
||||
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) {
|
||||
R accept<R, A>(covariant DartTypeVisitor<R, A> visitor, A argument) {
|
||||
return visitor.visitFunctionType(this, argument);
|
||||
}
|
||||
|
||||
void visitChildren(DartTypeVisitor visitor, var argument) {
|
||||
void visitChildren<R, A>(
|
||||
ResolutionDartTypeVisitor<R, A> visitor, var argument) {
|
||||
returnType.accept(visitor, argument);
|
||||
ResolutionDartType.visitList(parameterTypes, visitor, argument);
|
||||
ResolutionDartType.visitList(optionalParameterTypes, visitor, argument);
|
||||
|
@ -860,7 +866,7 @@ class ResolutionFunctionType extends ResolutionDartType
|
|||
bool _typeContainsMethodTypeVariableType(ResolutionDartType type) =>
|
||||
type.containsMethodTypeVariableType;
|
||||
|
||||
class ResolutionTypedefType extends GenericType<ResolutionTypedefType> {
|
||||
class ResolutionTypedefType extends GenericType {
|
||||
ResolutionDartType _unaliased;
|
||||
|
||||
ResolutionTypedefType(TypedefElement element,
|
||||
|
@ -907,7 +913,8 @@ class ResolutionTypedefType extends GenericType<ResolutionTypedefType> {
|
|||
|
||||
ResolutionTypedefType asRaw() => super.asRaw();
|
||||
|
||||
R accept<R, A>(ResolutionDartTypeVisitor<R, A> visitor, A argument) {
|
||||
R accept<R, A>(
|
||||
covariant ResolutionDartTypeVisitor<R, A> visitor, A argument) {
|
||||
return visitor.visitTypedefType(this, argument);
|
||||
}
|
||||
}
|
||||
|
@ -926,8 +933,8 @@ class ResolutionDynamicType extends ResolutionDartType implements DynamicType {
|
|||
|
||||
ResolutionTypeKind get kind => ResolutionTypeKind.DYNAMIC;
|
||||
|
||||
ResolutionDartType subst(List<ResolutionDartType> arguments,
|
||||
List<ResolutionDartType> parameters) =>
|
||||
ResolutionDartType subst(covariant List<ResolutionDartType> arguments,
|
||||
covariant List<ResolutionDartType> parameters) =>
|
||||
this;
|
||||
|
||||
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) {
|
||||
|
@ -1000,7 +1007,7 @@ abstract class BaseResolutionDartTypeVisitor<R, A>
|
|||
R visitGenericType(GenericType type, A argument) => visitType(type, argument);
|
||||
|
||||
@override
|
||||
R visitInterfaceType(ResolutionInterfaceType type, A argument) =>
|
||||
R visitInterfaceType(covariant ResolutionInterfaceType type, A argument) =>
|
||||
visitGenericType(type, argument);
|
||||
|
||||
@override
|
||||
|
@ -1009,33 +1016,38 @@ abstract class BaseResolutionDartTypeVisitor<R, A>
|
|||
}
|
||||
|
||||
abstract class AbstractTypeRelationMixin
|
||||
implements AbstractTypeRelation, ResolutionDartTypeVisitor<bool, DartType> {
|
||||
implements
|
||||
AbstractTypeRelation<ResolutionDartType>,
|
||||
ResolutionDartTypeVisitor<bool, ResolutionDartType> {
|
||||
Resolution get resolution;
|
||||
|
||||
@override
|
||||
CommonElements get commonElements => resolution.commonElements;
|
||||
|
||||
/// Ensures that the super hierarchy of [type] is computed.
|
||||
void ensureResolved(ResolutionInterfaceType type) {
|
||||
void ensureResolved(covariant ResolutionInterfaceType type) {
|
||||
// TODO(johnniwinther): Currently needed since literal types like int,
|
||||
// double, bool etc. might not have been resolved yet.
|
||||
type.element.ensureResolved(resolution);
|
||||
}
|
||||
|
||||
/// Returns the unaliased version of [type].
|
||||
DartType getUnaliased(ResolutionDartType type) {
|
||||
ResolutionDartType getUnaliased(covariant ResolutionDartType type) {
|
||||
type.computeUnaliased(resolution);
|
||||
return type.unaliased;
|
||||
}
|
||||
|
||||
@override
|
||||
DartType getTypeVariableBound(TypeVariableElement element) => element.bound;
|
||||
DartType getTypeVariableBound(covariant TypeVariableElement element) =>
|
||||
element.bound;
|
||||
|
||||
@override
|
||||
FunctionType getCallType(ResolutionInterfaceType type) => type.callType;
|
||||
FunctionType getCallType(covariant ResolutionInterfaceType type) =>
|
||||
type.callType;
|
||||
|
||||
@override
|
||||
InterfaceType asInstanceOf(ResolutionInterfaceType type, ClassEntity cls) =>
|
||||
InterfaceType asInstanceOf(
|
||||
covariant ResolutionInterfaceType type, ClassEntity cls) =>
|
||||
type.asInstanceOf(cls);
|
||||
|
||||
/// Handle as dynamic for both subtype and more specific relation to avoid
|
||||
|
@ -1046,21 +1058,23 @@ abstract class AbstractTypeRelationMixin
|
|||
visitType(t, s);
|
||||
}
|
||||
|
||||
class ResolutionMoreSpecificVisitor extends MoreSpecificVisitor
|
||||
class ResolutionMoreSpecificVisitor
|
||||
extends MoreSpecificVisitor<ResolutionDartType>
|
||||
with AbstractTypeRelationMixin {
|
||||
final Resolution resolution;
|
||||
|
||||
ResolutionMoreSpecificVisitor(this.resolution);
|
||||
}
|
||||
|
||||
class ResolutionSubtypeVisitor extends SubtypeVisitor
|
||||
class ResolutionSubtypeVisitor extends SubtypeVisitor<ResolutionDartType>
|
||||
with AbstractTypeRelationMixin {
|
||||
final Resolution resolution;
|
||||
|
||||
ResolutionSubtypeVisitor(this.resolution);
|
||||
}
|
||||
|
||||
class ResolutionPotentialSubtypeVisitor extends PotentialSubtypeVisitor
|
||||
class ResolutionPotentialSubtypeVisitor
|
||||
extends PotentialSubtypeVisitor<ResolutionDartType>
|
||||
with AbstractTypeRelationMixin {
|
||||
final Resolution resolution;
|
||||
|
||||
|
@ -1072,8 +1086,8 @@ class ResolutionPotentialSubtypeVisitor extends PotentialSubtypeVisitor
|
|||
* substitute for the bound of [typeVariable]. [bound] holds the bound against
|
||||
* which [typeArgument] should be checked.
|
||||
*/
|
||||
typedef void CheckTypeVariableBound<T extends GenericType>(T type,
|
||||
DartType typeArgument, TypeVariableType typeVariable, DartType bound);
|
||||
typedef void CheckTypeVariableBound(GenericType type, DartType typeArgument,
|
||||
TypeVariableType typeVariable, DartType bound);
|
||||
|
||||
class Types extends DartTypes {
|
||||
final Resolution resolution;
|
||||
|
@ -1098,35 +1112,34 @@ class Types extends DartTypes {
|
|||
}
|
||||
|
||||
@override
|
||||
InterfaceType asInstanceOf(ResolutionInterfaceType type, ClassEntity cls) {
|
||||
InterfaceType asInstanceOf(
|
||||
covariant ResolutionInterfaceType type, ClassEntity cls) {
|
||||
return type.asInstanceOf(cls);
|
||||
}
|
||||
|
||||
@override
|
||||
ResolutionDartType substByContext(
|
||||
ResolutionDartType base, ResolutionInterfaceType context) {
|
||||
ResolutionDartType substByContext(covariant ResolutionDartType base,
|
||||
covariant ResolutionInterfaceType context) {
|
||||
return base.substByContext(context);
|
||||
}
|
||||
|
||||
@override
|
||||
InterfaceType getThisType(ClassElement cls) {
|
||||
return cls.thisType;
|
||||
}
|
||||
InterfaceType getThisType(covariant ClassElement cls) => cls.thisType;
|
||||
|
||||
@override
|
||||
ResolutionInterfaceType getSupertype(ClassElement cls) {
|
||||
return cls.supertype;
|
||||
}
|
||||
ResolutionInterfaceType getSupertype(covariant ClassElement cls) =>
|
||||
cls.supertype;
|
||||
|
||||
@override
|
||||
Iterable<InterfaceType> getSupertypes(ClassElement cls) {
|
||||
Iterable<InterfaceType> getSupertypes(covariant ClassElement cls) {
|
||||
assert(cls.allSupertypes != null,
|
||||
failedAt(cls, 'Supertypes have not been computed for $cls.'));
|
||||
return cls.allSupertypes;
|
||||
}
|
||||
|
||||
@override
|
||||
FunctionType getCallType(ResolutionInterfaceType type) => type.callType;
|
||||
FunctionType getCallType(covariant ResolutionInterfaceType type) =>
|
||||
type.callType;
|
||||
|
||||
/// Flatten [type] by recursively removing enclosing `Future` annotations.
|
||||
///
|
||||
|
@ -1179,15 +1192,18 @@ class Types extends DartTypes {
|
|||
}
|
||||
|
||||
/** Returns true if t is a subtype of s */
|
||||
bool isSubtype(ResolutionDartType t, ResolutionDartType s) {
|
||||
bool isSubtype(
|
||||
covariant ResolutionDartType t, covariant ResolutionDartType s) {
|
||||
return subtypeVisitor.isSubtype(t, s);
|
||||
}
|
||||
|
||||
bool isAssignable(ResolutionDartType r, ResolutionDartType s) {
|
||||
bool isAssignable(
|
||||
covariant ResolutionDartType r, covariant ResolutionDartType s) {
|
||||
return subtypeVisitor.isAssignable(r, s);
|
||||
}
|
||||
|
||||
bool isPotentialSubtype(ResolutionDartType t, ResolutionDartType s) {
|
||||
bool isPotentialSubtype(
|
||||
covariant ResolutionDartType t, covariant ResolutionDartType s) {
|
||||
// TODO(johnniwinther): Return a set of variable points in the positive
|
||||
// cases.
|
||||
return potentialSubtypeVisitor.isSubtype(t, s);
|
||||
|
@ -1195,10 +1211,13 @@ class Types extends DartTypes {
|
|||
|
||||
@override
|
||||
void checkTypeVariableBounds(
|
||||
ResolutionInterfaceType type,
|
||||
covariant ResolutionInterfaceType type,
|
||||
void checkTypeVariableBound(InterfaceType type, DartType typeArgument,
|
||||
TypeVariableType typeVariable, DartType bound)) {
|
||||
genericCheckTypeVariableBounds(type, checkTypeVariableBound);
|
||||
void f(DartType type, DartType typeArgument, TypeVariableType typeVariable,
|
||||
DartType bound) =>
|
||||
checkTypeVariableBound(type, typeArgument, typeVariable, bound);
|
||||
genericCheckTypeVariableBounds(type, f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1206,8 +1225,8 @@ class Types extends DartTypes {
|
|||
* declared on [element]. Calls [checkTypeVariableBound] on each type
|
||||
* argument and bound.
|
||||
*/
|
||||
void genericCheckTypeVariableBounds<T extends GenericType>(
|
||||
T type, CheckTypeVariableBound<T> checkTypeVariableBound) {
|
||||
void genericCheckTypeVariableBounds(
|
||||
GenericType type, CheckTypeVariableBound checkTypeVariableBound) {
|
||||
TypeDeclarationElement element = type.element;
|
||||
List<ResolutionDartType> typeArguments = type.typeArguments;
|
||||
List<ResolutionDartType> typeVariables = element.typeVariables;
|
||||
|
@ -1653,7 +1672,8 @@ class MoreSpecificSubtypeVisitor
|
|||
return null;
|
||||
}
|
||||
|
||||
bool visitType(ResolutionDartType type, ResolutionDartType argument) {
|
||||
bool visitType(
|
||||
covariant ResolutionDartType type, ResolutionDartType argument) {
|
||||
return types.isMoreSpecific(type, argument);
|
||||
}
|
||||
|
||||
|
@ -1666,7 +1686,7 @@ class MoreSpecificSubtypeVisitor
|
|||
}
|
||||
|
||||
bool visitTypeVariableType(
|
||||
ResolutionTypeVariableType type, ResolutionDartType argument) {
|
||||
covariant ResolutionTypeVariableType type, ResolutionDartType argument) {
|
||||
ResolutionDartType constraint =
|
||||
types.getMostSpecific(constraintMap[type], argument);
|
||||
constraintMap[type] = constraint;
|
||||
|
@ -1674,7 +1694,7 @@ class MoreSpecificSubtypeVisitor
|
|||
}
|
||||
|
||||
bool visitFunctionType(
|
||||
ResolutionFunctionType type, ResolutionDartType argument) {
|
||||
covariant ResolutionFunctionType type, ResolutionDartType argument) {
|
||||
if (argument is ResolutionFunctionType) {
|
||||
if (type.parameterTypes.length != argument.parameterTypes.length) {
|
||||
return false;
|
||||
|
@ -1741,7 +1761,7 @@ class TypeDeclarationFormatter
|
|||
return proposal;
|
||||
}
|
||||
|
||||
void visit(ResolutionDartType type, [_]) {
|
||||
void visit(covariant ResolutionDartType type, [_]) {
|
||||
type.accept(this, null);
|
||||
}
|
||||
|
||||
|
@ -1756,7 +1776,7 @@ class TypeDeclarationFormatter
|
|||
}
|
||||
}
|
||||
|
||||
void visitType(ResolutionDartType type, String name) {
|
||||
void visitType(covariant ResolutionDartType type, String name) {
|
||||
if (name == null) {
|
||||
sb.write(type);
|
||||
} else {
|
||||
|
@ -1777,7 +1797,7 @@ class TypeDeclarationFormatter
|
|||
}
|
||||
}
|
||||
|
||||
void visitFunctionType(ResolutionFunctionType type, String name) {
|
||||
void visitFunctionType(covariant ResolutionFunctionType type, String name) {
|
||||
visit(type.returnType);
|
||||
sb.write(' ');
|
||||
if (name != null) {
|
||||
|
|
|
@ -125,7 +125,7 @@ class InterfaceType extends DartType {
|
|||
}
|
||||
|
||||
@override
|
||||
R accept<R, A>(DartTypeVisitor visitor, A argument) =>
|
||||
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
|
||||
visitor.visitInterfaceType(this, argument);
|
||||
|
||||
int get hashCode {
|
||||
|
@ -190,7 +190,7 @@ class TypeVariableType extends DartType {
|
|||
}
|
||||
|
||||
@override
|
||||
R accept<R, A>(DartTypeVisitor visitor, A argument) =>
|
||||
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
|
||||
visitor.visitTypeVariableType(this, argument);
|
||||
|
||||
int get hashCode => 17 * element.hashCode;
|
||||
|
@ -214,7 +214,7 @@ class VoidType extends DartType {
|
|||
}
|
||||
|
||||
@override
|
||||
R accept<R, A>(DartTypeVisitor visitor, A argument) =>
|
||||
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
|
||||
visitor.visitVoidType(this, argument);
|
||||
|
||||
int get hashCode => 6007;
|
||||
|
@ -237,7 +237,7 @@ class DynamicType extends DartType {
|
|||
}
|
||||
|
||||
@override
|
||||
R accept<R, A>(DartTypeVisitor visitor, A argument) =>
|
||||
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
|
||||
visitor.visitDynamicType(this, argument);
|
||||
|
||||
int get hashCode => 91;
|
||||
|
@ -309,7 +309,7 @@ class FunctionType extends DartType {
|
|||
}
|
||||
|
||||
@override
|
||||
R accept<R, A>(DartTypeVisitor visitor, A argument) =>
|
||||
R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
|
||||
visitor.visitFunctionType(this, argument);
|
||||
|
||||
int get hashCode {
|
||||
|
@ -410,53 +410,55 @@ List<DartType> _substTypes(
|
|||
abstract class DartTypeVisitor<R, A> {
|
||||
const DartTypeVisitor();
|
||||
|
||||
R visit(DartType type, A argument) => type.accept(this, argument);
|
||||
R visit(covariant DartType type, A argument) => type.accept(this, argument);
|
||||
|
||||
R visitVoidType(VoidType type, A argument) => null;
|
||||
R visitVoidType(covariant VoidType type, A argument) => null;
|
||||
|
||||
R visitTypeVariableType(TypeVariableType type, A argument) => null;
|
||||
R visitTypeVariableType(covariant TypeVariableType type, A argument) => null;
|
||||
|
||||
R visitFunctionType(FunctionType type, A argument) => null;
|
||||
R visitFunctionType(covariant FunctionType type, A argument) => null;
|
||||
|
||||
R visitInterfaceType(InterfaceType type, A argument) => null;
|
||||
R visitInterfaceType(covariant InterfaceType type, A argument) => null;
|
||||
|
||||
R visitDynamicType(DynamicType type, A argument) => null;
|
||||
R visitDynamicType(covariant DynamicType type, A argument) => null;
|
||||
}
|
||||
|
||||
abstract class BaseDartTypeVisitor<R, A> extends DartTypeVisitor<R, A> {
|
||||
const BaseDartTypeVisitor();
|
||||
|
||||
R visitType(DartType type, A argument);
|
||||
R visitType(covariant DartType type, A argument);
|
||||
|
||||
@override
|
||||
R visitVoidType(VoidType type, A argument) => visitType(type, argument);
|
||||
|
||||
@override
|
||||
R visitTypeVariableType(TypeVariableType type, A argument) =>
|
||||
R visitVoidType(covariant VoidType type, A argument) =>
|
||||
visitType(type, argument);
|
||||
|
||||
@override
|
||||
R visitFunctionType(FunctionType type, A argument) =>
|
||||
R visitTypeVariableType(covariant TypeVariableType type, A argument) =>
|
||||
visitType(type, argument);
|
||||
|
||||
@override
|
||||
R visitInterfaceType(InterfaceType type, A argument) =>
|
||||
R visitFunctionType(covariant FunctionType type, A argument) =>
|
||||
visitType(type, argument);
|
||||
|
||||
@override
|
||||
R visitDynamicType(DynamicType type, A argument) => visitType(type, argument);
|
||||
R visitInterfaceType(covariant InterfaceType type, A argument) =>
|
||||
visitType(type, argument);
|
||||
|
||||
@override
|
||||
R visitDynamicType(covariant DynamicType type, A argument) =>
|
||||
visitType(type, argument);
|
||||
}
|
||||
|
||||
/// Abstract visitor for determining relations between types.
|
||||
abstract class AbstractTypeRelation
|
||||
extends BaseDartTypeVisitor<bool, DartType> {
|
||||
abstract class AbstractTypeRelation<T extends DartType>
|
||||
extends BaseDartTypeVisitor<bool, T> {
|
||||
CommonElements get commonElements;
|
||||
|
||||
/// Ensures that the super hierarchy of [type] is computed.
|
||||
void ensureResolved(InterfaceType type) {}
|
||||
|
||||
/// Returns the unaliased version of [type].
|
||||
DartType getUnaliased(DartType type) => type.unaliased;
|
||||
T getUnaliased(T type) => type.unaliased;
|
||||
|
||||
/// Returns [type] as an instance of [cls], or `null` if [type] is not subtype
|
||||
/// if [cls].
|
||||
|
@ -469,31 +471,31 @@ abstract class AbstractTypeRelation
|
|||
/// Returns the declared bound of [element].
|
||||
DartType getTypeVariableBound(TypeVariableEntity element);
|
||||
|
||||
bool visitType(DartType t, DartType s) {
|
||||
bool visitType(T t, T s) {
|
||||
throw 'internal error: unknown type ${t}';
|
||||
}
|
||||
|
||||
bool visitVoidType(VoidType t, DartType s) {
|
||||
bool visitVoidType(VoidType t, T s) {
|
||||
assert(s is! VoidType);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool invalidTypeArguments(DartType t, DartType s);
|
||||
bool invalidTypeArguments(T t, T s);
|
||||
|
||||
bool invalidFunctionReturnTypes(DartType t, DartType s);
|
||||
bool invalidFunctionReturnTypes(T t, T s);
|
||||
|
||||
bool invalidFunctionParameterTypes(DartType t, DartType s);
|
||||
bool invalidFunctionParameterTypes(T t, T s);
|
||||
|
||||
bool invalidTypeVariableBounds(DartType bound, DartType s);
|
||||
bool invalidTypeVariableBounds(T bound, T s);
|
||||
|
||||
bool invalidCallableType(DartType callType, DartType s);
|
||||
bool invalidCallableType(covariant DartType callType, covariant DartType s);
|
||||
|
||||
bool visitInterfaceType(InterfaceType t, DartType s) {
|
||||
bool visitInterfaceType(InterfaceType t, covariant DartType s) {
|
||||
ensureResolved(t);
|
||||
|
||||
bool checkTypeArguments(InterfaceType instance, InterfaceType other) {
|
||||
List<DartType> tTypeArgs = instance.typeArguments;
|
||||
List<DartType> sTypeArgs = other.typeArguments;
|
||||
List<T> tTypeArgs = instance.typeArguments;
|
||||
List<T> sTypeArgs = other.typeArguments;
|
||||
assert(tTypeArgs.length == sTypeArgs.length);
|
||||
for (int i = 0; i < tTypeArgs.length; i++) {
|
||||
if (invalidTypeArguments(tTypeArgs[i], sTypeArgs[i])) {
|
||||
|
@ -539,8 +541,8 @@ abstract class AbstractTypeRelation
|
|||
// x.o : optionalParameterTypes on [:x:], and
|
||||
// len(xs) : length of list [:xs:].
|
||||
|
||||
Iterator<DartType> tps = tf.parameterTypes.iterator;
|
||||
Iterator<DartType> sps = sf.parameterTypes.iterator;
|
||||
Iterator<T> tps = tf.parameterTypes.iterator;
|
||||
Iterator<T> sps = sf.parameterTypes.iterator;
|
||||
bool sNotEmpty = sps.moveNext();
|
||||
bool tNotEmpty = tps.moveNext();
|
||||
tNext() => (tNotEmpty = tps.moveNext());
|
||||
|
@ -571,9 +573,9 @@ abstract class AbstractTypeRelation
|
|||
// subset relation with a linear search for [:sf.namedParameters:]
|
||||
// within [:tf.namedParameters:].
|
||||
List<String> tNames = tf.namedParameters;
|
||||
List<DartType> tTypes = tf.namedParameterTypes;
|
||||
List<T> tTypes = tf.namedParameterTypes;
|
||||
List<String> sNames = sf.namedParameters;
|
||||
List<DartType> sTypes = sf.namedParameterTypes;
|
||||
List<T> sTypes = sf.namedParameterTypes;
|
||||
int tIndex = 0;
|
||||
int sIndex = 0;
|
||||
while (tIndex < tNames.length && sIndex < sNames.length) {
|
||||
|
@ -618,7 +620,7 @@ abstract class AbstractTypeRelation
|
|||
return true;
|
||||
}
|
||||
|
||||
bool visitTypeVariableType(TypeVariableType t, DartType s) {
|
||||
bool visitTypeVariableType(TypeVariableType t, T s) {
|
||||
// Identity check is handled in [isSubtype].
|
||||
DartType bound = getTypeVariableBound(t.element);
|
||||
if (bound.isTypeVariable) {
|
||||
|
@ -646,8 +648,9 @@ abstract class AbstractTypeRelation
|
|||
}
|
||||
}
|
||||
|
||||
abstract class MoreSpecificVisitor extends AbstractTypeRelation {
|
||||
bool isMoreSpecific(DartType t, DartType s) {
|
||||
abstract class MoreSpecificVisitor<T extends DartType>
|
||||
extends AbstractTypeRelation<T> {
|
||||
bool isMoreSpecific(T t, T s) {
|
||||
if (identical(t, s) || s.treatAsDynamic || t == commonElements.nullType) {
|
||||
return true;
|
||||
}
|
||||
|
@ -666,55 +669,56 @@ abstract class MoreSpecificVisitor extends AbstractTypeRelation {
|
|||
return t.accept(this, s);
|
||||
}
|
||||
|
||||
bool invalidTypeArguments(DartType t, DartType s) {
|
||||
bool invalidTypeArguments(T t, T s) {
|
||||
return !isMoreSpecific(t, s);
|
||||
}
|
||||
|
||||
bool invalidFunctionReturnTypes(DartType t, DartType s) {
|
||||
bool invalidFunctionReturnTypes(T t, T s) {
|
||||
if (s.treatAsDynamic && t.isVoid) return true;
|
||||
return !s.isVoid && !isMoreSpecific(t, s);
|
||||
}
|
||||
|
||||
bool invalidFunctionParameterTypes(DartType t, DartType s) {
|
||||
bool invalidFunctionParameterTypes(T t, T s) {
|
||||
return !isMoreSpecific(t, s);
|
||||
}
|
||||
|
||||
bool invalidTypeVariableBounds(DartType bound, DartType s) {
|
||||
bool invalidTypeVariableBounds(T bound, T s) {
|
||||
return !isMoreSpecific(bound, s);
|
||||
}
|
||||
|
||||
bool invalidCallableType(DartType callType, DartType s) {
|
||||
bool invalidCallableType(covariant DartType callType, covariant DartType s) {
|
||||
return !isMoreSpecific(callType, s);
|
||||
}
|
||||
}
|
||||
|
||||
/// Type visitor that determines the subtype relation two types.
|
||||
abstract class SubtypeVisitor extends MoreSpecificVisitor {
|
||||
bool isSubtype(DartType t, DartType s) {
|
||||
abstract class SubtypeVisitor<T extends DartType>
|
||||
extends MoreSpecificVisitor<T> {
|
||||
bool isSubtype(T t, T s) {
|
||||
return t.treatAsDynamic || isMoreSpecific(t, s);
|
||||
}
|
||||
|
||||
bool isAssignable(DartType t, DartType s) {
|
||||
bool isAssignable(T t, T s) {
|
||||
return isSubtype(t, s) || isSubtype(s, t);
|
||||
}
|
||||
|
||||
bool invalidTypeArguments(DartType t, DartType s) {
|
||||
bool invalidTypeArguments(T t, T s) {
|
||||
return !isSubtype(t, s);
|
||||
}
|
||||
|
||||
bool invalidFunctionReturnTypes(DartType t, DartType s) {
|
||||
bool invalidFunctionReturnTypes(T t, T s) {
|
||||
return !s.isVoid && !isAssignable(t, s);
|
||||
}
|
||||
|
||||
bool invalidFunctionParameterTypes(DartType t, DartType s) {
|
||||
bool invalidFunctionParameterTypes(T t, T s) {
|
||||
return !isAssignable(t, s);
|
||||
}
|
||||
|
||||
bool invalidTypeVariableBounds(DartType bound, DartType s) {
|
||||
bool invalidTypeVariableBounds(T bound, T s) {
|
||||
return !isSubtype(bound, s);
|
||||
}
|
||||
|
||||
bool invalidCallableType(DartType callType, DartType s) {
|
||||
bool invalidCallableType(covariant DartType callType, covariant DartType s) {
|
||||
return !isSubtype(callType, s);
|
||||
}
|
||||
}
|
||||
|
@ -722,8 +726,9 @@ abstract class SubtypeVisitor extends MoreSpecificVisitor {
|
|||
/// Type visitor that determines one type could a subtype of another given the
|
||||
/// right type variable substitution. The computation is approximate and returns
|
||||
/// `false` only if we are sure no such substitution exists.
|
||||
abstract class PotentialSubtypeVisitor extends SubtypeVisitor {
|
||||
bool isSubtype(DartType t, DartType s) {
|
||||
abstract class PotentialSubtypeVisitor<T extends DartType>
|
||||
extends SubtypeVisitor<T> {
|
||||
bool isSubtype(T t, T s) {
|
||||
if (t is TypeVariableType || s is TypeVariableType) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -11,196 +11,231 @@ import 'elements.dart';
|
|||
abstract class ElementVisitor<R, A> {
|
||||
const ElementVisitor();
|
||||
|
||||
R visit(Element e, A arg) => e.accept(this, arg);
|
||||
R visit(covariant Element e, covariant A arg) => e.accept(this, arg);
|
||||
|
||||
R visitErroneousElement(ErroneousElement e, A arg) => null;
|
||||
R visitWarnOnUseElement(WarnOnUseElement e, A arg) => null;
|
||||
R visitAmbiguousElement(AmbiguousElement e, A arg) => null;
|
||||
R visitCompilationUnitElement(CompilationUnitElement e, A arg) => null;
|
||||
R visitLibraryElement(LibraryElement e, A arg) => null;
|
||||
R visitImportElement(ImportElement e, A arg) => null;
|
||||
R visitExportElement(ExportElement e, A arg) => null;
|
||||
R visitPrefixElement(PrefixElement e, A arg) => null;
|
||||
R visitTypedefElement(TypedefElement e, A arg) => null;
|
||||
R visitLocalVariableElement(LocalVariableElement e, A arg) => null;
|
||||
R visitParameterElement(ParameterElement e, A arg) => null;
|
||||
R visitFormalElement(FormalElement e, A arg) => null;
|
||||
R visitFieldElement(FieldElement e, A arg) => null;
|
||||
R visitFieldParameterElement(InitializingFormalElement e, A arg) => null;
|
||||
R visitAbstractFieldElement(AbstractFieldElement e, A arg) => null;
|
||||
R visitMethodElement(FunctionElement e, A arg) => null;
|
||||
R visitGetterElement(GetterElement e, A arg) => null;
|
||||
R visitSetterElement(SetterElement e, A arg) => null;
|
||||
R visitLocalFunctionElement(LocalFunctionElement e, A arg) => null;
|
||||
R visitConstructorElement(ConstructorElement e, A arg) => null;
|
||||
R visitConstructorBodyElement(ConstructorBodyElement e, A arg) => null;
|
||||
R visitClassElement(ClassElement e, A arg) => null;
|
||||
R visitMixinApplicationElement(MixinApplicationElement e, A arg) => null;
|
||||
R visitEnumClassElement(EnumClassElement e, A arg) => null;
|
||||
R visitTypeVariableElement(TypeVariableElement e, A arg) => null;
|
||||
R visitBoxFieldElement(BoxFieldElement e, A arg) => null;
|
||||
R visitClosureClassElement(ClosureClassElement e, A arg) => null;
|
||||
R visitClosureFieldElement(ClosureFieldElement e, A arg) => null;
|
||||
R visitErroneousElement(covariant ErroneousElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitWarnOnUseElement(covariant WarnOnUseElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitAmbiguousElement(covariant AmbiguousElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitCompilationUnitElement(
|
||||
covariant CompilationUnitElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitLibraryElement(covariant LibraryElement e, covariant A arg) => null;
|
||||
R visitImportElement(covariant ImportElement e, covariant A arg) => null;
|
||||
R visitExportElement(covariant ExportElement e, covariant A arg) => null;
|
||||
R visitPrefixElement(covariant PrefixElement e, covariant A arg) => null;
|
||||
R visitTypedefElement(covariant TypedefElement e, covariant A arg) => null;
|
||||
R visitLocalVariableElement(
|
||||
covariant LocalVariableElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitParameterElement(covariant ParameterElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitFormalElement(covariant FormalElement e, covariant A arg) => null;
|
||||
R visitFieldElement(covariant FieldElement e, covariant A arg) => null;
|
||||
R visitFieldParameterElement(
|
||||
covariant InitializingFormalElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitAbstractFieldElement(
|
||||
covariant AbstractFieldElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitMethodElement(covariant MethodElement e, covariant A arg) => null;
|
||||
R visitGetterElement(covariant GetterElement e, covariant A arg) => null;
|
||||
R visitSetterElement(covariant SetterElement e, covariant A arg) => null;
|
||||
R visitLocalFunctionElement(
|
||||
covariant LocalFunctionElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitConstructorElement(covariant ConstructorElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitConstructorBodyElement(
|
||||
covariant ConstructorBodyElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitClassElement(covariant ClassElement e, covariant A arg) => null;
|
||||
R visitMixinApplicationElement(
|
||||
covariant MixinApplicationElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitEnumClassElement(covariant EnumClassElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitTypeVariableElement(
|
||||
covariant TypeVariableElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitBoxFieldElement(covariant BoxFieldElement e, covariant A arg) => null;
|
||||
R visitClosureClassElement(
|
||||
covariant ClosureClassElement e, covariant A arg) =>
|
||||
null;
|
||||
R visitClosureFieldElement(
|
||||
covariant ClosureFieldElement e, covariant A arg) =>
|
||||
null;
|
||||
}
|
||||
|
||||
abstract class BaseElementVisitor<R, A> extends ElementVisitor<R, A> {
|
||||
const BaseElementVisitor();
|
||||
|
||||
R visitElement(Element e, A arg);
|
||||
R visitElement(covariant Element e, covariant A arg);
|
||||
|
||||
@override
|
||||
R visitErroneousElement(ErroneousElement e, A arg) {
|
||||
R visitErroneousElement(covariant ErroneousElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitWarnOnUseElement(WarnOnUseElement e, A arg) {
|
||||
R visitWarnOnUseElement(covariant WarnOnUseElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitAmbiguousElement(AmbiguousElement e, A arg) {
|
||||
R visitAmbiguousElement(covariant AmbiguousElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
R visitScopeContainerElement(ScopeContainerElement e, A arg) {
|
||||
R visitScopeContainerElement(
|
||||
covariant ScopeContainerElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitCompilationUnitElement(CompilationUnitElement e, A arg) {
|
||||
R visitCompilationUnitElement(
|
||||
covariant CompilationUnitElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitLibraryElement(LibraryElement e, A arg) {
|
||||
R visitLibraryElement(covariant LibraryElement e, covariant A arg) {
|
||||
return visitScopeContainerElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitImportElement(ImportElement e, A arg) {
|
||||
R visitImportElement(covariant ImportElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitExportElement(ExportElement e, A arg) {
|
||||
R visitExportElement(covariant ExportElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitPrefixElement(PrefixElement e, A arg) {
|
||||
R visitPrefixElement(covariant PrefixElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitTypedefElement(TypedefElement e, A arg) {
|
||||
R visitTypedefElement(covariant TypedefElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
R visitVariableElement(VariableElement e, A arg) {
|
||||
R visitVariableElement(covariant VariableElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitLocalVariableElement(LocalVariableElement e, A arg) {
|
||||
R visitLocalVariableElement(
|
||||
covariant LocalVariableElement e, covariant A arg) {
|
||||
return visitVariableElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitParameterElement(ParameterElement e, A arg) {
|
||||
R visitParameterElement(covariant ParameterElement e, covariant A arg) {
|
||||
return visitVariableElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitFormalElement(FormalElement e, A arg) {
|
||||
R visitFormalElement(covariant FormalElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitFieldElement(FieldElement e, A arg) {
|
||||
R visitFieldElement(covariant FieldElement e, covariant A arg) {
|
||||
return visitVariableElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitFieldParameterElement(InitializingFormalElement e, A arg) {
|
||||
R visitFieldParameterElement(
|
||||
covariant InitializingFormalElement e, covariant A arg) {
|
||||
return visitParameterElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitAbstractFieldElement(AbstractFieldElement e, A arg) {
|
||||
R visitAbstractFieldElement(
|
||||
covariant AbstractFieldElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
R visitFunctionElement(FunctionElement e, A arg) {
|
||||
R visitFunctionElement(covariant FunctionElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitMethodElement(MethodElement e, A arg) {
|
||||
R visitMethodElement(covariant MethodElement e, covariant A arg) {
|
||||
return visitFunctionElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitGetterElement(GetterElement e, A arg) {
|
||||
R visitGetterElement(covariant GetterElement e, covariant A arg) {
|
||||
return visitFunctionElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitSetterElement(SetterElement e, A arg) {
|
||||
R visitSetterElement(covariant SetterElement e, covariant A arg) {
|
||||
return visitFunctionElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitLocalFunctionElement(LocalFunctionElement e, A arg) {
|
||||
R visitLocalFunctionElement(
|
||||
covariant LocalFunctionElement e, covariant A arg) {
|
||||
return visitFunctionElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitConstructorElement(ConstructorElement e, A arg) {
|
||||
R visitConstructorElement(covariant ConstructorElement e, covariant A arg) {
|
||||
return visitFunctionElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitConstructorBodyElement(ConstructorBodyElement e, A arg) {
|
||||
R visitConstructorBodyElement(
|
||||
covariant ConstructorBodyElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitClassElement(ClassElement e, A arg) {
|
||||
R visitClassElement(covariant ClassElement e, covariant A arg) {
|
||||
return visitScopeContainerElement(e, arg);
|
||||
}
|
||||
|
||||
R visitTypeDeclarationElement(TypeDeclarationElement e, A arg) {
|
||||
R visitTypeDeclarationElement(
|
||||
covariant TypeDeclarationElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitMixinApplicationElement(MixinApplicationElement e, A arg) {
|
||||
R visitMixinApplicationElement(
|
||||
covariant MixinApplicationElement e, covariant A arg) {
|
||||
return visitClassElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitEnumClassElement(EnumClassElement e, A arg) {
|
||||
R visitEnumClassElement(covariant EnumClassElement e, covariant A arg) {
|
||||
return visitClassElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitTypeVariableElement(TypeVariableElement e, A arg) {
|
||||
R visitTypeVariableElement(covariant TypeVariableElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitBoxFieldElement(BoxFieldElement e, A arg) {
|
||||
R visitBoxFieldElement(covariant BoxFieldElement e, covariant A arg) {
|
||||
return visitElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitClosureClassElement(ClosureClassElement e, A arg) {
|
||||
R visitClosureClassElement(covariant ClosureClassElement e, covariant A arg) {
|
||||
return visitClassElement(e, arg);
|
||||
}
|
||||
|
||||
@override
|
||||
R visitClosureFieldElement(ClosureFieldElement e, A arg) {
|
||||
R visitClosureFieldElement(covariant ClosureFieldElement e, covariant A arg) {
|
||||
return visitVariableElement(e, arg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -602,5 +602,5 @@ class DeferredAction {
|
|||
|
||||
/// Interface for creating work items for enqueued member entities.
|
||||
abstract class WorkItemBuilder {
|
||||
WorkItem createWorkItem(MemberEntity entity);
|
||||
WorkItem createWorkItem(covariant MemberEntity entity);
|
||||
}
|
||||
|
|
|
@ -24,10 +24,10 @@ class ExpensiveMap<K, V> implements Map<K, V> {
|
|||
Iterable<K> get keys => _maps[0].keys;
|
||||
Iterable<V> get values => _maps[0].values;
|
||||
|
||||
bool containsKey(K key) => _maps[0].containsKey(key);
|
||||
bool containsValue(V value) => _maps[0].containsValue(value);
|
||||
bool containsKey(Object key) => _maps[0].containsKey(key);
|
||||
bool containsValue(Object value) => _maps[0].containsValue(value);
|
||||
|
||||
V operator [](K key) => _maps[0][key];
|
||||
V operator [](Object key) => _maps[0][key];
|
||||
|
||||
void forEach(void action(K key, V value)) {
|
||||
_maps[0].forEach(action);
|
||||
|
|
|
@ -94,7 +94,7 @@ _reportHere(DiagnosticReporter reporter, Spannable node, String debugMessage) {
|
|||
}
|
||||
|
||||
/// Set of tracked objects used by [track] and [ifTracked].
|
||||
var _trackedObjects = new Set();
|
||||
var _trackedObjects = new Set<Object>();
|
||||
|
||||
/// Global default value for the `printTrace` option of [track] and [ifTracked].
|
||||
bool trackWithTrace = false;
|
||||
|
|
|
@ -57,10 +57,10 @@ class TrackMap<K, V> implements Map<K, V> {
|
|||
Iterable<K> get keys => _map.keys;
|
||||
Iterable<V> get values => _map.values;
|
||||
|
||||
bool containsKey(K key) => _map.containsKey(key);
|
||||
bool containsValue(V value) => _map.containsValue(value);
|
||||
bool containsKey(Object key) => _map.containsKey(key);
|
||||
bool containsValue(Object value) => _map.containsValue(value);
|
||||
|
||||
V operator [](K key) => _map[key];
|
||||
V operator [](Object key) => _map[key];
|
||||
String toString() => _map.toString();
|
||||
|
||||
void forEach(void action(K key, V value)) {
|
||||
|
|
|
@ -143,7 +143,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
ClosedWorld get closedWorld => inferrer.closedWorld;
|
||||
|
||||
@override
|
||||
SemanticSendVisitor get sendVisitor => this;
|
||||
SemanticSendVisitor<TypeInformation, dynamic> get sendVisitor => this;
|
||||
|
||||
@override
|
||||
TypeInformation apply(ast.Node node, _) => visit(node);
|
||||
|
@ -1515,7 +1515,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
|
||||
@override
|
||||
TypeInformation visitUnresolvedSuperCompoundIndexSet(
|
||||
ast.Send node,
|
||||
ast.SendSet node,
|
||||
Element element,
|
||||
ast.Node index,
|
||||
op.AssignmentOperator operator,
|
||||
|
@ -1638,7 +1638,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
TypeInformation visitSuperFieldSetterCompound(
|
||||
ast.Send node,
|
||||
FieldElement field,
|
||||
FunctionElement setter,
|
||||
SetterElement setter,
|
||||
op.AssignmentOperator operator,
|
||||
ast.Node rhs,
|
||||
_) {
|
||||
|
@ -1648,7 +1648,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
@override
|
||||
TypeInformation visitSuperGetterFieldCompound(
|
||||
ast.Send node,
|
||||
FunctionElement getter,
|
||||
GetterElement getter,
|
||||
FieldElement field,
|
||||
op.AssignmentOperator operator,
|
||||
ast.Node rhs,
|
||||
|
@ -1659,8 +1659,8 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
@override
|
||||
TypeInformation visitSuperGetterSetterCompound(
|
||||
ast.Send node,
|
||||
FunctionElement getter,
|
||||
FunctionElement setter,
|
||||
GetterElement getter,
|
||||
SetterElement setter,
|
||||
op.AssignmentOperator operator,
|
||||
ast.Node rhs,
|
||||
_) {
|
||||
|
@ -1671,7 +1671,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
TypeInformation visitSuperMethodSetterCompound(
|
||||
ast.Send node,
|
||||
FunctionElement method,
|
||||
FunctionElement setter,
|
||||
SetterElement setter,
|
||||
op.AssignmentOperator operator,
|
||||
ast.Node rhs,
|
||||
_) {
|
||||
|
@ -1686,7 +1686,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
|
||||
@override
|
||||
TypeInformation visitUnresolvedSuperGetterCompound(
|
||||
ast.Send node,
|
||||
ast.SendSet node,
|
||||
Element getter,
|
||||
SetterElement setter,
|
||||
op.AssignmentOperator operator,
|
||||
|
@ -1720,19 +1720,19 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
|
||||
@override
|
||||
TypeInformation visitSuperFieldSetterSetIfNull(ast.Send node,
|
||||
FieldElement field, FunctionElement setter, ast.Node rhs, _) {
|
||||
FieldElement field, SetterElement setter, ast.Node rhs, _) {
|
||||
return handleSuperCompound(node, field, setter, rhs);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperGetterFieldSetIfNull(ast.Send node,
|
||||
FunctionElement getter, FieldElement field, ast.Node rhs, _) {
|
||||
GetterElement getter, FieldElement field, ast.Node rhs, _) {
|
||||
return handleSuperCompound(node, getter, field, rhs);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperGetterSetterSetIfNull(ast.Send node,
|
||||
FunctionElement getter, FunctionElement setter, ast.Node rhs, _) {
|
||||
GetterElement getter, SetterElement setter, ast.Node rhs, _) {
|
||||
return handleSuperCompound(node, getter, setter, rhs);
|
||||
}
|
||||
|
||||
|
@ -1744,7 +1744,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
|
||||
@override
|
||||
TypeInformation visitSuperMethodSetterSetIfNull(ast.Send node,
|
||||
FunctionElement method, FunctionElement setter, ast.Node rhs, _) {
|
||||
FunctionElement method, SetterElement setter, ast.Node rhs, _) {
|
||||
return handleSuperCompound(node, method, setter, rhs);
|
||||
}
|
||||
|
||||
|
@ -1787,50 +1787,34 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperFieldSetterPostfix(
|
||||
ast.SendSet node,
|
||||
FieldElement field,
|
||||
FunctionElement setter,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
TypeInformation visitSuperFieldSetterPostfix(ast.SendSet node,
|
||||
FieldElement field, SetterElement setter, op.IncDecOperator operator, _) {
|
||||
return handleSuperPrefixPostfix(node, field, setter);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperFieldSetterPrefix(
|
||||
ast.SendSet node,
|
||||
FieldElement field,
|
||||
FunctionElement setter,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
TypeInformation visitSuperFieldSetterPrefix(ast.SendSet node,
|
||||
FieldElement field, SetterElement setter, op.IncDecOperator operator, _) {
|
||||
return handleSuperPrefixPostfix(node, field, setter);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperGetterFieldPostfix(
|
||||
ast.SendSet node,
|
||||
FunctionElement getter,
|
||||
FieldElement field,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
TypeInformation visitSuperGetterFieldPostfix(ast.SendSet node,
|
||||
GetterElement getter, FieldElement field, op.IncDecOperator operator, _) {
|
||||
return handleSuperPrefixPostfix(node, getter, field);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperGetterFieldPrefix(
|
||||
ast.SendSet node,
|
||||
FunctionElement getter,
|
||||
FieldElement field,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
TypeInformation visitSuperGetterFieldPrefix(ast.SendSet node,
|
||||
GetterElement getter, FieldElement field, op.IncDecOperator operator, _) {
|
||||
return handleSuperPrefixPostfix(node, getter, field);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperGetterSetterPostfix(
|
||||
ast.SendSet node,
|
||||
FunctionElement getter,
|
||||
FunctionElement setter,
|
||||
GetterElement getter,
|
||||
SetterElement setter,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
return handleSuperPrefixPostfix(node, getter, setter);
|
||||
|
@ -1839,8 +1823,8 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
@override
|
||||
TypeInformation visitSuperGetterSetterPrefix(
|
||||
ast.SendSet node,
|
||||
FunctionElement getter,
|
||||
FunctionElement setter,
|
||||
GetterElement getter,
|
||||
SetterElement setter,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
return handleSuperPrefixPostfix(node, getter, setter);
|
||||
|
@ -1850,7 +1834,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
TypeInformation visitSuperMethodSetterPostfix(
|
||||
ast.SendSet node,
|
||||
FunctionElement method,
|
||||
FunctionElement setter,
|
||||
SetterElement setter,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
return handleSuperPrefixPostfix(node, method, setter);
|
||||
|
@ -1860,7 +1844,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
TypeInformation visitSuperMethodSetterPrefix(
|
||||
ast.SendSet node,
|
||||
FunctionElement method,
|
||||
FunctionElement setter,
|
||||
SetterElement setter,
|
||||
op.IncDecOperator operator,
|
||||
_) {
|
||||
return handleSuperPrefixPostfix(node, method, setter);
|
||||
|
@ -1971,8 +1955,8 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitUnresolvedSuperIndexSet(
|
||||
ast.SendSet node, Element element, ast.Node index, ast.Node rhs, _) {
|
||||
TypeInformation visitUnresolvedSuperIndexSet(ast.SendSet node,
|
||||
ErroneousElement element, ast.Node index, ast.Node rhs, _) {
|
||||
return handleSuperIndexSet(node, element, index, rhs);
|
||||
}
|
||||
|
||||
|
@ -2118,7 +2102,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
|
||||
@override
|
||||
TypeInformation visitSuperSetterSet(
|
||||
ast.Send node, SetterElement field, ast.Node rhs, _) {
|
||||
ast.SendSet node, SetterElement field, ast.Node rhs, _) {
|
||||
return handleSuperSet(node, field, rhs);
|
||||
}
|
||||
|
||||
|
@ -2152,13 +2136,13 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
|
||||
@override
|
||||
TypeInformation visitSuperGetterSet(
|
||||
ast.Send node, MethodElement getter, ast.Node rhs, _) {
|
||||
ast.Send node, GetterElement getter, ast.Node rhs, _) {
|
||||
return handleErroneousSuperSend(node);
|
||||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperMethodSet(
|
||||
ast.Send node, MethodElement method, ast.Node rhs, _) {
|
||||
ast.SendSet node, MethodElement method, ast.Node rhs, _) {
|
||||
return handleErroneousSuperSend(node);
|
||||
}
|
||||
|
||||
|
@ -2202,7 +2186,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperGetterInvoke(ast.Send node, MethodElement getter,
|
||||
TypeInformation visitSuperGetterInvoke(ast.Send node, GetterElement getter,
|
||||
ast.NodeList arguments, CallStructure callStructure, _) {
|
||||
return handleSuperClosureCall(node, getter, arguments);
|
||||
}
|
||||
|
@ -2215,7 +2199,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitSuperSetterInvoke(ast.Send node, FunctionElement setter,
|
||||
TypeInformation visitSuperSetterInvoke(ast.Send node, SetterElement setter,
|
||||
ast.NodeList arguments, CallStructure callStructure, _) {
|
||||
return handleErroneousSuperSend(node);
|
||||
}
|
||||
|
@ -2460,7 +2444,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitStaticGetterInvoke(ast.Send node, FunctionElement getter,
|
||||
TypeInformation visitStaticGetterInvoke(ast.Send node, GetterElement getter,
|
||||
ast.NodeList arguments, CallStructure callStructure, _) {
|
||||
return handleStaticFieldOrGetterInvoke(node, getter);
|
||||
}
|
||||
|
@ -2492,12 +2476,8 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitTopLevelGetterInvoke(
|
||||
ast.Send node,
|
||||
FunctionElement getter,
|
||||
ast.NodeList arguments,
|
||||
CallStructure callStructure,
|
||||
_) {
|
||||
TypeInformation visitTopLevelGetterInvoke(ast.Send node, GetterElement getter,
|
||||
ast.NodeList arguments, CallStructure callStructure, _) {
|
||||
return handleStaticFieldOrGetterInvoke(node, getter);
|
||||
}
|
||||
|
||||
|
@ -2572,7 +2552,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
/// Invoke a static or top level getter.
|
||||
TypeInformation handleStaticGetterGet(ast.Send node, MethodElement getter) {
|
||||
TypeInformation handleStaticGetterGet(ast.Send node, GetterElement getter) {
|
||||
Selector selector = elements.getSelector(node);
|
||||
TypeMask mask = inTreeData.typeOfSend(node);
|
||||
return handleStaticSend(node, selector, mask, getter, null);
|
||||
|
@ -2628,8 +2608,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
}
|
||||
|
||||
@override
|
||||
TypeInformation visitStaticGetterGet(
|
||||
ast.Send node, FunctionElement getter, _) {
|
||||
TypeInformation visitStaticGetterGet(ast.Send node, GetterElement getter, _) {
|
||||
return handleStaticGetterGet(node, getter);
|
||||
}
|
||||
|
||||
|
@ -2651,7 +2630,7 @@ class ElementGraphBuilder extends ast.Visitor<TypeInformation>
|
|||
|
||||
@override
|
||||
TypeInformation visitTopLevelGetterGet(
|
||||
ast.Send node, FunctionElement getter, _) {
|
||||
ast.Send node, GetterElement getter, _) {
|
||||
return handleStaticGetterGet(node, getter);
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ class ArgumentsTypes extends IterableMixin<TypeInformation> {
|
|||
return positional.every(f) && named.values.every(f);
|
||||
}
|
||||
|
||||
bool contains(TypeInformation type) {
|
||||
bool contains(Object type) {
|
||||
return positional.contains(type) || named.containsValue(type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ library compiler.src.inferrer.node_tracer;
|
|||
import '../common/names.dart' show Identifiers;
|
||||
import '../compiler.dart' show Compiler;
|
||||
import '../elements/elements.dart';
|
||||
import '../elements/entities.dart';
|
||||
import '../types/types.dart' show ContainerTypeMask, MapTypeMask;
|
||||
import '../util/util.dart' show Setlet;
|
||||
import 'debug.dart' as debug;
|
||||
|
@ -390,10 +391,9 @@ abstract class TracerVisitor implements TypeInformationVisitor {
|
|||
bailout('Passed to noSuchMethod');
|
||||
}
|
||||
|
||||
Iterable<Element> inferredTargetTypes =
|
||||
info.targets.map((MemberElement element) {
|
||||
// Issue 29886.
|
||||
// ignore: RETURN_OF_INVALID_TYPE
|
||||
Iterable<TypeInformation> inferredTargetTypes =
|
||||
info.targets.map((MemberEntity entity) {
|
||||
MemberElement element = entity;
|
||||
return inferrer.types.getInferredTypeOf(element);
|
||||
});
|
||||
if (inferredTargetTypes.any((user) => user == currentUser)) {
|
||||
|
|
|
@ -310,7 +310,7 @@ class ParameterAssignments extends IterableBase<TypeInformation> {
|
|||
Iterator<TypeInformation> get iterator => assignments.keys.iterator;
|
||||
Iterable<TypeInformation> where(Function f) => assignments.keys.where(f);
|
||||
|
||||
bool contains(TypeInformation info) => assignments.containsKey(info);
|
||||
bool contains(Object info) => assignments.containsKey(info);
|
||||
|
||||
String toString() => assignments.keys.toList().toString();
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ class MemberTypeInformation extends ElementTypeInformation
|
|||
|
||||
void addCall(Element caller, Spannable node) {
|
||||
assert(node is ast.Node || node is Element);
|
||||
_callers ??= <Element, Setlet>{};
|
||||
_callers ??= <Element, Setlet<Spannable>>{};
|
||||
_callers.putIfAbsent(caller, () => new Setlet()).add(node);
|
||||
}
|
||||
|
||||
|
@ -837,8 +837,10 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
|
|||
}
|
||||
}
|
||||
|
||||
Iterable<Element> get callees =>
|
||||
targets.map((MemberElement e) => e.implementation);
|
||||
Iterable<Element> get callees => targets.map((_e) {
|
||||
MemberElement e = _e;
|
||||
return e.implementation;
|
||||
});
|
||||
|
||||
TypeMask computeTypedSelector(InferrerEngine inferrer) {
|
||||
TypeMask receiverType = receiver.type;
|
||||
|
@ -853,7 +855,8 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
|
|||
}
|
||||
|
||||
bool targetsIncludeComplexNoSuchMethod(InferrerEngine inferrer) {
|
||||
return targets.any((MemberElement e) {
|
||||
return targets.any((_e) {
|
||||
MemberElement e = _e;
|
||||
return e is MethodElement &&
|
||||
e.isInstanceMember &&
|
||||
e.name == Identifiers.noSuchMethod_ &&
|
||||
|
@ -1022,8 +1025,8 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
|
|||
|
||||
// Walk over the found targets, and compute the joined union type mask
|
||||
// for all these targets.
|
||||
TypeMask result =
|
||||
inferrer.types.joinTypeMasks(targets.map((MemberElement element) {
|
||||
TypeMask result = inferrer.types.joinTypeMasks(targets.map((_element) {
|
||||
MemberElement element = _element;
|
||||
// If [canReachAll] is true, then we are iterating over all
|
||||
// targets that satisfy the untyped selector. We skip the return
|
||||
// type of the targets that can only be reached through
|
||||
|
@ -1118,8 +1121,10 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
|
|||
|
||||
bool hasStableType(InferrerEngine inferrer) {
|
||||
return receiver.isStable &&
|
||||
targets.every((MemberElement element) =>
|
||||
inferrer.types.getInferredTypeOf(element).isStable) &&
|
||||
targets.every((_element) {
|
||||
MemberElement element = _element;
|
||||
return inferrer.types.getInferredTypeOf(element).isStable;
|
||||
}) &&
|
||||
(arguments == null || arguments.every((info) => info.isStable)) &&
|
||||
super.hasStableType(inferrer);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,8 @@ class SourceInformationStrategy {
|
|||
const SourceInformationStrategy();
|
||||
|
||||
/// Create a [SourceInformationBuilder] for [member].
|
||||
SourceInformationBuilder createBuilderForContext(MemberEntity member) {
|
||||
SourceInformationBuilder createBuilderForContext(
|
||||
covariant MemberEntity member) {
|
||||
return const SourceInformationBuilder();
|
||||
}
|
||||
|
||||
|
@ -63,10 +64,10 @@ class SourceInformationBuilder {
|
|||
const SourceInformationBuilder();
|
||||
|
||||
/// Create a [SourceInformationBuilder] for [member].
|
||||
SourceInformationBuilder forContext(MemberEntity member) => this;
|
||||
SourceInformationBuilder forContext(covariant MemberEntity member) => this;
|
||||
|
||||
/// Generate [SourceInformation] the declaration of the [member].
|
||||
SourceInformation buildDeclaration(MemberEntity member) => null;
|
||||
SourceInformation buildDeclaration(covariant MemberEntity member) => null;
|
||||
|
||||
/// Generate [SourceInformation] for the generic [node].
|
||||
@deprecated
|
||||
|
|
|
@ -2036,7 +2036,7 @@ class AsyncStarRewriter extends AsyncRewriterBase {
|
|||
List<int> enclosingFinallyLabels = <int>[exitLabel];
|
||||
enclosingFinallyLabels.addAll(jumpTargets
|
||||
.where((js.Node node) => finallyLabels[node] != null)
|
||||
.map((js.Block node) => finallyLabels[node]));
|
||||
.map((js.Node node) => finallyLabels[node]));
|
||||
addStatement(js.js.statement("# = #;", [
|
||||
nextWhenCanceled,
|
||||
new js.ArrayInitializer(enclosingFinallyLabels.map(js.number).toList())
|
||||
|
|
|
@ -107,7 +107,7 @@ class JavaScriptBackendSerializer implements SerializerPlugin {
|
|||
}
|
||||
|
||||
@override
|
||||
void onData(NativeBehavior behavior, ObjectEncoder encoder) {
|
||||
void onData(covariant NativeBehavior behavior, ObjectEncoder encoder) {
|
||||
NativeBehaviorSerialization.serializeNativeBehavior(behavior, encoder);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import '../common.dart';
|
|||
import '../common_elements.dart';
|
||||
import '../constants/values.dart';
|
||||
import '../elements/elements.dart';
|
||||
import '../elements/types.dart' show TypeVariableType;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/resolution_types.dart';
|
||||
import '../io/code_output.dart';
|
||||
|
@ -344,7 +345,8 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
|
|||
}
|
||||
|
||||
jsAst.Expression _reifiedTypeArguments(ResolutionInterfaceType type) {
|
||||
jsAst.Expression unexpected(ResolutionTypeVariableType variable) {
|
||||
jsAst.Expression unexpected(TypeVariableType _variable) {
|
||||
ResolutionTypeVariableType variable = _variable;
|
||||
throw new SpannableAssertionFailure(
|
||||
NO_LOCATION_SPANNABLE,
|
||||
"Unexpected type variable '${variable.getStringAsDeclared(null)}'"
|
||||
|
|
|
@ -99,7 +99,7 @@ class JavaScriptConstantTask extends ConstantCompilerTask {
|
|||
// TODO(johnniwinther): Remove this when values are computed from the
|
||||
// expressions.
|
||||
@override
|
||||
void copyConstantValues(JavaScriptConstantTask task) {
|
||||
void copyConstantValues(covariant JavaScriptConstantTask task) {
|
||||
jsConstantCompiler.constantValueMap
|
||||
.addAll(task.jsConstantCompiler.constantValueMap);
|
||||
dartConstantCompiler.constantValueMap
|
||||
|
|
|
@ -393,7 +393,7 @@ class JavaScriptConstantSystem extends ConstantSystem {
|
|||
ConstantValue argument = createString(text);
|
||||
// TODO(johnniwinther): Use type arguments when all uses no longer expect
|
||||
// a [FieldElement].
|
||||
Map<FieldEntity, ConstantValue> fields = <dynamic, ConstantValue>{
|
||||
Map<dynamic, ConstantValue> fields = <dynamic, ConstantValue>{
|
||||
field: argument
|
||||
};
|
||||
return new ConstructedConstantValue(type, fields);
|
||||
|
|
|
@ -38,7 +38,8 @@ class ElementBackendStrategy implements BackendStrategy {
|
|||
|
||||
ElementBackendStrategy(this._compiler);
|
||||
|
||||
ClosedWorldRefiner createClosedWorldRefiner(ClosedWorldImpl closedWorld) =>
|
||||
ClosedWorldRefiner createClosedWorldRefiner(
|
||||
covariant ClosedWorldImpl closedWorld) =>
|
||||
closedWorld;
|
||||
|
||||
Sorter get sorter => const ElementSorter();
|
||||
|
|
|
@ -97,7 +97,7 @@ class _FieldNamingRegistry {
|
|||
class _FieldNamingScope {
|
||||
final _FieldNamingScope superScope;
|
||||
final Entity container;
|
||||
final Map<Element, jsAst.Name> names = new Maplet<Element, jsAst.Name>();
|
||||
final Map<Entity, jsAst.Name> names = new Maplet<Entity, jsAst.Name>();
|
||||
final _FieldNamingRegistry registry;
|
||||
|
||||
/// Naming counter used for fields of ordinary classes.
|
||||
|
|
|
@ -67,7 +67,7 @@ class FrequencyBasedNamer extends Namer
|
|||
}
|
||||
|
||||
@override
|
||||
jsAst.Name instanceFieldPropertyName(FieldElement element) {
|
||||
jsAst.Name instanceFieldPropertyName(FieldEntity element) {
|
||||
jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element);
|
||||
if (proposed != null) {
|
||||
return proposed;
|
||||
|
|
|
@ -307,10 +307,9 @@ class _LookupMapAnalysis implements LookupMapAnalysis {
|
|||
key.isPrimitive || _inUse.contains(key) || _overridesEquals(key);
|
||||
|
||||
void _addClassUse(ClassEntity cls) {
|
||||
ConstantValue key = _typeConstants.putIfAbsent(
|
||||
cls,
|
||||
() => _constantSystem.createType(
|
||||
_commonElements, _elementEnvironment.getRawType(cls)));
|
||||
TypeConstantValue f() => _constantSystem.createType(
|
||||
_commonElements, _elementEnvironment.getRawType(cls));
|
||||
ConstantValue key = _typeConstants.putIfAbsent(cls, f);
|
||||
_addUse(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ class MinifyNamer extends Namer
|
|||
}
|
||||
|
||||
@override
|
||||
jsAst.Name instanceFieldPropertyName(FieldElement element) {
|
||||
jsAst.Name instanceFieldPropertyName(FieldEntity element) {
|
||||
jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element);
|
||||
if (proposed != null) {
|
||||
return proposed;
|
||||
|
|
|
@ -193,7 +193,7 @@ class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis {
|
|||
}
|
||||
}
|
||||
|
||||
entities.forEach((MemberElement member) => processElementMetadata(member));
|
||||
entities.forEach((member) => processElementMetadata(member));
|
||||
}
|
||||
|
||||
void onResolutionComplete() {
|
||||
|
|
|
@ -78,7 +78,7 @@ abstract class MirrorsData {
|
|||
/// reflection is used in the program (and thus [isTreeShakingDisabled] is
|
||||
/// still false). Therefore _do not_ use this predicate to decide inclusion
|
||||
/// in the tree, use [requiredByMirrorSystem] instead.
|
||||
bool isClassReferencedFromMirrorSystem(ClassEntity element);
|
||||
bool isClassReferencedFromMirrorSystem(covariant ClassEntity element);
|
||||
|
||||
/// Returns `true` if the member [element] is covered by a `MirrorsUsed`
|
||||
/// annotation.
|
||||
|
@ -87,11 +87,11 @@ abstract class MirrorsData {
|
|||
/// reflection is used in the program (and thus [isTreeShakingDisabled] is
|
||||
/// still false). Therefore _do not_ use this predicate to decide inclusion
|
||||
/// in the tree, use [requiredByMirrorSystem] instead.
|
||||
bool isMemberReferencedFromMirrorSystem(MemberEntity element);
|
||||
bool isMemberReferencedFromMirrorSystem(covariant MemberEntity element);
|
||||
|
||||
/// Returns `true` if the library [element] is covered by a `MirrorsUsed`
|
||||
/// annotation.
|
||||
bool isLibraryReferencedFromMirrorSystem(LibraryEntity element);
|
||||
bool isLibraryReferencedFromMirrorSystem(covariant LibraryEntity element);
|
||||
|
||||
/// Returns `true` if the typedef [element] needs reflection information at
|
||||
/// runtime.
|
||||
|
@ -124,11 +124,11 @@ abstract class MirrorsData {
|
|||
@deprecated
|
||||
bool isAccessibleByReflection(Element element);
|
||||
|
||||
bool retainMetadataOfLibrary(LibraryEntity element,
|
||||
bool retainMetadataOfLibrary(covariant LibraryEntity element,
|
||||
{bool addForEmission: true});
|
||||
bool retainMetadataOfTypedef(TypedefElement element);
|
||||
bool retainMetadataOfClass(ClassEntity element);
|
||||
bool retainMetadataOfMember(MemberEntity element);
|
||||
bool retainMetadataOfClass(covariant ClassEntity element);
|
||||
bool retainMetadataOfMember(covariant MemberEntity element);
|
||||
bool retainMetadataOfParameter(ParameterElement element);
|
||||
|
||||
bool invokedReflectively(Element element);
|
||||
|
@ -153,8 +153,8 @@ abstract class MirrorsDataBuilder {
|
|||
|
||||
void maybeMarkClosureAsNeededForReflection(
|
||||
ClosureClassElement globalizedElement,
|
||||
FunctionElement callFunction,
|
||||
FunctionElement function);
|
||||
MethodElement callFunction,
|
||||
LocalFunctionElement function);
|
||||
|
||||
void computeMembersNeededForReflection(
|
||||
ResolutionWorldBuilder worldBuilder, ClosedWorld closedWorld);
|
||||
|
|
|
@ -1893,7 +1893,7 @@ class ConstantNamingVisitor implements ConstantValueVisitor {
|
|||
}
|
||||
|
||||
@override
|
||||
void visitMap(JavaScriptMapConstant constant, [_]) {
|
||||
void visitMap(covariant JavaScriptMapConstant constant, [_]) {
|
||||
// TODO(9476): Incorporate type parameters into name.
|
||||
addRoot('Map');
|
||||
if (constant.length == 0) {
|
||||
|
@ -2187,15 +2187,15 @@ class FunctionTypeNamer extends BaseResolutionDartTypeVisitor {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
visit(ResolutionDartType type, [_]) {
|
||||
visit(covariant ResolutionDartType type, [_]) {
|
||||
type.accept(this, null);
|
||||
}
|
||||
|
||||
visitType(ResolutionDartType type, _) {
|
||||
visitType(covariant ResolutionDartType type, _) {
|
||||
sb.write(type.name);
|
||||
}
|
||||
|
||||
visitFunctionType(ResolutionFunctionType type, _) {
|
||||
visitFunctionType(covariant ResolutionFunctionType type, _) {
|
||||
if (rtiEncoder.isSimpleFunctionType(type)) {
|
||||
sb.write('args${type.parameterTypes.length}');
|
||||
return;
|
||||
|
|
|
@ -34,7 +34,7 @@ class StringBackedName extends _NamerName {
|
|||
|
||||
int get hashCode => name.hashCode;
|
||||
|
||||
int compareTo(_NamerName other) {
|
||||
int compareTo(covariant _NamerName other) {
|
||||
other = other._target;
|
||||
if (other._kind != _kind) return other._kind - _kind;
|
||||
return name.compareTo(other.name);
|
||||
|
@ -63,7 +63,7 @@ abstract class _PrefixedName extends _NamerName implements jsAst.AstContainer {
|
|||
|
||||
int get hashCode => base.hashCode * 13 + prefix.hashCode;
|
||||
|
||||
int compareTo(_NamerName other) {
|
||||
int compareTo(covariant _NamerName other) {
|
||||
other = other._target;
|
||||
if (other._kind != _kind) return other._kind - _kind;
|
||||
_PrefixedName otherSameKind = other;
|
||||
|
@ -139,7 +139,7 @@ class CompoundName extends _NamerName implements jsAst.AstContainer {
|
|||
return _cachedHashCode;
|
||||
}
|
||||
|
||||
int compareTo(_NamerName other) {
|
||||
int compareTo(covariant _NamerName other) {
|
||||
other = other._target;
|
||||
if (other._kind != _kind) return other._kind - _kind;
|
||||
CompoundName otherSameKind = other;
|
||||
|
@ -171,7 +171,7 @@ class TokenName extends _NamerName implements jsAst.ReferenceCountedAstNode {
|
|||
}
|
||||
|
||||
@override
|
||||
int compareTo(_NamerName other) {
|
||||
int compareTo(covariant _NamerName other) {
|
||||
other = other._target;
|
||||
if (other._kind != _kind) return other._kind - _kind;
|
||||
TokenName otherToken = other;
|
||||
|
@ -212,7 +212,7 @@ class _NameReference extends _NamerName implements jsAst.AstContainer {
|
|||
String get name => _target.name;
|
||||
|
||||
@override
|
||||
int compareTo(_NamerName other) => _target.compareTo(other);
|
||||
int compareTo(covariant _NamerName other) => _target.compareTo(other);
|
||||
|
||||
@override
|
||||
bool operator ==(other) => _target == other;
|
||||
|
|
|
@ -195,14 +195,14 @@ abstract class NoSuchMethodResolver {
|
|||
///
|
||||
/// noSuchMethod(i) => super.noSuchMethod(i);
|
||||
///
|
||||
bool hasForwardingSyntax(FunctionEntity method);
|
||||
bool hasForwardingSyntax(covariant FunctionEntity method);
|
||||
|
||||
/// Computes whether [method] is of the form
|
||||
///
|
||||
/// noSuchMethod(i) => throw new Error();
|
||||
///
|
||||
bool hasThrowingSyntax(FunctionEntity method);
|
||||
bool hasThrowingSyntax(covariant FunctionEntity method);
|
||||
|
||||
/// Returns the `noSuchMethod` that [method] overrides.
|
||||
FunctionEntity getSuperNoSuchMethod(FunctionEntity method);
|
||||
FunctionEntity getSuperNoSuchMethod(covariant FunctionEntity method);
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ class _RuntimeTypesNeed implements RuntimeTypesNeed {
|
|||
this.localFunctionsNeedingRti,
|
||||
this.classesUsingTypeVariableExpression);
|
||||
|
||||
bool checkClass(ClassEntity cls) => true;
|
||||
bool checkClass(covariant ClassEntity cls) => true;
|
||||
|
||||
bool classNeedsRti(ClassEntity cls) {
|
||||
assert(checkClass(cls));
|
||||
|
@ -300,7 +300,7 @@ class RuntimeTypesNeedBuilderImpl extends _RuntimeTypesBase
|
|||
RuntimeTypesNeedBuilderImpl(this._elementEnvironment, DartTypes types)
|
||||
: super(types);
|
||||
|
||||
bool checkClass(ClassEntity cls) => true;
|
||||
bool checkClass(covariant ClassEntity cls) => true;
|
||||
|
||||
@override
|
||||
void registerClassUsingTypeVariableExpression(ClassEntity cls) {
|
||||
|
@ -845,7 +845,8 @@ class RuntimeTypesEncoderImpl implements RuntimeTypesEncoder {
|
|||
parameters = _elementEnvironment
|
||||
.getThisType(contextClass)
|
||||
.typeArguments
|
||||
.map((TypeVariableType type) {
|
||||
.map((DartType _type) {
|
||||
TypeVariableType type = _type;
|
||||
return type.element.name;
|
||||
}).toList();
|
||||
}
|
||||
|
@ -951,7 +952,8 @@ class RuntimeTypesEncoderImpl implements RuntimeTypesEncoder {
|
|||
}
|
||||
}
|
||||
|
||||
class TypeRepresentationGenerator implements ResolutionDartTypeVisitor {
|
||||
class TypeRepresentationGenerator
|
||||
implements ResolutionDartTypeVisitor<dynamic, Emitter> {
|
||||
final Namer namer;
|
||||
OnVariableCallback onVariable;
|
||||
ShouldEncodeTypedefCallback shouldEncodeTypedef;
|
||||
|
@ -1179,7 +1181,7 @@ class TypeCheckMapping implements TypeChecks {
|
|||
}
|
||||
}
|
||||
|
||||
class ArgumentCollector extends ResolutionDartTypeVisitor {
|
||||
class ArgumentCollector extends ResolutionDartTypeVisitor<dynamic, bool> {
|
||||
final Set<ClassEntity> classes = new Set<ClassEntity>();
|
||||
|
||||
collect(DartType type, {bool isTypeArgument: false}) {
|
||||
|
@ -1211,7 +1213,8 @@ class ArgumentCollector extends ResolutionDartTypeVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
class FunctionArgumentCollector extends ResolutionDartTypeVisitor {
|
||||
class FunctionArgumentCollector
|
||||
extends ResolutionDartTypeVisitor<dynamic, bool> {
|
||||
final Set<ClassEntity> classes = new Set<ClassEntity>();
|
||||
|
||||
FunctionArgumentCollector();
|
||||
|
|
|
@ -243,10 +243,10 @@ abstract class Emitter {
|
|||
|
||||
/// Returns the JS function that must be invoked to get the value of the
|
||||
/// lazily initialized static.
|
||||
jsAst.Expression isolateLazyInitializerAccess(FieldEntity element);
|
||||
jsAst.Expression isolateLazyInitializerAccess(covariant FieldEntity element);
|
||||
|
||||
/// Returns the closure expression of a static function.
|
||||
jsAst.Expression isolateStaticClosureAccess(FunctionEntity element);
|
||||
jsAst.Expression isolateStaticClosureAccess(covariant FunctionEntity element);
|
||||
|
||||
/// Returns the JS code for accessing the embedded [global].
|
||||
jsAst.Expression generateEmbeddedGlobalAccess(String global);
|
||||
|
@ -264,7 +264,8 @@ abstract class Emitter {
|
|||
jsAst.Expression constructorAccess(ClassEntity e);
|
||||
|
||||
/// Returns the JS prototype of the given class [e].
|
||||
jsAst.Expression prototypeAccess(ClassEntity e, bool hasBeenInstantiated);
|
||||
jsAst.Expression prototypeAccess(
|
||||
covariant ClassEntity e, bool hasBeenInstantiated);
|
||||
|
||||
/// Returns the JS constructor of the given interceptor class [e].
|
||||
jsAst.Expression interceptorClassAccess(ClassEntity e);
|
||||
|
@ -328,12 +329,12 @@ abstract class EmitterBase implements Emitter {
|
|||
}
|
||||
|
||||
@override
|
||||
jsAst.PropertyAccess interceptorClassAccess(ClassEntity element) {
|
||||
jsAst.Expression interceptorClassAccess(ClassEntity element) {
|
||||
return globalPropertyAccessForClass(element);
|
||||
}
|
||||
|
||||
@override
|
||||
jsAst.PropertyAccess typeAccess(Entity element) {
|
||||
jsAst.Expression typeAccess(Entity element) {
|
||||
return globalPropertyAccessForType(element);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import '../../common_elements.dart' show CommonElements, ElementEnvironment;
|
|||
import '../../elements/resolution_types.dart' show ResolutionDartType;
|
||||
import '../../deferred_load.dart' show OutputUnit;
|
||||
import '../../elements/elements.dart'
|
||||
show ClassElement, ConstructorBodyElement, LibraryElement, TypedefElement;
|
||||
show ConstructorBodyElement, LibraryElement, TypedefElement;
|
||||
import '../../elements/entities.dart';
|
||||
import '../../elements/entity_utils.dart' as utils;
|
||||
import '../../elements/names.dart';
|
||||
|
@ -315,7 +315,7 @@ class Emitter extends js_emitter.EmitterBase {
|
|||
|
||||
@override
|
||||
jsAst.PropertyAccess prototypeAccess(
|
||||
ClassElement element, bool hasBeenInstantiated) {
|
||||
ClassEntity element, bool hasBeenInstantiated) {
|
||||
return jsAst.js('#.prototype', constructorAccess(element));
|
||||
}
|
||||
|
||||
|
|
|
@ -149,8 +149,7 @@ class ModelEmitter {
|
|||
// We have to emit the deferred fragments first, since we need their
|
||||
// deferred hash (which depends on the output) when emitting the main
|
||||
// fragment.
|
||||
List<js.Expression> fragmentsCode =
|
||||
deferredFragments.map((DeferredFragment deferredUnit) {
|
||||
List<js.Expression> fragmentsCode = deferredFragments.map((deferredUnit) {
|
||||
js.Expression types =
|
||||
program.metadataTypesForOutputUnit(deferredUnit.outputUnit);
|
||||
return emitDeferredFragment(types, deferredUnit, program.holders);
|
||||
|
@ -400,14 +399,13 @@ class ModelEmitter {
|
|||
List<js.Property> globals = <js.Property>[];
|
||||
|
||||
js.ArrayInitializer fragmentUris(List<Fragment> fragments) {
|
||||
return js.stringArray(fragments.map((DeferredFragment fragment) =>
|
||||
"${fragment.outputFileName}.$deferredExtension"));
|
||||
return js.stringArray(fragments
|
||||
.map((fragment) => "${fragment.outputFileName}.$deferredExtension"));
|
||||
}
|
||||
|
||||
js.ArrayInitializer fragmentHashes(List<Fragment> fragments) {
|
||||
// TODO(floitsch): the hash must depend on the generated code.
|
||||
return js.numArray(
|
||||
fragments.map((DeferredFragment fragment) => fragment.hashCode));
|
||||
return js.numArray(fragments.map((fragment) => fragment.hashCode));
|
||||
}
|
||||
|
||||
List<js.Property> uris = new List<js.Property>(loadMap.length);
|
||||
|
|
|
@ -78,7 +78,7 @@ class _BoundMetadataEntry extends _MetadataEntry {
|
|||
if (_rc == 1) entry.accept(visitor);
|
||||
}
|
||||
|
||||
int compareTo(_MetadataEntry other) => other._rc - this._rc;
|
||||
int compareTo(covariant _MetadataEntry other) => other._rc - this._rc;
|
||||
}
|
||||
|
||||
abstract class Placeholder implements jsAst.DeferredNumber {
|
||||
|
|
|
@ -178,8 +178,14 @@ class RuntimeTypeGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
_generateIsTestsOn(classElement, generateIsTest,
|
||||
generateFunctionTypeSignature, generateSubstitution, generateTypeCheck);
|
||||
_generateIsTestsOn(classElement, (Element e) {
|
||||
generateIsTest(e);
|
||||
}, (Element e, ResolutionFunctionType t) {
|
||||
generateFunctionTypeSignature(e, t);
|
||||
},
|
||||
(Element e, {bool emitNull: false}) =>
|
||||
generateSubstitution(e, emitNull: emitNull),
|
||||
generateTypeCheck);
|
||||
|
||||
if (classElement == _commonElements.jsJavaScriptFunctionClass) {
|
||||
var type = _jsInteropAnalysis.buildJsFunctionType();
|
||||
|
|
|
@ -1260,7 +1260,7 @@ class FragmentEmitter {
|
|||
List<js.Property> globals = <js.Property>[];
|
||||
|
||||
js.ArrayInitializer fragmentUris(List<Fragment> fragments) {
|
||||
return js.stringArray(fragments.map((DeferredFragment fragment) =>
|
||||
return js.stringArray(fragments.map((Fragment fragment) =>
|
||||
"${fragment.outputFileName}.${ModelEmitter.deferredExtension}"));
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@ import '../common.dart';
|
|||
import '../common_elements.dart';
|
||||
import '../elements/elements.dart' show ClassElement, MethodElement;
|
||||
import '../elements/entities.dart';
|
||||
import '../elements/resolution_types.dart' show ResolutionFunctionType;
|
||||
import '../elements/types.dart' show DartType;
|
||||
import '../elements/resolution_types.dart'
|
||||
show ResolutionFunctionType, ResolutionTypeVariableType;
|
||||
import '../elements/types.dart';
|
||||
import '../js_backend/runtime_types.dart'
|
||||
show
|
||||
|
@ -45,12 +47,12 @@ class TypeTestRegistry {
|
|||
|
||||
Iterable<ClassEntity> get classesUsingTypeVariableTests {
|
||||
if (cachedClassesUsingTypeVariableTests == null) {
|
||||
cachedClassesUsingTypeVariableTests = new List<ClassEntity>.from(
|
||||
_codegenWorldBuilder.isChecks
|
||||
.where((DartType t) =>
|
||||
t is TypeVariableType &&
|
||||
t.element.typeDeclaration is ClassEntity)
|
||||
.map((dynamic v) => v.element.typeDeclaration));
|
||||
cachedClassesUsingTypeVariableTests = _codegenWorldBuilder.isChecks
|
||||
.where((DartType t) => t is ResolutionTypeVariableType)
|
||||
.map((DartType _v) {
|
||||
ResolutionTypeVariableType v = _v;
|
||||
return v.element.enclosingClass;
|
||||
}).toList();
|
||||
}
|
||||
return cachedClassesUsingTypeVariableTests;
|
||||
}
|
||||
|
@ -118,7 +120,9 @@ class TypeTestRegistry {
|
|||
// argument checks.
|
||||
// TODO(karlklose): merge this case with 2 when unifying argument and
|
||||
// object checks.
|
||||
rtiChecks.getRequiredArgumentClasses().forEach(addClassWithSuperclasses);
|
||||
rtiChecks
|
||||
.getRequiredArgumentClasses()
|
||||
.forEach((e) => addClassWithSuperclasses(e));
|
||||
|
||||
// 2. Add classes that are referenced by substitutions in object checks and
|
||||
// their superclasses.
|
||||
|
|
|
@ -58,7 +58,7 @@ class JsToFrontendMapImpl implements JsToFrontendMap {
|
|||
});
|
||||
}
|
||||
|
||||
LibraryEntity toFrontendLibrary(JLibrary library) =>
|
||||
LibraryEntity toFrontendLibrary(covariant JLibrary library) =>
|
||||
_frontendLibraryList[library.libraryIndex];
|
||||
|
||||
final Map<ClassEntity, ClassEntity> _toBackendClass =
|
||||
|
@ -75,7 +75,8 @@ class JsToFrontendMapImpl implements JsToFrontendMap {
|
|||
});
|
||||
}
|
||||
|
||||
ClassEntity toFrontendClass(JClass cls) => _frontendClassList[cls.classIndex];
|
||||
ClassEntity toFrontendClass(covariant JClass cls) =>
|
||||
_frontendClassList[cls.classIndex];
|
||||
|
||||
final Map<MemberEntity, MemberEntity> _toBackendMember =
|
||||
<MemberEntity, MemberEntity>{};
|
||||
|
@ -141,7 +142,7 @@ class JsToFrontendMapImpl implements JsToFrontendMap {
|
|||
});
|
||||
}
|
||||
|
||||
MemberEntity toFrontendMember(JMember member) =>
|
||||
MemberEntity toFrontendMember(covariant JMember member) =>
|
||||
_frontendMemberList[member.memberIndex];
|
||||
|
||||
DartType toBackendType(DartType type) =>
|
||||
|
@ -689,8 +690,8 @@ class JsBackendUsage implements BackendUsage {
|
|||
|
||||
@override
|
||||
Iterable<FunctionEntity> get globalFunctionDependencies {
|
||||
return _backendUsage.globalFunctionDependencies
|
||||
.map((FunctionEntity e) => _map.toBackendMember(e));
|
||||
FunctionEntity f(FunctionEntity e) => _map.toBackendMember(e);
|
||||
return _backendUsage.globalFunctionDependencies.map(f);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -87,7 +87,7 @@ abstract class KernelToElementMap {
|
|||
MemberEntity getMember(ir.Member node);
|
||||
|
||||
/// Returns the kernel IR node that defines the [member].
|
||||
ir.Member getMemberNode(MemberEntity member);
|
||||
ir.Node getMemberNode(covariant MemberEntity member);
|
||||
|
||||
/// Returns the [FunctionEntity] corresponding to the procedure [node].
|
||||
FunctionEntity getMethod(ir.Procedure node);
|
||||
|
@ -1020,8 +1020,8 @@ abstract class KernelToTypeInferenceMap {
|
|||
TypeMask typeOfSet(ir.PropertySet write, ClosedWorld closedWorld);
|
||||
|
||||
/// Returns the inferred type of [listLiteral].
|
||||
TypeMask typeOfListLiteral(
|
||||
MemberEntity owner, ir.ListLiteral listLiteral, ClosedWorld closedWorld);
|
||||
TypeMask typeOfListLiteral(covariant MemberEntity owner,
|
||||
ir.ListLiteral listLiteral, ClosedWorld closedWorld);
|
||||
|
||||
/// Returns the inferred type of iterator in [forInStatement].
|
||||
TypeMask typeOfIterator(ir.ForInStatement forInStatement);
|
||||
|
@ -1067,10 +1067,10 @@ abstract class KernelToLocalsMap {
|
|||
// TODO(johnniwinther): Make these return the [KernelToLocalsMap] to use from
|
||||
// now on.
|
||||
/// Call to notify that [member] is currently being inlined.
|
||||
void enterInlinedMember(MemberEntity member);
|
||||
void enterInlinedMember(covariant MemberEntity member);
|
||||
|
||||
/// Call to notify that [member] is no longer being inlined.
|
||||
void leaveInlinedMember(MemberEntity member);
|
||||
void leaveInlinedMember(covariant MemberEntity member);
|
||||
|
||||
/// Returns the [Local] for [node].
|
||||
Local getLocal(ir.VariableDeclaration node);
|
||||
|
|
|
@ -764,7 +764,7 @@ class KernelToElementMapImpl extends KernelToElementMapMixin {
|
|||
}
|
||||
|
||||
@override
|
||||
ir.Member getMemberNode(KMember member) {
|
||||
ir.Member getMemberNode(covariant KMember member) {
|
||||
return _memberList[member.memberIndex].node;
|
||||
}
|
||||
|
||||
|
@ -1198,12 +1198,12 @@ class KernelElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
bool isMixinApplication(KClass cls) {
|
||||
bool isMixinApplication(covariant KClass cls) {
|
||||
return elementMap._isMixinApplication(cls);
|
||||
}
|
||||
|
||||
@override
|
||||
bool isUnnamedMixinApplication(KClass cls) {
|
||||
bool isUnnamedMixinApplication(covariant KClass cls) {
|
||||
return elementMap._isUnnamedMixinApplication(cls);
|
||||
}
|
||||
|
||||
|
@ -1229,12 +1229,12 @@ class KernelElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
FunctionType getFunctionType(KFunction function) {
|
||||
FunctionType getFunctionType(covariant KFunction function) {
|
||||
return elementMap._getFunctionType(function);
|
||||
}
|
||||
|
||||
@override
|
||||
FunctionType getLocalFunctionType(KLocalFunction function) {
|
||||
FunctionType getLocalFunctionType(covariant KLocalFunction function) {
|
||||
return function.functionType;
|
||||
}
|
||||
|
||||
|
@ -1331,7 +1331,7 @@ class KernelElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
void forEachClass(KLibrary library, void f(ClassEntity cls)) {
|
||||
void forEachClass(covariant KLibrary library, void f(ClassEntity cls)) {
|
||||
elementMap._forEachClass(library, f);
|
||||
}
|
||||
|
||||
|
@ -1346,13 +1346,13 @@ class KernelElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
bool isDeferredLoadLibraryGetter(KMember member) {
|
||||
bool isDeferredLoadLibraryGetter(covariant KMember member) {
|
||||
// TODO(johnniwinther): Support these.
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
Iterable<ConstantValue> getMemberMetadata(KMember member) {
|
||||
Iterable<ConstantValue> getMemberMetadata(covariant KMember member) {
|
||||
_MemberData memberData = elementMap._memberList[member.memberIndex];
|
||||
return memberData.getMetadata(elementMap);
|
||||
}
|
||||
|
@ -1716,13 +1716,14 @@ class KernelNativeMemberResolver extends NativeMemberResolverBase {
|
|||
CommonElements get commonElements => elementMap.commonElements;
|
||||
|
||||
@override
|
||||
native.NativeBehavior computeNativeFieldStoreBehavior(KField field) {
|
||||
native.NativeBehavior computeNativeFieldStoreBehavior(
|
||||
covariant KField field) {
|
||||
ir.Field node = elementMap._memberList[field.memberIndex].node;
|
||||
return elementMap.getNativeBehaviorForFieldStore(node);
|
||||
}
|
||||
|
||||
@override
|
||||
native.NativeBehavior computeNativeFieldLoadBehavior(KField field,
|
||||
native.NativeBehavior computeNativeFieldLoadBehavior(covariant KField field,
|
||||
{bool isJsInterop}) {
|
||||
ir.Field node = elementMap._memberList[field.memberIndex].node;
|
||||
return elementMap.getNativeBehaviorForFieldLoad(node,
|
||||
|
@ -1730,7 +1731,8 @@ class KernelNativeMemberResolver extends NativeMemberResolverBase {
|
|||
}
|
||||
|
||||
@override
|
||||
native.NativeBehavior computeNativeMethodBehavior(KFunction function,
|
||||
native.NativeBehavior computeNativeMethodBehavior(
|
||||
covariant KFunction function,
|
||||
{bool isJsInterop}) {
|
||||
ir.Member node = elementMap._memberList[function.memberIndex].node;
|
||||
return elementMap.getNativeBehaviorForMethod(node,
|
||||
|
@ -1738,7 +1740,7 @@ class KernelNativeMemberResolver extends NativeMemberResolverBase {
|
|||
}
|
||||
|
||||
@override
|
||||
bool isNativeMethod(KFunction function) {
|
||||
bool isNativeMethod(covariant KFunction function) {
|
||||
if (!native.maybeEnableNative(function.library.canonicalUri)) return false;
|
||||
ir.Member node = elementMap._memberList[function.memberIndex].node;
|
||||
return node.isExternal &&
|
||||
|
|
|
@ -46,7 +46,8 @@ class KernelBackendStrategy implements BackendStrategy {
|
|||
KernelBackendStrategy(this._compiler);
|
||||
|
||||
@override
|
||||
ClosedWorldRefiner createClosedWorldRefiner(KernelClosedWorld closedWorld) {
|
||||
ClosedWorldRefiner createClosedWorldRefiner(
|
||||
covariant KernelClosedWorld closedWorld) {
|
||||
return closedWorld;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ class KernelVisitor extends Object
|
|||
return node;
|
||||
}
|
||||
|
||||
ir.Node associateNode(ir.Node node, Node ast) {
|
||||
N associateNode<N extends ir.Node>(N node, Node ast) {
|
||||
kernel.nodeToAst[node] = ast;
|
||||
return node;
|
||||
}
|
||||
|
@ -1275,7 +1275,7 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.Expression visitClassTypeLiteralSet(
|
||||
SendSet node, ConstantExpression constant, Node rhs, _) {
|
||||
SendSet node, TypeConstantExpression constant, Node rhs, _) {
|
||||
return buildTypeLiteralSet(constant, rhs);
|
||||
}
|
||||
|
||||
|
@ -1412,7 +1412,7 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.Expression visitDynamicTypeLiteralSet(
|
||||
SendSet node, ConstantExpression constant, Node rhs, _) {
|
||||
SendSet node, TypeConstantExpression constant, Node rhs, _) {
|
||||
return buildTypeLiteralSet(constant, rhs);
|
||||
}
|
||||
|
||||
|
@ -2323,7 +2323,7 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.Expression handleStaticGetterSet(
|
||||
SendSet node, FunctionElement getter, Node rhs, _) {
|
||||
SendSet node, GetterElement getter, Node rhs, _) {
|
||||
return buildStaticAccessor(getter)
|
||||
.buildAssignment(visitForValue(rhs), voidContext: isVoidContext);
|
||||
}
|
||||
|
@ -2359,7 +2359,7 @@ class KernelVisitor extends Object
|
|||
}
|
||||
|
||||
@override
|
||||
ir.SuperMethodInvocation visitSuperBinary(Send node, FunctionElement function,
|
||||
ir.SuperMethodInvocation visitSuperBinary(Send node, MethodElement function,
|
||||
BinaryOperator operator, Node argument, _) {
|
||||
transformerFlags |= TransformerFlag.superCalls;
|
||||
return new ir.SuperMethodInvocation(
|
||||
|
@ -2412,7 +2412,7 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.SuperMethodInvocation visitSuperEquals(
|
||||
Send node, FunctionElement function, Node argument, _) {
|
||||
Send node, MethodElement function, Node argument, _) {
|
||||
return buildSuperEquals(function, argument);
|
||||
}
|
||||
|
||||
|
@ -2519,8 +2519,7 @@ class KernelVisitor extends Object
|
|||
}
|
||||
|
||||
@override
|
||||
ir.SuperPropertyGet visitSuperGetterGet(
|
||||
Send node, FunctionElement getter, _) {
|
||||
ir.SuperPropertyGet visitSuperGetterGet(Send node, MethodElement getter, _) {
|
||||
return buildSuperPropertyAccessor(getter).buildSimpleRead();
|
||||
}
|
||||
|
||||
|
@ -2556,7 +2555,7 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.SuperMethodInvocation visitSuperIndex(
|
||||
Send node, FunctionElement function, Node index, _) {
|
||||
Send node, MethodElement function, Node index, _) {
|
||||
return buildSuperIndexAccessor(index, function).buildSimpleRead();
|
||||
}
|
||||
|
||||
|
@ -2617,14 +2616,14 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.Expression visitSuperMethodSet(
|
||||
Send node, MethodElement method, Node rhs, _) {
|
||||
SendSet node, MethodElement method, Node rhs, _) {
|
||||
return buildSuperPropertyAccessor(method)
|
||||
.buildAssignment(visitForValue(rhs), voidContext: isVoidContext);
|
||||
}
|
||||
|
||||
@override
|
||||
ir.Not visitSuperNotEquals(
|
||||
Send node, FunctionElement function, Node argument, _) {
|
||||
Send node, MethodElement function, Node argument, _) {
|
||||
return new ir.Not(buildSuperEquals(function, argument));
|
||||
}
|
||||
|
||||
|
@ -2649,7 +2648,7 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.SuperMethodInvocation visitSuperUnary(
|
||||
Send node, UnaryOperator operator, FunctionElement function, _) {
|
||||
Send node, UnaryOperator operator, MethodElement function, _) {
|
||||
transformerFlags |= TransformerFlag.superCalls;
|
||||
return new ir.SuperMethodInvocation(kernel.irName(function.name, function),
|
||||
new ir.Arguments.empty(), kernel.functionToIr(function));
|
||||
|
@ -2827,7 +2826,7 @@ class KernelVisitor extends Object
|
|||
|
||||
@override
|
||||
ir.Expression visitTypedefTypeLiteralSet(
|
||||
SendSet node, ConstantExpression constant, Node rhs, _) {
|
||||
SendSet node, TypeConstantExpression constant, Node rhs, _) {
|
||||
return buildTypeLiteralSet(constant, rhs);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ part of dart2js.kernel.element_map;
|
|||
/// Support for subtype checks of kernel based [DartType]s.
|
||||
class _KernelDartTypes extends DartTypes {
|
||||
final KernelToElementMapImpl elementMap;
|
||||
final SubtypeVisitor subtypeVisitor;
|
||||
final PotentialSubtypeVisitor potentialSubtypeVisitor;
|
||||
final SubtypeVisitor<DartType> subtypeVisitor;
|
||||
final PotentialSubtypeVisitor<DartType> potentialSubtypeVisitor;
|
||||
|
||||
_KernelDartTypes(this.elementMap)
|
||||
: this.subtypeVisitor = new _KernelSubtypeVisitor(elementMap),
|
||||
|
@ -98,7 +98,8 @@ class _KernelOrderedTypeSetBuilder extends OrderedTypeSetBuilderBase {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _AbstractTypeRelationMixin implements AbstractTypeRelation {
|
||||
abstract class _AbstractTypeRelationMixin
|
||||
implements AbstractTypeRelation<DartType> {
|
||||
KernelToElementMapImpl get elementMap;
|
||||
|
||||
@override
|
||||
|
@ -122,14 +123,14 @@ abstract class _AbstractTypeRelationMixin implements AbstractTypeRelation {
|
|||
}
|
||||
}
|
||||
|
||||
class _KernelSubtypeVisitor extends SubtypeVisitor
|
||||
class _KernelSubtypeVisitor extends SubtypeVisitor<DartType>
|
||||
with _AbstractTypeRelationMixin {
|
||||
final KernelToElementMapImpl elementMap;
|
||||
|
||||
_KernelSubtypeVisitor(this.elementMap);
|
||||
}
|
||||
|
||||
class _KernelPotentialSubtypeVisitor extends PotentialSubtypeVisitor
|
||||
class _KernelPotentialSubtypeVisitor extends PotentialSubtypeVisitor<DartType>
|
||||
with _AbstractTypeRelationMixin {
|
||||
final KernelToElementMapImpl elementMap;
|
||||
|
||||
|
|
|
@ -11,12 +11,15 @@ import "../elements/elements.dart"
|
|||
Element,
|
||||
ErroneousElement,
|
||||
FunctionElement,
|
||||
MethodElement;
|
||||
GetterElement,
|
||||
MethodElement,
|
||||
SetterElement;
|
||||
import "../elements/operators.dart"
|
||||
show AssignmentOperator, BinaryOperator, IncDecOperator, UnaryOperator;
|
||||
import "../elements/resolution_types.dart"
|
||||
show ResolutionDartType, ResolutionInterfaceType;
|
||||
import "../tree/tree.dart" show Expression, NewExpression, Node, NodeList, Send;
|
||||
import "../tree/tree.dart"
|
||||
show Expression, NewExpression, Node, NodeList, Send, SendSet;
|
||||
import "../universe/call_structure.dart" show CallStructure;
|
||||
import "../universe/selector.dart" show Selector;
|
||||
import 'accessors.dart';
|
||||
|
@ -184,8 +187,8 @@ abstract class UnresolvedVisitor {
|
|||
receiver, methodName, buildArguments(arguments), constructor);
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedCompound(
|
||||
Send node, Element element, AssignmentOperator operator, Node rhs, _) {
|
||||
ir.Expression visitUnresolvedCompound(Send node, ErroneousElement element,
|
||||
AssignmentOperator operator, Node rhs, _) {
|
||||
return buildThrowUnresolvedGetter('${node.selector}');
|
||||
}
|
||||
|
||||
|
@ -202,12 +205,12 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedPostfix(
|
||||
Send node, Element element, IncDecOperator operator, _) {
|
||||
Send node, ErroneousElement element, IncDecOperator operator, _) {
|
||||
return buildThrowUnresolvedGetter('${node.selector}');
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedPrefix(
|
||||
Send node, Element element, IncDecOperator operator, _) {
|
||||
Send node, ErroneousElement element, IncDecOperator operator, _) {
|
||||
return buildThrowUnresolvedGetter('${node.selector}');
|
||||
}
|
||||
|
||||
|
@ -223,7 +226,7 @@ abstract class UnresolvedVisitor {
|
|||
possiblyErroneousFunctionToIr(constructor), buildArguments(arguments));
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSet(Send node, Element element, Node rhs, _) {
|
||||
ir.Expression visitUnresolvedSet(SendSet node, Element element, Node rhs, _) {
|
||||
return buildThrowUnresolvedSetter('${node.selector}', visitForValue(rhs));
|
||||
}
|
||||
|
||||
|
@ -258,7 +261,7 @@ abstract class UnresolvedVisitor {
|
|||
|
||||
ir.Expression visitUnresolvedStaticSetterCompound(
|
||||
Send node,
|
||||
MethodElement getter,
|
||||
GetterElement getter,
|
||||
Element element,
|
||||
AssignmentOperator operator,
|
||||
Node rhs,
|
||||
|
@ -268,7 +271,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedStaticSetterPostfix(Send node,
|
||||
MethodElement getter, Element element, IncDecOperator operator, _) {
|
||||
GetterElement getter, Element element, IncDecOperator operator, _) {
|
||||
var accessor = new ClassStaticAccessor(
|
||||
this, getter.name, possiblyErroneousFunctionToIr(getter), null);
|
||||
var result = accessor.buildPostfixIncrement(
|
||||
|
@ -279,7 +282,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedStaticSetterPrefix(Send node,
|
||||
MethodElement getter, Element element, IncDecOperator operator, _) {
|
||||
GetterElement getter, Element element, IncDecOperator operator, _) {
|
||||
var accessor = new ClassStaticAccessor(
|
||||
this, getter.name, possiblyErroneousFunctionToIr(getter), null);
|
||||
var result = accessor.buildPrefixIncrement(
|
||||
|
@ -290,7 +293,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedStaticSetterSetIfNull(
|
||||
Send node, MethodElement getter, Element element, Node rhs, _) {
|
||||
Send node, GetterElement getter, Element element, Node rhs, _) {
|
||||
var accessor = new ClassStaticAccessor(
|
||||
this, getter.name, possiblyErroneousFunctionToIr(getter), null);
|
||||
return accessor.buildNullAwareAssignment(visitForValue(rhs), null,
|
||||
|
@ -312,8 +315,8 @@ abstract class UnresolvedVisitor {
|
|||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperCompoundIndexSet(Send node, Element element,
|
||||
Node index, AssignmentOperator operator, Node rhs, _) {
|
||||
ir.Expression visitUnresolvedSuperCompoundIndexSet(SendSet node,
|
||||
Element element, Node index, AssignmentOperator operator, Node rhs, _) {
|
||||
return buildUnresolvedSuperIndexAccessor(index, element)
|
||||
.buildCompoundAssignment(
|
||||
new ir.Name(operator.selectorName), visitForValue(rhs));
|
||||
|
@ -323,13 +326,18 @@ abstract class UnresolvedVisitor {
|
|||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperGetterCompound(Send node, Element element,
|
||||
MethodElement setter, AssignmentOperator operator, Node rhs, _) {
|
||||
ir.Expression visitUnresolvedSuperGetterCompound(
|
||||
SendSet node,
|
||||
Element element,
|
||||
SetterElement setter,
|
||||
AssignmentOperator operator,
|
||||
Node rhs,
|
||||
_) {
|
||||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperGetterCompoundIndexSet(
|
||||
Send node,
|
||||
SendSet node,
|
||||
Element element,
|
||||
MethodElement setter,
|
||||
Node index,
|
||||
|
@ -340,7 +348,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperGetterIndexPostfix(
|
||||
Send node,
|
||||
SendSet node,
|
||||
Element element,
|
||||
MethodElement setter,
|
||||
Node index,
|
||||
|
@ -350,7 +358,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperGetterIndexPrefix(
|
||||
Send node,
|
||||
SendSet node,
|
||||
Element element,
|
||||
MethodElement setter,
|
||||
Node index,
|
||||
|
@ -359,13 +367,13 @@ abstract class UnresolvedVisitor {
|
|||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperGetterPostfix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, _) {
|
||||
ir.Expression visitUnresolvedSuperGetterPostfix(SendSet node, Element element,
|
||||
SetterElement setter, IncDecOperator operator, _) {
|
||||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperGetterPrefix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, _) {
|
||||
ir.Expression visitUnresolvedSuperGetterPrefix(SendSet node, Element element,
|
||||
SetterElement setter, IncDecOperator operator, _) {
|
||||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
|
@ -390,7 +398,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperIndexSet(
|
||||
Send node, Element element, Node index, Node rhs, _) {
|
||||
SendSet node, ErroneousElement element, Node index, Node rhs, _) {
|
||||
return buildUnresolvedSuperIndexAccessor(index, element)
|
||||
.buildAssignment(visitForValue(rhs));
|
||||
}
|
||||
|
@ -403,12 +411,12 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperPostfix(
|
||||
Send node, Element element, IncDecOperator operator, _) {
|
||||
SendSet node, Element element, IncDecOperator operator, _) {
|
||||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperPrefix(
|
||||
Send node, Element element, IncDecOperator operator, _) {
|
||||
SendSet node, Element element, IncDecOperator operator, _) {
|
||||
return buildThrowUnresolvedSuperGetter('${node.selector}');
|
||||
}
|
||||
|
||||
|
@ -419,7 +427,7 @@ abstract class UnresolvedVisitor {
|
|||
|
||||
ir.Expression visitUnresolvedSuperSetterCompound(
|
||||
Send node,
|
||||
MethodElement getter,
|
||||
GetterElement getter,
|
||||
Element element,
|
||||
AssignmentOperator operator,
|
||||
Node rhs,
|
||||
|
@ -430,7 +438,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperSetterCompoundIndexSet(
|
||||
Send node,
|
||||
SendSet node,
|
||||
MethodElement getter,
|
||||
Element element,
|
||||
Node index,
|
||||
|
@ -443,7 +451,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperSetterIndexPostfix(
|
||||
Send node,
|
||||
SendSet node,
|
||||
MethodElement indexFunction,
|
||||
Element element,
|
||||
Node index,
|
||||
|
@ -454,7 +462,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperSetterIndexPrefix(
|
||||
Send node,
|
||||
SendSet node,
|
||||
MethodElement indexFunction,
|
||||
Element element,
|
||||
Node index,
|
||||
|
@ -464,20 +472,20 @@ abstract class UnresolvedVisitor {
|
|||
.buildPrefixIncrement(new ir.Name(operator.selectorName));
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperSetterPostfix(Send node,
|
||||
MethodElement getter, Element element, IncDecOperator operator, _) {
|
||||
ir.Expression visitUnresolvedSuperSetterPostfix(SendSet node,
|
||||
GetterElement getter, Element element, IncDecOperator operator, _) {
|
||||
return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter)
|
||||
.buildPostfixIncrement(new ir.Name(operator.selectorName));
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperSetterPrefix(Send node,
|
||||
MethodElement getter, Element element, IncDecOperator operator, _) {
|
||||
ir.Expression visitUnresolvedSuperSetterPrefix(SendSet node,
|
||||
GetterElement getter, Element element, IncDecOperator operator, _) {
|
||||
return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter)
|
||||
.buildPrefixIncrement(new ir.Name(operator.selectorName));
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperSetterSetIfNull(
|
||||
Send node, MethodElement getter, Element element, Node rhs, _) {
|
||||
Send node, GetterElement getter, Element element, Node rhs, _) {
|
||||
return buildUnresolvedSuperPropertyAccessor('${node.selector}', getter)
|
||||
.buildNullAwareAssignment(visitForValue(rhs), null);
|
||||
}
|
||||
|
@ -523,7 +531,7 @@ abstract class UnresolvedVisitor {
|
|||
|
||||
ir.Expression visitUnresolvedTopLevelSetterCompound(
|
||||
Send node,
|
||||
MethodElement getter,
|
||||
GetterElement getter,
|
||||
Element element,
|
||||
AssignmentOperator operator,
|
||||
Node rhs,
|
||||
|
@ -538,7 +546,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedTopLevelSetterPostfix(Send node,
|
||||
MethodElement getter, Element element, IncDecOperator operator, _) {
|
||||
GetterElement getter, Element element, IncDecOperator operator, _) {
|
||||
var accessor = new TopLevelStaticAccessor(
|
||||
this, getter.name, possiblyErroneousFunctionToIr(getter), null);
|
||||
var result = accessor.buildPostfixIncrement(
|
||||
|
@ -549,7 +557,7 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedTopLevelSetterPrefix(Send node,
|
||||
MethodElement getter, Element element, IncDecOperator operator, _) {
|
||||
GetterElement getter, Element element, IncDecOperator operator, _) {
|
||||
var accessor = new TopLevelStaticAccessor(
|
||||
this, getter.name, possiblyErroneousFunctionToIr(getter), null);
|
||||
var result = accessor.buildPrefixIncrement(
|
||||
|
@ -560,20 +568,20 @@ abstract class UnresolvedVisitor {
|
|||
}
|
||||
|
||||
ir.Expression visitUnresolvedTopLevelSetterSetIfNull(
|
||||
Send node, MethodElement getter, Element element, Node rhs, _) {
|
||||
Send node, GetterElement getter, Element element, Node rhs, _) {
|
||||
var accessor = new TopLevelStaticAccessor(
|
||||
this, getter.name, possiblyErroneousFunctionToIr(getter), null);
|
||||
return accessor.buildNullAwareAssignment(visitForValue(rhs), null,
|
||||
voidContext: isVoidContext);
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperGetterIndexSetIfNull(Send node,
|
||||
ir.Expression visitUnresolvedSuperGetterIndexSetIfNull(SendSet node,
|
||||
Element element, MethodElement setter, Node index, Node rhs, _) {
|
||||
return buildUnresolvedSuperIndexAccessor(index, element)
|
||||
.buildNullAwareAssignment(visitForValue(rhs), null);
|
||||
}
|
||||
|
||||
ir.Expression visitUnresolvedSuperSetterIndexSetIfNull(Send node,
|
||||
ir.Expression visitUnresolvedSuperSetterIndexSetIfNull(SendSet node,
|
||||
MethodElement getter, Element element, Node index, Node rhs, _) {
|
||||
return buildUnresolvedSuperIndexAccessor(index, element)
|
||||
.buildNullAwareAssignment(visitForValue(rhs), null);
|
||||
|
|
|
@ -80,14 +80,14 @@ abstract class NativeMemberResolverBase implements NativeMemberResolver {
|
|||
NativeBasicData get nativeBasicData;
|
||||
NativeDataBuilder get nativeDataBuilder;
|
||||
|
||||
bool isJsInteropMember(MemberEntity element);
|
||||
bool isNativeMethod(FunctionEntity element);
|
||||
bool isJsInteropMember(covariant MemberEntity element);
|
||||
bool isNativeMethod(covariant FunctionEntity element);
|
||||
|
||||
NativeBehavior computeNativeMethodBehavior(FunctionEntity function,
|
||||
NativeBehavior computeNativeMethodBehavior(covariant FunctionEntity function,
|
||||
{bool isJsInterop});
|
||||
NativeBehavior computeNativeFieldLoadBehavior(FieldEntity field,
|
||||
NativeBehavior computeNativeFieldLoadBehavior(covariant FieldEntity field,
|
||||
{bool isJsInterop});
|
||||
NativeBehavior computeNativeFieldStoreBehavior(FieldEntity field);
|
||||
NativeBehavior computeNativeFieldStoreBehavior(covariant FieldEntity field);
|
||||
|
||||
@override
|
||||
void resolveNativeMember(MemberEntity element, [NativeRegistry registry]) {
|
||||
|
@ -128,7 +128,7 @@ abstract class NativeMemberResolverBase implements NativeMemberResolver {
|
|||
|
||||
/// Process the potentially native [field]. Adds information from metadata
|
||||
/// attributes. Returns `true` of [method] is native.
|
||||
bool _processFieldAnnotations(FieldEntity element) {
|
||||
bool _processFieldAnnotations(covariant FieldEntity element) {
|
||||
if (element.isInstanceMember &&
|
||||
nativeBasicData.isNativeClass(element.enclosingClass)) {
|
||||
// Exclude non-instance (static) fields - they are not really native and
|
||||
|
@ -143,7 +143,7 @@ abstract class NativeMemberResolverBase implements NativeMemberResolver {
|
|||
|
||||
/// Process the potentially native [method]. Adds information from metadata
|
||||
/// attributes. Returns `true` of [method] is native.
|
||||
bool _processMethodAnnotations(FunctionEntity method) {
|
||||
bool _processMethodAnnotations(covariant FunctionEntity method) {
|
||||
if (isNativeMethod(method)) {
|
||||
if (method.isStatic) {
|
||||
_setNativeNameForStaticMethod(method);
|
||||
|
@ -435,7 +435,8 @@ class BaseNativeClassFinder implements NativeClassFinder {
|
|||
|
||||
/// Adds [cls] to [nativeClasses] and performs further processing of [cls],
|
||||
/// if necessary.
|
||||
void _processNativeClass(ClassEntity cls, Set<ClassEntity> nativeClasses) {
|
||||
void _processNativeClass(
|
||||
covariant ClassEntity cls, Set<ClassEntity> nativeClasses) {
|
||||
nativeClasses.add(cls);
|
||||
// Js Interop interfaces do not have tags.
|
||||
if (_nativeBasicData.isJsInteropClass(cls)) return;
|
||||
|
@ -456,7 +457,7 @@ class BaseNativeClassFinder implements NativeClassFinder {
|
|||
|
||||
/// Returns the name of the super class of [cls] or `null` of [cls] has
|
||||
/// no explicit superclass.
|
||||
String _findExtendsNameOfClass(ClassEntity cls) {
|
||||
String _findExtendsNameOfClass(covariant ClassEntity cls) {
|
||||
return _elementEnvironment
|
||||
.getSuperClass(cls, skipUnnamedMixinApplications: true)
|
||||
?.name;
|
||||
|
|
|
@ -171,10 +171,11 @@ abstract class OrderedTypeSetBuilderBase implements OrderedTypeSetBuilder {
|
|||
OrderedTypeSetBuilderBase(this.cls, {this.reporter, InterfaceType objectType})
|
||||
: this._objectType = objectType;
|
||||
|
||||
InterfaceType getThisType(ClassEntity cls);
|
||||
InterfaceType substByContext(InterfaceType type, InterfaceType context);
|
||||
int getHierarchyDepth(ClassEntity cls);
|
||||
OrderedTypeSet getOrderedTypeSet(ClassEntity cls);
|
||||
InterfaceType getThisType(covariant ClassEntity cls);
|
||||
InterfaceType substByContext(
|
||||
covariant InterfaceType type, covariant InterfaceType context);
|
||||
int getHierarchyDepth(covariant ClassEntity cls);
|
||||
OrderedTypeSet getOrderedTypeSet(covariant ClassEntity cls);
|
||||
|
||||
OrderedTypeSet createOrderedTypeSet(
|
||||
InterfaceType supertype, Link<DartType> interfaces) {
|
||||
|
|
|
@ -139,6 +139,7 @@ abstract class PartialFunctionElement
|
|||
PartialFunctionElement copyWithEnclosing(Element enclosing);
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class PartialMethodElement extends MethodElementX
|
||||
with PartialElement, PartialFunctionMixin
|
||||
implements PartialFunctionElement {
|
||||
|
@ -161,6 +162,7 @@ class PartialMethodElement extends MethodElementX
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class PartialGetterElement extends GetterElementX
|
||||
with PartialElement, PartialFunctionMixin
|
||||
implements GetterElement, PartialFunctionElement {
|
||||
|
@ -186,6 +188,7 @@ class PartialGetterElement extends GetterElementX
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class PartialSetterElement extends SetterElementX
|
||||
with PartialElement, PartialFunctionMixin
|
||||
implements SetterElement, PartialFunctionElement {
|
||||
|
|
|
@ -105,7 +105,8 @@ abstract class MembersCreator {
|
|||
ClassElement superclass = supertype.element;
|
||||
|
||||
// Inherit class and interface members from superclass.
|
||||
void inheritClassMember(DeclaredMember member) {
|
||||
void inheritClassMember(Member _member) {
|
||||
DeclaredMember member = _member;
|
||||
if (shouldSkipMember(member)) return;
|
||||
if (!member.isStatic) {
|
||||
DeclaredMember inherited = member.inheritFrom(supertype);
|
||||
|
@ -136,7 +137,8 @@ abstract class MembersCreator {
|
|||
if (mixinApplication.mixin != null) {
|
||||
// Only mix in class members when the mixin type is not malformed.
|
||||
|
||||
void inheritMixinMember(DeclaredMember member) {
|
||||
void inheritMixinMember(Member _member) {
|
||||
DeclaredMember member = _member;
|
||||
if (shouldSkipMember(member)) return;
|
||||
Name name = member.name;
|
||||
if (!member.isAbstract && !member.isStatic) {
|
||||
|
@ -165,7 +167,8 @@ abstract class MembersCreator {
|
|||
LibraryElement library = cls.library;
|
||||
ResolutionInterfaceType thisType = cls.thisType;
|
||||
|
||||
void createMember(MemberElement element) {
|
||||
void createMember(Element _element) {
|
||||
MemberElement element = _element;
|
||||
if (element.isConstructor) return;
|
||||
String elementName = element.name;
|
||||
if (shouldSkipName(elementName)) return;
|
||||
|
|
|
@ -257,7 +257,7 @@ class EnumCreator {
|
|||
|
||||
EnumFormalElementX nameFormal;
|
||||
|
||||
List<Element> parameters = <Element>[indexFormal];
|
||||
List<FormalElement> parameters = <FormalElement>[indexFormal];
|
||||
List<ResolutionDartType> parameterTypes = <ResolutionDartType>[intType];
|
||||
if (!matchKernelRepresentationForTesting) {
|
||||
nameFormal = new EnumFormalElementX(constructor, nameDefinition,
|
||||
|
|
|
@ -6,7 +6,7 @@ part of dart2js.resolution.compute_members;
|
|||
|
||||
class DeclaredMember implements Member {
|
||||
final Name name;
|
||||
final Element element;
|
||||
final MemberElement element;
|
||||
final ResolutionInterfaceType declarer;
|
||||
final ResolutionDartType type;
|
||||
final ResolutionFunctionType functionType;
|
||||
|
@ -116,7 +116,7 @@ class InheritedMember implements DeclaredMember {
|
|||
assert(!declaration.isStatic);
|
||||
}
|
||||
|
||||
Element get element => declaration.element;
|
||||
MemberElement get element => declaration.element;
|
||||
|
||||
Name get name => declaration.name;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class CommonResolverVisitor<R> extends Visitor<R> {
|
|||
node, 'internal error: Unhandled node: ${node.getObjectDescription()}');
|
||||
}
|
||||
|
||||
R visitEmptyStatement(Node node) => null;
|
||||
R visitEmptyStatement(EmptyStatement node) => null;
|
||||
|
||||
/** Convenience method for visiting nodes that may be null. */
|
||||
R visit(Node node) => (node == null) ? null : node.accept(this);
|
||||
|
|
|
@ -142,7 +142,7 @@ class ResolutionFrontEndStrategy implements FrontendStrategy {
|
|||
}
|
||||
|
||||
FunctionEntity computeMain(
|
||||
LibraryElement mainApp, WorldImpactBuilder impactBuilder) {
|
||||
covariant LibraryElement mainApp, WorldImpactBuilder impactBuilder) {
|
||||
_elementEnvironment._mainLibrary = mainApp;
|
||||
if (mainApp == null) return null;
|
||||
MethodElement mainFunction;
|
||||
|
@ -394,16 +394,17 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
Iterable<LibraryEntity> get libraries => _compiler.libraryLoader.libraries;
|
||||
|
||||
@override
|
||||
String getLibraryName(LibraryElement library) => library.libraryName;
|
||||
String getLibraryName(covariant LibraryElement library) =>
|
||||
library.libraryName;
|
||||
|
||||
@override
|
||||
ResolutionInterfaceType getThisType(ClassElement cls) {
|
||||
ResolutionInterfaceType getThisType(covariant ClassElement cls) {
|
||||
cls.ensureResolved(_resolution);
|
||||
return cls.thisType;
|
||||
}
|
||||
|
||||
@override
|
||||
ResolutionInterfaceType getRawType(ClassElement cls) {
|
||||
ResolutionInterfaceType getRawType(covariant ClassElement cls) {
|
||||
cls.ensureResolved(_resolution);
|
||||
return cls.rawType;
|
||||
}
|
||||
|
@ -414,17 +415,17 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
bool isMixinApplication(ClassElement cls) {
|
||||
bool isMixinApplication(covariant ClassElement cls) {
|
||||
return cls.isMixinApplication;
|
||||
}
|
||||
|
||||
@override
|
||||
bool isUnnamedMixinApplication(ClassElement cls) {
|
||||
bool isUnnamedMixinApplication(covariant ClassElement cls) {
|
||||
return cls.isUnnamedMixinApplication;
|
||||
}
|
||||
|
||||
@override
|
||||
ClassEntity getEffectiveMixinClass(ClassElement cls) {
|
||||
ClassEntity getEffectiveMixinClass(covariant ClassElement cls) {
|
||||
if (!cls.isMixinApplication) return null;
|
||||
do {
|
||||
MixinApplicationElement mixinApplication = cls;
|
||||
|
@ -434,19 +435,20 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
ResolutionDartType getTypeVariableBound(TypeVariableElement typeVariable) {
|
||||
ResolutionDartType getTypeVariableBound(
|
||||
covariant TypeVariableElement typeVariable) {
|
||||
return typeVariable.bound;
|
||||
}
|
||||
|
||||
@override
|
||||
ResolutionInterfaceType createInterfaceType(
|
||||
ClassElement cls, List<ResolutionDartType> typeArguments) {
|
||||
ResolutionInterfaceType createInterfaceType(covariant ClassElement cls,
|
||||
covariant List<ResolutionDartType> typeArguments) {
|
||||
cls.ensureResolved(_resolution);
|
||||
return cls.thisType.createInstantiation(typeArguments);
|
||||
}
|
||||
|
||||
@override
|
||||
MemberElement lookupClassMember(ClassElement cls, String name,
|
||||
MemberElement lookupClassMember(covariant ClassElement cls, String name,
|
||||
{bool setter: false, bool required: false}) {
|
||||
cls.ensureResolved(_resolution);
|
||||
Element member = cls.implementation.lookupLocalMember(name);
|
||||
|
@ -474,7 +476,7 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
ConstructorElement lookupConstructor(ClassElement cls, String name,
|
||||
ConstructorElement lookupConstructor(covariant ClassElement cls, String name,
|
||||
{bool required: false}) {
|
||||
cls.ensureResolved(_resolution);
|
||||
ConstructorElement constructor = cls.implementation.lookupConstructor(name);
|
||||
|
@ -489,8 +491,8 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
void forEachClassMember(
|
||||
ClassElement cls, void f(ClassElement declarer, MemberElement member)) {
|
||||
void forEachClassMember(covariant ClassElement cls,
|
||||
void f(ClassElement declarer, MemberElement member)) {
|
||||
cls.ensureResolved(_resolution);
|
||||
cls.forEachMember((ClassElement declarer, _member) {
|
||||
MemberElement member = _member;
|
||||
|
@ -503,7 +505,7 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
|
||||
@override
|
||||
void forEachConstructor(
|
||||
ClassElement cls, void f(ConstructorEntity constructor)) {
|
||||
covariant ClassElement cls, void f(ConstructorEntity constructor)) {
|
||||
cls.ensureResolved(_resolution);
|
||||
for (ConstructorElement constructor in cls.implementation.constructors) {
|
||||
_resolution.ensureResolved(constructor.declaration);
|
||||
|
@ -513,7 +515,7 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
ClassEntity getSuperClass(ClassElement cls,
|
||||
ClassEntity getSuperClass(covariant ClassElement cls,
|
||||
{bool skipUnnamedMixinApplications: false}) {
|
||||
cls.ensureResolved(_resolution);
|
||||
ClassElement superclass = cls.superclass;
|
||||
|
@ -527,13 +529,12 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
|
||||
@override
|
||||
void forEachSupertype(
|
||||
ClassElement cls, void f(ResolutionInterfaceType supertype)) {
|
||||
cls.allSupertypes
|
||||
.forEach((ResolutionInterfaceType supertype) => f(supertype));
|
||||
covariant ClassElement cls, void f(ResolutionInterfaceType supertype)) {
|
||||
cls.allSupertypes.forEach((InterfaceType supertype) => f(supertype));
|
||||
}
|
||||
|
||||
@override
|
||||
void forEachMixin(ClassElement cls, void f(ClassElement mixin)) {
|
||||
void forEachMixin(covariant ClassElement cls, void f(ClassElement mixin)) {
|
||||
for (; cls != null; cls = cls.superclass) {
|
||||
if (cls.isMixinApplication) {
|
||||
MixinApplicationElement mixinApplication = cls;
|
||||
|
@ -543,7 +544,8 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
MemberElement lookupLibraryMember(LibraryElement library, String name,
|
||||
MemberElement lookupLibraryMember(
|
||||
covariant LibraryElement library, String name,
|
||||
{bool setter: false, bool required: false}) {
|
||||
Element member = library.implementation.findLocal(name);
|
||||
if (member != null && member.isAbstractField) {
|
||||
|
@ -571,7 +573,7 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
|
||||
@override
|
||||
void forEachLibraryMember(
|
||||
LibraryElement library, void f(MemberEntity member)) {
|
||||
covariant LibraryElement library, void f(MemberEntity member)) {
|
||||
library.implementation.forEachLocalMember((Element element) {
|
||||
if (!element.isClass && !element.isTypedef) {
|
||||
MemberElement member = element;
|
||||
|
@ -581,7 +583,7 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
ClassElement lookupClass(LibraryElement library, String name,
|
||||
ClassElement lookupClass(covariant LibraryElement library, String name,
|
||||
{bool required: false}) {
|
||||
ClassElement cls = library.implementation.findLocal(name);
|
||||
if (cls == null && required) {
|
||||
|
@ -594,10 +596,11 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
void forEachClass(LibraryElement library, void f(ClassElement cls)) {
|
||||
library.implementation.forEachLocalMember((member) {
|
||||
void forEachClass(covariant LibraryElement library, void f(ClassEntity cls)) {
|
||||
library.implementation.forEachLocalMember((dynamic member) {
|
||||
if (member.isClass) {
|
||||
f(member);
|
||||
ClassElement cls = member;
|
||||
f(cls);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -621,12 +624,12 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
bool isDeferredLoadLibraryGetter(MemberElement member) {
|
||||
bool isDeferredLoadLibraryGetter(covariant MemberElement member) {
|
||||
return member.isDeferredLoaderGetter;
|
||||
}
|
||||
|
||||
@override
|
||||
ResolutionFunctionType getFunctionType(MethodElement method) {
|
||||
ResolutionFunctionType getFunctionType(covariant MethodElement method) {
|
||||
if (method is ConstructorBodyElement) {
|
||||
return method.constructor.type;
|
||||
}
|
||||
|
@ -635,18 +638,19 @@ class _CompilerElementEnvironment implements ElementEnvironment {
|
|||
}
|
||||
|
||||
@override
|
||||
ResolutionFunctionType getLocalFunctionType(LocalFunctionElement function) {
|
||||
ResolutionFunctionType getLocalFunctionType(
|
||||
covariant LocalFunctionElement function) {
|
||||
return function.type;
|
||||
}
|
||||
|
||||
@override
|
||||
ResolutionDartType getUnaliasedType(ResolutionDartType type) {
|
||||
ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) {
|
||||
type.computeUnaliased(_resolution);
|
||||
return type.unaliased;
|
||||
}
|
||||
|
||||
@override
|
||||
Iterable<ConstantValue> getMemberMetadata(MemberElement element) {
|
||||
Iterable<ConstantValue> getMemberMetadata(covariant MemberElement element) {
|
||||
List<ConstantValue> values = <ConstantValue>[];
|
||||
_compiler.reporter.withCurrentElement(element, () {
|
||||
for (MetadataAnnotation metadata in element.implementation.metadata) {
|
||||
|
@ -677,8 +681,8 @@ class _ElementAnnotationProcessor implements AnnotationProcessor {
|
|||
|
||||
/// Check whether [cls] has a `@Native(...)` annotation, and if so, set its
|
||||
/// native name from the annotation.
|
||||
void extractNativeAnnotations(
|
||||
LibraryElement library, NativeBasicDataBuilder nativeBasicDataBuilder) {
|
||||
void extractNativeAnnotations(covariant LibraryElement library,
|
||||
NativeBasicDataBuilder nativeBasicDataBuilder) {
|
||||
library.forEachLocalMember((Element element) {
|
||||
if (element.isClass) {
|
||||
EagerAnnotationHandler.checkAnnotation(_compiler, element,
|
||||
|
@ -687,8 +691,8 @@ class _ElementAnnotationProcessor implements AnnotationProcessor {
|
|||
});
|
||||
}
|
||||
|
||||
void extractJsInteropAnnotations(
|
||||
LibraryElement library, NativeBasicDataBuilder nativeBasicDataBuilder) {
|
||||
void extractJsInteropAnnotations(covariant LibraryElement library,
|
||||
NativeBasicDataBuilder nativeBasicDataBuilder) {
|
||||
bool checkJsInteropAnnotation(Element element) {
|
||||
return EagerAnnotationHandler.checkAnnotation(
|
||||
_compiler, element, const JsInteropAnnotationHandler());
|
||||
|
@ -850,7 +854,7 @@ class _ElementAnnotationProcessor implements AnnotationProcessor {
|
|||
}
|
||||
|
||||
_compiler.libraryLoader.libraries
|
||||
.forEach(processJsInteropAnnotationsInLibrary);
|
||||
.forEach((LibraryEntity l) => processJsInteropAnnotationsInLibrary(l));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ abstract class MutableScope extends NestedScope {
|
|||
final Map<String, Element> elements;
|
||||
|
||||
MutableScope(Scope parent)
|
||||
: super(parent),
|
||||
this.elements = new Map<String, Element>() {
|
||||
: this.elements = new Map<String, Element>(),
|
||||
super(parent) {
|
||||
assert(parent != null);
|
||||
}
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { super.foo = rhs; }
|
||||
/// }
|
||||
///
|
||||
R visitSuperMethodSet(Send node, MethodElement method, Node rhs, A arg);
|
||||
R visitSuperMethodSet(SendSet node, MethodElement method, Node rhs, A arg);
|
||||
|
||||
/// Getter call to the super [getter].
|
||||
///
|
||||
|
@ -534,7 +534,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super.foo;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterGet(Send node, FunctionElement getter, A arg);
|
||||
R visitSuperGetterGet(Send node, GetterElement getter, A arg);
|
||||
|
||||
/// Getter call the super [setter].
|
||||
///
|
||||
|
@ -547,7 +547,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super.foo;
|
||||
/// }
|
||||
///
|
||||
R visitSuperSetterGet(Send node, FunctionElement setter, A arg);
|
||||
R visitSuperSetterGet(Send node, SetterElement setter, A arg);
|
||||
|
||||
/// Setter call to the super [setter].
|
||||
///
|
||||
|
@ -560,7 +560,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { super.foo = rhs; }
|
||||
/// }
|
||||
///
|
||||
R visitSuperSetterSet(SendSet node, FunctionElement setter, Node rhs, A arg);
|
||||
R visitSuperSetterSet(SendSet node, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// Assignment of [rhs] to the super [getter].
|
||||
///
|
||||
|
@ -573,7 +573,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { super.foo = rhs; }
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterSet(SendSet node, FunctionElement getter, Node rhs, A arg);
|
||||
R visitSuperGetterSet(SendSet node, GetterElement getter, Node rhs, A arg);
|
||||
|
||||
/// Invocation of the super [getter] with [arguments].
|
||||
///
|
||||
|
@ -586,8 +586,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { super.foo(null, 42; }
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterInvoke(Send node, FunctionElement getter,
|
||||
NodeList arguments, CallStructure callStructure, A arg);
|
||||
R visitSuperGetterInvoke(Send node, GetterElement getter, NodeList arguments,
|
||||
CallStructure callStructure, A arg);
|
||||
|
||||
/// Invocation of the super [setter] with [arguments].
|
||||
///
|
||||
|
@ -600,8 +600,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { super.foo(null, 42; }
|
||||
/// }
|
||||
///
|
||||
R visitSuperSetterInvoke(Send node, FunctionElement setter,
|
||||
NodeList arguments, CallStructure callStructure, A arg);
|
||||
R visitSuperSetterInvoke(Send node, SetterElement setter, NodeList arguments,
|
||||
CallStructure callStructure, A arg);
|
||||
|
||||
/// Invocation of a [expression] with [arguments].
|
||||
///
|
||||
|
@ -701,7 +701,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m() { C.foo = rhs; }
|
||||
///
|
||||
R visitStaticFunctionSet(Send node, MethodElement function, Node rhs, A arg);
|
||||
R visitStaticFunctionSet(
|
||||
SendSet node, MethodElement function, Node rhs, A arg);
|
||||
|
||||
/// Getter call to the static [getter].
|
||||
///
|
||||
|
@ -712,7 +713,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m() => C.foo;
|
||||
///
|
||||
R visitStaticGetterGet(Send node, FunctionElement getter, A arg);
|
||||
R visitStaticGetterGet(Send node, GetterElement getter, A arg);
|
||||
|
||||
/// Getter call the static [setter].
|
||||
///
|
||||
|
@ -723,7 +724,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m() => C.foo;
|
||||
///
|
||||
R visitStaticSetterGet(Send node, FunctionElement setter, A arg);
|
||||
R visitStaticSetterGet(Send node, SetterElement setter, A arg);
|
||||
|
||||
/// Setter call to the static [setter].
|
||||
///
|
||||
|
@ -734,7 +735,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m() { C.foo = rhs; }
|
||||
///
|
||||
R visitStaticSetterSet(SendSet node, FunctionElement setter, Node rhs, A arg);
|
||||
R visitStaticSetterSet(SendSet node, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// Assignment of [rhs] to the static [getter].
|
||||
///
|
||||
|
@ -745,7 +746,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m() { C.foo = rhs; }
|
||||
///
|
||||
R visitStaticGetterSet(SendSet node, FunctionElement getter, Node rhs, A arg);
|
||||
R visitStaticGetterSet(SendSet node, GetterElement getter, Node rhs, A arg);
|
||||
|
||||
/// Invocation of the static [getter] with [arguments].
|
||||
///
|
||||
|
@ -756,8 +757,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m() { C.foo(null, 42; }
|
||||
///
|
||||
R visitStaticGetterInvoke(Send node, FunctionElement getter,
|
||||
NodeList arguments, CallStructure callStructure, A arg);
|
||||
R visitStaticGetterInvoke(Send node, GetterElement getter, NodeList arguments,
|
||||
CallStructure callStructure, A arg);
|
||||
|
||||
/// Invocation of the static [setter] with [arguments].
|
||||
///
|
||||
|
@ -768,8 +769,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m() { C.foo(null, 42; }
|
||||
///
|
||||
R visitStaticSetterInvoke(Send node, FunctionElement setter,
|
||||
NodeList arguments, CallStructure callStructure, A arg);
|
||||
R visitStaticSetterInvoke(Send node, SetterElement setter, NodeList arguments,
|
||||
CallStructure callStructure, A arg);
|
||||
|
||||
/// Read of the top level [field].
|
||||
///
|
||||
|
@ -848,7 +849,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { foo = rhs; }
|
||||
///
|
||||
R visitTopLevelFunctionSet(
|
||||
Send node, MethodElement function, Node rhs, A arg);
|
||||
SendSet node, MethodElement function, Node rhs, A arg);
|
||||
|
||||
/// Getter call to the top level [getter].
|
||||
///
|
||||
|
@ -857,7 +858,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// get foo => null;
|
||||
/// m() => foo;
|
||||
///
|
||||
R visitTopLevelGetterGet(Send node, FunctionElement getter, A arg);
|
||||
R visitTopLevelGetterGet(Send node, GetterElement getter, A arg);
|
||||
|
||||
/// Getter call the top level [setter].
|
||||
///
|
||||
|
@ -866,7 +867,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set foo(_) {}
|
||||
/// m() => foo;
|
||||
///
|
||||
R visitTopLevelSetterGet(Send node, FunctionElement setter, A arg);
|
||||
R visitTopLevelSetterGet(Send node, SetterElement setter, A arg);
|
||||
|
||||
/// Setter call to the top level [setter].
|
||||
///
|
||||
|
@ -875,8 +876,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set foo(_) {}
|
||||
/// m() { foo = rhs; }
|
||||
///
|
||||
R visitTopLevelSetterSet(
|
||||
SendSet node, FunctionElement setter, Node rhs, A arg);
|
||||
R visitTopLevelSetterSet(SendSet node, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// Assignment of [rhs] to the top level [getter].
|
||||
///
|
||||
|
@ -885,8 +885,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// get foo => null;
|
||||
/// m() { foo = rhs; }
|
||||
///
|
||||
R visitTopLevelGetterSet(
|
||||
SendSet node, FunctionElement getter, Node rhs, A arg);
|
||||
R visitTopLevelGetterSet(SendSet node, GetterElement getter, Node rhs, A arg);
|
||||
|
||||
/// Invocation of the top level [getter] with [arguments].
|
||||
///
|
||||
|
@ -895,7 +894,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// get foo => null;
|
||||
/// m() { foo(null, 42); }
|
||||
///
|
||||
R visitTopLevelGetterInvoke(Send node, FunctionElement getter,
|
||||
R visitTopLevelGetterInvoke(Send node, GetterElement getter,
|
||||
NodeList arguments, CallStructure callStructure, A arg);
|
||||
|
||||
/// Invocation of the top level [setter] with [arguments].
|
||||
|
@ -905,7 +904,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set foo(_) {};
|
||||
/// m() { foo(null, 42); }
|
||||
///
|
||||
R visitTopLevelSetterInvoke(Send node, FunctionElement setter,
|
||||
R visitTopLevelSetterInvoke(Send node, SetterElement setter,
|
||||
NodeList arguments, CallStructure callStructure, A arg);
|
||||
|
||||
/// Read of the type literal for class [element].
|
||||
|
@ -935,7 +934,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { C = rhs; }
|
||||
///
|
||||
R visitClassTypeLiteralSet(
|
||||
SendSet node, ConstantExpression constant, Node rhs, A arg);
|
||||
SendSet node, TypeConstantExpression constant, Node rhs, A arg);
|
||||
|
||||
/// Read of the type literal for typedef [element].
|
||||
///
|
||||
|
@ -964,7 +963,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { F = rhs; }
|
||||
///
|
||||
R visitTypedefTypeLiteralSet(
|
||||
SendSet node, ConstantExpression constant, Node rhs, A arg);
|
||||
SendSet node, TypeConstantExpression constant, Node rhs, A arg);
|
||||
|
||||
/// Read of the type literal for type variable [element].
|
||||
///
|
||||
|
@ -1024,7 +1023,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() { dynamic = rhs; }
|
||||
///
|
||||
R visitDynamicTypeLiteralSet(
|
||||
SendSet node, ConstantExpression constant, Node rhs, A arg);
|
||||
SendSet node, TypeConstantExpression constant, Node rhs, A arg);
|
||||
|
||||
/// Binary expression `left operator right` where [operator] is a user
|
||||
/// definable operator. Binary expressions using operator `==` are handled
|
||||
|
@ -1052,8 +1051,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(a) => super + a;
|
||||
/// }
|
||||
///
|
||||
R visitSuperBinary(Send node, FunctionElement function,
|
||||
BinaryOperator operator, Node argument, A arg);
|
||||
R visitSuperBinary(Send node, MethodElement function, BinaryOperator operator,
|
||||
Node argument, A arg);
|
||||
|
||||
/// Binary operation on the unresolved super [element].
|
||||
///
|
||||
|
@ -1108,7 +1107,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(a) => super[a];
|
||||
/// }
|
||||
///
|
||||
R visitSuperIndex(Send node, FunctionElement function, Node index, A arg);
|
||||
R visitSuperIndex(Send node, MethodElement function, Node index, A arg);
|
||||
|
||||
/// Index expression `super[index]` where 'operator []' is unresolved.
|
||||
///
|
||||
|
@ -1180,7 +1179,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(a) => --super[a];
|
||||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperGetterIndexPrefix(Send node, Element element,
|
||||
R visitUnresolvedSuperGetterIndexPrefix(SendSet node, Element element,
|
||||
MethodElement setter, Node index, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix operation on an index expression `super[index] operator` where
|
||||
|
@ -1196,7 +1195,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(a) => super[a]++;
|
||||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperGetterIndexPostfix(Send node, Element element,
|
||||
R visitUnresolvedSuperGetterIndexPostfix(SendSet node, Element element,
|
||||
MethodElement setter, Node index, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix operation on an index expression `operator super[index]` where
|
||||
|
@ -1213,7 +1212,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperSetterIndexPrefix(
|
||||
Send node,
|
||||
SendSet node,
|
||||
MethodElement indexFunction,
|
||||
Element element,
|
||||
Node index,
|
||||
|
@ -1234,7 +1233,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperSetterIndexPostfix(
|
||||
Send node,
|
||||
SendSet node,
|
||||
MethodElement indexFunction,
|
||||
Element element,
|
||||
Node index,
|
||||
|
@ -1294,7 +1293,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperNotEquals(
|
||||
Send node, FunctionElement function, Node argument, A arg);
|
||||
Send node, MethodElement function, Node argument, A arg);
|
||||
|
||||
/// Binary expression `left == right`.
|
||||
///
|
||||
|
@ -1316,7 +1315,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(a) => super == a;
|
||||
/// }
|
||||
///
|
||||
R visitSuperEquals(Send node, FunctionElement function, Node argument, A arg);
|
||||
R visitSuperEquals(Send node, MethodElement function, Node argument, A arg);
|
||||
|
||||
/// Unary expression `operator expression` where [operator] is a user
|
||||
/// definable operator.
|
||||
|
@ -1341,7 +1340,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperUnary(
|
||||
Send node, UnaryOperator operator, FunctionElement function, A arg);
|
||||
Send node, UnaryOperator operator, MethodElement function, A arg);
|
||||
|
||||
/// Unary operation on the unresolved super [element].
|
||||
///
|
||||
|
@ -1399,7 +1398,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperIndexSet(
|
||||
Send node, Element element, Node index, Node rhs, A arg);
|
||||
SendSet node, ErroneousElement element, Node index, Node rhs, A arg);
|
||||
|
||||
/// If-null, ??, expression with operands [left] and [right].
|
||||
///
|
||||
|
@ -1588,8 +1587,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => o += rhs;
|
||||
/// }
|
||||
///
|
||||
R visitStaticGetterSetterCompound(Send node, FunctionElement getter,
|
||||
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
R visitStaticGetterSetterCompound(Send node, GetterElement getter,
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from a
|
||||
/// static [method], that is, closurizing [method], and writing to a static
|
||||
|
@ -1604,7 +1603,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitStaticMethodSetterCompound(Send node, MethodElement method,
|
||||
MethodElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] on a top level
|
||||
/// [field].
|
||||
|
@ -1637,8 +1636,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set o(_) {}
|
||||
/// m(rhs) => o += rhs;
|
||||
///
|
||||
R visitTopLevelGetterSetterCompound(Send node, FunctionElement getter,
|
||||
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
R visitTopLevelGetterSetterCompound(Send node, GetterElement getter,
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from a
|
||||
/// top level [method], that is, closurizing [method], and writing to a top
|
||||
|
@ -1651,7 +1650,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => o += rhs;
|
||||
///
|
||||
R visitTopLevelMethodSetterCompound(Send node, FunctionElement method,
|
||||
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from a
|
||||
/// top level [method], that is, closurizing [method], and writing to an
|
||||
|
@ -1662,7 +1661,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// o() {}
|
||||
/// m(rhs) => o += rhs;
|
||||
///
|
||||
R visitTopLevelMethodCompound(Send node, FunctionElement method,
|
||||
R visitTopLevelMethodCompound(Send node, MethodElement method,
|
||||
AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] on a super
|
||||
|
@ -1838,8 +1837,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => o ??= rhs;
|
||||
/// }
|
||||
///
|
||||
R visitStaticGetterSetterSetIfNull(Send node, FunctionElement getter,
|
||||
FunctionElement setter, Node rhs, A arg);
|
||||
R visitStaticGetterSetterSetIfNull(
|
||||
Send node, GetterElement getter, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the static property defined by
|
||||
/// [method] and [setter]. That is, [rhs] is only evaluated and assigned to
|
||||
|
@ -1855,7 +1854,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitStaticMethodSetterSetIfNull(
|
||||
Send node, MethodElement method, MethodElement setter, Node rhs, A arg);
|
||||
Send node, MethodElement method, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the static [method]. That is,
|
||||
/// [rhs] is only evaluated and assigned, if the value of the [method] is
|
||||
|
@ -1902,8 +1901,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set o(_) {}
|
||||
/// m(rhs) => o ??= rhs;
|
||||
///
|
||||
R visitTopLevelGetterSetterSetIfNull(Send node, FunctionElement getter,
|
||||
FunctionElement setter, Node rhs, A arg);
|
||||
R visitTopLevelGetterSetterSetIfNull(
|
||||
Send node, GetterElement getter, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the top level property defined
|
||||
/// by [method] and [setter]. That is, [rhs] is only evaluated and assigned to
|
||||
|
@ -1916,8 +1915,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set o(_) {}
|
||||
/// m(rhs) => o ??= rhs;
|
||||
///
|
||||
R visitTopLevelMethodSetterSetIfNull(Send node, FunctionElement method,
|
||||
FunctionElement setter, Node rhs, A arg);
|
||||
R visitTopLevelMethodSetterSetIfNull(
|
||||
Send node, FunctionElement method, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the top level [method]. That is,
|
||||
/// [rhs] is only evaluated and assigned, if the value of the [method] is
|
||||
|
@ -1995,8 +1994,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => super.o ??= rhs;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterSetterSetIfNull(Send node, FunctionElement getter,
|
||||
FunctionElement setter, Node rhs, A arg);
|
||||
R visitSuperGetterSetterSetIfNull(
|
||||
Send node, GetterElement getter, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the super property defined
|
||||
/// by [method] and [setter]. That is, [rhs] is only evaluated and assigned to
|
||||
|
@ -2013,8 +2012,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => super.o ??= rhs;
|
||||
/// }
|
||||
///
|
||||
R visitSuperMethodSetterSetIfNull(Send node, FunctionElement method,
|
||||
FunctionElement setter, Node rhs, A arg);
|
||||
R visitSuperMethodSetterSetIfNull(
|
||||
Send node, FunctionElement method, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the super [method].
|
||||
/// That is, [rhs] is only evaluated and assigned, if the value of
|
||||
|
@ -2048,7 +2047,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperGetterSetIfNull(
|
||||
Send node, Element element, MethodElement setter, Node rhs, A arg);
|
||||
Send node, Element element, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the super property defined
|
||||
/// by [getter] with no corresponding setter. That is, [rhs] is only evaluated
|
||||
|
@ -2065,7 +2064,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperSetterSetIfNull(
|
||||
Send node, MethodElement getter, Element element, Node rhs, A arg);
|
||||
Send node, GetterElement getter, Element element, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the top level property defined
|
||||
/// by [field] and [setter]. That is, [rhs] is only evaluated and assigned to
|
||||
|
@ -2084,7 +2083,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperFieldSetterSetIfNull(
|
||||
Send node, FieldElement field, FunctionElement setter, Node rhs, A arg);
|
||||
Send node, FieldElement field, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the top level property defined
|
||||
/// by [getter] and [field]. That is, [rhs] is only evaluated and assigned to
|
||||
|
@ -2103,7 +2102,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperGetterFieldSetIfNull(
|
||||
Send node, FunctionElement getter, FieldElement field, Node rhs, A arg);
|
||||
Send node, GetterElement getter, FieldElement field, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to an unresolved super property.
|
||||
/// That is, [rhs] is only evaluated and assigned, if the value of the
|
||||
|
@ -2134,7 +2133,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => C.foo ??= 42;
|
||||
///
|
||||
R visitUnresolvedStaticGetterSetIfNull(
|
||||
Send node, Element element, MethodElement setter, Node rhs, A arg);
|
||||
Send node, Element element, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the top level property defined
|
||||
/// by [setter] with no corresponding getter. That is, [rhs] is only evaluated
|
||||
|
@ -2147,7 +2146,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => foo ??= 42;
|
||||
///
|
||||
R visitUnresolvedTopLevelGetterSetIfNull(
|
||||
Send node, Element element, MethodElement setter, Node rhs, A arg);
|
||||
Send node, Element element, SetterElement setter, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the static property defined
|
||||
/// by [getter] with no corresponding setter. That is, [rhs] is only evaluated
|
||||
|
@ -2162,7 +2161,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => C.foo ??= 42;
|
||||
///
|
||||
R visitUnresolvedStaticSetterSetIfNull(
|
||||
Send node, MethodElement getter, Element element, Node rhs, A arg);
|
||||
Send node, GetterElement getter, Element element, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to the top level property defined
|
||||
/// by [getter] with no corresponding setter. That is, [rhs] is only evaluated
|
||||
|
@ -2175,7 +2174,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => foo ??= 42;
|
||||
///
|
||||
R visitUnresolvedTopLevelSetterSetIfNull(
|
||||
Send node, MethodElement getter, Element element, Node rhs, A arg);
|
||||
Send node, GetterElement getter, Element element, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to an unresolved property.
|
||||
/// That is, [rhs] is only evaluated and assigned, if the value of the
|
||||
|
@ -2278,7 +2277,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperPrefix(
|
||||
Send node, Element element, IncDecOperator operator, A arg);
|
||||
SendSet node, Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] on an unresolved super property.
|
||||
///
|
||||
|
@ -2291,7 +2290,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperPostfix(
|
||||
Send node, Element element, IncDecOperator operator, A arg);
|
||||
SendSet node, Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] on an unresolved
|
||||
/// super property.
|
||||
|
@ -2353,8 +2352,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => super.o += rhs;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterSetterCompound(Send node, FunctionElement getter,
|
||||
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
R visitSuperGetterSetterCompound(Send node, GetterElement getter,
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from a
|
||||
/// super [method], that is, closurizing [method], and writing to a super
|
||||
|
@ -2371,7 +2370,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperMethodSetterCompound(Send node, FunctionElement method,
|
||||
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading the
|
||||
/// closurized super [method] and trying to invoke the non-existing setter.
|
||||
|
@ -2385,7 +2384,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => super.o += rhs;
|
||||
/// }
|
||||
///
|
||||
R visitSuperMethodCompound(Send node, FunctionElement method,
|
||||
R visitSuperMethodCompound(Send node, MethodElement method,
|
||||
AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from the
|
||||
|
@ -2400,8 +2399,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => super.o += rhs;
|
||||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperGetterCompound(Send node, Element element,
|
||||
MethodElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
R visitUnresolvedSuperGetterCompound(SendSet node, Element element,
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from a
|
||||
/// super [getter] and writing to the non-existing super setter.
|
||||
|
@ -2415,7 +2414,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => super.o += rhs;
|
||||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperSetterCompound(Send node, MethodElement getter,
|
||||
R visitUnresolvedSuperSetterCompound(Send node, GetterElement getter,
|
||||
Element element, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from a
|
||||
|
@ -2434,7 +2433,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperFieldSetterCompound(Send node, FieldElement field,
|
||||
FunctionElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] reading from a
|
||||
/// super [getter] and writing to a super [field].
|
||||
|
@ -2451,7 +2450,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m(rhs) => super.o += rhs;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterFieldCompound(Send node, FunctionElement getter,
|
||||
R visitSuperGetterFieldCompound(Send node, GetterElement getter,
|
||||
FieldElement field, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment expression of [rhs] with [operator] on a type literal
|
||||
|
@ -2543,7 +2542,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperGetterCompoundIndexSet(
|
||||
Send node,
|
||||
SendSet node,
|
||||
Element element,
|
||||
MethodElement setter,
|
||||
Node index,
|
||||
|
@ -2565,7 +2564,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperSetterCompoundIndexSet(
|
||||
Send node,
|
||||
SendSet node,
|
||||
MethodElement getter,
|
||||
Element element,
|
||||
Node index,
|
||||
|
@ -2584,8 +2583,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super[1] += 42;
|
||||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperCompoundIndexSet(Send node, Element element, Node index,
|
||||
AssignmentOperator operator, Node rhs, A arg);
|
||||
R visitUnresolvedSuperCompoundIndexSet(SendSet node, Element element,
|
||||
Node index, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to [index] on the index operators
|
||||
/// of [receiver].
|
||||
|
@ -2625,7 +2624,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super[1] ??= 42;
|
||||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperGetterIndexSetIfNull(Send node, Element element,
|
||||
R visitUnresolvedSuperGetterIndexSetIfNull(SendSet node, Element element,
|
||||
MethodElement setter, Node index, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to [index] on a super class where
|
||||
|
@ -2640,7 +2639,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super[1] ??= 42;
|
||||
/// }
|
||||
///
|
||||
R visitUnresolvedSuperSetterIndexSetIfNull(Send node, MethodElement getter,
|
||||
R visitUnresolvedSuperSetterIndexSetIfNull(SendSet node, MethodElement getter,
|
||||
Element element, Node index, Node rhs, A arg);
|
||||
|
||||
/// If-null assignment expression of [rhs] to [index] on a super class where
|
||||
|
@ -2787,8 +2786,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++o;
|
||||
/// }
|
||||
///
|
||||
R visitStaticGetterSetterPrefix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitStaticGetterSetterPrefix(Send node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a static [method], that is,
|
||||
/// closurizing [method], and writing to a static [setter].
|
||||
|
@ -2801,8 +2800,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++o;
|
||||
/// }
|
||||
///
|
||||
R visitStaticMethodSetterPrefix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitStaticMethodSetterPrefix(Send node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] on a top level [field].
|
||||
///
|
||||
|
@ -2833,8 +2832,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set o(_) {}
|
||||
/// m() => ++o;
|
||||
///
|
||||
R visitTopLevelGetterSetterPrefix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitTopLevelGetterSetterPrefix(Send node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a top level [method], that
|
||||
/// is, closurizing [method], and writing to a top level [setter].
|
||||
|
@ -2846,7 +2845,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++o;
|
||||
///
|
||||
R visitTopLevelMethodSetterPrefix(Send node, FunctionElement method,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] on a super [field].
|
||||
///
|
||||
|
@ -2860,7 +2859,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperFieldPrefix(
|
||||
Send node, FieldElement field, IncDecOperator operator, A arg);
|
||||
SendSet node, FieldElement field, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from the super field [readField]
|
||||
/// and writing to the different super field [writtenField].
|
||||
|
@ -2877,7 +2876,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++super.field;
|
||||
/// }
|
||||
///
|
||||
R visitSuperFieldFieldPrefix(Send node, FieldElement readField,
|
||||
R visitSuperFieldFieldPrefix(SendSet node, FieldElement readField,
|
||||
FieldElement writtenField, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a super [field] and writing
|
||||
|
@ -2895,8 +2894,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++super.field;
|
||||
/// }
|
||||
///
|
||||
R visitSuperFieldSetterPrefix(Send node, FieldElement field,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitSuperFieldSetterPrefix(SendSet node, FieldElement field,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a super [getter] and
|
||||
/// writing to a super [setter].
|
||||
|
@ -2911,8 +2910,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++super.field;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterSetterPrefix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitSuperGetterSetterPrefix(SendSet node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a super [getter] and
|
||||
/// writing to a super [field].
|
||||
|
@ -2929,7 +2928,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++super.field;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterFieldPrefix(Send node, FunctionElement getter,
|
||||
R visitSuperGetterFieldPrefix(SendSet node, GetterElement getter,
|
||||
FieldElement field, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a super [method], that is,
|
||||
|
@ -2945,8 +2944,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => ++super.o;
|
||||
/// }
|
||||
///
|
||||
R visitSuperMethodSetterPrefix(Send node, FunctionElement method,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitSuperMethodSetterPrefix(SendSet node, FunctionElement method,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a super [method], that is,
|
||||
/// closurizing [method], and writing to an unresolved super setter.
|
||||
|
@ -2962,7 +2961,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperMethodPrefix(
|
||||
Send node, FunctionElement method, IncDecOperator operator, A arg);
|
||||
Send node, MethodElement method, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from an unresolved super getter
|
||||
/// and writing to a super [setter].
|
||||
|
@ -2977,8 +2976,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
///
|
||||
R visitUnresolvedSuperGetterPrefix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, A arg);
|
||||
R visitUnresolvedSuperGetterPrefix(SendSet node, Element element,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a super [getter] and
|
||||
/// writing to an unresolved super setter.
|
||||
|
@ -2993,7 +2992,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
///
|
||||
R visitUnresolvedSuperSetterPrefix(Send node, MethodElement getter,
|
||||
R visitUnresolvedSuperSetterPrefix(SendSet node, GetterElement getter,
|
||||
Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] on a type literal for a class [element].
|
||||
|
@ -3168,8 +3167,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => o++;
|
||||
/// }
|
||||
///
|
||||
R visitStaticGetterSetterPostfix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitStaticGetterSetterPostfix(Send node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from a static [method], that
|
||||
/// is, closurizing [method], and writing to a static [setter].
|
||||
|
@ -3182,8 +3181,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => o++;
|
||||
/// }
|
||||
///
|
||||
R visitStaticMethodSetterPostfix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitStaticMethodSetterPostfix(Send node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] on a top level [field].
|
||||
///
|
||||
|
@ -3214,8 +3213,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// set o(_) {}
|
||||
/// m() => o++;
|
||||
///
|
||||
R visitTopLevelGetterSetterPostfix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitTopLevelGetterSetterPostfix(Send node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from a top level [method], that
|
||||
/// is, closurizing [method], and writing to a top level [setter].
|
||||
|
@ -3227,7 +3226,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => o++;
|
||||
///
|
||||
R visitTopLevelMethodSetterPostfix(Send node, FunctionElement method,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] on a super [field].
|
||||
///
|
||||
|
@ -3241,7 +3240,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperFieldPostfix(
|
||||
Send node, FieldElement field, IncDecOperator operator, A arg);
|
||||
SendSet node, FieldElement field, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from the super field
|
||||
/// [readField] and writing to the different super field [writtenField].
|
||||
|
@ -3258,7 +3257,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super.field++;
|
||||
/// }
|
||||
///
|
||||
R visitSuperFieldFieldPostfix(Send node, FieldElement readField,
|
||||
R visitSuperFieldFieldPostfix(SendSet node, FieldElement readField,
|
||||
FieldElement writtenField, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from a super [field] and
|
||||
|
@ -3276,8 +3275,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super.field++;
|
||||
/// }
|
||||
///
|
||||
R visitSuperFieldSetterPostfix(Send node, FieldElement field,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitSuperFieldSetterPostfix(SendSet node, FieldElement field,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from a super [getter] and
|
||||
/// writing to a super [setter].
|
||||
|
@ -3292,8 +3291,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super.field++;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterSetterPostfix(Send node, FunctionElement getter,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitSuperGetterSetterPostfix(SendSet node, GetterElement getter,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from a super [getter] and
|
||||
/// writing to a super [field].
|
||||
|
@ -3310,7 +3309,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super.field++;
|
||||
/// }
|
||||
///
|
||||
R visitSuperGetterFieldPostfix(Send node, FunctionElement getter,
|
||||
R visitSuperGetterFieldPostfix(SendSet node, GetterElement getter,
|
||||
FieldElement field, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from a super [method], that is,
|
||||
|
@ -3326,8 +3325,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m() => super.o++;
|
||||
/// }
|
||||
///
|
||||
R visitSuperMethodSetterPostfix(Send node, FunctionElement method,
|
||||
FunctionElement setter, IncDecOperator operator, A arg);
|
||||
R visitSuperMethodSetterPostfix(SendSet node, FunctionElement method,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] reading from a super [method], that is,
|
||||
/// closurizing [method], and writing to an unresolved super.
|
||||
|
@ -3343,7 +3342,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitSuperMethodPostfix(
|
||||
Send node, FunctionElement method, IncDecOperator operator, A arg);
|
||||
Send node, MethodElement method, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from an unresolved super getter
|
||||
/// and writing to a super [setter].
|
||||
|
@ -3358,8 +3357,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
///
|
||||
R visitUnresolvedSuperGetterPostfix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, A arg);
|
||||
R visitUnresolvedSuperGetterPostfix(SendSet node, Element element,
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix expression with [operator] reading from a super [getter] and
|
||||
/// writing to an unresolved super setter.
|
||||
|
@ -3374,7 +3373,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
///
|
||||
R visitUnresolvedSuperSetterPostfix(Send node, MethodElement getter,
|
||||
R visitUnresolvedSuperSetterPostfix(SendSet node, GetterElement getter,
|
||||
Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix expression with [operator] on a type literal for a class
|
||||
|
@ -3488,7 +3487,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m11() => unresolved?.Foo?.bar = 42;
|
||||
///
|
||||
// TODO(johnniwinther): Split the cases in which a prefix is resolved.
|
||||
R visitUnresolvedSet(Send node, Element element, Node rhs, A arg);
|
||||
R visitUnresolvedSet(SendSet node, Element element, Node rhs, A arg);
|
||||
|
||||
/// Assignment of [rhs] to the unresolved super [element].
|
||||
///
|
||||
|
@ -3545,7 +3544,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => C.foo += 42;
|
||||
///
|
||||
R visitUnresolvedStaticGetterCompound(Send node, Element element,
|
||||
MethodElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment of [rhs] with [operator] reading from the
|
||||
/// non-existing top level getter and writing to the top level [setter].
|
||||
|
@ -3556,7 +3555,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => foo += 42;
|
||||
///
|
||||
R visitUnresolvedTopLevelGetterCompound(Send node, Element element,
|
||||
MethodElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
SetterElement setter, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment of [rhs] with [operator] reading from the static
|
||||
/// [getter] and writing to the non-existing static setter.
|
||||
|
@ -3568,7 +3567,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m1() => C.foo += 42;
|
||||
///
|
||||
R visitUnresolvedStaticSetterCompound(Send node, MethodElement getter,
|
||||
R visitUnresolvedStaticSetterCompound(Send node, GetterElement getter,
|
||||
Element element, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment of [rhs] with [operator] reading from the top level
|
||||
|
@ -3579,7 +3578,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// get foo => 42;
|
||||
/// m1() => foo += 42;
|
||||
///
|
||||
R visitUnresolvedTopLevelSetterCompound(Send node, MethodElement getter,
|
||||
R visitUnresolvedTopLevelSetterCompound(Send node, GetterElement getter,
|
||||
Element element, AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Compound assignment of [rhs] with [operator] reading the closurized static
|
||||
|
@ -3613,8 +3612,8 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m11() => unresolved?.Foo?.bar += 42;
|
||||
///
|
||||
// TODO(johnniwinther): Split the cases in which a prefix is resolved.
|
||||
R visitUnresolvedCompound(
|
||||
Send node, Element element, AssignmentOperator operator, Node rhs, A arg);
|
||||
R visitUnresolvedCompound(Send node, ErroneousElement element,
|
||||
AssignmentOperator operator, Node rhs, A arg);
|
||||
|
||||
/// Prefix operation of [operator] reading from the non-existing static getter
|
||||
/// and writing to the static [setter].
|
||||
|
@ -3627,7 +3626,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => ++C.foo;
|
||||
///
|
||||
R visitUnresolvedStaticGetterPrefix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, A arg);
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix operation of [operator] reading from the non-existing top level
|
||||
/// getter and writing to the top level [setter].
|
||||
|
@ -3638,7 +3637,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => ++foo;
|
||||
///
|
||||
R visitUnresolvedTopLevelGetterPrefix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, A arg);
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix operation of [operator] reading from the static [getter] and
|
||||
/// writing to the non-existing static setter.
|
||||
|
@ -3650,7 +3649,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m1() => ++C.foo;
|
||||
///
|
||||
R visitUnresolvedStaticSetterPrefix(Send node, MethodElement getter,
|
||||
R visitUnresolvedStaticSetterPrefix(Send node, GetterElement getter,
|
||||
Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix operation of [operator] reading from the top level [getter] and
|
||||
|
@ -3661,7 +3660,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// get foo => 42;
|
||||
/// m1() => ++foo;
|
||||
///
|
||||
R visitUnresolvedTopLevelSetterPrefix(Send node, MethodElement getter,
|
||||
R visitUnresolvedTopLevelSetterPrefix(Send node, GetterElement getter,
|
||||
Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Prefix operation of [operator] reading the closurized static [method] and
|
||||
|
@ -3709,7 +3708,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
///
|
||||
// TODO(johnniwinther): Split the cases in which a prefix is resolved.
|
||||
R visitUnresolvedPrefix(
|
||||
Send node, Element element, IncDecOperator operator, A arg);
|
||||
Send node, ErroneousElement element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix operation of [operator] reading from the non-existing static
|
||||
/// getter and writing to the static [setter].
|
||||
|
@ -3722,7 +3721,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => C.foo++;
|
||||
///
|
||||
R visitUnresolvedStaticGetterPostfix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, A arg);
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix operation of [operator] reading from the non-existing top level
|
||||
/// getter and writing to the top level [setter].
|
||||
|
@ -3733,7 +3732,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// m1() => foo++;
|
||||
///
|
||||
R visitUnresolvedTopLevelGetterPostfix(Send node, Element element,
|
||||
MethodElement setter, IncDecOperator operator, A arg);
|
||||
SetterElement setter, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix operation of [operator] reading from the static [getter] and
|
||||
/// writing to the non-existing static setter.
|
||||
|
@ -3745,7 +3744,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// }
|
||||
/// m1() => C.foo++;
|
||||
///
|
||||
R visitUnresolvedStaticSetterPostfix(Send node, MethodElement getter,
|
||||
R visitUnresolvedStaticSetterPostfix(Send node, GetterElement getter,
|
||||
Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix operation of [operator] reading from the top level [getter] and
|
||||
|
@ -3756,7 +3755,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
/// get foo => 42;
|
||||
/// m1() => foo++;
|
||||
///
|
||||
R visitUnresolvedTopLevelSetterPostfix(Send node, MethodElement getter,
|
||||
R visitUnresolvedTopLevelSetterPostfix(Send node, GetterElement getter,
|
||||
Element element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Postfix operation of [operator] reading the closurized static [method] and
|
||||
|
@ -3804,7 +3803,7 @@ abstract class SemanticSendVisitor<R, A> {
|
|||
///
|
||||
// TODO(johnniwinther): Split the cases in which a prefix is resolved.
|
||||
R visitUnresolvedPostfix(
|
||||
Send node, Element element, IncDecOperator operator, A arg);
|
||||
Send node, ErroneousElement element, IncDecOperator operator, A arg);
|
||||
|
||||
/// Invocation of an undefined unary [operator] on [expression].
|
||||
R errorUndefinedUnaryExpression(
|
||||
|
@ -4247,7 +4246,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// get m => 42;
|
||||
///
|
||||
R visitTopLevelGetterDeclaration(
|
||||
FunctionExpression node, MethodElement getter, Node body, A arg);
|
||||
FunctionExpression node, GetterElement getter, Node body, A arg);
|
||||
|
||||
/// A declaration of a top level [setter].
|
||||
///
|
||||
|
@ -4256,7 +4255,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// set m(a) {}
|
||||
///
|
||||
R visitTopLevelSetterDeclaration(FunctionExpression node,
|
||||
MethodElement setter, NodeList parameters, Node body, A arg);
|
||||
SetterElement setter, NodeList parameters, Node body, A arg);
|
||||
|
||||
/// A declaration of a top level [function].
|
||||
///
|
||||
|
@ -4276,7 +4275,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitStaticGetterDeclaration(
|
||||
FunctionExpression node, MethodElement getter, Node body, A arg);
|
||||
FunctionExpression node, GetterElement getter, Node body, A arg);
|
||||
|
||||
/// A declaration of a static [setter].
|
||||
///
|
||||
|
@ -4286,7 +4285,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// static set m(a) {}
|
||||
/// }
|
||||
///
|
||||
R visitStaticSetterDeclaration(FunctionExpression node, MethodElement setter,
|
||||
R visitStaticSetterDeclaration(FunctionExpression node, SetterElement setter,
|
||||
NodeList parameters, Node body, A arg);
|
||||
|
||||
/// A declaration of a static [function].
|
||||
|
@ -4309,7 +4308,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitAbstractGetterDeclaration(
|
||||
FunctionExpression node, MethodElement getter, A arg);
|
||||
FunctionExpression node, GetterElement getter, A arg);
|
||||
|
||||
/// A declaration of an abstract instance [setter].
|
||||
///
|
||||
|
@ -4320,7 +4319,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitAbstractSetterDeclaration(FunctionExpression node,
|
||||
MethodElement setter, NodeList parameters, A arg);
|
||||
SetterElement setter, NodeList parameters, A arg);
|
||||
|
||||
/// A declaration of an abstract instance [method].
|
||||
///
|
||||
|
@ -4342,7 +4341,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitInstanceGetterDeclaration(
|
||||
FunctionExpression node, MethodElement getter, Node body, A arg);
|
||||
FunctionExpression node, GetterElement getter, Node body, A arg);
|
||||
|
||||
/// A declaration of an instance [setter].
|
||||
///
|
||||
|
@ -4353,7 +4352,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
|
|||
/// }
|
||||
///
|
||||
R visitInstanceSetterDeclaration(FunctionExpression node,
|
||||
MethodElement setter, NodeList parameters, Node body, A arg);
|
||||
SetterElement setter, NodeList parameters, Node body, A arg);
|
||||
|
||||
/// A declaration of an instance [method].
|
||||
///
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@ import 'semantic_visitor.dart';
|
|||
/// node.
|
||||
abstract class SemanticSendStructure<R, A> {
|
||||
/// Calls the matching visit method on [visitor] with [node] and [arg].
|
||||
R dispatch(SemanticSendVisitor<R, A> visitor, Node node, A arg);
|
||||
R dispatch(SemanticSendVisitor<R, A> visitor, covariant Node node, A arg);
|
||||
}
|
||||
|
||||
enum SendStructureKind {
|
||||
|
|
|
@ -35,7 +35,7 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
final Scope scope;
|
||||
final MessageKind defaultValuesError;
|
||||
final bool createRealParameters;
|
||||
List<Element> optionalParameters = const <Element>[];
|
||||
List<FormalElement> optionalParameters = const <FormalElement>[];
|
||||
int optionalParameterCount = 0;
|
||||
bool isOptionalParameter = false;
|
||||
bool optionalParametersAreNamed = false;
|
||||
|
@ -65,7 +65,7 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
}
|
||||
optionalParametersAreNamed = (identical(value, '{'));
|
||||
isOptionalParameter = true;
|
||||
LinkBuilder<Element> elements = analyzeNodes(node.nodes);
|
||||
LinkBuilder<FormalElement> elements = analyzeNodes(node.nodes);
|
||||
optionalParameterCount = elements.length;
|
||||
optionalParameters = elements.toList();
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
}
|
||||
|
||||
/// A [SendSet] node is an optional parameter with a default value.
|
||||
Element visitSendSet(SendSet node) {
|
||||
FormalElementX visitSendSet(SendSet node) {
|
||||
FormalElementX element;
|
||||
if (node.receiver != null) {
|
||||
element = createFieldParameter(node, node.arguments.first);
|
||||
|
@ -267,7 +267,7 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
return element;
|
||||
}
|
||||
|
||||
Element visitFunctionExpression(FunctionExpression node) {
|
||||
FormalElementX visitFunctionExpression(FunctionExpression node) {
|
||||
// This is a function typed parameter.
|
||||
Modifiers modifiers = currentDefinitions.modifiers;
|
||||
if (modifiers.isFinal) {
|
||||
|
@ -282,8 +282,8 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
return createParameter(node.name, null);
|
||||
}
|
||||
|
||||
LinkBuilder<Element> analyzeNodes(Link<Node> link) {
|
||||
LinkBuilder<Element> elements = new LinkBuilder<Element>();
|
||||
LinkBuilder<FormalElement> analyzeNodes(Link<Node> link) {
|
||||
LinkBuilder<FormalElement> elements = new LinkBuilder<FormalElement>();
|
||||
for (; !link.isEmpty; link = link.tail) {
|
||||
Element element = link.head.accept(this);
|
||||
if (element != null) {
|
||||
|
@ -356,7 +356,7 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
resolution, element, scope, registry,
|
||||
defaultValuesError: defaultValuesError,
|
||||
createRealParameters: createRealParameters);
|
||||
List<Element> parameters = const <Element>[];
|
||||
List<FormalElement> parameters = const <FormalElement>[];
|
||||
int requiredParameterCount = 0;
|
||||
if (formalParameters == null) {
|
||||
if (!element.isGetter) {
|
||||
|
@ -380,7 +380,7 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
formalParameters, MessageKind.EXTRA_FORMALS);
|
||||
}
|
||||
}
|
||||
LinkBuilder<Element> parametersBuilder =
|
||||
LinkBuilder<FormalElement> parametersBuilder =
|
||||
visitor.analyzeNodes(formalParameters.nodes);
|
||||
requiredParameterCount = parametersBuilder.length;
|
||||
parameters = parametersBuilder.toList();
|
||||
|
@ -438,7 +438,7 @@ class SignatureResolver extends MappingVisitor<FormalElementX> {
|
|||
const <ResolutionDartType>[];
|
||||
List<String> namedParameters = const <String>[];
|
||||
List<ResolutionDartType> namedParameterTypes = const <ResolutionDartType>[];
|
||||
List<Element> orderedOptionalParameters =
|
||||
List<FormalElement> orderedOptionalParameters =
|
||||
visitor.optionalParameters.toList();
|
||||
if (visitor.optionalParametersAreNamed) {
|
||||
// TODO(karlklose); replace when [visitor.optionalParameters] is a [List].
|
||||
|
|
|
@ -352,8 +352,9 @@ class TreeElementMapping extends TreeElements {
|
|||
}
|
||||
|
||||
@override
|
||||
Element getFunctionDefinition(FunctionExpression node) {
|
||||
return this[node];
|
||||
FunctionElement getFunctionDefinition(FunctionExpression node) {
|
||||
Element e = this[node];
|
||||
return e is FunctionElement ? e : null;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -192,7 +192,8 @@ class TypeResolver {
|
|||
assert(visibleTypeParameterNames != null);
|
||||
|
||||
if (node.typeParameters != null) {
|
||||
List<String> newTypeNames = node.typeParameters.map((TypeVariable node) {
|
||||
List<String> newTypeNames = node.typeParameters.map((_node) {
|
||||
TypeVariable node = _node;
|
||||
return node.name.asIdentifier().source;
|
||||
}).toList();
|
||||
visibleTypeParameterNames = visibleTypeParameterNames.toList()
|
||||
|
|
|
@ -102,8 +102,8 @@ abstract class ElementSerializer {
|
|||
|
||||
/// Serializes [element] into the [encoder] using the [kind] computed
|
||||
/// by [getSerializedKind].
|
||||
void serialize(
|
||||
Element element, ObjectEncoder encoder, SerializedElementKind kind);
|
||||
void serialize(covariant Element element, ObjectEncoder encoder,
|
||||
SerializedElementKind kind);
|
||||
}
|
||||
|
||||
class SerializerUtil {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -108,7 +108,7 @@ class JsonValueEncoder implements ValueVisitor {
|
|||
}
|
||||
|
||||
/// [ValueVisitor] that generates a verbose JSON-like output.
|
||||
class PrettyPrintEncoder implements ValueVisitor {
|
||||
class PrettyPrintEncoder implements ValueVisitor<dynamic, String> {
|
||||
StringBuffer buffer;
|
||||
|
||||
String toText(Value value) {
|
||||
|
|
|
@ -276,7 +276,8 @@ abstract class AnalyzableElementMixin implements AnalyzableElement, ElementZ {
|
|||
TreeElements get treeElements => _unsupported('treeElements');
|
||||
}
|
||||
|
||||
abstract class AstElementMixinZ implements AstElement, ElementZ {
|
||||
abstract class AstElementMixinZ<N extends Node>
|
||||
implements AstElement, ElementZ {
|
||||
ResolvedAst _resolvedAst;
|
||||
|
||||
// TODO(johnniwinther): This is needed for the token invariant assertion. Find
|
||||
|
@ -288,7 +289,7 @@ abstract class AstElementMixinZ implements AstElement, ElementZ {
|
|||
bool get hasResolvedAst => _resolvedAst != null;
|
||||
|
||||
@override
|
||||
get node => _unsupported('node');
|
||||
N get node => _unsupported('node');
|
||||
|
||||
@override
|
||||
ResolvedAst get resolvedAst {
|
||||
|
@ -399,6 +400,7 @@ class AbstractFieldElementZ extends ElementZ
|
|||
bool get isTopLevel => _canonicalElement.isTopLevel;
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class LibraryElementZ extends DeserializedElementZ
|
||||
with AnalyzableElementMixin, ContainerMixin, LibraryElementCommon
|
||||
implements LibraryElement {
|
||||
|
@ -760,11 +762,12 @@ abstract class StaticMemberMixin implements DeserializedElementZ {
|
|||
bool get isClassMember => true;
|
||||
}
|
||||
|
||||
abstract class TypedElementMixin implements DeserializedElementZ, TypedElement {
|
||||
ResolutionDartType _type;
|
||||
abstract class TypedElementMixin<T extends ResolutionDartType>
|
||||
implements DeserializedElementZ, TypedElement {
|
||||
T _type;
|
||||
|
||||
@override
|
||||
ResolutionDartType get type {
|
||||
T get type {
|
||||
if (_type == null) {
|
||||
_type = _decoder.getType(Key.TYPE);
|
||||
}
|
||||
|
@ -772,7 +775,7 @@ abstract class TypedElementMixin implements DeserializedElementZ, TypedElement {
|
|||
}
|
||||
|
||||
@override
|
||||
ResolutionDartType computeType(Resolution resolution) => type;
|
||||
T computeType(Resolution resolution) => type;
|
||||
}
|
||||
|
||||
abstract class ParametersMixin
|
||||
|
@ -921,6 +924,7 @@ abstract class ClassElementMixin
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class ClassElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
|
@ -929,7 +933,7 @@ class ClassElementZ extends DeserializedElementZ
|
|||
class_members.ClassMemberMixin,
|
||||
ContainerMixin,
|
||||
LibraryMemberMixin,
|
||||
TypeDeclarationMixin<ResolutionInterfaceType>,
|
||||
TypeDeclarationMixin,
|
||||
ClassElementMixin
|
||||
implements ClassElement {
|
||||
bool _isObject;
|
||||
|
@ -1020,6 +1024,10 @@ class ClassElementZ extends DeserializedElementZ
|
|||
// TODO(johnniwinther): Why can't this always be computed in ensureResolved?
|
||||
return _callType;
|
||||
}
|
||||
|
||||
ResolutionInterfaceType get thisType => super.thisType;
|
||||
|
||||
ResolutionInterfaceType get rawType => super.rawType;
|
||||
}
|
||||
|
||||
abstract class MixinApplicationElementMixin
|
||||
|
@ -1051,7 +1059,8 @@ class UnnamedMixinApplicationElementZ extends ElementZ
|
|||
ClassElementCommon,
|
||||
ClassElementMixin,
|
||||
class_members.ClassMemberMixin,
|
||||
TypeDeclarationMixin<ResolutionInterfaceType>,
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_MIXIN
|
||||
TypeDeclarationMixin,
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
MixinApplicationElementCommon,
|
||||
|
@ -1202,6 +1211,7 @@ class UnnamedMixinApplicationElementZ extends ElementZ
|
|||
SourceSpan get sourcePosition => subclass.sourcePosition;
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
|
||||
List<FieldElement> _enumValues;
|
||||
|
||||
|
@ -1211,7 +1221,7 @@ class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
|
|||
bool get isEnumClass => true;
|
||||
|
||||
@override
|
||||
List<FieldElement> get enumValues {
|
||||
List<EnumConstantElement> get enumValues {
|
||||
if (_enumValues == null) {
|
||||
_enumValues = _decoder.getElements(Key.FIELDS);
|
||||
}
|
||||
|
@ -1219,14 +1229,15 @@ class EnumClassElementZ extends ClassElementZ implements EnumClassElement {
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
abstract class ConstructorElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<FunctionExpression>,
|
||||
ClassMemberMixin,
|
||||
FunctionTypedElementMixin,
|
||||
ParametersMixin,
|
||||
TypedElementMixin,
|
||||
TypedElementMixin<ResolutionFunctionType>,
|
||||
MemberElementMixin,
|
||||
ConstructorElementCommon
|
||||
implements
|
||||
|
@ -1306,7 +1317,7 @@ abstract class ConstructorElementZ extends DeserializedElementZ
|
|||
PrefixElement get redirectionDeferredPrefix => null;
|
||||
|
||||
@override
|
||||
ResolutionInterfaceType computeEffectiveTargetType(
|
||||
ResolutionDartType computeEffectiveTargetType(
|
||||
ResolutionInterfaceType newType) =>
|
||||
newType;
|
||||
}
|
||||
|
@ -1416,10 +1427,11 @@ class RedirectingFactoryConstructorElementZ extends ConstructorElementZ {
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class ForwardingConstructorElementZ extends ElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ
|
||||
AstElementMixinZ<FunctionExpression>
|
||||
implements
|
||||
ConstructorElement,
|
||||
// TODO(johnniwinther): Sort out whether a constructor is a method.
|
||||
|
@ -1441,7 +1453,7 @@ class ForwardingConstructorElementZ extends ElementZ
|
|||
AsyncMarker get asyncMarker => AsyncMarker.SYNC;
|
||||
|
||||
@override
|
||||
ResolutionInterfaceType computeEffectiveTargetType(
|
||||
ResolutionDartType computeEffectiveTargetType(
|
||||
ResolutionInterfaceType newType) {
|
||||
return enclosingClass.thisType.substByContext(newType);
|
||||
}
|
||||
|
@ -1583,7 +1595,7 @@ abstract class MemberElementMixin
|
|||
abstract class FieldElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<VariableDefinitions>,
|
||||
TypedElementMixin,
|
||||
MemberElementMixin
|
||||
implements FieldElement {
|
||||
|
@ -1638,6 +1650,7 @@ class StaticFieldElementZ extends FieldElementZ
|
|||
StaticFieldElementZ(ObjectDecoder decoder) : super(decoder);
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class EnumConstantElementZ extends StaticFieldElementZ
|
||||
implements EnumConstantElement {
|
||||
EnumConstantElementZ(ObjectDecoder decoder) : super(decoder);
|
||||
|
@ -1650,13 +1663,14 @@ class InstanceFieldElementZ extends FieldElementZ
|
|||
InstanceFieldElementZ(ObjectDecoder decoder) : super(decoder);
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
abstract class FunctionElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<FunctionExpression>,
|
||||
ParametersMixin,
|
||||
FunctionTypedElementMixin,
|
||||
TypedElementMixin,
|
||||
TypedElementMixin<ResolutionFunctionType>,
|
||||
MemberElementMixin
|
||||
implements MethodElement {
|
||||
FunctionElementZ(ObjectDecoder decoder) : super(decoder);
|
||||
|
@ -1704,7 +1718,7 @@ abstract class LocalExecutableMixin
|
|||
Element get enclosingElement => executableContext;
|
||||
|
||||
@override
|
||||
Element get enclosingClass => memberContext.enclosingClass;
|
||||
ClassElementZ get enclosingClass => memberContext.enclosingClass;
|
||||
|
||||
@override
|
||||
ExecutableElement get executableContext {
|
||||
|
@ -1735,13 +1749,14 @@ abstract class LocalExecutableMixin
|
|||
TreeElements get treeElements => memberContext.treeElements;
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
class LocalFunctionElementZ extends DeserializedElementZ
|
||||
with
|
||||
LocalExecutableMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<FunctionExpression>,
|
||||
ParametersMixin,
|
||||
FunctionTypedElementMixin,
|
||||
TypedElementMixin
|
||||
TypedElementMixin<ResolutionFunctionType>
|
||||
implements LocalFunctionElement {
|
||||
LocalFunctionElementZ(ObjectDecoder decoder) : super(decoder);
|
||||
|
||||
|
@ -1759,13 +1774,14 @@ class LocalFunctionElementZ extends DeserializedElementZ
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
abstract class GetterElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<FunctionExpression>,
|
||||
FunctionTypedElementMixin,
|
||||
ParametersMixin,
|
||||
TypedElementMixin,
|
||||
TypedElementMixin<ResolutionFunctionType>,
|
||||
MemberElementMixin
|
||||
implements GetterElement {
|
||||
AbstractFieldElement abstractField;
|
||||
|
@ -1804,13 +1820,14 @@ class InstanceGetterElementZ extends GetterElementZ
|
|||
InstanceGetterElementZ(ObjectDecoder decoder) : super(decoder);
|
||||
}
|
||||
|
||||
// ignore: STRONG_MODE_INVALID_METHOD_OVERRIDE_FROM_BASE
|
||||
abstract class SetterElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<FunctionExpression>,
|
||||
FunctionTypedElementMixin,
|
||||
ParametersMixin,
|
||||
TypedElementMixin,
|
||||
TypedElementMixin<ResolutionFunctionType>,
|
||||
MemberElementMixin
|
||||
implements SetterElement {
|
||||
AbstractFieldElement abstractField;
|
||||
|
@ -1847,11 +1864,11 @@ class InstanceSetterElementZ extends SetterElementZ
|
|||
InstanceSetterElementZ(ObjectDecoder decoder) : super(decoder);
|
||||
}
|
||||
|
||||
abstract class TypeDeclarationMixin<T extends GenericType>
|
||||
abstract class TypeDeclarationMixin
|
||||
implements ElementZ, TypeDeclarationElement {
|
||||
List<ResolutionDartType> _typeVariables;
|
||||
T _rawType;
|
||||
T _thisType;
|
||||
GenericType _rawType;
|
||||
GenericType _thisType;
|
||||
Name _memberName;
|
||||
|
||||
Name get memberName {
|
||||
|
@ -1872,7 +1889,7 @@ abstract class TypeDeclarationMixin<T extends GenericType>
|
|||
}
|
||||
}
|
||||
|
||||
T _createType(List<ResolutionDartType> typeArguments);
|
||||
GenericType _createType(List<ResolutionDartType> typeArguments);
|
||||
|
||||
@override
|
||||
List<ResolutionDartType> get typeVariables {
|
||||
|
@ -1881,19 +1898,19 @@ abstract class TypeDeclarationMixin<T extends GenericType>
|
|||
}
|
||||
|
||||
@override
|
||||
T get rawType {
|
||||
GenericType get rawType {
|
||||
_ensureTypes();
|
||||
return _rawType;
|
||||
}
|
||||
|
||||
@override
|
||||
T get thisType {
|
||||
GenericType get thisType {
|
||||
_ensureTypes();
|
||||
return _thisType;
|
||||
}
|
||||
|
||||
@override
|
||||
T computeType(Resolution resolution) => thisType;
|
||||
GenericType computeType(Resolution resolution) => thisType;
|
||||
|
||||
@override
|
||||
bool get isResolved => true;
|
||||
|
@ -1902,10 +1919,10 @@ abstract class TypeDeclarationMixin<T extends GenericType>
|
|||
class TypedefElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<Node>,
|
||||
LibraryMemberMixin,
|
||||
ParametersMixin,
|
||||
TypeDeclarationMixin<ResolutionTypedefType>
|
||||
TypeDeclarationMixin
|
||||
implements TypedefElement {
|
||||
ResolutionDartType _alias;
|
||||
|
||||
|
@ -1941,10 +1958,17 @@ class TypedefElementZ extends DeserializedElementZ
|
|||
|
||||
@override
|
||||
void checkCyclicReference(Resolution resolution) {}
|
||||
|
||||
ResolutionTypedefType get thisType => super.thisType;
|
||||
|
||||
ResolutionTypedefType get rawType => super.rawType;
|
||||
}
|
||||
|
||||
class TypeVariableElementZ extends DeserializedElementZ
|
||||
with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ<Node>,
|
||||
TypedElementMixin<ResolutionTypeVariableType>
|
||||
implements TypeVariableElement {
|
||||
GenericElement _typeDeclaration;
|
||||
ResolutionTypeVariableType _type;
|
||||
|
@ -1977,7 +2001,7 @@ class TypeVariableElementZ extends DeserializedElementZ
|
|||
Element get enclosingElement => typeDeclaration;
|
||||
|
||||
@override
|
||||
Element get enclosingClass => typeDeclaration;
|
||||
ClassElementZ get enclosingClass => typeDeclaration;
|
||||
|
||||
@override
|
||||
int get index => _decoder.getInt(Key.INDEX);
|
||||
|
@ -2002,7 +2026,7 @@ class TypeVariableElementZ extends DeserializedElementZ
|
|||
}
|
||||
|
||||
class SyntheticTypeVariableElementZ extends ElementZ
|
||||
with AnalyzableElementMixin, AstElementMixinZ
|
||||
with AnalyzableElementMixin, AstElementMixinZ<Node>
|
||||
implements TypeVariableElement {
|
||||
final TypeDeclarationElement typeDeclaration;
|
||||
final int index;
|
||||
|
@ -2047,7 +2071,7 @@ class SyntheticTypeVariableElementZ extends ElementZ
|
|||
Element get enclosingElement => typeDeclaration;
|
||||
|
||||
@override
|
||||
Element get enclosingClass => typeDeclaration;
|
||||
ClassElementZ get enclosingClass => typeDeclaration;
|
||||
|
||||
ResolutionDartType get bound {
|
||||
assert(_bound != null,
|
||||
|
@ -2066,7 +2090,10 @@ class SyntheticTypeVariableElementZ extends ElementZ
|
|||
}
|
||||
|
||||
abstract class ParameterElementZ extends DeserializedElementZ
|
||||
with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ<VariableDefinitions>,
|
||||
TypedElementMixin
|
||||
implements ParameterElement {
|
||||
FunctionElement _functionDeclaration;
|
||||
ConstantExpression _constant;
|
||||
|
@ -2122,7 +2149,7 @@ abstract class ParameterElementZ extends DeserializedElementZ
|
|||
Expression initializer;
|
||||
|
||||
@override
|
||||
Node node;
|
||||
VariableDefinitions node;
|
||||
|
||||
@override
|
||||
bool get isNamed => _decoder.getBool(Key.IS_NAMED);
|
||||
|
@ -2183,12 +2210,14 @@ class InitializingFormalElementZ extends LocalParameterElementZ
|
|||
|
||||
@override
|
||||
bool get isLocal => true;
|
||||
|
||||
ConstructorElementZ get functionDeclaration => super.functionDeclaration;
|
||||
}
|
||||
|
||||
class LocalVariableElementZ extends DeserializedElementZ
|
||||
with
|
||||
AnalyzableElementMixin,
|
||||
AstElementMixinZ,
|
||||
AstElementMixinZ<VariableDefinitions>,
|
||||
LocalExecutableMixin,
|
||||
TypedElementMixin
|
||||
implements LocalVariableElement {
|
||||
|
|
|
@ -11,6 +11,7 @@ import '../common/resolution.dart';
|
|||
import '../compiler.dart';
|
||||
import '../elements/resolution_types.dart';
|
||||
import '../elements/elements.dart';
|
||||
import '../elements/entities.dart';
|
||||
import '../script.dart';
|
||||
import '../serialization/impact_serialization.dart';
|
||||
import 'package:front_end/src/fasta/scanner.dart';
|
||||
|
@ -108,7 +109,8 @@ class ResolutionDeserializerSystem extends DeserializerSystem {
|
|||
}
|
||||
|
||||
@override
|
||||
bool isDeserialized(Element element) {
|
||||
bool isDeserialized(Entity entity) {
|
||||
Element element = entity;
|
||||
return deserializedLibraries.contains(element.library);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,10 +130,12 @@ List<int> readAll(String filename, {bool zeroTerminated: true}) {
|
|||
class CompilerSourceFileProvider extends SourceFileProvider {
|
||||
// TODO(johnniwinther): Remove this when no longer needed for the old compiler
|
||||
// API.
|
||||
Future<List<int>> call(Uri resourceUri) => readFromUri(resourceUri);
|
||||
Future<List<int>> call(Uri resourceUri) =>
|
||||
readFromUri(resourceUri).then((input) => input.data);
|
||||
|
||||
@override
|
||||
Future readFromUri(Uri uri, {InputKind inputKind: InputKind.utf8}) =>
|
||||
Future<api.Input<List<int>>> readFromUri(Uri uri,
|
||||
{InputKind inputKind: InputKind.utf8}) =>
|
||||
readBytesFromUri(uri, inputKind);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class SsaAstBuilder extends SsaAstBuilderBase {
|
|||
|
||||
DiagnosticReporter get reporter => backend.reporter;
|
||||
|
||||
HGraph build(ElementCodegenWorkItem work, ClosedWorld closedWorld) {
|
||||
HGraph build(covariant ElementCodegenWorkItem work, ClosedWorld closedWorld) {
|
||||
return task.measure(() {
|
||||
if (handleConstantField(work.element, work.registry, closedWorld)) {
|
||||
// No code is generated for `work.element`.
|
||||
|
@ -3291,7 +3291,7 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
|
||||
if (closedWorld.isUsedAsMixin(cls)) return true;
|
||||
|
||||
return closedWorld.anyStrictSubclassOf(cls, (ClassElement subclass) {
|
||||
return closedWorld.anyStrictSubclassOf(cls, (ClassEntity subclass) {
|
||||
return !rtiSubstitutions.isTrivialSubstitution(subclass, cls);
|
||||
});
|
||||
}
|
||||
|
@ -3417,7 +3417,7 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
}
|
||||
}
|
||||
ResolutionInterfaceType type = elements.getType(node);
|
||||
ResolutionInterfaceType expectedType =
|
||||
ResolutionDartType expectedType =
|
||||
constructorDeclaration.computeEffectiveTargetType(type);
|
||||
expectedType = localsHandler.substInContext(expectedType);
|
||||
|
||||
|
@ -3575,11 +3575,15 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
bool definitelyFails = false;
|
||||
|
||||
void addTypeVariableBoundCheck(
|
||||
ResolutionInterfaceType instance,
|
||||
ResolutionDartType typeArgument,
|
||||
ResolutionTypeVariableType typeVariable,
|
||||
ResolutionDartType bound) {
|
||||
InterfaceType _instance,
|
||||
DartType _typeArgument,
|
||||
TypeVariableType _typeVariable,
|
||||
DartType _bound) {
|
||||
if (definitelyFails) return;
|
||||
ResolutionInterfaceType instance = _instance;
|
||||
ResolutionDartType typeArgument = _typeArgument;
|
||||
ResolutionTypeVariableType typeVariable = _typeVariable;
|
||||
ResolutionDartType bound = _bound;
|
||||
|
||||
int subtypeRelation = types.computeSubtypeRelation(typeArgument, bound);
|
||||
if (subtypeRelation == DartTypes.IS_SUBTYPE) return;
|
||||
|
@ -4356,7 +4360,7 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
|
||||
@override
|
||||
void visitSuperMethodSet(
|
||||
ast.Send node, MethodElement method, ast.Node rhs, _) {
|
||||
ast.SendSet node, MethodElement method, ast.Node rhs, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
|
@ -4367,8 +4371,8 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperIndexSet(
|
||||
ast.Send node, Element element, ast.Node index, ast.Node rhs, _) {
|
||||
void visitUnresolvedSuperIndexSet(ast.SendSet node, ErroneousElement element,
|
||||
ast.Node index, ast.Node rhs, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
|
@ -4395,20 +4399,20 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperGetterIndexPrefix(ast.Send node, Element element,
|
||||
void visitUnresolvedSuperGetterIndexPrefix(ast.SendSet node, Element element,
|
||||
MethodElement setter, ast.Node index, IncDecOperator operator, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperGetterIndexPostfix(ast.Send node, Element element,
|
||||
void visitUnresolvedSuperGetterIndexPostfix(ast.SendSet node, Element element,
|
||||
MethodElement setter, ast.Node index, IncDecOperator operator, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperSetterIndexPrefix(
|
||||
ast.Send node,
|
||||
ast.SendSet node,
|
||||
MethodElement indexFunction,
|
||||
Element element,
|
||||
ast.Node index,
|
||||
|
@ -4419,7 +4423,7 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
|
||||
@override
|
||||
void visitUnresolvedSuperSetterIndexPostfix(
|
||||
ast.Send node,
|
||||
ast.SendSet node,
|
||||
MethodElement indexFunction,
|
||||
Element element,
|
||||
ast.Node index,
|
||||
|
@ -4454,7 +4458,7 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
|
||||
@override
|
||||
void visitUnresolvedSuperGetterCompoundIndexSet(
|
||||
ast.Send node,
|
||||
ast.SendSet node,
|
||||
Element element,
|
||||
MethodElement setter,
|
||||
ast.Node index,
|
||||
|
@ -4466,7 +4470,7 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
|
||||
@override
|
||||
void visitUnresolvedSuperSetterCompoundIndexSet(
|
||||
ast.Send node,
|
||||
ast.SendSet node,
|
||||
MethodElement getter,
|
||||
Element element,
|
||||
ast.Node index,
|
||||
|
@ -4477,7 +4481,7 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperCompoundIndexSet(ast.Send node, Element element,
|
||||
void visitUnresolvedSuperCompoundIndexSet(ast.SendSet node, Element element,
|
||||
ast.Node index, AssignmentOperator operator, ast.Node rhs, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
@ -4502,13 +4506,13 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
|
||||
@override
|
||||
void visitUnresolvedSuperPrefix(
|
||||
ast.Send node, Element element, IncDecOperator operator, _) {
|
||||
ast.SendSet node, Element element, IncDecOperator operator, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperPostfix(
|
||||
ast.Send node, Element element, IncDecOperator operator, _) {
|
||||
ast.SendSet node, Element element, IncDecOperator operator, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
|
@ -4543,19 +4547,19 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
}
|
||||
|
||||
@override
|
||||
void visitSuperMethodCompound(ast.Send node, FunctionElement method,
|
||||
void visitSuperMethodCompound(ast.Send node, MethodElement method,
|
||||
AssignmentOperator operator, ast.Node rhs, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperGetterCompound(ast.Send node, Element element,
|
||||
MethodElement setter, AssignmentOperator operator, ast.Node rhs, _) {
|
||||
void visitUnresolvedSuperGetterCompound(ast.SendSet node, Element element,
|
||||
SetterElement setter, AssignmentOperator operator, ast.Node rhs, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitUnresolvedSuperSetterCompound(ast.Send node, MethodElement getter,
|
||||
void visitUnresolvedSuperSetterCompound(ast.Send node, GetterElement getter,
|
||||
Element element, AssignmentOperator operator, ast.Node rhs, _) {
|
||||
handleSuperSendSet(node);
|
||||
}
|
||||
|
@ -5149,12 +5153,14 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
ClassElement targetClass = targetConstructor.enclosingClass;
|
||||
if (rtiNeed.classNeedsRti(targetClass)) {
|
||||
ClassElement cls = redirectingConstructor.enclosingClass;
|
||||
ResolutionInterfaceType targetType =
|
||||
ResolutionDartType targetType =
|
||||
redirectingConstructor.computeEffectiveTargetType(cls.thisType);
|
||||
targetType = localsHandler.substInContext(targetType);
|
||||
targetType.typeArguments.forEach((ResolutionDartType argument) {
|
||||
inputs.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
|
||||
});
|
||||
if (targetType is ResolutionInterfaceType) {
|
||||
targetType.typeArguments.forEach((ResolutionDartType argument) {
|
||||
inputs.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
|
||||
});
|
||||
}
|
||||
}
|
||||
pushInvokeStatic(node, targetConstructor.declaration, inputs);
|
||||
HInstruction value = pop();
|
||||
|
@ -5719,14 +5725,14 @@ class SsaAstGraphBuilder extends ast.Visitor
|
|||
listConstructor = constructorElement.effectiveTarget;
|
||||
|
||||
ResolutionInterfaceType type = elements.getType(node);
|
||||
ResolutionInterfaceType expectedType =
|
||||
ResolutionDartType expectedType =
|
||||
constructorElement.computeEffectiveTargetType(type);
|
||||
expectedType = localsHandler.substInContext(expectedType);
|
||||
|
||||
ClassElement cls = listConstructor.enclosingClass;
|
||||
|
||||
MethodElement createFunction = listConstructor;
|
||||
if (rtiNeed.classNeedsRti(cls)) {
|
||||
if (expectedType is ResolutionInterfaceType && rtiNeed.classNeedsRti(cls)) {
|
||||
List<HInstruction> typeInputs = <HInstruction>[];
|
||||
expectedType.typeArguments.forEach((ResolutionDartType argument) {
|
||||
typeInputs
|
||||
|
|
|
@ -413,14 +413,14 @@ class KernelJumpTarget extends JumpTarget<ast.Node> {
|
|||
KernelJumpTarget(this.targetStatement, KernelAstAdapter adapter,
|
||||
{bool makeContinueLabel = false}) {
|
||||
originalStatement = targetStatement;
|
||||
this.labels = <LabelDefinition>[];
|
||||
this.labels = <LabelDefinition<ast.Node>>[];
|
||||
if (targetStatement is ir.WhileStatement ||
|
||||
targetStatement is ir.DoStatement ||
|
||||
targetStatement is ir.ForStatement ||
|
||||
targetStatement is ir.ForInStatement) {
|
||||
// Currently these labels are set at resolution on the element itself.
|
||||
// Once that gets updated, this logic can change downstream.
|
||||
JumpTarget target = adapter.elements
|
||||
JumpTarget<ast.Node> target = adapter.elements
|
||||
.getTargetDefinition(adapter.getNode(targetStatement));
|
||||
if (target != null) {
|
||||
labels.addAll(target.labels);
|
||||
|
@ -449,7 +449,7 @@ class KernelJumpTarget extends JumpTarget<ast.Node> {
|
|||
}
|
||||
|
||||
@override
|
||||
LabelDefinition addLabel(ast.Label label, String labelName) {
|
||||
LabelDefinition<ast.Node> addLabel(ast.Label label, String labelName) {
|
||||
LabelDefinition result = new LabelDefinitionX(label, labelName, this);
|
||||
labels.add(result);
|
||||
return result;
|
||||
|
@ -468,13 +468,13 @@ class KernelJumpTarget extends JumpTarget<ast.Node> {
|
|||
bool get isTarget => isBreakTarget || isContinueTarget;
|
||||
|
||||
@override
|
||||
List<LabelDefinition> labels;
|
||||
List<LabelDefinition<ast.Node>> labels;
|
||||
|
||||
@override
|
||||
String get name => 'target';
|
||||
|
||||
@override
|
||||
ast.Node get statement => null;
|
||||
ast.Label get statement => null;
|
||||
|
||||
String toString() => 'Target:$targetStatement';
|
||||
}
|
||||
|
|
|
@ -1211,8 +1211,8 @@ abstract class HInstruction implements Spannable {
|
|||
// These methods should be overwritten by instructions that
|
||||
// participate in global value numbering.
|
||||
int typeCode() => HInstruction.UNDEFINED_TYPECODE;
|
||||
bool typeEquals(HInstruction other) => false;
|
||||
bool dataEquals(HInstruction other) => false;
|
||||
bool typeEquals(covariant HInstruction other) => false;
|
||||
bool dataEquals(covariant HInstruction other) => false;
|
||||
|
||||
accept(HVisitor visitor);
|
||||
|
||||
|
@ -1695,11 +1695,11 @@ abstract class HInvokeDynamic extends HInvoke {
|
|||
HInvokeDynamic(Selector selector, this.mask, this.element,
|
||||
List<HInstruction> inputs, TypeMask type,
|
||||
[bool isIntercepted = false])
|
||||
: super(inputs, type),
|
||||
this.selector = selector,
|
||||
: this.selector = selector,
|
||||
specializer = isIntercepted
|
||||
? InvokeDynamicSpecializer.lookupSpecializer(selector)
|
||||
: const InvokeDynamicSpecializer();
|
||||
: const InvokeDynamicSpecializer(),
|
||||
super(inputs, type);
|
||||
toString() => 'invoke dynamic: selector=$selector, mask=$mask';
|
||||
HInstruction get receiver => inputs[0];
|
||||
HInstruction getDartReceiver(ClosedWorld closedWorld) {
|
||||
|
@ -2512,7 +2512,7 @@ class HThis extends HParameterValue {
|
|||
HThis(ThisLocal element, TypeMask type) : super(element, type);
|
||||
|
||||
ThisLocal get sourceElement => super.sourceElement;
|
||||
void set sourceElement(ThisLocal local) {
|
||||
void set sourceElement(covariant ThisLocal local) {
|
||||
super.sourceElement = local;
|
||||
}
|
||||
|
||||
|
@ -3001,8 +3001,8 @@ class HTypeConversion extends HCheck {
|
|||
HTypeConversion.withTypeRepresentation(this.typeExpression, this.kind,
|
||||
TypeMask type, HInstruction input, HInstruction typeRepresentation)
|
||||
: checkedType = type,
|
||||
super(<HInstruction>[input, typeRepresentation], type),
|
||||
receiverTypeCheckSelector = null {
|
||||
receiverTypeCheckSelector = null,
|
||||
super(<HInstruction>[input, typeRepresentation], type) {
|
||||
assert(!typeExpression.isTypedef);
|
||||
sourceElement = input.sourceElement;
|
||||
}
|
||||
|
@ -3010,8 +3010,8 @@ class HTypeConversion extends HCheck {
|
|||
HTypeConversion.viaMethodOnType(this.typeExpression, this.kind, TypeMask type,
|
||||
HInstruction reifiedType, HInstruction input)
|
||||
: checkedType = type,
|
||||
super(<HInstruction>[reifiedType, input], type),
|
||||
receiverTypeCheckSelector = null {
|
||||
receiverTypeCheckSelector = null,
|
||||
super(<HInstruction>[reifiedType, input], type) {
|
||||
// This form is currently used only for function types.
|
||||
assert(typeExpression.isFunctionType);
|
||||
assert(kind == CHECKED_MODE_CHECK || kind == CAST_TYPE_CHECK);
|
||||
|
|
|
@ -24,7 +24,7 @@ class RastaSsaBuilder extends SsaAstBuilderBase {
|
|||
this.sourceInformationFactory)
|
||||
: super(task, backend);
|
||||
|
||||
HGraph build(ElementCodegenWorkItem work, ClosedWorld closedWorld) {
|
||||
HGraph build(covariant ElementCodegenWorkItem work, ClosedWorld closedWorld) {
|
||||
return task.measure(() {
|
||||
if (handleConstantField(work.element, work.registry, closedWorld)) {
|
||||
// No code is generated for `work.element`.
|
||||
|
|
|
@ -85,7 +85,7 @@ class SsaBuilderTask extends CompilerTask {
|
|||
}
|
||||
|
||||
abstract class SsaBuilderFieldMixin {
|
||||
ConstantValue getFieldInitialConstantValue(FieldEntity field);
|
||||
ConstantValue getFieldInitialConstantValue(covariant FieldEntity field);
|
||||
|
||||
/// Handle field initializer of [element]. Returns `true` if no code
|
||||
/// is needed for the field.
|
||||
|
|
|
@ -526,7 +526,8 @@ class FlatTypeMask implements TypeMask {
|
|||
}
|
||||
}
|
||||
|
||||
bool needsNoSuchMethodHandling(Selector selector, ClosedWorld closedWorld) {
|
||||
bool needsNoSuchMethodHandling(
|
||||
Selector selector, covariant ClosedWorld closedWorld) {
|
||||
// A call on an empty type mask is either dead code, or a call on
|
||||
// `null`.
|
||||
if (isEmptyOrNull) return false;
|
||||
|
|
|
@ -93,7 +93,8 @@ abstract class ForwardingTypeMask implements TypeMask {
|
|||
return forwardTo.intersection(other, closedWorld);
|
||||
}
|
||||
|
||||
bool needsNoSuchMethodHandling(Selector selector, ClosedWorld closedWorld) {
|
||||
bool needsNoSuchMethodHandling(
|
||||
Selector selector, covariant ClosedWorld closedWorld) {
|
||||
return forwardTo.needsNoSuchMethodHandling(selector, closedWorld);
|
||||
}
|
||||
|
||||
|
|
|
@ -189,8 +189,10 @@ class UnionTypeMask implements TypeMask {
|
|||
|
||||
TypeMask nonNullable() {
|
||||
if (!isNullable) return this;
|
||||
Iterable<FlatTypeMask> newIterable =
|
||||
disjointMasks.map((e) => e.nonNullable());
|
||||
Iterable<FlatTypeMask> newIterable = disjointMasks.map((e) {
|
||||
FlatTypeMask r = e.nonNullable();
|
||||
return r;
|
||||
});
|
||||
return new UnionTypeMask._internal(newIterable);
|
||||
}
|
||||
|
||||
|
|
|
@ -343,7 +343,8 @@ class ClassHierarchyNode {
|
|||
{bool instantiatedOnly: false,
|
||||
bool sorted: true,
|
||||
ClassElement withRespectTo}) {
|
||||
bool isRelatedTo(ClassElement subclass) {
|
||||
bool isRelatedTo(ClassEntity _subclass) {
|
||||
ClassElement subclass = _subclass;
|
||||
return subclass == withRespectTo ||
|
||||
subclass.implementsInterface(withRespectTo);
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@ part of world_builder;
|
|||
abstract class CodegenWorldBuilder implements WorldBuilder {
|
||||
/// Calls [f] with every instance field, together with its declarer, in an
|
||||
/// instance of [cls].
|
||||
void forEachInstanceField(
|
||||
ClassEntity cls, void f(ClassEntity declarer, FieldEntity field));
|
||||
void forEachInstanceField(covariant ClassEntity cls,
|
||||
void f(ClassEntity declarer, FieldEntity field));
|
||||
|
||||
/// Calls [f] for each parameter of [function] providing the type and name of
|
||||
/// the parameter and the [defaultValue] if the parameter is optional.
|
||||
void forEachParameter(FunctionEntity function,
|
||||
void forEachParameter(covariant FunctionEntity function,
|
||||
void f(DartType type, String name, ConstantValue defaultValue));
|
||||
|
||||
void forEachInvokedName(
|
||||
|
@ -28,10 +28,10 @@ abstract class CodegenWorldBuilder implements WorldBuilder {
|
|||
f(String name, Map<Selector, SelectorConstraints> selectors));
|
||||
|
||||
/// Returns `true` if [field] has a constant initializer.
|
||||
bool hasConstantFieldInitializer(FieldEntity field);
|
||||
bool hasConstantFieldInitializer(covariant FieldEntity field);
|
||||
|
||||
/// Returns the constant initializer for [field].
|
||||
ConstantValue getConstantFieldInitializer(FieldEntity field);
|
||||
ConstantValue getConstantFieldInitializer(covariant FieldEntity field);
|
||||
|
||||
/// Returns `true` if [member] is invoked as a setter.
|
||||
bool hasInvokedSetter(MemberEntity member, ClosedWorld world);
|
||||
|
@ -326,7 +326,7 @@ abstract class CodegenWorldBuilderImpl implements CodegenWorldBuilder {
|
|||
_invokedSetters.forEach(f);
|
||||
}
|
||||
|
||||
void registerIsCheck(DartType type) {
|
||||
void registerIsCheck(covariant DartType type) {
|
||||
isChecks.add(type.unaliased);
|
||||
}
|
||||
|
||||
|
@ -423,14 +423,14 @@ abstract class CodegenWorldBuilderImpl implements CodegenWorldBuilder {
|
|||
});
|
||||
}
|
||||
|
||||
void _processInstantiatedClassMember(
|
||||
ClassEntity cls, MemberEntity member, MemberUsedCallback memberUsed) {
|
||||
void _processInstantiatedClassMember(ClassEntity cls,
|
||||
covariant MemberEntity member, MemberUsedCallback memberUsed) {
|
||||
if (!member.isInstanceMember) return;
|
||||
_getMemberUsage(member, memberUsed);
|
||||
}
|
||||
|
||||
_MemberUsage _getMemberUsage(
|
||||
MemberEntity member, MemberUsedCallback memberUsed) {
|
||||
covariant MemberEntity member, MemberUsedCallback memberUsed) {
|
||||
return _instanceMemberUsage.putIfAbsent(member, () {
|
||||
String memberName = member.name;
|
||||
ClassEntity cls = member.enclosingClass;
|
||||
|
|
|
@ -74,7 +74,7 @@ class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase {
|
|||
.addInstantiation(constructor, instance.type, instance.kind);
|
||||
} else {
|
||||
ConstructorElement target = constructor.effectiveTarget;
|
||||
ResolutionInterfaceType targetType =
|
||||
ResolutionDartType targetType =
|
||||
constructor.computeEffectiveTargetType(instance.type);
|
||||
ClassElement cls = target.enclosingClass;
|
||||
bool isNative = _nativeBasicData.isNativeClass(cls);
|
||||
|
@ -86,8 +86,10 @@ class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase {
|
|||
} else {
|
||||
kind = Instantiation.DIRECTLY_INSTANTIATED;
|
||||
}
|
||||
infoFor(targetType.element)
|
||||
.addInstantiation(target, targetType, kind);
|
||||
if (targetType is ResolutionInterfaceType) {
|
||||
infoFor(targetType.element)
|
||||
.addInstantiation(target, targetType, kind);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld {
|
|||
/// subtypes. The latter case only contains spurious information from
|
||||
/// instantiations through factory constructors and mixins.
|
||||
// TODO(johnniwinther): Improve semantic precision.
|
||||
bool isImplemented(ClassEntity cls);
|
||||
bool isImplemented(covariant ClassEntity cls);
|
||||
|
||||
/// Set of all fields that are statically known to be written to.
|
||||
Iterable<FieldEntity> get fieldSetters;
|
||||
|
@ -431,7 +431,7 @@ abstract class ResolutionWorldBuilderBase
|
|||
return _implementedClasses.contains(cls);
|
||||
}
|
||||
|
||||
void registerClosurizedMember(FunctionEntity element) {
|
||||
void registerClosurizedMember(MemberEntity element) {
|
||||
closurizedMembers.add(element);
|
||||
FunctionType type = _elementEnvironment.getFunctionType(element);
|
||||
if (type.containsTypeVariables) {
|
||||
|
@ -575,7 +575,7 @@ abstract class ResolutionWorldBuilderBase
|
|||
return constraints.addReceiverConstraint(mask);
|
||||
}
|
||||
|
||||
void registerIsCheck(DartType type) {
|
||||
void registerIsCheck(covariant DartType type) {
|
||||
isChecks.add(type);
|
||||
}
|
||||
|
||||
|
@ -654,7 +654,8 @@ abstract class ResolutionWorldBuilderBase
|
|||
/// Called to create a [_ClassUsage] for [cls].
|
||||
///
|
||||
/// Subclasses override this to ensure needed invariants on [cls].
|
||||
_ClassUsage _createClassUsage(ClassEntity cls) => new _ClassUsage(cls);
|
||||
_ClassUsage _createClassUsage(covariant ClassEntity cls) =>
|
||||
new _ClassUsage(cls);
|
||||
|
||||
/// Return the canonical [_ClassUsage] for [cls].
|
||||
_ClassUsage _getClassUsage(ClassEntity cls) {
|
||||
|
@ -709,8 +710,8 @@ abstract class ResolutionWorldBuilderBase
|
|||
map[memberName].addAll(remaining);
|
||||
}
|
||||
|
||||
void _processInstantiatedClassMember(
|
||||
ClassEntity cls, MemberEntity member, MemberUsedCallback memberUsed) {
|
||||
void _processInstantiatedClassMember(ClassEntity cls,
|
||||
covariant MemberEntity member, MemberUsedCallback memberUsed) {
|
||||
if (!member.isInstanceMember) return;
|
||||
String memberName = member.name;
|
||||
// The obvious thing to test here would be "member.isNative",
|
||||
|
@ -774,7 +775,8 @@ abstract class ResolutionWorldBuilderBase
|
|||
_allTypedefs.add(typdef);
|
||||
}
|
||||
|
||||
void registerMixinUse(ClassEntity mixinApplication, ClassEntity mixin) {
|
||||
void registerMixinUse(
|
||||
covariant ClassEntity mixinApplication, covariant ClassEntity mixin) {
|
||||
// TODO(johnniwinther): Add map restricted to live classes.
|
||||
// We don't support patch classes as mixin.
|
||||
Set<ClassEntity> users =
|
||||
|
@ -803,24 +805,24 @@ abstract class ResolutionWorldBuilderBase
|
|||
return usage != null && usage.hasUse;
|
||||
}
|
||||
|
||||
bool checkClass(ClassEntity cls);
|
||||
bool validateClass(ClassEntity cls);
|
||||
bool checkClass(covariant ClassEntity cls);
|
||||
bool validateClass(covariant ClassEntity cls);
|
||||
|
||||
/// Returns the class mixed into [cls] if any.
|
||||
ClassEntity getAppliedMixin(ClassEntity cls);
|
||||
ClassEntity getAppliedMixin(covariant ClassEntity cls);
|
||||
|
||||
/// Returns the hierarchy depth of [cls].
|
||||
int getHierarchyDepth(ClassEntity cls);
|
||||
int getHierarchyDepth(covariant ClassEntity cls);
|
||||
|
||||
/// Returns `true` if [cls] implements `Function` either explicitly or through
|
||||
/// a `call` method.
|
||||
bool implementsFunction(ClassEntity cls);
|
||||
bool implementsFunction(covariant ClassEntity cls);
|
||||
|
||||
/// Returns the superclass of [cls] if any.
|
||||
ClassEntity getSuperClass(ClassEntity cls);
|
||||
ClassEntity getSuperClass(covariant ClassEntity cls);
|
||||
|
||||
/// Returns all supertypes of [cls].
|
||||
Iterable<InterfaceType> getSupertypes(ClassEntity cls);
|
||||
Iterable<InterfaceType> getSupertypes(covariant ClassEntity cls);
|
||||
|
||||
ClassHierarchyNode _ensureClassHierarchyNode(ClassEntity cls) {
|
||||
assert(checkClass(cls));
|
||||
|
|
|
@ -57,11 +57,11 @@ abstract class ReceiverConstraint {
|
|||
/// Returns whether [element] is a potential target when being
|
||||
/// invoked on a receiver with this constraint. [selector] is used to ensure
|
||||
/// library privacy is taken into account.
|
||||
bool canHit(MemberElement element, Selector selector, World world);
|
||||
bool canHit(MemberEntity element, Selector selector, covariant World world);
|
||||
|
||||
/// Returns whether this [TypeMask] applied to [selector] can hit a
|
||||
/// [noSuchMethod].
|
||||
bool needsNoSuchMethodHandling(Selector selector, World world);
|
||||
bool needsNoSuchMethodHandling(Selector selector, covariant World world);
|
||||
}
|
||||
|
||||
/// The combined constraints on receivers all the dynamic call sites of the same
|
||||
|
@ -99,7 +99,7 @@ abstract class SelectorConstraints {
|
|||
///
|
||||
/// Ideally the selector constraints for calls `foo` with two positional
|
||||
/// arguments apply to `A.foo` but `B.foo`.
|
||||
bool applies(MemberEntity element, Selector selector, World world);
|
||||
bool applies(MemberEntity element, Selector selector, covariant World world);
|
||||
|
||||
/// Returns `true` if at least one of the receivers matching these constraints
|
||||
/// in the closed [world] have no implementation matching [selector].
|
||||
|
@ -112,14 +112,14 @@ abstract class SelectorConstraints {
|
|||
///
|
||||
/// the potential receiver `new A()` has no implementation of `foo` and thus
|
||||
/// needs to handle the call through its `noSuchMethod` handler.
|
||||
bool needsNoSuchMethodHandling(Selector selector, World world);
|
||||
bool needsNoSuchMethodHandling(Selector selector, covariant World world);
|
||||
}
|
||||
|
||||
/// A mutable [SelectorConstraints] used in [WorldBuilder].
|
||||
abstract class UniverseSelectorConstraints extends SelectorConstraints {
|
||||
/// Adds [constraint] to these selector constraints. Return `true` if the set
|
||||
/// of potential receivers expanded due to the new constraint.
|
||||
bool addReceiverConstraint(ReceiverConstraint constraint);
|
||||
bool addReceiverConstraint(covariant ReceiverConstraint constraint);
|
||||
}
|
||||
|
||||
/// Strategy for computing the constraints on potential receivers of dynamic
|
||||
|
|
|
@ -31,7 +31,7 @@ class ImmutableEmptySet<E> extends IterableBase<E> implements Set<E> {
|
|||
bool containsAll(Iterable<Object> other) => other.isEmpty;
|
||||
|
||||
Set<E> union(Set<E> other) => new Set.from(other);
|
||||
Set<E> intersection(Set<E> other) => this;
|
||||
Set<E> intersection(Set<Object> other) => this;
|
||||
Set<E> difference(Set<Object> other) => this;
|
||||
Set<E> toSet() => new Set();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class Maplet<K, V> extends MapBase<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
bool containsKey(K key) {
|
||||
bool containsKey(Object key) {
|
||||
if (_extra == null) {
|
||||
return _key == key;
|
||||
} else if (_MARKER == _extra) {
|
||||
|
@ -70,7 +70,7 @@ class Maplet<K, V> extends MapBase<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
V operator [](K key) {
|
||||
V operator [](Object key) {
|
||||
if (_extra == null) {
|
||||
return (_key == key) ? _value : null;
|
||||
} else if (_MARKER == _extra) {
|
||||
|
@ -166,7 +166,7 @@ class Maplet<K, V> extends MapBase<K, V> {
|
|||
}
|
||||
}
|
||||
|
||||
V remove(K key) {
|
||||
V remove(Object key) {
|
||||
if (_extra == null) {
|
||||
if (_key != key) return null;
|
||||
_key = _MARKER;
|
||||
|
|
|
@ -57,7 +57,7 @@ class Setlet<E> extends IterableBase<E> implements Set<E> {
|
|||
}
|
||||
}
|
||||
|
||||
bool contains(E element) {
|
||||
bool contains(Object element) {
|
||||
if (_extra == null) {
|
||||
return _contents == element;
|
||||
} else if (_MARKER == _extra) {
|
||||
|
@ -232,7 +232,7 @@ class Setlet<E> extends IterableBase<E> implements Set<E> {
|
|||
}
|
||||
}
|
||||
|
||||
bool containsAll(Iterable<E> other) {
|
||||
bool containsAll(Iterable<Object> other) {
|
||||
for (E e in other) {
|
||||
if (!this.contains(e)) return false;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ class Setlet<E> extends IterableBase<E> implements Set<E> {
|
|||
|
||||
Set<E> union(Set<E> other) => new Set<E>.from(this)..addAll(other);
|
||||
|
||||
Setlet<E> intersection(Set<E> other) =>
|
||||
Setlet<E> intersection(Set<Object> other) =>
|
||||
new Setlet<E>.from(this.where((e) => other.contains(e)));
|
||||
|
||||
Setlet<E> difference(Set<Object> other) =>
|
||||
|
|
|
@ -253,7 +253,8 @@ abstract class ClosedWorld implements World {
|
|||
/// Returns whether [element] will be the one used at runtime when being
|
||||
/// invoked on an instance of [cls]. [selector] is used to ensure library
|
||||
/// privacy is taken into account.
|
||||
bool hasElementIn(ClassEntity cls, Selector selector, Entity element);
|
||||
bool hasElementIn(
|
||||
covariant ClassEntity cls, Selector selector, covariant Entity element);
|
||||
|
||||
/// Returns [ClassHierarchyNode] for [cls] used to model the class hierarchies
|
||||
/// of known classes.
|
||||
|
@ -365,7 +366,7 @@ abstract class ClosedWorldRefiner {
|
|||
|
||||
/// Adds the closure class [cls] to the inference world. The class is
|
||||
/// considered directly instantiated.
|
||||
void registerClosureClass(ClassElement cls);
|
||||
void registerClosureClass(covariant ClassElement cls);
|
||||
}
|
||||
|
||||
abstract class OpenWorld implements World {
|
||||
|
@ -373,7 +374,7 @@ abstract class OpenWorld implements World {
|
|||
///
|
||||
/// This ensures that class hierarchy queries can be performed on [cls] and
|
||||
/// classes that extend or implement it.
|
||||
void registerClass(ClassEntity cls);
|
||||
void registerClass(covariant ClassEntity cls);
|
||||
|
||||
void registerUsedElement(MemberEntity element);
|
||||
void registerTypedef(TypedefElement typedef);
|
||||
|
@ -484,23 +485,24 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
|||
return cachedMasks.putIfAbsent(base, createMask);
|
||||
}
|
||||
|
||||
bool checkEntity(Entity element);
|
||||
bool checkEntity(covariant Entity element);
|
||||
|
||||
bool checkClass(ClassEntity cls);
|
||||
bool checkClass(covariant ClassEntity cls);
|
||||
|
||||
bool checkInvariants(ClassEntity cls, {bool mustBeInstantiated: true});
|
||||
bool checkInvariants(covariant ClassEntity cls,
|
||||
{bool mustBeInstantiated: true});
|
||||
|
||||
OrderedTypeSet getOrderedTypeSet(ClassEntity cls);
|
||||
OrderedTypeSet getOrderedTypeSet(covariant ClassEntity cls);
|
||||
|
||||
int getHierarchyDepth(ClassEntity cls);
|
||||
int getHierarchyDepth(covariant ClassEntity cls);
|
||||
|
||||
ClassEntity getSuperClass(ClassEntity cls);
|
||||
ClassEntity getSuperClass(covariant ClassEntity cls);
|
||||
|
||||
Iterable<ClassEntity> getInterfaces(ClassEntity cls);
|
||||
Iterable<ClassEntity> getInterfaces(covariant ClassEntity cls);
|
||||
|
||||
ClassEntity getAppliedMixin(ClassEntity cls);
|
||||
ClassEntity getAppliedMixin(covariant ClassEntity cls);
|
||||
|
||||
bool isNamedMixinApplication(ClassEntity cls);
|
||||
bool isNamedMixinApplication(covariant ClassEntity cls);
|
||||
|
||||
@override
|
||||
bool isInstantiated(ClassEntity cls) {
|
||||
|
@ -801,8 +803,8 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
|||
|
||||
/// Returns whether a [selector] call on an instance of [cls]
|
||||
/// will hit a method at runtime, and not go through [noSuchMethod].
|
||||
bool hasConcreteMatch(ClassEntity cls, Selector selector,
|
||||
{ClassEntity stopAtSuperclass});
|
||||
bool hasConcreteMatch(covariant ClassEntity cls, Selector selector,
|
||||
{covariant ClassEntity stopAtSuperclass});
|
||||
|
||||
@override
|
||||
bool needsNoSuchMethod(
|
||||
|
@ -1075,12 +1077,12 @@ abstract class ClosedWorldBase implements ClosedWorld, ClosedWorldRefiner {
|
|||
return sideEffects;
|
||||
}
|
||||
|
||||
SideEffects getSideEffectsOfElement(Entity element) {
|
||||
SideEffects getSideEffectsOfElement(covariant Entity element) {
|
||||
assert(checkEntity(element));
|
||||
return _sideEffects.putIfAbsent(element, _makeSideEffects);
|
||||
}
|
||||
|
||||
static _makeSideEffects() => new SideEffects();
|
||||
static SideEffects _makeSideEffects() => new SideEffects();
|
||||
|
||||
@override
|
||||
SideEffects getCurrentlyKnownSideEffects(Entity element) {
|
||||
|
|
|
@ -10,55 +10,15 @@
|
|||
|
||||
"uris": [
|
||||
".",
|
||||
"../../tests/compiler/dart2js/"
|
||||
"../../tests/compiler/dart2js/",
|
||||
"../../tests/utils/"
|
||||
],
|
||||
|
||||
"exclude": [
|
||||
"$ This file is input and has errors:",
|
||||
"^tests/compiler/dart2js/data/one_line_dart_program\\.dart",
|
||||
|
||||
"^tests/compiler/dart2js/analyze_api_test\\.dart",
|
||||
"^tests/compiler/dart2js/analyze_dart2js_test\\.dart",
|
||||
"^tests/compiler/dart2js/analyze_test_test\\.dart",
|
||||
"^tests/compiler/dart2js/analyze_unused_dart2js_test\\.dart",
|
||||
"^tests/compiler/dart2js/class_set_test\\.dart",
|
||||
"^tests/compiler/dart2js/constant_expression_test\\.dart",
|
||||
"^tests/compiler/dart2js/data/mirrors_helper\\.dart",
|
||||
"^tests/compiler/dart2js/deferred_dont_inline_deferred_constants_test\\.dart",
|
||||
"^tests/compiler/dart2js/deferred_follow_constant_dependencies_test\\.dart",
|
||||
"^tests/compiler/dart2js/deferred_follow_implicit_super_regression_test\\.dart",
|
||||
"^tests/compiler/dart2js/deferred_load_graph_segmentation_test\\.dart",
|
||||
"^tests/compiler/dart2js/deferred_mirrors_test\\.dart",
|
||||
"^tests/compiler/dart2js/deferred_not_in_main_test\\.dart",
|
||||
"^tests/compiler/dart2js/embedded_category_api_boundary_test\\.dart",
|
||||
"^tests/compiler/dart2js/gvn_dynamic_field_get_test\\.dart",
|
||||
"^tests/compiler/dart2js/kernel/closed_world_test\\.dart",
|
||||
"^tests/compiler/dart2js/members_test\\.dart",
|
||||
"^tests/compiler/dart2js/metadata_test\\.dart",
|
||||
"^tests/compiler/dart2js/mirror_private_name_inheritance_test\\.dart",
|
||||
"^tests/compiler/dart2js/mixin_typevariable_test\\.dart",
|
||||
"^tests/compiler/dart2js/quarantined/http_test\\.dart",
|
||||
"^tests/compiler/dart2js/resolver_test\\.dart",
|
||||
"^tests/compiler/dart2js/serialization/duplicate_library_test\\.dart",
|
||||
"^tests/compiler/dart2js/serialization/equivalence_test\\.dart",
|
||||
"^tests/compiler/dart2js/serialization/test_helper\\.dart",
|
||||
"^tests/compiler/dart2js/simple_inferrer_const_closure_default_test\\.dart",
|
||||
"^tests/compiler/dart2js/simple_inferrer_test\\.dart",
|
||||
"^tests/compiler/dart2js/sourcemaps/data/invokes_test_file\\.dart",
|
||||
"^tests/compiler/dart2js/sourcemaps/mapping_test\\.dart",
|
||||
"^tests/compiler/dart2js/sourcemaps/nomapping_test\\.dart",
|
||||
"^tests/compiler/dart2js/sourcemaps/output_structure\\.dart",
|
||||
"^tests/compiler/dart2js/type_equals_test\\.dart",
|
||||
"^tests/compiler/dart2js/type_inference7_test\\.dart",
|
||||
"^tests/compiler/dart2js/type_inference8_test\\.dart",
|
||||
"^tests/compiler/dart2js/type_mask2_test\\.dart",
|
||||
"^tests/compiler/dart2js/type_mask_test\\.dart",
|
||||
"^tests/compiler/dart2js/type_representation_test\\.dart",
|
||||
"^tests/compiler/dart2js/type_substitution_test\\.dart",
|
||||
"^tests/compiler/dart2js/type_test_helper\\.dart",
|
||||
"^tests/compiler/dart2js/type_variable_occurrence_test\\.dart",
|
||||
|
||||
"^tests/compiler/dart2js/path with spaces/.*"
|
||||
"^tests/compiler/dart2js/data/.*",
|
||||
"^tests/compiler/dart2js/path with spaces/.*",
|
||||
"^tests/compiler/dart2js/sourcemaps/data/.*",
|
||||
"^tests/utils/dummy\\.dart"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ printUsage() {
|
|||
}
|
||||
|
||||
void main(List<String> args) {
|
||||
List options = [];
|
||||
List files = [];
|
||||
var options = <String>[];
|
||||
var files = <String>[];
|
||||
|
||||
for (String arg in args) {
|
||||
if (arg.startsWith('-')) {
|
||||
|
|
|
@ -151,8 +151,8 @@ _showProgress(newUsed, newCapacity, oldUsed, oldCapacity) {
|
|||
color: true);
|
||||
|
||||
sb.write(' | ');
|
||||
var maxUsed = max(lastMaxUsed, newUsed + oldUsed);
|
||||
var maxCapacity = max(lastMaxCapacity, newCapacity + oldCapacity);
|
||||
int maxUsed = max(lastMaxUsed, newUsed + oldUsed);
|
||||
int maxCapacity = max(lastMaxCapacity, newCapacity + oldCapacity);
|
||||
_writeNumber(sb, lastMaxUsed, maxUsed);
|
||||
_writeNumber(sb, lastMaxCapacity, maxCapacity, color: true);
|
||||
stdout.write('$sb');
|
||||
|
|
|
@ -237,14 +237,6 @@ Future<Null> analyzeUris(
|
|||
await for (AnalyzerDiagnostic diagnostic in diagnostics) {
|
||||
if (diagnostic.uri != null) {
|
||||
String path = toFilePath(diagnostic.uri);
|
||||
if (!(analysisOptions?.path?.contains("/pkg/compiler/") ?? false) &&
|
||||
diagnostic.code.startsWith("STRONG_MODE") &&
|
||||
(path.startsWith("pkg/compiler/") ||
|
||||
path.startsWith("tests/compiler/dart2js/"))) {
|
||||
// TODO(ahe): Remove this hack to work around dart2js not being
|
||||
// strong-mode clean.
|
||||
continue;
|
||||
}
|
||||
if (!filesToAnalyze.contains(path)) continue;
|
||||
}
|
||||
String message = "$diagnostic";
|
||||
|
|
18
tests/compiler/dart2js/analysis_options.yaml
Normal file
18
tests/compiler/dart2js/analysis_options.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
# 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.
|
||||
|
||||
analyzer:
|
||||
strong-mode: true
|
||||
|
||||
language:
|
||||
enableSuperMixins: false
|
||||
|
||||
errors:
|
||||
todo: ignore
|
||||
|
||||
deprecated_member_use: ignore
|
||||
|
||||
exclude:
|
||||
- data/*
|
||||
- sourcemaps/data/*
|
|
@ -7,7 +7,6 @@ library analyze_api;
|
|||
import 'package:sdk_library_metadata/libraries.dart';
|
||||
import 'analyze_helper.dart';
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
|
||||
|
||||
/**
|
||||
* Map of white-listed warnings and errors.
|
||||
|
|
|
@ -132,8 +132,8 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler {
|
|||
}
|
||||
|
||||
@override
|
||||
void report(Message message, Uri uri, int begin, int end, String text,
|
||||
api.Diagnostic kind) {
|
||||
void report(covariant Message message, Uri uri, int begin, int end,
|
||||
String text, api.Diagnostic kind) {
|
||||
if (kind == api.Diagnostic.WARNING) {
|
||||
if (checkWhiteList(uri, message, text)) {
|
||||
// Suppress whitelisted warnings.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue