| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 new JavaScriptTracer(codePositions, [visitor]).apply(node); | 381 new JavaScriptTracer(codePositions, [visitor]).apply(node); |
| 382 List<CodePoint> codePoints = visitor.codePoints; | 382 List<CodePoint> codePoints = visitor.codePoints; |
| 383 mainSourceMapInfo = new SourceMapInfo( | 383 mainSourceMapInfo = new SourceMapInfo( |
| 384 null, code, node, | 384 null, code, node, |
| 385 codePoints, | 385 codePoints, |
| 386 codePositions, | 386 codePositions, |
| 387 nodeMap); | 387 nodeMap); |
| 388 } | 388 } |
| 389 | 389 |
| 390 return new SourceMaps( | 390 return new SourceMaps( |
| 391 sourceFileManager, mainSourceMapInfo, elementSourceMapInfos); | 391 compiler, |
| 392 sourceFileManager, |
| 393 mainSourceMapInfo, |
| 394 elementSourceMapInfos); |
| 392 } | 395 } |
| 393 } | 396 } |
| 394 | 397 |
| 395 class SourceMaps { | 398 class SourceMaps { |
| 399 final api.CompilerImpl compiler; |
| 396 final SourceFileManager sourceFileManager; | 400 final SourceFileManager sourceFileManager; |
| 397 // TODO(johnniwinther): Supported multiple output units. | 401 // TODO(johnniwinther): Supported multiple output units. |
| 398 final SourceMapInfo mainSourceMapInfo; | 402 final SourceMapInfo mainSourceMapInfo; |
| 399 final Map<Element, SourceMapInfo> elementSourceMapInfos; | 403 final Map<Element, SourceMapInfo> elementSourceMapInfos; |
| 400 | 404 |
| 401 SourceMaps( | 405 SourceMaps( |
| 406 this.compiler, |
| 402 this.sourceFileManager, | 407 this.sourceFileManager, |
| 403 this.mainSourceMapInfo, | 408 this.mainSourceMapInfo, |
| 404 this.elementSourceMapInfos); | 409 this.elementSourceMapInfos); |
| 405 } | 410 } |
| 406 | 411 |
| 407 /// Source mapping information for the JavaScript code of an [Element]. | 412 /// Source mapping information for the JavaScript code of an [Element]. |
| 408 class SourceMapInfo { | 413 class SourceMapInfo { |
| 409 final String name; | 414 final String name; |
| 410 final Element element; | 415 final Element element; |
| 411 final String code; | 416 final String code; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 absoluteUri = base.resolveUri(uri); | 593 absoluteUri = base.resolveUri(uri); |
| 589 } else { | 594 } else { |
| 590 absoluteUri = base.resolve(uri); | 595 absoluteUri = base.resolve(uri); |
| 591 } | 596 } |
| 592 return sourceFiles.putIfAbsent(absoluteUri, () { | 597 return sourceFiles.putIfAbsent(absoluteUri, () { |
| 593 String text = new File.fromUri(absoluteUri).readAsStringSync(); | 598 String text = new File.fromUri(absoluteUri).readAsStringSync(); |
| 594 return new StringSourceFile.fromUri(absoluteUri, text); | 599 return new StringSourceFile.fromUri(absoluteUri, text); |
| 595 }); | 600 }); |
| 596 } | 601 } |
| 597 } | 602 } |
| OLD | NEW |