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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// Source information system mapping that attempts a semantic mapping between 5 /// Source information system mapping that attempts a semantic mapping between
6 /// offsets of JavaScript code points to offsets of Dart code points. 6 /// offsets of JavaScript code points to offsets of Dart code points.
7 7
8 library dart2js.source_information.position; 8 library dart2js.source_information.position;
9 9
10 import '../dart2jslib.dart' show 10 import '../dart2jslib.dart' show
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 new OffsetSourceLocation(sourceFile, 165 new OffsetSourceLocation(sourceFile,
166 element.resolvedAst.node.getEndToken().charOffset, name)); 166 element.resolvedAst.node.getEndToken().charOffset, name));
167 } 167 }
168 } 168 }
169 169
170 170
171 @override 171 @override
172 SourceInformation buildLoop(Node node) => buildBegin(node); 172 SourceInformation buildLoop(Node node) => buildBegin(node);
173 173
174 @override 174 @override
175 SourceInformation buildGet(Node node) => buildBegin(node); 175 SourceInformation buildGet(Node node) {
176 Node left = node;
177 Node right = node;
178 Send send = node.asSend();
179 if (send != null) {
180 right = send.selector;
181 }
182 // For a read access like `a.b` the first source locations points to the
183 // left-most part of the access, `a` in the example, and the second source
184 // location points to the 'name' of accessed property, `b` in the
185 // 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.
186 // JavaScript invocations.
187 return new PositionSourceInformation(
188 new OffsetSourceLocation(
189 sourceFile, left.getBeginToken().charOffset, name),
190 new OffsetSourceLocation(
191 sourceFile, right.getBeginToken().charOffset, name));
192 }
176 193
177 @override 194 @override
178 SourceInformation buildCall(Node receiver, Node call) { 195 SourceInformation buildCall(Node receiver, Node call) {
179 return new PositionSourceInformation( 196 return new PositionSourceInformation(
180 new OffsetSourceLocation( 197 new OffsetSourceLocation(
181 sourceFile, receiver.getBeginToken().charOffset, name), 198 sourceFile, receiver.getBeginToken().charOffset, name),
182 new OffsetSourceLocation( 199 new OffsetSourceLocation(
183 sourceFile, call.getBeginToken().charOffset, name)); 200 sourceFile, call.getBeginToken().charOffset, name));
184 } 201 }
185 202
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 450
434 @override 451 @override
435 void onPositions(js.Node node, 452 void onPositions(js.Node node,
436 int startPosition, 453 int startPosition,
437 int endPosition, 454 int endPosition,
438 int closingPosition) { 455 int closingPosition) {
439 codePositions.registerPositions( 456 codePositions.registerPositions(
440 node, startPosition, endPosition, closingPosition); 457 node, startPosition, endPosition, closingPosition);
441 } 458 }
442 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698