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

Side by Side Diff: pkg/compiler/lib/src/io/position_information.dart

Issue 1916053003: Add toStructuredText to ConstantExpression and align method names with ConstantValue (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: dartfmt Created 4 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
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 '../common.dart'; 10 import '../common.dart';
11 import '../elements/elements.dart' show AstElement, FieldElement, ResolvedAst, R esolvedAstKind; 11 import '../elements/elements.dart'
12 show AstElement, FieldElement, ResolvedAst, ResolvedAstKind;
12 import '../js/js.dart' as js; 13 import '../js/js.dart' as js;
13 import '../js/js_debug.dart'; 14 import '../js/js_debug.dart';
14 import '../js/js_source_mapping.dart'; 15 import '../js/js_source_mapping.dart';
15 import '../tree/tree.dart' show FunctionExpression, Node, Send; 16 import '../tree/tree.dart' show FunctionExpression, Node, Send;
16 import 'code_output.dart' show CodeBuffer; 17 import 'code_output.dart' show CodeBuffer;
17 import 'source_file.dart'; 18 import 'source_file.dart';
18 import 'source_information.dart'; 19 import 'source_information.dart';
19 20
20 /// [SourceInformation] that consists of an offset position into the source 21 /// [SourceInformation] that consists of an offset position into the source
21 /// code. 22 /// code.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 final AstElement element; 144 final AstElement element;
144 145
145 PositionSourceInformationBuilder(AstElement element) 146 PositionSourceInformationBuilder(AstElement element)
146 : this.element = element, 147 : this.element = element,
147 sourceFile = element.implementation.compilationUnit.script.file, 148 sourceFile = element.implementation.compilationUnit.script.file,
148 name = computeElementNameForSourceMaps(element); 149 name = computeElementNameForSourceMaps(element);
149 150
150 SourceInformation buildDeclaration(ResolvedAst resolvedAst) { 151 SourceInformation buildDeclaration(ResolvedAst resolvedAst) {
151 if (resolvedAst.kind != ResolvedAstKind.PARSED) { 152 if (resolvedAst.kind != ResolvedAstKind.PARSED) {
152 SourceSpan span = resolvedAst.element.sourcePosition; 153 SourceSpan span = resolvedAst.element.sourcePosition;
153 return new PositionSourceInformation(new OffsetSourceLocation( 154 return new PositionSourceInformation(
154 sourceFile, span.begin, name)); 155 new OffsetSourceLocation(sourceFile, span.begin, name));
155 } else { 156 } else {
156 return new PositionSourceInformation( 157 return new PositionSourceInformation(
157 new OffsetSourceLocation(sourceFile, 158 new OffsetSourceLocation(
158 resolvedAst.node.getBeginToken().charOffset, name), 159 sourceFile, resolvedAst.node.getBeginToken().charOffset, name),
159 new OffsetSourceLocation(sourceFile, 160 new OffsetSourceLocation(
160 resolvedAst.node.getEndToken().charOffset, name)); 161 sourceFile, resolvedAst.node.getEndToken().charOffset, name));
161 } 162 }
162 } 163 }
163 164
164 /// Builds a source information object pointing the start position of [node]. 165 /// Builds a source information object pointing the start position of [node].
165 SourceInformation buildBegin(Node node) { 166 SourceInformation buildBegin(Node node) {
166 return new PositionSourceInformation(new OffsetSourceLocation( 167 return new PositionSourceInformation(new OffsetSourceLocation(
167 sourceFile, node.getBeginToken().charOffset, name)); 168 sourceFile, node.getBeginToken().charOffset, name));
168 } 169 }
169 170
170 @override 171 @override
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 1282
1282 @override 1283 @override
1283 CodePosition operator [](js.Node node) { 1284 CodePosition operator [](js.Node node) {
1284 CodePosition codePosition = codePositions[node]; 1285 CodePosition codePosition = codePositions[node];
1285 if (codePosition == null) { 1286 if (codePosition == null) {
1286 coverage.registerNodesWithoutOffset(node); 1287 coverage.registerNodesWithoutOffset(node);
1287 } 1288 }
1288 return codePosition; 1289 return codePosition;
1289 } 1290 }
1290 } 1291 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/type_graph_dump.dart ('k') | pkg/compiler/lib/src/io/start_end_information.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698