| Index: pkg/compiler/lib/src/constants/constructors.dart
|
| diff --git a/pkg/compiler/lib/src/constants/constructors.dart b/pkg/compiler/lib/src/constants/constructors.dart
|
| index 7faf5933f6e2fde3a23cc1a1f8c578a1c2e1b271..49cf3e2bb1cefad5bdc4cf9186d2d55f2cb71e47 100644
|
| --- a/pkg/compiler/lib/src/constants/constructors.dart
|
| +++ b/pkg/compiler/lib/src/constants/constructors.dart
|
| @@ -18,6 +18,7 @@ enum ConstantConstructorKind {
|
| GENERATIVE,
|
| REDIRECTING_GENERATIVE,
|
| REDIRECTING_FACTORY,
|
| + ERRONEOUS,
|
| }
|
|
|
| /// Definition of a constant constructor.
|
| @@ -34,6 +35,8 @@ abstract class ConstantConstructor {
|
| List<ConstantExpression> arguments,
|
| CallStructure callStructure);
|
|
|
| + ConstructorElement get parentConstructor;
|
| +
|
| accept(ConstantConstructorVisitor visitor, arg);
|
| }
|
|
|
| @@ -49,6 +52,7 @@ abstract class ConstantConstructorVisitor<R, A> {
|
| RedirectingGenerativeConstantConstructor constructor, A arg);
|
| R visitRedirectingFactory(
|
| RedirectingFactoryConstantConstructor constructor, A arg);
|
| + R visitErroneous(ErroneousConstantConstructor constructor, A arg);
|
| }
|
|
|
| /// A generative constant constructor.
|
| @@ -70,6 +74,13 @@ class GenerativeConstantConstructor implements ConstantConstructor{
|
| return type.substByContext(newType);
|
| }
|
|
|
| + ConstructorElement get parentConstructor {
|
| + if (superConstructorInvocation != null) {
|
| + return superConstructorInvocation.target;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| Map<FieldElement, ConstantExpression> computeInstanceFields(
|
| List<ConstantExpression> arguments,
|
| CallStructure callStructure) {
|
| @@ -162,6 +173,10 @@ class RedirectingGenerativeConstantConstructor implements ConstantConstructor {
|
| return ConstantConstructorKind.REDIRECTING_GENERATIVE;
|
| }
|
|
|
| + ConstructorElement get parentConstructor {
|
| + return thisConstructorInvocation.target;
|
| + }
|
| +
|
| InterfaceType computeInstanceType(InterfaceType newType) {
|
| return thisConstructorInvocation.computeInstanceType()
|
| .substByContext(newType);
|
| @@ -218,6 +233,10 @@ class RedirectingFactoryConstantConstructor implements ConstantConstructor {
|
| return ConstantConstructorKind.REDIRECTING_FACTORY;
|
| }
|
|
|
| + ConstructorElement get parentConstructor {
|
| + return targetConstructorInvocation.target;
|
| + }
|
| +
|
| InterfaceType computeInstanceType(InterfaceType newType) {
|
| return targetConstructorInvocation.computeInstanceType()
|
| .substByContext(newType);
|
| @@ -253,3 +272,31 @@ class RedirectingFactoryConstantConstructor implements ConstantConstructor {
|
| return sb.toString();
|
| }
|
| }
|
| +
|
| +/// An erroneous constant constructor.
|
| +class ErroneousConstantConstructor implements ConstantConstructor {
|
| + const ErroneousConstantConstructor();
|
| +
|
| + @override
|
| + accept(ConstantConstructorVisitor visitor, arg) {
|
| + return visitor.visitErroneous(this, arg);
|
| + }
|
| +
|
| + @override
|
| + Map<FieldElement, ConstantExpression> computeInstanceFields(
|
| + List<ConstantExpression> arguments, CallStructure callStructure) {
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + InterfaceType computeInstanceType(InterfaceType newType) {
|
| + throw new UnsupportedError(
|
| + 'ErroneousConstantConstructor.computeInstanceType is unsupported.');
|
| + }
|
| +
|
| + @override
|
| + ConstantConstructorKind get kind => ConstantConstructorKind.ERRONEOUS;
|
| +
|
| + @override
|
| + ConstructorElement get parentConstructor => null;
|
| +}
|
|
|