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

Unified Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 675113002: Support async/await in the dart2js frontend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 589baba80f7ce1d98cdd8c26a2dead9fbda5d8d1..fad4298d35af97a8d80cc6d5b4c10ba27292c562 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -718,6 +718,9 @@ abstract class Compiler implements DiagnosticListener {
final bool suppressWarnings;
+ /// `true` if async/await features are supported.
+ final bool enableAsyncAwait;
+
/// If `true`, some values are cached for reuse in incremental compilation.
/// Incremental compilation is basically calling [run] more than once.
final bool hasIncrementalSupport;
@@ -761,6 +764,9 @@ abstract class Compiler implements DiagnosticListener {
ClassElement symbolClass;
ClassElement stackTraceClass;
ClassElement typedDataClass;
+ ClassElement futureClass;
+ ClassElement iterableClass;
+ ClassElement streamClass;
/// The constant for the [proxy] variable defined in dart:core.
ConstantValue proxyConstant;
@@ -958,6 +964,7 @@ abstract class Compiler implements DiagnosticListener {
this.useContentSecurityPolicy: false,
this.suppressWarnings: false,
bool hasIncrementalSupport: false,
+ this.enableAsyncAwait: false,
api.CompilerOutputProvider outputProvider,
List<String> strips: const []})
: this.disableTypeInferenceFlag =
@@ -1075,6 +1082,8 @@ abstract class Compiler implements DiagnosticListener {
return node;
} else if (node is Node) {
return spanFromNode(node);
+ } else if (node is TokenPair) {
+ return spanFromTokens(node.begin, node.end);
} else if (node is Token) {
return spanFromTokens(node, node);
} else if (node is HInstruction) {
@@ -1190,6 +1199,8 @@ abstract class Compiler implements DiagnosticListener {
mirrorsUsedClass = findRequiredElement(library, 'MirrorsUsed');
} else if (uri == DART_ASYNC) {
deferredLibraryClass = findRequiredElement(library, 'DeferredLibrary');
+ futureClass = findRequiredElement(library, 'Future');
+ streamClass = findRequiredElement(library, 'Stream');
} else if (uri == DART_NATIVE_TYPED_DATA) {
typedDataClass = findRequiredElement(library, 'NativeTypedData');
} else if (uri == js_backend.JavaScriptBackend.DART_JS_HELPER) {
@@ -1286,6 +1297,7 @@ abstract class Compiler implements DiagnosticListener {
mapClass = lookupCoreClass('Map');
nullClass = lookupCoreClass('Null');
stackTraceClass = lookupCoreClass('StackTrace');
+ iterableClass = lookupCoreClass('Iterable');
symbolClass = lookupCoreClass('Symbol');
if (!missingCoreClasses.isEmpty) {
internalError(coreLibrary,
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/apiimpl.dart ('k') | sdk/lib/_internal/compiler/implementation/dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698