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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dart2js.dart

Issue 675113002: Support async/await in the dart2js frontend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update unittests Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.cmdline; 5 library dart2js.cmdline;
6 6
7 import 'dart:async' 7 import 'dart:async'
8 show Future, EventSink; 8 show Future, EventSink;
9 import 'dart:convert' show UTF8, LineSplitter; 9 import 'dart:convert' show UTF8, LineSplitter;
10 import 'dart:io' 10 import 'dart:io'
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Uri sourceMapOut = currentDirectory.resolve('out.js.map'); 107 Uri sourceMapOut = currentDirectory.resolve('out.js.map');
108 Uri packageRoot = null; 108 Uri packageRoot = null;
109 List<String> options = new List<String>(); 109 List<String> options = new List<String>();
110 bool explicitOut = false; 110 bool explicitOut = false;
111 bool wantHelp = false; 111 bool wantHelp = false;
112 bool wantVersion = false; 112 bool wantVersion = false;
113 String outputLanguage = 'JavaScript'; 113 String outputLanguage = 'JavaScript';
114 bool stripArgumentSet = false; 114 bool stripArgumentSet = false;
115 bool analyzeOnly = false; 115 bool analyzeOnly = false;
116 bool analyzeAll = false; 116 bool analyzeAll = false;
117 bool enableAsyncAwait = false;
117 bool trustTypeAnnotations = false; 118 bool trustTypeAnnotations = false;
118 bool checkedMode = false; 119 bool checkedMode = false;
119 // List of provided options that imply that output is expected. 120 // List of provided options that imply that output is expected.
120 List<String> optionsImplyCompilation = <String>[]; 121 List<String> optionsImplyCompilation = <String>[];
121 bool hasDisallowUnsafeEval = false; 122 bool hasDisallowUnsafeEval = false;
122 // TODO(johnniwinther): Measure time for reading files. 123 // TODO(johnniwinther): Measure time for reading files.
123 SourceFileProvider inputProvider = new CompilerSourceFileProvider(); 124 SourceFileProvider inputProvider = new CompilerSourceFileProvider();
124 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); 125 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider);
125 Map<String, dynamic> environment = new Map<String, dynamic>(); 126 Map<String, dynamic> environment = new Map<String, dynamic>();
126 127
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 setAnalyzeOnly(String argument) { 183 setAnalyzeOnly(String argument) {
183 analyzeOnly = true; 184 analyzeOnly = true;
184 passThrough(argument); 185 passThrough(argument);
185 } 186 }
186 187
187 setAnalyzeAll(String argument) { 188 setAnalyzeAll(String argument) {
188 analyzeAll = true; 189 analyzeAll = true;
189 passThrough(argument); 190 passThrough(argument);
190 } 191 }
191 192
193 setEnableAsync(String argument) {
194 enableAsyncAwait = true;
195 passThrough(argument);
196 }
197
192 setVerbose(_) { 198 setVerbose(_) {
193 diagnosticHandler.verbose = true; 199 diagnosticHandler.verbose = true;
194 passThrough('--verbose'); 200 passThrough('--verbose');
195 } 201 }
196 202
197 implyCompilation(String argument) { 203 implyCompilation(String argument) {
198 optionsImplyCompilation.add(argument); 204 optionsImplyCompilation.add(argument);
199 passThrough(argument); 205 passThrough(argument);
200 } 206 }
201 207
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 new OptionHandler('--analyze-signatures-only', setAnalyzeOnly), 316 new OptionHandler('--analyze-signatures-only', setAnalyzeOnly),
311 new OptionHandler('--disable-native-live-type-analysis', passThrough), 317 new OptionHandler('--disable-native-live-type-analysis', passThrough),
312 new OptionHandler('--categories=.*', setCategories), 318 new OptionHandler('--categories=.*', setCategories),
313 new OptionHandler('--disable-type-inference', implyCompilation), 319 new OptionHandler('--disable-type-inference', implyCompilation),
314 new OptionHandler('--terse', passThrough), 320 new OptionHandler('--terse', passThrough),
315 new OptionHandler('--dump-info', implyCompilation), 321 new OptionHandler('--dump-info', implyCompilation),
316 new OptionHandler('--disallow-unsafe-eval', 322 new OptionHandler('--disallow-unsafe-eval',
317 (_) => hasDisallowUnsafeEval = true), 323 (_) => hasDisallowUnsafeEval = true),
318 new OptionHandler('--show-package-warnings', passThrough), 324 new OptionHandler('--show-package-warnings', passThrough),
319 new OptionHandler('--csp', passThrough), 325 new OptionHandler('--csp', passThrough),
326 new OptionHandler('--enable-async', setEnableAsync),
320 new OptionHandler('-D.+=.*', addInEnvironment), 327 new OptionHandler('-D.+=.*', addInEnvironment),
321 328
322 // The following two options must come last. 329 // The following two options must come last.
323 new OptionHandler('-.*', (String argument) { 330 new OptionHandler('-.*', (String argument) {
324 helpAndFail("Unknown option '$argument'."); 331 helpAndFail("Unknown option '$argument'.");
325 }), 332 }),
326 new OptionHandler('.*', (String argument) { 333 new OptionHandler('.*', (String argument) {
327 arguments.add(nativeToUriPath(argument)); 334 arguments.add(nativeToUriPath(argument));
328 }) 335 })
329 ]; 336 ];
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 diagnosticHandler.info( 377 diagnosticHandler.info(
371 "Option '--analyze-all' implies '--analyze-only'.", 378 "Option '--analyze-all' implies '--analyze-only'.",
372 api.Diagnostic.INFO); 379 api.Diagnostic.INFO);
373 } 380 }
374 diagnosticHandler.info( 381 diagnosticHandler.info(
375 "Options $optionsImplyCompilation indicate that output is expected, " 382 "Options $optionsImplyCompilation indicate that output is expected, "
376 "but compilation is turned off by the option '--analyze-only'.", 383 "but compilation is turned off by the option '--analyze-only'.",
377 api.Diagnostic.INFO); 384 api.Diagnostic.INFO);
378 } 385 }
379 if (analyzeAll) analyzeOnly = true; 386 if (analyzeAll) analyzeOnly = true;
387 if (enableAsyncAwait && !analyzeOnly) {
388 helpAndFail("Option '--enable-async' currently only supported together "
floitsch 2014/11/03 17:55:54 ... is currently ... ... in combination with ...
Johnni Winther 2014/11/04 12:24:33 Done.
389 "with the '--analyze-only' option.");
390 }
380 391
381 diagnosticHandler.info('Package root is $packageRoot'); 392 diagnosticHandler.info('Package root is $packageRoot');
382 393
383 options.add('--out=$out'); 394 options.add('--out=$out');
384 options.add('--source-map=$sourceMapOut'); 395 options.add('--source-map=$sourceMapOut');
385 396
386 RandomAccessFileOutputProvider outputProvider = 397 RandomAccessFileOutputProvider outputProvider =
387 new RandomAccessFileOutputProvider( 398 new RandomAccessFileOutputProvider(
388 out, sourceMapOut, onInfo: diagnosticHandler.info, onFailure: fail); 399 out, sourceMapOut, onInfo: diagnosticHandler.info, onFailure: fail);
389 400
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 } else if (exitCode == 253) { 679 } else if (exitCode == 253) {
669 print(">>> TEST CRASH"); 680 print(">>> TEST CRASH");
670 } else { 681 } else {
671 print(">>> TEST FAIL"); 682 print(">>> TEST FAIL");
672 } 683 }
673 stderr.writeln(">>> EOF STDERR"); 684 stderr.writeln(">>> EOF STDERR");
674 subscription.resume(); 685 subscription.resume();
675 }); 686 });
676 }); 687 });
677 } 688 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698