Files
sdk/pkg/front_end/testcases/general/illegal_named_function_expression.dart
T
Johnni Winther 40ad7aee40 [cfe] Use [BlockExpression] to encode named function expressions
Previously a named function expression (function declaration occurring
in an expression context) was encoded using a
[NamedFunctionExpressionJudgment] which was a specialization of a [Let]
expression. This encoding couldn't handle recursive calls occurring in
the body of the named function expression, since the let variable
is not available in the initializer of the let variable, leading to
a crash in serialization.

This CL changes the encoding to use a [BlockExpression] instead and
deletes the [NamedFunctionExpressionJudgment] node.

Closes https://github.com/dart-lang/sdk/issues/49122

Change-Id: I40c5535624b2d8933a6f400c927ba42b028f7a29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246445
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-05-31 11:47:33 +00:00

10 lines
309 B
Dart

// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
test() {
var x = void f<T>(T t) {};
print(x.runtimeType);
print(void g<T>(T t) {});
}