5b0128565c
Change-Id: I3c42781acd253ac82658593c96ab92ef6c2cdb50 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/392466 Commit-Queue: Mark Zhou <markzipan@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
36 lines
918 B
Dart
36 lines
918 B
Dart
// Copyright (c) 2024, 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.
|
|
|
|
import 'package:expect/expect.dart';
|
|
import 'package:reload_test/reload_test_utils.dart';
|
|
|
|
// Adapted from:
|
|
// https://github.com/dart-lang/sdk/blob/63622f03eeaf72983b2f4957fa84da8062693f00/runtime/vm/isolate_reload_test.cc#L5493
|
|
|
|
// Note: The original VM test checks for allocated objects on the heap after a
|
|
// hot reload. There isn't an obvious web analogue, so we've left this off
|
|
// unless this side effect becomes visible across platforms.
|
|
|
|
class C {
|
|
int value = 42;
|
|
}
|
|
|
|
class Foo {
|
|
static var x = C();
|
|
}
|
|
|
|
late var closure;
|
|
|
|
helper() {
|
|
closure = () => Foo.x.value;
|
|
}
|
|
|
|
Future<void> main() async {
|
|
helper();
|
|
Expect.equals(42, closure());
|
|
await hotReload();
|
|
|
|
Expect.throws(closure);
|
|
}
|