| Index: sdk/lib/_internal/compiler/implementation/elements/modelx.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
|
| index 1ea7a23e8d21d4eccf6346b944dabd76a0547fcc..d1ad31e07858a4a55278d2958e883af5b7e65910 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
|
| @@ -317,6 +317,7 @@ class ErroneousElementX extends ElementX implements ErroneousElement {
|
| get origin => unsupported();
|
| get defaultImplementation => unsupported();
|
|
|
| + bool get isRedirectingFactory => unsupported();
|
| bool get isPatched => unsupported();
|
| bool get isPatch => unsupported();
|
|
|
| @@ -1093,6 +1094,38 @@ class FunctionSignatureX implements FunctionSignature {
|
| }
|
|
|
| int get parameterCount => requiredParameterCount + optionalParameterCount;
|
| +
|
| + /**
|
| + * Check whether a function with this signature can be used instead of a
|
| + * function with signature [signature] without causing a `noSuchMethod`
|
| + * exception/call.
|
| + */
|
| + bool isCompatibleWith(FunctionSignature signature) {
|
| + if (optionalParametersAreNamed != signature.optionalParametersAreNamed) {
|
| + return false;
|
| + }
|
| + if (optionalParametersAreNamed) {
|
| + if (requiredParameterCount != signature.requiredParameterCount) {
|
| + return false;
|
| + }
|
| + for (Element namedParameter in signature.optionalParameters) {
|
| + if (!optionalParameters.contains(namedParameter)) {
|
| + return false;
|
| + }
|
| + }
|
| + } else {
|
| + // There must be at least as many arguments as in the other signature, but
|
| + // this signature must not have more required paramters. Having more
|
| + // optional parameters is not a problem, they simply are never provided
|
| + // by call sites of a call to a method with the other signature.
|
| + if (requiredParameterCount > signature.requiredParameterCount ||
|
| + requiredParameterCount < signature.parameterCount ||
|
| + parameterCount < signature.parameterCount) {
|
| + return false;
|
| + }
|
| + }
|
| + return true;
|
| + }
|
| }
|
|
|
| class FunctionElementX extends ElementX implements FunctionElement {
|
| @@ -1152,6 +1185,8 @@ class FunctionElementX extends ElementX implements FunctionElement {
|
| bool get isPatched => patch != null;
|
| bool get isPatch => origin != null;
|
|
|
| + bool get isRedirectingFactory => defaultImplementation != this;
|
| +
|
| FunctionElement get redirectionTarget {
|
| if (this == defaultImplementation) return this;
|
| var target = defaultImplementation;
|
|
|