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

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

Issue 1248483008: Split MessageKind into a MessageKind key and a MessageTemplate. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update 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 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 that maps spans of Dart AST nodes to spans of 5 /// Source information system that maps spans of Dart AST nodes to spans of
6 /// JavaScript nodes. 6 /// JavaScript nodes.
7 7
8 library dart2js.source_information.start_end; 8 library dart2js.source_information.start_end;
9 9
10 import '../dart2jslib.dart' show 10 import '../dart2jslib.dart' show
11 MessageKind, 11 MessageKind,
12 MessageTemplate,
12 SourceSpan; 13 SourceSpan;
13 import '../elements/elements.dart' show 14 import '../elements/elements.dart' show
14 AstElement, 15 AstElement,
15 LocalElement; 16 LocalElement;
16 import '../js/js.dart' as js; 17 import '../js/js.dart' as js;
17 import '../js/js_source_mapping.dart'; 18 import '../js/js_source_mapping.dart';
18 import '../scanner/scannerlib.dart' show Token; 19 import '../scanner/scannerlib.dart' show Token;
19 import '../tree/tree.dart' show Node, Send; 20 import '../tree/tree.dart' show Node, Send;
20 21
21 import 'source_file.dart'; 22 import 'source_file.dart';
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 SourceLocation sourceFileLocationForToken(Token token) { 176 SourceLocation sourceFileLocationForToken(Token token) {
176 SourceLocation location = 177 SourceLocation location =
177 new OffsetSourceLocation(sourceFile, token.charOffset, name); 178 new OffsetSourceLocation(sourceFile, token.charOffset, name);
178 checkValidSourceFileLocation(location, sourceFile, token.charOffset); 179 checkValidSourceFileLocation(location, sourceFile, token.charOffset);
179 return location; 180 return location;
180 } 181 }
181 182
182 void checkValidSourceFileLocation( 183 void checkValidSourceFileLocation(
183 SourceLocation location, SourceFile sourceFile, int offset) { 184 SourceLocation location, SourceFile sourceFile, int offset) {
184 if (!location.isValid) { 185 if (!location.isValid) {
185 throw MessageKind.INVALID_SOURCE_FILE_LOCATION.message( 186 throw MessageTemplate.TEMPLATES[MessageKind.INVALID_SOURCE_FILE_LOCATION]
186 {'offset': offset, 187 .message(
187 'fileName': sourceFile.filename, 188 {'offset': offset,
188 'length': sourceFile.length}); 189 'fileName': sourceFile.filename,
190 'length': sourceFile.length});
189 } 191 }
190 } 192 }
191 193
192 @override 194 @override
193 SourceInformation buildLoop(Node node) { 195 SourceInformation buildLoop(Node node) {
194 return new StartEndSourceInformation( 196 return new StartEndSourceInformation(
195 sourceFileLocationForToken(node.getBeginToken()), 197 sourceFileLocationForToken(node.getBeginToken()),
196 sourceFileLocationForToken(node.getEndToken())); 198 sourceFileLocationForToken(node.getEndToken()));
197 } 199 }
198 200
(...skipping 25 matching lines...) Expand all
224 226
225 @override 227 @override
226 SourceInformationBuilder forContext( 228 SourceInformationBuilder forContext(
227 AstElement element, {SourceInformation sourceInformation}) { 229 AstElement element, {SourceInformation sourceInformation}) {
228 return new StartEndSourceInformationBuilder(element); 230 return new StartEndSourceInformationBuilder(element);
229 } 231 }
230 } 232 }
231 233
232 234
233 235
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698