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

Side by Side Diff: tests/compiler/dart2js/sourcemaps/output_structure.dart

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. Created 3 years, 6 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library sourcemap.output_structure; 5 library sourcemap.output_structure;
6 6
7 import 'dart:math' as Math; 7 import 'dart:math' as Math;
8 import 'html_parts.dart' show Annotation, CodeLine, JsonStrategy; 8 import 'html_parts.dart' show CodeLine, JsonStrategy;
9 9
10 // Constants used to identify the subsection of the JavaScript output. These 10 // Constants used to identify the subsection of the JavaScript output. These
11 // are specifically for the unminified full_emitter output. 11 // are specifically for the unminified full_emitter output.
12 const String HEAD = ' var dart = ['; 12 const String HEAD = ' var dart = [';
13 const String TAIL = ' }], '; 13 const String TAIL = ' }], ';
14 const String END = ' setupProgram(dart'; 14 const String END = ' setupProgram(dart';
15 15
16 final RegExp TOP_LEVEL_VALUE = new RegExp(r'^ (".+?"):'); 16 final RegExp TOP_LEVEL_VALUE = new RegExp(r'^ (".+?"):');
17 final RegExp TOP_LEVEL_FUNCTION = 17 final RegExp TOP_LEVEL_FUNCTION =
18 new RegExp(r'^ ([a-zA-Z0-9_$]+): \[?function'); 18 new RegExp(r'^ ([a-zA-Z0-9_$]+): \[?function');
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (line.code.startsWith(END)) { 176 if (line.code.startsWith(END)) {
177 return index; 177 return index;
178 } 178 }
179 index++; 179 index++;
180 } 180 }
181 return lines.length; 181 return lines.length;
182 } 182 }
183 183
184 String readHeader(CodeLine line) { 184 String readHeader(CodeLine line) {
185 String code = line.code; 185 String code = line.code;
186 String ssaLineHeader;
187 if (code.startsWith(HEAD)) { 186 if (code.startsWith(HEAD)) {
188 return code.substring(HEAD.length); 187 return code.substring(HEAD.length);
189 } else if (code.startsWith(TAIL)) { 188 } else if (code.startsWith(TAIL)) {
190 return code.substring(TAIL.length); 189 return code.substring(TAIL.length);
191 } 190 }
192 return null; 191 return null;
193 } 192 }
194 193
195 List<LibraryBlock> computeHeaderMap( 194 List<LibraryBlock> computeHeaderMap(
196 List<CodeLine> lines, int start, int end) { 195 List<CodeLine> lines, int start, int end) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 ..to = to 315 ..to = to
317 ..codeSource = codeSource; 316 ..codeSource = codeSource;
318 json['children'].forEach( 317 json['children'].forEach(
319 (child) => statics.children.add(fromJson(child, strategy))); 318 (child) => statics.children.add(fromJson(child, strategy)));
320 return statics; 319 return statics;
321 case EntityKind.STATIC_FUNCTION: 320 case EntityKind.STATIC_FUNCTION:
322 return new StaticFunction(name, from) 321 return new StaticFunction(name, from)
323 ..to = to 322 ..to = to
324 ..codeSource = codeSource; 323 ..codeSource = codeSource;
325 } 324 }
325 throw "Unhandled: $kind";
326 } 326 }
327 } 327 }
328 328
329 /// A block defining the content of a Dart library. 329 /// A block defining the content of a Dart library.
330 class LibraryBlock extends AbstractEntity { 330 class LibraryBlock extends AbstractEntity {
331 List<BasicEntity> children = <BasicEntity>[]; 331 List<BasicEntity> children = <BasicEntity>[];
332 int get headerEnd => from + 2; 332 int get headerEnd => from + 2;
333 int get footerStart => to /* - 1*/; 333 int get footerStart => to /* - 1*/;
334 334
335 LibraryBlock(String name, int from) : super(name, from); 335 LibraryBlock(String name, int from) : super(name, from);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 } 709 }
710 710
711 static CodeSource fromJson(Map json) { 711 static CodeSource fromJson(Map json) {
712 if (json == null) return null; 712 if (json == null) return null;
713 CodeSource codeSource = new CodeSource(CodeKind.values[json['kind']], 713 CodeSource codeSource = new CodeSource(CodeKind.values[json['kind']],
714 Uri.parse(json['uri']), json['name'], json['begin'], json['end']); 714 Uri.parse(json['uri']), json['name'], json['begin'], json['end']);
715 json['members'].forEach((m) => codeSource.members.add(fromJson(m))); 715 json['members'].forEach((m) => codeSource.members.add(fromJson(m)));
716 return codeSource; 716 return codeSource;
717 } 717 }
718 } 718 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/nomapping_test.dart ('k') | tests/compiler/dart2js/sourcemaps/sourcemap_html_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698