OLD | NEW |
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 library sourcemap.helper; | 5 library sourcemap.helper; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'package:compiler/compiler_new.dart'; | 9 import 'package:compiler/compiler_new.dart'; |
10 import 'package:compiler/src/apiimpl.dart' as api; | 10 import 'package:compiler/src/apiimpl.dart' as api; |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 RecordingSourceInformationStrategy strategy = | 330 RecordingSourceInformationStrategy strategy = |
331 new RecordingSourceInformationStrategy( | 331 new RecordingSourceInformationStrategy( |
332 backend.sourceInformationStrategy); | 332 backend.sourceInformationStrategy); |
333 backend.sourceInformationStrategy = strategy; | 333 backend.sourceInformationStrategy = strategy; |
334 await compiler.run(inputUri); | 334 await compiler.run(inputUri); |
335 | 335 |
336 SourceMapInfo mainSourceMapInfo; | 336 SourceMapInfo mainSourceMapInfo; |
337 Map<Element, SourceMapInfo> elementSourceMapInfos = | 337 Map<Element, SourceMapInfo> elementSourceMapInfos = |
338 <Element, SourceMapInfo>{}; | 338 <Element, SourceMapInfo>{}; |
339 if (perElement) { | 339 if (perElement) { |
340 backend.generatedCode.forEach((Element element, js.Expression node) { | 340 backend.generatedCode |
| 341 .forEach((MemberElement element, js.Expression node) { |
341 RecordedSourceInformationProcess subProcess = | 342 RecordedSourceInformationProcess subProcess = |
342 strategy.subProcessForNode(node); | 343 strategy.subProcessForNode(node); |
343 if (subProcess == null) { | 344 if (subProcess == null) { |
344 // TODO(johnniwinther): Find out when this is happening and if it | 345 // TODO(johnniwinther): Find out when this is happening and if it |
345 // is benign. (Known to happen for `bool#fromString`) | 346 // is benign. (Known to happen for `bool#fromString`) |
346 print('No subProcess found for $element'); | 347 print('No subProcess found for $element'); |
347 return; | 348 return; |
348 } | 349 } |
349 LocationMap nodeMap = subProcess.nodeToSourceLocationsMap; | 350 LocationMap nodeMap = subProcess.nodeToSourceLocationsMap; |
350 String code = subProcess.code; | 351 String code = subProcess.code; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 absoluteUri = base.resolveUri(uri); | 570 absoluteUri = base.resolveUri(uri); |
570 } else { | 571 } else { |
571 absoluteUri = base.resolve(uri); | 572 absoluteUri = base.resolve(uri); |
572 } | 573 } |
573 return sourceFiles.putIfAbsent(absoluteUri, () { | 574 return sourceFiles.putIfAbsent(absoluteUri, () { |
574 String text = new File.fromUri(absoluteUri).readAsStringSync(); | 575 String text = new File.fromUri(absoluteUri).readAsStringSync(); |
575 return new StringSourceFile.fromUri(absoluteUri, text); | 576 return new StringSourceFile.fromUri(absoluteUri, text); |
576 }); | 577 }); |
577 } | 578 } |
578 } | 579 } |
OLD | NEW |