mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
feat: Codegen feature flags (#28920)
This commit adds "deno_features" crate that contains definitions of all unstable features in Deno. Based on these definitions, both Rust and JS code is generated ensuring that the two are always in sync. In addition some of flag handling was rewritten to use the generated definitions, instead of hand rolling these flag definitions. --------- Co-authored-by: snek <snek@deno.com>
This commit is contained in:
parent
4924731ac3
commit
189ccffdb9
19 changed files with 701 additions and 284 deletions
|
@ -96,8 +96,10 @@ pub fn op_bootstrap_user_agent(state: &mut OpState) -> String {
|
|||
pub fn op_bootstrap_unstable_args(state: &mut OpState) -> Vec<String> {
|
||||
let options = state.borrow::<BootstrapOptions>();
|
||||
let mut flags = Vec::with_capacity(options.unstable_features.len());
|
||||
for granular_flag in crate::UNSTABLE_GRANULAR_FLAGS.iter() {
|
||||
if options.unstable_features.contains(&granular_flag.id) {
|
||||
for unstable_feature in &options.unstable_features {
|
||||
if let Some(granular_flag) =
|
||||
deno_features::UNSTABLE_FEATURES.get((*unstable_feature) as usize)
|
||||
{
|
||||
flags.push(format!("--unstable-{}", granular_flag.name));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue