| Index: pkg/analyzer/lib/src/dart/constant/value.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/constant/value.dart b/pkg/analyzer/lib/src/dart/constant/value.dart
|
| index a927df61a25e54153166a5a6ec2f78c9bf38275f..91d79cf9b931def496abd7b8dd53e623c6a71172 100644
|
| --- a/pkg/analyzer/lib/src/dart/constant/value.dart
|
| +++ b/pkg/analyzer/lib/src/dart/constant/value.dart
|
| @@ -136,6 +136,29 @@ class BoolState extends InstanceState {
|
| }
|
|
|
| /**
|
| + * Information about a const constructor invocation.
|
| + */
|
| +class ConstructorInvocation {
|
| + /**
|
| + * The constructor that was called.
|
| + */
|
| + final ConstructorElement constructor;
|
| +
|
| + /**
|
| + * The positional arguments passed to the constructor.
|
| + */
|
| + final List<DartObjectImpl> positionalArguments;
|
| +
|
| + /**
|
| + * The named arguments passed to the constructor.
|
| + */
|
| + final Map<String, DartObjectImpl> namedArguments;
|
| +
|
| + ConstructorInvocation(
|
| + this.constructor, this.positionalArguments, this.namedArguments);
|
| +}
|
| +
|
| +/**
|
| * A representation of an instance of a Dart class.
|
| */
|
| class DartObjectImpl implements DartObject {
|
| @@ -375,6 +398,16 @@ class DartObjectImpl implements DartObject {
|
| return null;
|
| }
|
|
|
| + /// Gets the constructor that was called to create this value, if this is a
|
| + /// const constructor invocation. Otherwise returns null.
|
| + ConstructorInvocation getInvocation() {
|
| + InstanceState state = _state;
|
| + if (state is GenericState) {
|
| + return state.invocation;
|
| + }
|
| + return null;
|
| + }
|
| +
|
| /**
|
| * Return the result of invoking the '>' operator on this object with the
|
| * [rightOperand]. The [typeProvider] is the type provider used to find known
|
| @@ -1322,10 +1355,15 @@ class GenericState extends InstanceState {
|
| final HashMap<String, DartObjectImpl> _fieldMap;
|
|
|
| /**
|
| + * Information about the constructor invoked to generate this instance.
|
| + */
|
| + final ConstructorInvocation invocation;
|
| +
|
| + /**
|
| * Initialize a newly created state to represent a newly created object. The
|
| * [fieldMap] contains the values of the fields of the instance.
|
| */
|
| - GenericState(this._fieldMap);
|
| + GenericState(this._fieldMap, {this.invocation});
|
|
|
| @override
|
| HashMap<String, DartObjectImpl> get fields => _fieldMap;
|
|
|