Skip to content

Commit 3a1229e

Browse files
alexmarkovCommit Bot
authored and
Commit Bot
committed
[kernel] Remove obsolete AsyncMarker.SyncYielding and YieldStatement.isNative
AsyncMarker.SyncYielding and YieldStatement.isNative became obsolete after async/async*/sync* kernel transformation was removed in https://dart-review.googlesource.com/c/sdk/+/249944. TEST=ci Issue: #48378 Change-Id: I69ac994af77f7e403686750bf8df437868bf33fa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249947 Commit-Queue: Alexander Markov <[email protected]> Reviewed-by: Sigmund Cherem <[email protected]> Reviewed-by: Slava Egorov <[email protected]>
1 parent 3a45cf1 commit 3a1229e

File tree

16 files changed

+98
-365
lines changed

16 files changed

+98
-365
lines changed

pkg/compiler/lib/src/inferrer/builder.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,6 @@ class KernelTypeGraphBuilder extends ir.Visitor<TypeInformation>
434434
case ir.AsyncMarker.AsyncStar:
435435
recordReturnType(_types.asyncStarStreamType);
436436
break;
437-
case ir.AsyncMarker.SyncYielding:
438-
failedAt(
439-
_analyzedMember, "Unexpected async marker: ${node.asyncMarker}");
440-
break;
441437
}
442438
assert(_breaksFor.isEmpty);
443439
assert(_continuesFor.isEmpty);

pkg/compiler/lib/src/ir/impact_data.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,6 @@ class ImpactBuilder extends StaticTypeVisitor implements ImpactRegistry {
192192
}
193193
registerAsyncStar(elementType);
194194
break;
195-
196-
case ir.AsyncMarker.SyncYielding:
197-
failedAt(CURRENT_ELEMENT_SPANNABLE,
198-
"Unexpected async marker: ${asyncMarker}");
199195
}
200196
}
201197

pkg/compiler/lib/src/ir/util.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ AsyncMarker getAsyncMarker(ir.FunctionNode node) {
5858
return AsyncMarker.SYNC;
5959
case ir.AsyncMarker.SyncStar:
6060
return AsyncMarker.SYNC_STAR;
61-
case ir.AsyncMarker.SyncYielding:
6261
default:
6362
throw UnsupportedError(
6463
"Async marker ${node.asyncMarker} is not supported.");

pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ import '../messages.dart' as messages show getLocationFromUri;
7676
import '../modifier.dart'
7777
show Modifier, constMask, covariantMask, finalMask, lateMask, requiredMask;
7878
import '../names.dart' show emptyName, minusName, plusName;
79-
import '../problems.dart'
80-
show internalProblem, unexpected, unhandled, unsupported;
79+
import '../problems.dart' show internalProblem, unhandled, unsupported;
8180
import '../scope.dart';
8281
import '../source/diet_parser.dart';
8382
import '../source/source_class_builder.dart';
@@ -1415,9 +1414,6 @@ class BodyBuilder extends StackListenerImpl
14151414

14161415
case AsyncMarker.Sync:
14171416
break; // skip
1418-
case AsyncMarker.SyncYielding:
1419-
unexpected("async, async*, sync, or sync*", "$asyncModifier",
1420-
member.charOffset, uri);
14211417
}
14221418

