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

Side by Side Diff: pkg/analysis_server/lib/src/services/correction/util.dart

Issue 515733002: 'Inline Local' refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 | « no previous file | pkg/analysis_server/lib/src/services/refactoring/inline_local.dart » ('j') | 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 services.src.correction.util; 5 library services.src.correction.util;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 8
9 import 'package:analysis_server/src/protocol.dart' show SourceEdit; 9 import 'package:analysis_server/src/protocol.dart' show SourceEdit;
10 import 'package:analysis_server/src/services/correction/source_range.dart'; 10 import 'package:analysis_server/src/services/correction/source_range.dart';
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 * [SourceRange] from [oldIndent] to [newIndent], keeping indentation of lines 404 * [SourceRange] from [oldIndent] to [newIndent], keeping indentation of lines
405 * relative to each other. 405 * relative to each other.
406 */ 406 */
407 SourceEdit createIndentEdit(SourceRange range, String oldIndent, 407 SourceEdit createIndentEdit(SourceRange range, String oldIndent,
408 String newIndent) { 408 String newIndent) {
409 String newSource = replaceSourceRangeIndent(range, oldIndent, newIndent); 409 String newSource = replaceSourceRangeIndent(range, oldIndent, newIndent);
410 return new SourceEdit(range.offset, range.length, newSource); 410 return new SourceEdit(range.offset, range.length, newSource);
411 } 411 }
412 412
413 /** 413 /**
414 * Returns the [AstNode] that encloses the given offset.
415 */
416 AstNode findNode(int offset) => new NodeLocator.con1(offset).searchWithin(unit );
417
418 /**
414 * Returns the actual type source of the given [Expression], may be `null` 419 * Returns the actual type source of the given [Expression], may be `null`
415 * if can not be resolved, should be treated as the `dynamic` type. 420 * if can not be resolved, should be treated as the `dynamic` type.
416 */ 421 */
417 String getExpressionTypeSource(Expression expression) { 422 String getExpressionTypeSource(Expression expression) {
418 if (expression == null) { 423 if (expression == null) {
419 return null; 424 return null;
420 } 425 }
421 DartType type = expression.bestType; 426 DartType type = expression.bestType;
422 if (type.isDynamic) { 427 if (type.isDynamic) {
423 return null; 428 return null;
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 1278
1274 @override 1279 @override
1275 Object visitExpression(Expression node) { 1280 Object visitExpression(Expression node) {
1276 if (node is BinaryExpression && node.operator.type == groupOperatorType) { 1281 if (node is BinaryExpression && node.operator.type == groupOperatorType) {
1277 return super.visitNode(node); 1282 return super.visitNode(node);
1278 } 1283 }
1279 operands.add(node); 1284 operands.add(node);
1280 return null; 1285 return null;
1281 } 1286 }
1282 } 1287 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/refactoring/inline_local.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698