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

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

Issue 1750393002: Add --use-new-source-info option (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/diff_view.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
11 import 'package:compiler/src/commandline_options.dart';
11 import 'package:compiler/src/null_compiler_output.dart' show NullSink; 12 import 'package:compiler/src/null_compiler_output.dart' show NullSink;
12 import 'package:compiler/src/elements/elements.dart'; 13 import 'package:compiler/src/elements/elements.dart';
13 import 'package:compiler/src/helpers/helpers.dart'; 14 import 'package:compiler/src/helpers/helpers.dart';
14 import 'package:compiler/src/filenames.dart'; 15 import 'package:compiler/src/filenames.dart';
15 import 'package:compiler/src/io/code_output.dart'; 16 import 'package:compiler/src/io/code_output.dart';
16 import 'package:compiler/src/io/source_file.dart'; 17 import 'package:compiler/src/io/source_file.dart';
17 import 'package:compiler/src/io/source_information.dart'; 18 import 'package:compiler/src/io/source_information.dart';
18 import 'package:compiler/src/io/position_information.dart'; 19 import 'package:compiler/src/io/position_information.dart';
19 import 'package:compiler/src/js/js.dart' as js; 20 import 'package:compiler/src/js/js.dart' as js;
20 import 'package:compiler/src/js/js_debug.dart'; 21 import 'package:compiler/src/js/js_debug.dart';
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (add) { 265 if (add) {
265 nodes.add(node); 266 nodes.add(node);
266 } 267 }
267 node.visitChildren(this); 268 node.visitChildren(this);
268 if (node == soughtNode) { 269 if (node == soughtNode) {
269 add = false; 270 add = false;
270 } 271 }
271 } 272 }
272 } 273 }
273 274
274 const String USE_NEW_SOURCE_INFO = '--use-new-source-info';
275 const String DISABLE_INLINING = '--disable-inlining'; 275 const String DISABLE_INLINING = '--disable-inlining';
276 276
277 /// Processor that computes [SourceMapInfo] for the JavaScript compiled for a 277 /// Processor that computes [SourceMapInfo] for the JavaScript compiled for a
278 /// given Dart file. 278 /// given Dart file.
279 class SourceMapProcessor { 279 class SourceMapProcessor {
280 /// If `true` the output from the compilation is written to files. 280 /// If `true` the output from the compilation is written to files.
281 final bool outputToFile; 281 final bool outputToFile;
282 282
283 /// The [Uri] of the Dart entrypoint. 283 /// The [Uri] of the Dart entrypoint.
284 Uri inputUri; 284 Uri inputUri;
(...skipping 20 matching lines...) Expand all
305 305
306 /// Computes the [SourceMapInfo] for the compiled elements. 306 /// Computes the [SourceMapInfo] for the compiled elements.
307 Future<SourceMaps> process( 307 Future<SourceMaps> process(
308 List<String> options, 308 List<String> options,
309 {bool verbose: true, 309 {bool verbose: true,
310 bool perElement: true, 310 bool perElement: true,
311 bool forMain: false}) async { 311 bool forMain: false}) async {
312 OutputProvider outputProvider = outputToFile 312 OutputProvider outputProvider = outputToFile
313 ? new CloningOutputProvider(targetUri, sourceMapFileUri) 313 ? new CloningOutputProvider(targetUri, sourceMapFileUri)
314 : new OutputProvider(); 314 : new OutputProvider();
315 if (options.contains(USE_NEW_SOURCE_INFO)) { 315 if (options.contains(Flags.useNewSourceInfo)) {
316 if (verbose) print('Using the new source information system.'); 316 if (verbose) print('Using the new source information system.');
317 useNewSourceInfo = true;
318 } 317 }
319 api.CompilerImpl compiler = await compilerFor( 318 api.CompilerImpl compiler = await compilerFor(
320 outputProvider: outputProvider, 319 outputProvider: outputProvider,
321 // TODO(johnniwinther): Use [verbose] to avoid showing diagnostics. 320 // TODO(johnniwinther): Use [verbose] to avoid showing diagnostics.
322 options: ['--out=$targetUri', '--source-map=$sourceMapFileUri'] 321 options: ['--out=$targetUri', '--source-map=$sourceMapFileUri']
323 ..addAll(options)); 322 ..addAll(options));
324 if (options.contains(DISABLE_INLINING)) { 323 if (options.contains(DISABLE_INLINING)) {
325 if (verbose) print('Inlining disabled'); 324 if (verbose) print('Inlining disabled');
326 compiler.disableInlining = true; 325 compiler.disableInlining = true;
327 } 326 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 absoluteUri = base.resolveUri(uri); 587 absoluteUri = base.resolveUri(uri);
589 } else { 588 } else {
590 absoluteUri = base.resolve(uri); 589 absoluteUri = base.resolve(uri);
591 } 590 }
592 return sourceFiles.putIfAbsent(absoluteUri, () { 591 return sourceFiles.putIfAbsent(absoluteUri, () {
593 String text = new File.fromUri(absoluteUri).readAsStringSync(); 592 String text = new File.fromUri(absoluteUri).readAsStringSync();
594 return new StringSourceFile.fromUri(absoluteUri, text); 593 return new StringSourceFile.fromUri(absoluteUri, text);
595 }); 594 });
596 } 595 }
597 } 596 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/sourcemaps/diff_view.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698