| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 @override | 132 @override |
| 133 void register(js.Node node, int codeOffset, SourceLocation sourceLocation) { | 133 void register(js.Node node, int codeOffset, SourceLocation sourceLocation) { |
| 134 nodeToSourceLocationsMap.register(node, codeOffset, sourceLocation); | 134 nodeToSourceLocationsMap.register(node, codeOffset, sourceLocation); |
| 135 sourceMapper.register(node, codeOffset, sourceLocation); | 135 sourceMapper.register(node, codeOffset, sourceLocation); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 /// A wrapper of [SourceInformationProcessor] that records source locations and | 139 /// A wrapper of [SourceInformationProcessor] that records source locations and |
| 140 /// code positions. | 140 /// code positions. |
| 141 class RecordingSourceInformationProcessor | 141 class RecordingSourceInformationProcessor extends SourceInformationProcessor { |
| 142 implements SourceInformationProcessor { | |
| 143 final RecordingSourceInformationStrategy wrapper; | 142 final RecordingSourceInformationStrategy wrapper; |
| 144 final SourceInformationProcessor processor; | 143 final SourceInformationProcessor processor; |
| 145 final CodePositionRecorder codePositions; | 144 final CodePositionRecorder codePositions; |
| 146 final LocationMap nodeToSourceLocationsMap; | 145 final LocationMap nodeToSourceLocationsMap; |
| 147 | 146 |
| 148 RecordingSourceInformationProcessor(this.wrapper, this.processor, | 147 RecordingSourceInformationProcessor(this.wrapper, this.processor, |
| 149 this.codePositions, this.nodeToSourceLocationsMap); | 148 this.codePositions, this.nodeToSourceLocationsMap); |
| 150 | 149 |
| 151 @override | 150 @override |
| 152 void onPositions( | 151 void onPositions( |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 absoluteUri = base.resolveUri(uri); | 550 absoluteUri = base.resolveUri(uri); |
| 552 } else { | 551 } else { |
| 553 absoluteUri = base.resolve(uri); | 552 absoluteUri = base.resolve(uri); |
| 554 } | 553 } |
| 555 return sourceFiles.putIfAbsent(absoluteUri, () { | 554 return sourceFiles.putIfAbsent(absoluteUri, () { |
| 556 String text = new File.fromUri(absoluteUri).readAsStringSync(); | 555 String text = new File.fromUri(absoluteUri).readAsStringSync(); |
| 557 return new StringSourceFile.fromUri(absoluteUri, text); | 556 return new StringSourceFile.fromUri(absoluteUri, text); |
| 558 }); | 557 }); |
| 559 } | 558 } |
| 560 } | 559 } |
| OLD | NEW |