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

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

Issue 1803303002: Move all flags to CompilerOptions (first step to stop passing the compiler to (Closed) Base URL: git@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/mock_compiler.dart ('k') | tests/compiler/dart2js/type_test_helper.dart » ('j') | 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;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 if (add) { 265 if (add) {
266 nodes.add(node); 266 nodes.add(node);
267 } 267 }
268 node.visitChildren(this); 268 node.visitChildren(this);
269 if (node == soughtNode) { 269 if (node == soughtNode) {
270 add = false; 270 add = false;
271 } 271 }
272 } 272 }
273 } 273 }
274 274
275 const String DISABLE_INLINING = '--disable-inlining';
276
277 /// Processor that computes [SourceMapInfo] for the JavaScript compiled for a 275 /// Processor that computes [SourceMapInfo] for the JavaScript compiled for a
278 /// given Dart file. 276 /// given Dart file.
279 class SourceMapProcessor { 277 class SourceMapProcessor {
280 /// If `true` the output from the compilation is written to files. 278 /// If `true` the output from the compilation is written to files.
281 final bool outputToFile; 279 final bool outputToFile;
282 280
283 /// The [Uri] of the Dart entrypoint. 281 /// The [Uri] of the Dart entrypoint.
284 Uri inputUri; 282 Uri inputUri;
285 283
286 /// The name of the JavaScript output file. 284 /// The name of the JavaScript output file.
(...skipping 21 matching lines...) Expand all
308 List<String> options, 306 List<String> options,
309 {bool verbose: true, 307 {bool verbose: true,
310 bool perElement: true, 308 bool perElement: true,
311 bool forMain: false}) async { 309 bool forMain: false}) async {
312 OutputProvider outputProvider = outputToFile 310 OutputProvider outputProvider = outputToFile
313 ? new CloningOutputProvider(targetUri, sourceMapFileUri) 311 ? new CloningOutputProvider(targetUri, sourceMapFileUri)
314 : new OutputProvider(); 312 : new OutputProvider();
315 if (options.contains(Flags.useNewSourceInfo)) { 313 if (options.contains(Flags.useNewSourceInfo)) {
316 if (verbose) print('Using the new source information system.'); 314 if (verbose) print('Using the new source information system.');
317 } 315 }
316 if (options.contains(Flags.disableInlining)) {
317 if (verbose) print('Inlining disabled');
318 }
318 api.CompilerImpl compiler = await compilerFor( 319 api.CompilerImpl compiler = await compilerFor(
319 outputProvider: outputProvider, 320 outputProvider: outputProvider,
320 // TODO(johnniwinther): Use [verbose] to avoid showing diagnostics. 321 // TODO(johnniwinther): Use [verbose] to avoid showing diagnostics.
321 options: ['--out=$targetUri', '--source-map=$sourceMapFileUri'] 322 options: ['--out=$targetUri', '--source-map=$sourceMapFileUri']
322 ..addAll(options)); 323 ..addAll(options));
323 if (options.contains(DISABLE_INLINING)) {
324 if (verbose) print('Inlining disabled');
325 compiler.disableInlining = true;
326 }
327 324
328 JavaScriptBackend backend = compiler.backend; 325 JavaScriptBackend backend = compiler.backend;
329 var handler = compiler.handler; 326 var handler = compiler.handler;
330 SourceFileProvider sourceFileProvider = handler.provider; 327 SourceFileProvider sourceFileProvider = handler.provider;
331 sourceFileManager = new ProviderSourceFileManager( 328 sourceFileManager = new ProviderSourceFileManager(
332 sourceFileProvider, 329 sourceFileProvider,
333 outputProvider); 330 outputProvider);
334 RecordingSourceInformationStrategy strategy = 331 RecordingSourceInformationStrategy strategy =
335 new RecordingSourceInformationStrategy(backend.sourceInformationStrategy ); 332 new RecordingSourceInformationStrategy(backend.sourceInformationStrategy );
336 backend.sourceInformationStrategy = strategy; 333 backend.sourceInformationStrategy = strategy;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 absoluteUri = base.resolveUri(uri); 589 absoluteUri = base.resolveUri(uri);
593 } else { 590 } else {
594 absoluteUri = base.resolve(uri); 591 absoluteUri = base.resolve(uri);
595 } 592 }
596 return sourceFiles.putIfAbsent(absoluteUri, () { 593 return sourceFiles.putIfAbsent(absoluteUri, () {
597 String text = new File.fromUri(absoluteUri).readAsStringSync(); 594 String text = new File.fromUri(absoluteUri).readAsStringSync();
598 return new StringSourceFile.fromUri(absoluteUri, text); 595 return new StringSourceFile.fromUri(absoluteUri, text);
599 }); 596 });
600 } 597 }
601 } 598 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js/type_test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698