Skip to content

Commit 112cba1

Browse files
nshahanCommit Bot
authored and
Commit Bot
committed
[ddc] Add flag to use the new runtime type system
Currently the flag does nothing. Follow up changes will add support incrementally. Add a `--canary` flag to DDC that will enable all features in development to simplify use in tests and benchmarks. Issue: #48950 Change-Id: I4878c771bdb4f4c6e8b8cd618737009268b02cbe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237602 Commit-Queue: Nicholas Shahan <[email protected]> Reviewed-by: Sigmund Cherem <[email protected]> Reviewed-by: Anna Gringauze <[email protected]>
1 parent 34ebfc6 commit 112cba1

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

pkg/dev_compiler/lib/src/compiler/shared_command.dart

+19-4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class SharedCompilerOptions {
9595

9696
final bool soundNullSafety;
9797

98+
/// A canary feature that enables a new runtime type representation.
99+
final bool newRuntimeTypes;
100+
98101
SharedCompilerOptions(
99102
{this.sourceMap = true,
100103
this.inlineSourceMap = false,
@@ -110,7 +113,10 @@ class SharedCompilerOptions {
110113
this.multiRootScheme,
111114
this.multiRootOutputPath,
112115
this.experiments = const {},
113-
this.soundNullSafety = false});
116+
this.soundNullSafety = false,
117+
bool canaryFeatures = false})
118+
: // Current canary features.
119+
newRuntimeTypes = canaryFeatures;
114120

115121
SharedCompilerOptions.fromArguments(ArgResults args)
116122
: this(
@@ -131,7 +137,8 @@ class SharedCompilerOptions {
131137
multiRootOutputPath: args['multi-root-output-path'] as String,
132138
experiments: parseExperimentalArguments(
133139
args['enable-experiment'] as List<String>),
134-
soundNullSafety: args['sound-null-safety'] as bool);
140+
soundNullSafety: args['sound-null-safety'] as bool,
141+
canaryFeatures: args['canary'] as bool);
135142

136143
SharedCompilerOptions.fromSdkRequiredArguments(ArgResults args)
137144
: this(
@@ -145,7 +152,8 @@ class SharedCompilerOptions {
145152
multiRootOutputPath: args['multi-root-output-path'] as String,
146153
experiments: parseExperimentalArguments(
147154
args['enable-experiment'] as List<String>),
148-
soundNullSafety: args['sound-null-safety'] as bool);
155+
soundNullSafety: args['sound-null-safety'] as bool,
156+
canaryFeatures: args['canary'] as bool);
149157

150158
static void addArguments(ArgParser parser, {bool hide = true}) {
151159
addSdkRequiredArguments(parser, hide: hide);
@@ -213,7 +221,14 @@ class SharedCompilerOptions {
213221
..addFlag('sound-null-safety',
214222
help: 'Compile for sound null safety at runtime.',
215223
negatable: true,
216-
defaultsTo: false);
224+
defaultsTo: false)
225+
..addFlag('canary',
226+
help: 'Enable all compiler features under active development. '
227+
'This option is intended for compiler development only. '
228+
'Canary features are likely to be unstable and can be removed '
229+
'without warning.',
230+
defaultsTo: false,
231+
hide: true);
217232
}
218233

219234
static String _getModuleName(ArgResults args) {

pkg/dev_compiler/tool/ddb

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ void main(List<String> args) async {
6969
negatable: true)
7070
..addFlag('weak-null-safety-errors',
7171
help: 'Treat weak null safety warnings as errors.', defaultsTo: false)
72+
..addFlag('canary',
73+
help: 'Enable all compiler features under active development.',
74+
defaultsTo: false)
7275
..addFlag('observe',
7376
help:
7477
'Run the compiler in the Dart VM with --observe. Implies --debug.',
@@ -128,6 +131,7 @@ void main(List<String> args) async {
128131
var nonNullAsserts = options['null-assertions'] as bool;
129132
var nativeNonNullAsserts = options['native-null-assertions'] as bool;
130133
var weakNullSafetyErrors = options['weak-null-safety-errors'] as bool;
134+
var canaryFeatures = options['canary'] as bool;
131135
var entry = p.canonicalize(options.rest.first);
132136
var out = (options['out'] as String) ?? p.setExtension(entry, '.js');
133137
var libRoot = p.dirname(entry);
@@ -240,6 +244,7 @@ void main(List<String> args) async {
240244
if (soundNullSafety) '--sound-null-safety',
241245
if (options['packages'] != null) '--packages=${options['packages']}',
242246
if (emitDebugSymbols) '--emit-debug-symbols',
247+
if (canaryFeatures) '--canary',
243248
'-o',
244249
out,
245250
entry

0 commit comments

Comments
 (0)