Skip to content

Commit 00e481a

Browse files
liamappelbecommit-bot@chromium.org
authored andcommitted
[vm] Reland the flag flip behind the --nnbd build flag
Bug: #40409 Bug: #40179 Change-Id: Ib84926ef15068d23dcac7b89843c454b8446b28e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134062 Reviewed-by: Siva Annamalai <[email protected]> Commit-Queue: Liam Appelbe <[email protected]>
1 parent d550879 commit 00e481a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

runtime/BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ config("dart_config") {
140140
}
141141
}
142142

143+
if (use_nnbd) {
144+
defines += [ "DART_BUILT_WITH_NNBD_FLAG" ]
145+
}
146+
143147
if (!is_win) {
144148
cflags = [
145149
"-Werror",

runtime/vm/dart.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,16 @@ class Dart : public AllStatic {
123123
static Dart_EntropySource entropy_source_callback() {
124124
return entropy_source_callback_;
125125
}
126+
127+
// TODO(dartbug.com/40342): Delete these functions.
126128
static void set_non_nullable_flag(bool value) { non_nullable_flag_ = value; }
127-
static bool non_nullable_flag() { return non_nullable_flag_; }
129+
static bool non_nullable_flag() {
130+
#ifdef DART_BUILT_WITH_NNBD_FLAG
131+
return true;
132+
#else
133+
return non_nullable_flag_;
134+
#endif
135+
}
128136

129137
private:
130138
static void WaitForIsolateShutdown();

0 commit comments

Comments
 (0)