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

Side by Side Diff: pkg/kernel/lib/transformations/continuation.dart

Issue 2743283002: [kernel] set dartAsyncMarker to Sync for continuations (Closed)
Patch Set: Created 3 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 | « no previous file | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 kernel.transformations.continuation; 5 library kernel.transformations.continuation;
6 6
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 8
9 import '../ast.dart'; 9 import '../ast.dart';
10 import '../core_types.dart'; 10 import '../core_types.dart';
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 super(helper, enclosingFunction); 121 super(helper, enclosingFunction);
122 122
123 FunctionNode rewrite() { 123 FunctionNode rewrite() {
124 // :sync_body(:iterator) { 124 // :sync_body(:iterator) {
125 // modified <node.body>; 125 // modified <node.body>;
126 // } 126 // }
127 final nestedClosureVariable = new VariableDeclaration(":sync_op"); 127 final nestedClosureVariable = new VariableDeclaration(":sync_op");
128 final function = new FunctionNode(buildClosureBody(), 128 final function = new FunctionNode(buildClosureBody(),
129 positionalParameters: [iteratorVariable], 129 positionalParameters: [iteratorVariable],
130 requiredParameterCount: 1, 130 requiredParameterCount: 1,
131 asyncMarker: AsyncMarker.SyncYielding) 131 asyncMarker: AsyncMarker.SyncYielding,
132 dartAsyncMarker: AsyncMarker.Sync)
Kevin Millikin (Google) 2017/03/13 11:20:35 This is a fresh function that doesn't correspond d
132 ..fileOffset = enclosingFunction.fileOffset 133 ..fileOffset = enclosingFunction.fileOffset
133 ..fileEndOffset = enclosingFunction.fileEndOffset 134 ..fileEndOffset = enclosingFunction.fileEndOffset
134 ..returnType = helper.coreTypes.boolClass.rawType; 135 ..returnType = helper.coreTypes.boolClass.rawType;
135 136
136 final closureFunction = 137 final closureFunction =
137 new FunctionDeclaration(nestedClosureVariable, function) 138 new FunctionDeclaration(nestedClosureVariable, function)
138 ..fileOffset = enclosingFunction.parent.fileOffset; 139 ..fileOffset = enclosingFunction.parent.fileOffset;
139 140
140 // return new _SyncIterable(:sync_body); 141 // return new _SyncIterable(:sync_body);
141 final arguments = new Arguments([new VariableGet(nestedClosureVariable)]); 142 final arguments = new Arguments([new VariableGet(nestedClosureVariable)]);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // modified <node.body>; 220 // modified <node.body>;
220 // } 221 // }
221 final parameters = <VariableDeclaration>[ 222 final parameters = <VariableDeclaration>[
222 expressionRewriter.asyncResult, 223 expressionRewriter.asyncResult,
223 new VariableDeclaration(':exception'), 224 new VariableDeclaration(':exception'),
224 new VariableDeclaration(':stack_trace'), 225 new VariableDeclaration(':stack_trace'),
225 ]; 226 ];
226 final function = new FunctionNode(buildWrappedBody(), 227 final function = new FunctionNode(buildWrappedBody(),
227 positionalParameters: parameters, 228 positionalParameters: parameters,
228 requiredParameterCount: 0, 229 requiredParameterCount: 0,
229 asyncMarker: AsyncMarker.SyncYielding) 230 asyncMarker: AsyncMarker.SyncYielding,
231 dartAsyncMarker: AsyncMarker.Sync)
230 ..fileOffset = enclosingFunction.fileOffset 232 ..fileOffset = enclosingFunction.fileOffset
231 ..fileEndOffset = enclosingFunction.fileEndOffset; 233 ..fileEndOffset = enclosingFunction.fileEndOffset;
232 234
233 // The await expression lifter might have created a number of 235 // The await expression lifter might have created a number of
234 // [VariableDeclarations]. 236 // [VariableDeclarations].
235 // TODO(kustermann): If we didn't need any variables we should not emit 237 // TODO(kustermann): If we didn't need any variables we should not emit
236 // these. 238 // these.
237 statements.addAll(variableDeclarations()); 239 statements.addAll(variableDeclarations());
238 statements.addAll(expressionRewriter.variables); 240 statements.addAll(expressionRewriter.variables);
239 241
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 coreTypes.getMember('dart:core', '_SyncIterable', ''), 906 coreTypes.getMember('dart:core', '_SyncIterable', ''),
905 coreTypes.getMember('dart:async', '_StreamIterator', ''), 907 coreTypes.getMember('dart:async', '_StreamIterator', ''),
906 coreTypes.getMember('dart:async', 'Future', 'microtask'), 908 coreTypes.getMember('dart:async', 'Future', 'microtask'),
907 coreTypes.getMember('dart:async', '_AsyncStarStreamController', ''), 909 coreTypes.getMember('dart:async', '_AsyncStarStreamController', ''),
908 coreTypes.getTopLevelMember('dart:async', '_asyncThenWrapperHelper'), 910 coreTypes.getTopLevelMember('dart:async', '_asyncThenWrapperHelper'),
909 coreTypes.getTopLevelMember('dart:async', '_asyncErrorWrapperHelper'), 911 coreTypes.getTopLevelMember('dart:async', '_asyncErrorWrapperHelper'),
910 coreTypes.getTopLevelMember('dart:async', '_awaitHelper'), 912 coreTypes.getTopLevelMember('dart:async', '_awaitHelper'),
911 coreTypes); 913 coreTypes);
912 } 914 }
913 } 915 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698