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

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: Updated cf. comments. 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
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..56b88d13703a055c4452ceb7e980b66345facc79 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 when both `a` and `b` are compiled into
+ // 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) {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/type_propagation.dart ('k') | pkg/compiler/lib/src/io/source_information.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698