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

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

Issue 1053323002: Issue 22988. Improve checking for conflicts between parameters and local elements during extracting… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up. Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/extract_method_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 engine.resolver; 5 library engine.resolver;
6 6
7 import "dart:math" as math; 7 import "dart:math" as math;
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/src/generated/utilities_collection.dart'; 10 import 'package:analyzer/src/generated/utilities_collection.dart';
(...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 } else if (_inFunction) { 3071 } else if (_inFunction) {
3072 SimpleIdentifier variableName = node.name; 3072 SimpleIdentifier variableName = node.name;
3073 LocalVariableElementImpl variable; 3073 LocalVariableElementImpl variable;
3074 if (isConst && hasInitializer) { 3074 if (isConst && hasInitializer) {
3075 variable = new ConstLocalVariableElementImpl.forNode(variableName); 3075 variable = new ConstLocalVariableElementImpl.forNode(variableName);
3076 } else { 3076 } else {
3077 variable = new LocalVariableElementImpl.forNode(variableName); 3077 variable = new LocalVariableElementImpl.forNode(variableName);
3078 } 3078 }
3079 element = variable; 3079 element = variable;
3080 Block enclosingBlock = node.getAncestor((node) => node is Block); 3080 Block enclosingBlock = node.getAncestor((node) => node is Block);
3081 int functionEnd = node.offset + node.length;
3082 int blockEnd = enclosingBlock.offset + enclosingBlock.length;
3083 // TODO(brianwilkerson) This isn't right for variables declared in a for 3081 // TODO(brianwilkerson) This isn't right for variables declared in a for
3084 // loop. 3082 // loop.
3085 variable.setVisibleRange(functionEnd, blockEnd - functionEnd - 1); 3083 variable.setVisibleRange(enclosingBlock.offset, enclosingBlock.length);
3086 _currentHolder.addLocalVariable(variable); 3084 _currentHolder.addLocalVariable(variable);
3087 variableName.staticElement = element; 3085 variableName.staticElement = element;
3088 } else { 3086 } else {
3089 SimpleIdentifier variableName = node.name; 3087 SimpleIdentifier variableName = node.name;
3090 TopLevelVariableElementImpl variable; 3088 TopLevelVariableElementImpl variable;
3091 if (isConst && hasInitializer) { 3089 if (isConst && hasInitializer) {
3092 variable = new ConstTopLevelVariableElementImpl(variableName); 3090 variable = new ConstTopLevelVariableElementImpl(variableName);
3093 } else { 3091 } else {
3094 variable = new TopLevelVariableElementImpl.forNode(variableName); 3092 variable = new TopLevelVariableElementImpl.forNode(variableName);
3095 } 3093 }
(...skipping 12389 matching lines...) Expand 10 before | Expand all | Expand 10 after
15485 nonFields.add(node); 15483 nonFields.add(node);
15486 return null; 15484 return null;
15487 } 15485 }
15488 15486
15489 @override 15487 @override
15490 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 15488 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
15491 15489
15492 @override 15490 @override
15493 Object visitWithClause(WithClause node) => null; 15491 Object visitWithClause(WithClause node) => null;
15494 } 15492 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/extract_method_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698