| Index: pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| index 2e0d063e80d1220a2c72c794010625cd64a073d0..6243f47f13c8b058261503dc35b691c6d67beebf 100644
|
| --- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| +++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
|
| @@ -422,7 +422,8 @@ class ConstantEvaluationEngine {
|
| List<Expression> arguments,
|
| ConstructorElement constructor,
|
| ConstantVisitor constantVisitor,
|
| - ErrorReporter errorReporter) {
|
| + ErrorReporter errorReporter,
|
| + {ConstructorInvocation invocation}) {
|
| if (!getConstructorImpl(constructor).isCycleFree) {
|
| // It's not safe to evaluate this constructor, so bail out.
|
| // TODO(paulberry): ensure that a reasonable error message is produced
|
| @@ -434,6 +435,7 @@ class ConstantEvaluationEngine {
|
| int argumentCount = arguments.length;
|
| List<DartObjectImpl> argumentValues =
|
| new List<DartObjectImpl>(argumentCount);
|
| + List<DartObjectImpl> positionalArguments = <DartObjectImpl>[];
|
| List<Expression> argumentNodes = new List<Expression>(argumentCount);
|
| HashMap<String, DartObjectImpl> namedArgumentValues =
|
| new HashMap<String, DartObjectImpl>();
|
| @@ -448,10 +450,16 @@ class ConstantEvaluationEngine {
|
| namedArgumentNodes[name] = argument;
|
| argumentValues[i] = typeProvider.nullObject;
|
| } else {
|
| - argumentValues[i] = constantVisitor._valueOf(argument);
|
| + var argumentValue = constantVisitor._valueOf(argument);
|
| + argumentValues[i] = argumentValue;
|
| + positionalArguments.add(argumentValue);
|
| argumentNodes[i] = argument;
|
| }
|
| }
|
| + if (invocation == null) {
|
| + invocation = new ConstructorInvocation(
|
| + constructor, positionalArguments, namedArgumentValues);
|
| + }
|
| constructor = followConstantRedirectionChain(constructor);
|
| InterfaceType definingClass = constructor.returnType as InterfaceType;
|
| if (constructor.isFactory) {
|
| @@ -709,7 +717,8 @@ class ConstantEvaluationEngine {
|
| initializer.argumentList.arguments,
|
| constructor,
|
| initializerVisitor,
|
| - errorReporter);
|
| + errorReporter,
|
| + invocation: invocation);
|
| }
|
| }
|
| }
|
| @@ -727,7 +736,8 @@ class ConstantEvaluationEngine {
|
| superArguments, initializerVisitor, errorReporter);
|
| }
|
| }
|
| - return new DartObjectImpl(definingClass, new GenericState(fieldMap));
|
| + return new DartObjectImpl(
|
| + definingClass, new GenericState(fieldMap, invocation: invocation));
|
| }
|
|
|
| void evaluateSuperConstructorCall(
|
|
|