14231419
if (problem != null) {

pkg/kernel/binary.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ type CanonicalName {
147147

148148
type ComponentFile {
149149
UInt32 magic = 0x90ABCDEF;
150-
UInt32 formatVersion = 82;
150+
UInt32 formatVersion = 83;
151151
Byte[10] shortSdkHash;
152152
List<String> problemsAsJson; // Described in problems.md.
153153
Library[] libraries;
@@ -510,8 +510,7 @@ enum AsyncMarker {
510510
Sync,
511511
SyncStar,
512512
Async,
513-
AsyncStar,
514-
SyncYielding
513+
AsyncStar
515514
}
516515
*/
517516

@@ -1398,7 +1397,7 @@ type TryFinally extends Statement {
13981397
type YieldStatement extends Statement {
13991398
Byte tag = 77;
14001399
FileOffset fileOffset;
1401-
Byte flags (isYieldStar, isNative);
1400+
Byte flags (isYieldStar);
14021401
Expression expression;
14031402
}
14041403

pkg/kernel/lib/ast.dart

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3956,43 +3956,6 @@ enum AsyncMarker {
39563956
SyncStar,
39573957
Async,
39583958
AsyncStar,
3959-
3960-
// `SyncYielding` is a marker that tells Dart VM that this function is an
3961-
// artificial closure introduced by an async transformer which desugared all
3962-
// async syntax into a combination of native yields and helper method calls.
3963-
//
3964-
// Native yields (formatted as `[yield]`) are semantically close to
3965-
// `yield x` statement: they denote a yield/resume point within a function
3966-
// but are completely decoupled from the notion of iterators. When
3967-
// execution of the closure reaches `[yield] x` it stops and return the
3968-
// value of `x` to the caller. If closure is called again it continues
3969-
// to the next statement after this yield as if it was suspended and resumed.
3970-
//
3971-
// Consider this example:
3972-
//
3973-
// g() {
3974-
// var :await_jump_var = 0;
3975-
// var :await_ctx_var;
3976-
//
3977-
// f(x) yielding {
3978-
// [yield] '${x}:0';
3979-
// [yield] '${x}:1';
3980-
// [yield] '${x}:2';
3981-
// }
3982-
//
3983-
// return f;
3984-
// }
3985-
//
3986-
// print(f('a')); /* prints 'a:0', :await_jump_var = 1 */
3987-
// print(f('b')); /* prints 'b:1', :await_jump_var = 2 */
3988-
// print(f('c')); /* prints 'c:2', :await_jump_var = 3 */
3989-
//
3990-
// Note: currently Dart VM implicitly relies on async transformer to
3991-
// inject certain artificial variables into g (like `:await_jump_var`).
3992-
// As such SyncYielding and native yield are not intended to be used on their
3993-
// own, but are rather an implementation artifact of the async transformer
3994-
// itself.
3995-
SyncYielding,
39963959
}
39973960

39983961
// ------------------------------------------------------------------------
@@ -10523,33 +10486,23 @@ class TryFinally extends Statement {
1052310486
}
1052410487

1052510488
/// Statement of form `yield x` or `yield* x`.
10526-
///
10527-
/// For native yield semantics see `AsyncMarker.SyncYielding`.
1052810489
class YieldStatement extends Statement {
1052910490
Expression expression;
1053010491
int flags = 0;
1053110492

10532-
YieldStatement(this.expression,
10533-
{bool isYieldStar: false, bool isNative: false}) {
10493+
YieldStatement(this.expression, {bool isYieldStar: false}) {
1053410494
expression.parent = this;
1053510495
this.isYieldStar = isYieldStar;
10536-
this.isNative = isNative;
1053710496
}
1053810497

1053910498
static const int FlagYieldStar = 1 << 0;
10540-
static const int FlagNative = 1 << 1;
1054110499

1054210500
bool get isYieldStar => flags & FlagYieldStar != 0;
10543-
bool get isNative => flags & FlagNative != 0;
1054410501

1054510502
void set isYieldStar(bool value) {
1054610503
flags = value ? (flags | FlagYieldStar) : (flags & ~FlagYieldStar);
1054710504
}
1054810505

10549-
void set isNative(bool value) {
10550-
flags = value ? (flags | FlagNative) : (flags & ~FlagNative);
10551-
}
10552-
1055310506
@override
1055410507
R accept<R>(StatementVisitor<R> v) => v.visitYieldStatement(this);
1055510508

pkg/kernel/lib/binary/ast_from_binary.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2895,8 +2895,7 @@ class BinaryBuilder {
28952895
int offset = readOffset();
28962896
int flags = readByte();
28972897
return new YieldStatement(readExpression(),
2898-
isYieldStar: flags & YieldStatement.FlagYieldStar != 0,
2899-
isNative: flags & YieldStatement.FlagNative != 0)
2898+
isYieldStar: flags & YieldStatement.FlagYieldStar != 0)
29002899
..fileOffset = offset;
29012900
}
29022901

pkg/kernel/lib/binary/tag.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class Tag {
179179
/// Internal version of kernel binary format.
180180
/// Bump it when making incompatible changes in kernel binaries.
181181
/// Keep in sync with runtime/vm/kernel_binary.h, pkg/kernel/binary.md.
182-
static const int BinaryFormatVersion = 82;
182+
static const int BinaryFormatVersion = 83;
183183
}
184184

185185
abstract class ConstantTag {

pkg/kernel/lib/text/ast_to_text.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
818818
return 'async';
819819
case AsyncMarker.AsyncStar:
820820
return 'async*';
821-
case AsyncMarker.SyncYielding:
822-
return 'yielding';
823821
default:
824822
return '<Invalid async marker: $marker>';
825823
}
@@ -2414,8 +2412,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
24142412
writeIndentation();
24152413
if (node.isYieldStar) {
24162414
writeWord('yield*');
2417-
} else if (node.isNative) {
2418-
writeWord('[yield]');
24192415
} else {
24202416
writeWord('yield');
24212417
}

pkg/kernel/lib/type_checker.dart

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -363,26 +363,6 @@ class TypeCheckingVisitor
363363
case AsyncMarker.AsyncStar:
364364
return null;
365365

366-
case AsyncMarker.SyncYielding:
367-
// The SyncStar transform wraps the original function body twice,
368-
// where the inner most function returns bool.
369-
TreeNode? parent = function.parent;
370-
while (parent is! FunctionNode) {
371-
parent = parent!.parent;
372-
}
373-
FunctionNode enclosingFunction = parent;
374-
if (enclosingFunction.dartAsyncMarker == AsyncMarker.Sync) {
375-
parent = enclosingFunction.parent;
376-
while (parent is! FunctionNode) {
377-
parent = parent!.parent;
378-
}
379-
enclosingFunction = parent;
380-
if (enclosingFunction.dartAsyncMarker == AsyncMarker.SyncStar) {
381-
return coreTypes.boolLegacyRawType;
382-
}
383-
}
384-
return null;
385-
386366
default:
387367
throw 'Unexpected async marker: ${function.asyncMarker}';
388368
}
@@ -405,9 +385,6 @@ class TypeCheckingVisitor
405385
}
406386
return const DynamicType();
407387

408-
case AsyncMarker.SyncYielding:
409-
return function.returnType;
410-
411388
default:
412389
throw 'Unexpected async marker: ${function.asyncMarker}';
413390
}

pkg/kernel/lib/verifier.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
528528
switch (currentAsyncMarker) {
529529
case AsyncMarker.Sync:
530530
case AsyncMarker.Async:
531-
case AsyncMarker.SyncYielding:
532531
// ok
533532
break;
534533
case AsyncMarker.SyncStar:
@@ -556,7 +555,6 @@ class VerifyingVisitor extends RecursiveResultVisitor<void> {
556555
break;
557556
case AsyncMarker.SyncStar:
558557
case AsyncMarker.AsyncStar:
559-
case AsyncMarker.SyncYielding:
560558
// ok
561559
break;
562560
}

pkg/vm/lib/transformations/type_flow/summary_collector.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,6 @@ class _VariablesInfoCollector extends RecursiveVisitor {
363363
final function = node.function;
364364
function.accept(this);
365365

366-
if (function.asyncMarker == AsyncMarker.SyncYielding) {
367-
// Mark parameters of synthetic async_op closures as captured
368-
// to make sure their updates at yield points are taken into account.
369-
for (var v in function.positionalParameters) {
370-
_captureVariable(v);
371-
}
372-
for (var v in function.namedParameters) {
373-
_captureVariable(v);
374-
}
375-
}
376-
377366
activeStatements = savedActiveStatements;
378367
numVariablesAtActiveStatements = savedNumVariablesAtActiveStatements;
379368
numVariablesAtFunctionEntry = savedNumVariablesAtFunctionEntry;

0 commit comments

Comments
 (0)