| Index: pkg/compiler/lib/src/io/start_end_information.dart
|
| diff --git a/pkg/compiler/lib/src/io/start_end_information.dart b/pkg/compiler/lib/src/io/start_end_information.dart
|
| index 71a3aec938bfb458bc3b69a14b6d9375f79f6cf2..3840b77b93eb8eba0117ebd46e224d7959281994 100644
|
| --- a/pkg/compiler/lib/src/io/start_end_information.dart
|
| +++ b/pkg/compiler/lib/src/io/start_end_information.dart
|
| @@ -7,12 +7,13 @@
|
|
|
| library dart2js.source_information.start_end;
|
|
|
| +import 'package:front_end/src/fasta/scanner.dart' show Token;
|
| +
|
| import '../common.dart';
|
| import '../diagnostics/messages.dart' show MessageTemplate;
|
| import '../elements/elements.dart' show ResolvedAst, ResolvedAstKind;
|
| import '../js/js.dart' as js;
|
| import '../js/js_source_mapping.dart';
|
| -import 'package:front_end/src/fasta/scanner.dart' show Token;
|
| import '../tree/tree.dart' show Node;
|
| import 'source_file.dart';
|
| import 'source_information.dart';
|
| @@ -117,13 +118,25 @@ class StartEndSourceInformationStrategy
|
| }
|
|
|
| @override
|
| - SourceInformationProcessor createProcessor(SourceMapper sourceMapper) {
|
| - return new StartEndSourceInformationProcessor(sourceMapper);
|
| + SourceInformationProcessor createProcessor(
|
| + SourceMapperProvider provider, SourceInformationReader reader) {
|
| + return new StartEndSourceInformationProcessor(provider, reader);
|
| }
|
| }
|
|
|
| class StartEndSourceInformationProcessor extends SourceInformationProcessor {
|
| + /// The id for this source information engine.
|
| + ///
|
| + /// The id is added to the source map file in an extra "engine" property and
|
| + /// serves as a version number for the engine.
|
| + ///
|
| + /// The version history of this engine is:
|
| + ///
|
| + /// v1: The initial version with an id.
|
| + static const String id = 'v1';
|
| +
|
| final SourceMapper sourceMapper;
|
| + final SourceInformationReader reader;
|
|
|
| /// Used to track whether a terminating source location marker has been
|
| /// registered for the top-most node with source information.
|
| @@ -137,7 +150,8 @@ class StartEndSourceInformationProcessor extends SourceInformationProcessor {
|
| /// [NoSourceLocationMarker] after areas with source information.
|
| js.Node subRoot;
|
|
|
| - StartEndSourceInformationProcessor(this.sourceMapper);
|
| + StartEndSourceInformationProcessor(SourceMapperProvider provider, this.reader)
|
| + : this.sourceMapper = provider.createSourceMapper(id);
|
|
|
| void onStartPosition(js.Node node, int startPosition) {
|
| if (root == null) {
|
| @@ -145,7 +159,7 @@ class StartEndSourceInformationProcessor extends SourceInformationProcessor {
|
| sourceMapper.register(
|
| node, startPosition, const NoSourceLocationMarker());
|
| }
|
| - if (subRoot == null && node.sourceInformation != null) {
|
| + if (subRoot == null && reader.getSourceInformation(node) != null) {
|
| subRoot = node;
|
| }
|
| }
|
| @@ -153,8 +167,9 @@ class StartEndSourceInformationProcessor extends SourceInformationProcessor {
|
| @override
|
| void onPositions(
|
| js.Node node, int startPosition, int endPosition, int closingPosition) {
|
| - if (node.sourceInformation != null) {
|
| - StartEndSourceInformation sourceInformation = node.sourceInformation;
|
| + StartEndSourceInformation sourceInformation =
|
| + reader.getSourceInformation(node);
|
| + if (sourceInformation != null) {
|
| sourceMapper.register(
|
| node, startPosition, sourceInformation.startPosition);
|
| if (sourceInformation.endPosition != null) {
|
|
|