Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1711433002: Deprecate old "isPotentiallyMutated..." API. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 12602 matching lines...) Expand 10 before | Expand all | Expand 10 after
12613 if (parent is Label) { 12613 if (parent is Label) {
12614 return null; 12614 return null;
12615 } 12615 }
12616 // Prepare VariableElement. 12616 // Prepare VariableElement.
12617 Element element = nameScope.lookup(node, definingLibrary); 12617 Element element = nameScope.lookup(node, definingLibrary);
12618 if (element is! VariableElement) { 12618 if (element is! VariableElement) {
12619 return null; 12619 return null;
12620 } 12620 }
12621 // Must be local or parameter. 12621 // Must be local or parameter.
12622 ElementKind kind = element.kind; 12622 ElementKind kind = element.kind;
12623 if (kind == ElementKind.LOCAL_VARIABLE) { 12623 if (kind == ElementKind.LOCAL_VARIABLE || kind == ElementKind.PARAMETER) {
12624 node.staticElement = element; 12624 node.staticElement = element;
12625 LocalVariableElementImpl variableImpl =
12626 element as LocalVariableElementImpl;
12627 if (node.inSetterContext()) { 12625 if (node.inSetterContext()) {
12628 variableImpl.markPotentiallyMutatedInScope();
12629 _localVariableInfo.potentiallyMutatedInScope.add(element); 12626 _localVariableInfo.potentiallyMutatedInScope.add(element);
12630 if (element.enclosingElement != _enclosingFunction) { 12627 if (element.enclosingElement != _enclosingFunction) {
12631 variableImpl.markPotentiallyMutatedInClosure();
12632 _localVariableInfo.potentiallyMutatedInClosure.add(element); 12628 _localVariableInfo.potentiallyMutatedInClosure.add(element);
12633 } 12629 }
12634 } 12630 }
12635 } else if (kind == ElementKind.PARAMETER) {
12636 node.staticElement = element;
12637 if (node.inSetterContext()) {
12638 ParameterElementImpl parameterImpl = element as ParameterElementImpl;
12639 parameterImpl.markPotentiallyMutatedInScope();
12640 _localVariableInfo.potentiallyMutatedInScope.add(element);
12641 // If we are in some closure, check if it is not the same as where
12642 // variable is declared.
12643 if (_enclosingFunction != null &&
12644 (element.enclosingElement != _enclosingFunction)) {
12645 parameterImpl.markPotentiallyMutatedInClosure();
12646 _localVariableInfo.potentiallyMutatedInClosure.add(element);
12647 }
12648 }
12649 } 12631 }
12650 return null; 12632 return null;
12651 } 12633 }
12652 12634
12653 @override 12635 @override
12654 Object visitTypeName(TypeName node) { 12636 Object visitTypeName(TypeName node) {
12655 return null; 12637 return null;
12656 } 12638 }
12657 } 12639 }
12658 12640
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
12802 nonFields.add(node); 12784 nonFields.add(node);
12803 return null; 12785 return null;
12804 } 12786 }
12805 12787
12806 @override 12788 @override
12807 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 12789 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
12808 12790
12809 @override 12791 @override
12810 Object visitWithClause(WithClause node) => null; 12792 Object visitWithClause(WithClause node) => null;
12811 } 12793 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698