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

Unified Diff: pkg/compiler/lib/src/io/position_information.dart

Issue 1250633002: Add operators test to source_mapping_test. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/io/position_information.dart
diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart
index 416d7ea2c1a4e6c8d328c49cb84b2a3ed7e3c3bb..f7cdf7b6994c824d1acb6ee286f874b5ae3fd5f7 100644
--- a/pkg/compiler/lib/src/io/position_information.dart
+++ b/pkg/compiler/lib/src/io/position_information.dart
@@ -172,7 +172,24 @@ class PositionSourceInformationBuilder implements SourceInformationBuilder {
SourceInformation buildLoop(Node node) => buildBegin(node);
@override
- SourceInformation buildGet(Node node) => buildBegin(node);
+ SourceInformation buildGet(Node node) {
+ Node left = node;
+ Node right = node;
+ Send send = node.asSend();
+ if (send != null) {
+ right = send.selector;
+ }
+ // For a read access like `a.b` the first source locations points to the
+ // left-most part of the access, `a` in the example, and the second source
+ // location points to the 'name' of accessed property, `b` in the
+ // example. The latter is needed if when both `a` and `b` are compiled into
karlklose 2015/07/22 09:06:48 'if' or 'when' - you decide.
Johnni Winther 2015/07/22 10:50:05 Done.
+ // JavaScript invocations.
+ return new PositionSourceInformation(
+ new OffsetSourceLocation(
+ sourceFile, left.getBeginToken().charOffset, name),
+ new OffsetSourceLocation(
+ sourceFile, right.getBeginToken().charOffset, name));
+ }
@override
SourceInformation buildCall(Node receiver, Node call) {

Powered by Google App Engine
This is Rietveld 408576698