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

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 1187953005: Fix last column calculation in scanForLocalVariableLocations (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | 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 part of service; 5 part of service;
6 6
7 /// An RpcException represents an exceptional event that happened 7 /// An RpcException represents an exceptional event that happened
8 /// while invoking an rpc. 8 /// while invoking an rpc.
9 abstract class RpcException implements Exception { 9 abstract class RpcException implements Exception {
10 RpcException(this.message); 10 RpcException(this.message);
(...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 2541
2542 // Result. 2542 // Result.
2543 var r = <LocalVarLocation>[]; 2543 var r = <LocalVarLocation>[];
2544 2544
2545 // Limits. 2545 // Limits.
2546 final lastLine = tokenToLine(endTokenPos); 2546 final lastLine = tokenToLine(endTokenPos);
2547 if (lastLine == null) { 2547 if (lastLine == null) {
2548 return r; 2548 return r;
2549 } 2549 }
2550 2550
2551 final lastColumn = tokenToCol(endTokenPos); 2551 var lastColumn = tokenToCol(endTokenPos);
2552 if (lastColumn == null) { 2552 if (lastColumn == null) {
2553 return r; 2553 return r;
2554 } 2554 }
2555 // Current scan position. 2555 // Current scan position.
2556 var line = tokenToLine(tokenPos); 2556 var line = tokenToLine(tokenPos);
2557 if (line == null) { 2557 if (line == null) {
2558 return r; 2558 return r;
2559 } 2559 }
2560 var column = tokenToCol(tokenPos); 2560 var column = tokenToCol(tokenPos);
2561 if (column == null) { 2561 if (column == null) {
2562 return r; 2562 return r;
2563 } 2563 }
2564 2564
2565 // Move back by name length. 2565 // Move back by name length.
2566 // TODO(johnmccutchan): Fix LocalVarDescriptor to set column before the 2566 // TODO(johnmccutchan): Fix LocalVarDescriptor to set column before the
2567 // identifier name. 2567 // identifier name.
2568 column = math.max(0, column - name.length); 2568 column = math.max(0, column - name.length);
2569 2569
2570 var lineContents; 2570 var lineContents;
2571 2571
2572 if (line == lastLine) { 2572 if (line == lastLine) {
2573 // Only one line. 2573 // Only one line.
2574 if (!getLine(line).isTrivialLine) { 2574 if (!getLine(line).isTrivialLine) {
2575 // TODO(johnmccutchan): end token pos -> column can lie for snapshotted
2576 // code. e.g.:
2577 // io_sink.dart source line 23 ends at column 39
2578 // io_sink.dart snapshotted source line 23 ends at column 35.
2579 lastColumn = math.min(getLine(line).text.length, lastColumn);
2575 lineContents = getLine(line).text.substring(column, lastColumn - 1); 2580 lineContents = getLine(line).text.substring(column, lastColumn - 1);
2576 return scanLineForLocalVariableLocations(pattern, 2581 return scanLineForLocalVariableLocations(pattern,
2577 name, 2582 name,
2578 lineContents, 2583 lineContents,
2579 line, 2584 line,
2580 column); 2585 column);
2581 } 2586 }
2582 } 2587 }
2583 2588
2584 // Scan first line. 2589 // Scan first line.
(...skipping 16 matching lines...) Expand all
2601 r.addAll( 2606 r.addAll(
2602 scanLineForLocalVariableLocations(pattern, 2607 scanLineForLocalVariableLocations(pattern,
2603 name, 2608 name,
2604 lineContents, 2609 lineContents,
2605 line++, 2610 line++,
2606 0)); 2611 0));
2607 } 2612 }
2608 2613
2609 // Scan last line. 2614 // Scan last line.
2610 if (!getLine(line).isTrivialLine) { 2615 if (!getLine(line).isTrivialLine) {
2616 // TODO(johnmccutchan): end token pos -> column can lie for snapshotted
2617 // code. e.g.:
2618 // io_sink.dart source line 23 ends at column 39
2619 // io_sink.dart snapshotted source line 23 ends at column 35.
2620 lastColumn = math.min(getLine(line).text.length, lastColumn);
2611 lineContents = getLine(line).text.substring(0, lastColumn - 1); 2621 lineContents = getLine(line).text.substring(0, lastColumn - 1);
2612 r.addAll( 2622 r.addAll(
2613 scanLineForLocalVariableLocations(pattern, 2623 scanLineForLocalVariableLocations(pattern,
2614 name, 2624 name,
2615 lineContents, 2625 lineContents,
2616 line, 2626 line,
2617 0)); 2627 0));
2618 } 2628 }
2619 return r; 2629 return r;
2620 } 2630 }
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 var v = list[i]; 3345 var v = list[i];
3336 if ((v is ObservableMap) && _isServiceMap(v)) { 3346 if ((v is ObservableMap) && _isServiceMap(v)) {
3337 list[i] = owner.getFromMap(v); 3347 list[i] = owner.getFromMap(v);
3338 } else if (v is ObservableList) { 3348 } else if (v is ObservableList) {
3339 _upgradeObservableList(v, owner); 3349 _upgradeObservableList(v, owner);
3340 } else if (v is ObservableMap) { 3350 } else if (v is ObservableMap) {
3341 _upgradeObservableMap(v, owner); 3351 _upgradeObservableMap(v, owner);
3342 } 3352 }
3343 } 3353 }
3344 } 3354 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698