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

Side by Side Diff: pkg/analysis_server/lib/src/services/refactoring/extract_local.dart

Issue 1131423002: Clean up many generated constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment change Created 5 years, 7 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
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 services.src.refactoring.extract_local; 5 library services.src.refactoring.extract_local;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/protocol_server.dart' hide Element; 10 import 'package:analysis_server/src/protocol_server.dart' hide Element;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 312 }
313 return target; 313 return target;
314 } 314 }
315 315
316 /** 316 /**
317 * Returns [AstNode]s at the offsets of the given [SourceRange]s. 317 * Returns [AstNode]s at the offsets of the given [SourceRange]s.
318 */ 318 */
319 List<AstNode> _findNodes(List<SourceRange> ranges) { 319 List<AstNode> _findNodes(List<SourceRange> ranges) {
320 List<AstNode> nodes = <AstNode>[]; 320 List<AstNode> nodes = <AstNode>[];
321 for (SourceRange range in ranges) { 321 for (SourceRange range in ranges) {
322 AstNode node = new NodeLocator.con1(range.offset).searchWithin(unit); 322 AstNode node = new NodeLocator(range.offset).searchWithin(unit);
323 nodes.add(node); 323 nodes.add(node);
324 } 324 }
325 return nodes; 325 return nodes;
326 } 326 }
327 327
328 /** 328 /**
329 * Returns the [ExpressionFunctionBody] that encloses [node], or `null` 329 * Returns the [ExpressionFunctionBody] that encloses [node], or `null`
330 * if [node] is not enclosed with an [ExpressionFunctionBody]. 330 * if [node] is not enclosed with an [ExpressionFunctionBody].
331 */ 331 */
332 ExpressionFunctionBody _getEnclosingExpressionBody(AstNode node) { 332 ExpressionFunctionBody _getEnclosingExpressionBody(AstNode node) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 { 395 {
396 String rawSelectionSource = utils.getRangeText(selectionRange); 396 String rawSelectionSource = utils.getRangeText(selectionRange);
397 List<Token> selectionTokens = TokenUtils.getTokens(rawSelectionSource); 397 List<Token> selectionTokens = TokenUtils.getTokens(rawSelectionSource);
398 selectionSource = 398 selectionSource =
399 _encodeExpressionTokens(rootExpression, selectionTokens); 399 _encodeExpressionTokens(rootExpression, selectionTokens);
400 } 400 }
401 // prepare enclosing function 401 // prepare enclosing function
402 AstNode enclosingFunction; 402 AstNode enclosingFunction;
403 { 403 {
404 AstNode selectionNode = 404 AstNode selectionNode =
405 new NodeLocator.con1(selectionOffset).searchWithin(unit); 405 new NodeLocator(selectionOffset).searchWithin(unit);
406 enclosingFunction = getEnclosingExecutableNode(selectionNode); 406 enclosingFunction = getEnclosingExecutableNode(selectionNode);
407 } 407 }
408 // visit function 408 // visit function
409 enclosingFunction 409 enclosingFunction
410 .accept(new _OccurrencesVisitor(this, occurrences, selectionSource)); 410 .accept(new _OccurrencesVisitor(this, occurrences, selectionSource));
411 } 411 }
412 412
413 void _prepareOffsetsLengths() { 413 void _prepareOffsetsLengths() {
414 offsets.clear(); 414 offsets.clear();
415 lengths.clear(); 415 lengths.clear();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 _TokenLocalElementVisitor(this.map); 598 _TokenLocalElementVisitor(this.map);
599 599
600 visitSimpleIdentifier(SimpleIdentifier node) { 600 visitSimpleIdentifier(SimpleIdentifier node) {
601 Element element = node.staticElement; 601 Element element = node.staticElement;
602 if (element is LocalVariableElement) { 602 if (element is LocalVariableElement) {
603 map[node.token] = element; 603 map[node.token] = element;
604 } 604 }
605 } 605 }
606 } 606 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698