| Index: pkg/analyzer/lib/src/dart/ast/ast.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
|
| index dafbff2a599875377fb12b9562bb0fff78fe640c..4a9826ee757dc032867fbdddfca18f88e424ee9c 100644
|
| --- a/pkg/analyzer/lib/src/dart/ast/ast.dart
|
| +++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
|
| @@ -4722,6 +4722,13 @@ class ForStatementImpl extends StatementImpl implements ForStatement {
|
| */
|
| abstract class FunctionBodyImpl extends AstNodeImpl implements FunctionBody {
|
| /**
|
| + * Additional information about local variables and parameters that are
|
| + * declared within this function body or any enclosing function body. `null`
|
| + * if resolution has not yet been performed.
|
| + */
|
| + LocalVariableInfo localVariableInfo;
|
| +
|
| + /**
|
| * Return `true` if this function body is asynchronous.
|
| */
|
| bool get isAsynchronous => false;
|
| @@ -4747,6 +4754,22 @@ abstract class FunctionBodyImpl extends AstNodeImpl implements FunctionBody {
|
| * is no star.
|
| */
|
| Token get star => null;
|
| +
|
| + @override
|
| + bool isPotentiallyMutatedInClosure(VariableElement variable) {
|
| + if (localVariableInfo == null) {
|
| + throw new StateError('Resolution has not yet been performed');
|
| + }
|
| + return localVariableInfo.potentiallyMutatedInClosure.contains(variable);
|
| + }
|
| +
|
| + @override
|
| + bool isPotentiallyMutatedInScope(VariableElement variable) {
|
| + if (localVariableInfo == null) {
|
| + throw new StateError('Resolution has not yet been performed');
|
| + }
|
| + return localVariableInfo.potentiallyMutatedInScope.contains(variable);
|
| + }
|
| }
|
|
|
| /**
|
| @@ -6557,6 +6580,26 @@ abstract class LiteralImpl extends ExpressionImpl implements Literal {
|
| }
|
|
|
| /**
|
| + * Additional information about local variables within a function or method
|
| + * produced at resolution time.
|
| + */
|
| +class LocalVariableInfo {
|
| + /**
|
| + * The set of local variables and parameters that are potentially mutated
|
| + * within a local function other than the function in which they are declared.
|
| + */
|
| + final Set<VariableElement> potentiallyMutatedInClosure =
|
| + new Set<VariableElement>();
|
| +
|
| + /**
|
| + * The set of local variables and parameters that are potentiall mutated
|
| + * within the scope of their declarations.
|
| + */
|
| + final Set<VariableElement> potentiallyMutatedInScope =
|
| + new Set<VariableElement>();
|
| +}
|
| +
|
| +/**
|
| * A single key/value pair in a map literal.
|
| *
|
| * > mapLiteralEntry ::=
|
|
|