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

Side by Side Diff: pkg/compiler/lib/src/dart2js.dart

Issue 839323003: Implementation of async-await transformation on js ast. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 5 years, 10 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 | 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;
118 bool allowNativeExtensions = false; 117 bool allowNativeExtensions = false;
119 bool trustTypeAnnotations = false; 118 bool trustTypeAnnotations = false;
120 bool trustPrimitives = false; 119 bool trustPrimitives = false;
121 bool checkedMode = false; 120 bool checkedMode = false;
122 // List of provided options that imply that output is expected. 121 // List of provided options that imply that output is expected.
123 List<String> optionsImplyCompilation = <String>[]; 122 List<String> optionsImplyCompilation = <String>[];
124 bool hasDisallowUnsafeEval = false; 123 bool hasDisallowUnsafeEval = false;
125 // TODO(johnniwinther): Measure time for reading files. 124 // TODO(johnniwinther): Measure time for reading files.
126 SourceFileProvider inputProvider = new CompilerSourceFileProvider(); 125 SourceFileProvider inputProvider = new CompilerSourceFileProvider();
127 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider); 126 diagnosticHandler = new FormattingDiagnosticHandler(inputProvider);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 setAnalyzeOnly(String argument) { 184 setAnalyzeOnly(String argument) {
186 analyzeOnly = true; 185 analyzeOnly = true;
187 passThrough(argument); 186 passThrough(argument);
188 } 187 }
189 188
190 setAnalyzeAll(String argument) { 189 setAnalyzeAll(String argument) {
191 analyzeAll = true; 190 analyzeAll = true;
192 passThrough(argument); 191 passThrough(argument);
193 } 192 }
194 193
195 setEnableAsync(String argument) {
196 enableAsyncAwait = true;
197 passThrough(argument);
198 }
199
200 setAllowNativeExtensions(String argument) { 194 setAllowNativeExtensions(String argument) {
201 allowNativeExtensions = true; 195 allowNativeExtensions = true;
202 passThrough(argument); 196 passThrough(argument);
203 } 197 }
204 198
205 setVerbose(_) { 199 setVerbose(_) {
206 diagnosticHandler.verbose = true; 200 diagnosticHandler.verbose = true;
207 passThrough('--verbose'); 201 passThrough('--verbose');
208 } 202 }
209 203
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 new OptionHandler('--categories=.*', setCategories), 327 new OptionHandler('--categories=.*', setCategories),
334 new OptionHandler('--disable-type-inference', implyCompilation), 328 new OptionHandler('--disable-type-inference', implyCompilation),
335 new OptionHandler('--terse', passThrough), 329 new OptionHandler('--terse', passThrough),
336 new OptionHandler('--deferred-map=.+', implyCompilation), 330 new OptionHandler('--deferred-map=.+', implyCompilation),
337 new OptionHandler('--dump-info', implyCompilation), 331 new OptionHandler('--dump-info', implyCompilation),
338 new OptionHandler('--disallow-unsafe-eval', 332 new OptionHandler('--disallow-unsafe-eval',
339 (_) => hasDisallowUnsafeEval = true), 333 (_) => hasDisallowUnsafeEval = true),
340 new OptionHandler('--show-package-warnings', passThrough), 334 new OptionHandler('--show-package-warnings', passThrough),
341 new OptionHandler('--csp', passThrough), 335 new OptionHandler('--csp', passThrough),
342 new OptionHandler('--enable-experimental-mirrors', passThrough), 336 new OptionHandler('--enable-experimental-mirrors', passThrough),
343 new OptionHandler('--enable-async', setEnableAsync), 337 new OptionHandler('--enable-async', (_) {
338 diagnosticHandler.info(
339 "Option '--enable-async' is no longer needed. "
340 "Async-await is supported by default.",
341 api.Diagnostic.HINT);
342 }),
344 new OptionHandler('--enable-enum', (_) { 343 new OptionHandler('--enable-enum', (_) {
345 diagnosticHandler.info( 344 diagnosticHandler.info(
346 "Option '--enable-enum' is no longer needed. " 345 "Option '--enable-enum' is no longer needed. "
347 "Enums are supported by default.", 346 "Enums are supported by default.",
348 api.Diagnostic.HINT); 347 api.Diagnostic.HINT);
349 }), 348 }),
350 new OptionHandler('--allow-native-extensions', setAllowNativeExtensions), 349 new OptionHandler('--allow-native-extensions', setAllowNativeExtensions),
351 new OptionHandler('--generate-code-with-compile-time-errors', passThrough), 350 new OptionHandler('--generate-code-with-compile-time-errors', passThrough),
352 351
353 // The following three options must come last. 352 // The following three options must come last.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 "Option '--analyze-all' implies '--analyze-only'.", 402 "Option '--analyze-all' implies '--analyze-only'.",
404 api.Diagnostic.INFO); 403 api.Diagnostic.INFO);
405 } 404 }
406 diagnosticHandler.info( 405 diagnosticHandler.info(
407 "Options $optionsImplyCompilation indicate that output is expected, " 406 "Options $optionsImplyCompilation indicate that output is expected, "
408 "but compilation is turned off by the option '--analyze-only'.", 407 "but compilation is turned off by the option '--analyze-only'.",
409 api.Diagnostic.INFO); 408 api.Diagnostic.INFO);
410 } 409 }
411 if (analyzeAll) analyzeOnly = true; 410 if (analyzeAll) analyzeOnly = true;
412 if (!analyzeOnly) { 411 if (!analyzeOnly) {
413 if (enableAsyncAwait && outputLanguage != OUTPUT_LANGUAGE_DART) {
414 helpAndFail("Option '--enable-async' is currently only supported in "
415 "combination with the '--analyze-only' option.");
416 }
417 if (allowNativeExtensions) { 412 if (allowNativeExtensions) {
418 helpAndFail("Option '--allow-native-extensions' is only supported in " 413 helpAndFail("Option '--allow-native-extensions' is only supported in "
419 "combination with the '--analyze-only' option."); 414 "combination with the '--analyze-only' option.");
420 } 415 }
421 } 416 }
422 417
423 diagnosticHandler.info('Package root is $packageRoot'); 418 diagnosticHandler.info('Package root is $packageRoot');
424 419
425 options.add('--out=$out'); 420 options.add('--out=$out');
426 options.add('--source-map=$sourceMapOut'); 421 options.add('--source-map=$sourceMapOut');
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } else if (exitCode == 253) { 717 } else if (exitCode == 253) {
723 print(">>> TEST CRASH"); 718 print(">>> TEST CRASH");
724 } else { 719 } else {
725 print(">>> TEST FAIL"); 720 print(">>> TEST FAIL");
726 } 721 }
727 stderr.writeln(">>> EOF STDERR"); 722 stderr.writeln(">>> EOF STDERR");
728 subscription.resume(); 723 subscription.resume();
729 }); 724 });
730 }); 725 });
731 } 726 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698