File tree 1 file changed +4
-2
lines changed
runtime/vm/compiler/frontend
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3941,14 +3941,16 @@ Fragment StreamingFlowGraphBuilder::BuildAsExpression(TokenPosition* p) {
3941
3941
if (p != nullptr ) *p = position;
3942
3942
3943
3943
const uint8_t flags = ReadFlags (); // read flags.
3944
+ const bool is_unchecked_cast = (flags & kAsExpressionFlagUnchecked ) != 0 ;
3944
3945
const bool is_type_error = (flags & kAsExpressionFlagTypeError ) != 0 ;
3945
3946
3946
3947
Fragment instructions = BuildExpression (); // read operand.
3947
3948
3948
3949
const AbstractType& type = T.BuildType (); // read type.
3949
- if (type.IsInstantiated () && type.IsTopTypeForSubtyping ()) {
3950
+ if (is_unchecked_cast ||
3951
+ (type.IsInstantiated () && type.IsTopTypeForSubtyping ())) {
3950
3952
// We already evaluated the operand on the left and just leave it there as
3951
- // the result of the `obj as dynamic` expression.
3953
+ // the result of unchecked cast or `obj as dynamic` expression.
3952
3954
} else {
3953
3955
// We do not care whether the 'as' cast as implicitly added by the frontend
3954
3956
// or explicitly written by the user, in both cases we use an assert
You can’t perform that action at this time.
0 commit comments