Files
sdk/pkg/front_end/testcases/const_functions/const_functions_recursion.dart.weak.expect
T
Kallen Tu 45c9d8a25e [cfe] Enable recursive function calls for const functions.
Change-Id: Ia164adaf5da313cae4db2b3b326a909e57d8c07c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192200
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2021-03-19 17:56:17 +00:00

30 lines
711 B
Plaintext

library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "package:expect/expect.dart" as exp;
import "package:expect/expect.dart";
static const field core::int b = #C1;
static method fn(core::int a) → core::int {
if(a.{core::num::==}(1))
return 1;
return a.{core::num::*}(self::fn(a.{core::num::-}(1)));
}
static method localTest() → core::int {
function fnLocal(core::int a) → core::int {
if(a.{core::num::==}(1))
return 1;
return a.{core::num::*}(fnLocal.call(a.{core::num::-}(1)));
}
return #C1;
}
static method main() → void {
exp::Expect::equals(#C1, 24);
exp::Expect::equals(self::localTest(), 24);
}
constants {
#C1 = 24
}