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

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

Issue 1052243003: Issue 23081. Fix for inlining into IndexExpression index. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | pkg/analysis_server/test/services/refactoring/inline_local_test.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' 9 import 'package:analysis_server/src/protocol.dart'
10 show SourceChange, SourceEdit; 10 show SourceChange, SourceEdit;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 * Returns [getExpressionPrecedence] for the parent of [node], 254 * Returns [getExpressionPrecedence] for the parent of [node],
255 * or `0` if the parent node is [ParenthesizedExpression]. 255 * or `0` if the parent node is [ParenthesizedExpression].
256 * 256 *
257 * The reason is that `(expr)` is always executed after `expr`. 257 * The reason is that `(expr)` is always executed after `expr`.
258 */ 258 */
259 int getExpressionParentPrecedence(AstNode node) { 259 int getExpressionParentPrecedence(AstNode node) {
260 AstNode parent = node.parent; 260 AstNode parent = node.parent;
261 if (parent is ParenthesizedExpression) { 261 if (parent is ParenthesizedExpression) {
262 return 0; 262 return 0;
263 } 263 }
264 if (parent is IndexExpression && parent.index == node) {
265 return 0;
266 }
264 return getExpressionPrecedence(parent); 267 return getExpressionPrecedence(parent);
265 } 268 }
266 269
267 /** 270 /**
268 * Returns the precedence of [node] it is an [Expression], negative otherwise. 271 * Returns the precedence of [node] it is an [Expression], negative otherwise.
269 */ 272 */
270 int getExpressionPrecedence(AstNode node) { 273 int getExpressionPrecedence(AstNode node) {
271 if (node is Expression) { 274 if (node is Expression) {
272 return node.precedence; 275 return node.precedence;
273 } 276 }
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 1559
1557 @override 1560 @override
1558 Object visitExpression(Expression node) { 1561 Object visitExpression(Expression node) {
1559 if (node is BinaryExpression && node.operator.type == groupOperatorType) { 1562 if (node is BinaryExpression && node.operator.type == groupOperatorType) {
1560 return super.visitNode(node); 1563 return super.visitNode(node);
1561 } 1564 }
1562 operands.add(node); 1565 operands.add(node);
1563 return null; 1566 return null;
1564 } 1567 }
1565 } 1568 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/refactoring/inline_local_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698