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

Unified Diff: pkg/compiler/lib/src/js/rewrite_async.dart

Issue 1018393003: Rename the inner function of async functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js/rewrite_async.dart
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index 83611e22ee12d17df0d40b6fba77ce9fd6ae5d7f..e23b1cf409c0e539248fb04bde35cf880d1b94fd 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -117,6 +117,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
/// or error case.
String errorCodeName;
+ final String suggestedBodyName;
/// The inner function that is scheduled to do each await/yield,
/// and called to do a new iteration for sync*.
js.VariableUse get body => new js.VariableUse(bodyName);
@@ -179,7 +180,8 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
AsyncRewriterBase(this.diagnosticListener,
spannable,
- this.safeVariableName)
+ this.safeVariableName,
+ this.suggestedBodyName)
: _spannable = spannable;
/// Initialize names used by the subClass.
@@ -199,7 +201,7 @@ abstract class AsyncRewriterBase extends js.NodeVisitor {
// generated after the analysis.
resultName = freshName("result");
errorCodeName = freshName("errorCode");
- bodyName = freshName("body");
+ bodyName = freshName(suggestedBodyName);
gotoName = freshName("goto");
handlerName = freshName("handler");
nextName = freshName("next");
@@ -1674,10 +1676,12 @@ class AsyncRewriter extends AsyncRewriterBase {
spannable,
{this.asyncHelper,
this.newCompleter,
- safeVariableName})
+ String safeVariableName(String proposedName),
+ String bodyName})
: super(diagnosticListener,
spannable,
- safeVariableName);
+ safeVariableName,
+ bodyName);
@override
void addYield(js.DartYield node, js.Expression expression) {
@@ -1804,10 +1808,12 @@ class SyncStarRewriter extends AsyncRewriterBase {
this.newIterable,
this.yieldStarExpression,
this.uncaughtErrorExpression,
- safeVariableName})
+ String safeVariableName(String proposedName),
+ String bodyName})
: super(diagnosticListener,
spannable,
- safeVariableName);
+ safeVariableName,
+ bodyName);
/// Translates a yield/yield* in an sync*.
///
@@ -1972,10 +1978,12 @@ class AsyncStarRewriter extends AsyncRewriterBase {
this.newController,
this.yieldExpression,
this.yieldStarExpression,
- String safeVariableName(String original)})
+ String safeVariableName(String proposedName),
+ String bodyName})
: super(diagnosticListener,
spannable,
- safeVariableName);
+ safeVariableName,
+ bodyName);
/// Translates a yield/yield* in an async* function.
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698