Skip to content

Commit

Permalink
Make all native props and funcs overridable by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Arshia001 committed Feb 22, 2024
1 parent b18a366 commit 01184df
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ion-proc/src/attribute/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Name {
attrs: Vec::new(),
lit: Lit::Str(LitStr::new(&name, literal.span())),
})),
parse_quote!(#ion::flags::PropertyFlags::CONSTANT_ENUMERATED),
parse_quote!(#ion::flags::PropertyFlags::ENUMERATE),
)
}
Name::Symbol(symbol) => {
Expand Down
2 changes: 1 addition & 1 deletion ion-proc/src/class/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl Method {
if name.is_case(Case::Snake) {
name = name.to_case(Case::Camel)
}
quote!(#ion::function_spec!(#class::#ident, #name, #nargs, #ion::flags::PropertyFlags::CONSTANT_ENUMERATED))
quote!(#ion::function_spec!(#class::#ident, #name, #nargs, #ion::flags::PropertyFlags::ENUMERATE))
}
Name::Symbol(symbol) => {
quote!(#ion::function_spec_symbol!(#class::#ident, #symbol, #nargs, #ion::flags::PropertyFlags::CONSTANT))
Expand Down
9 changes: 2 additions & 7 deletions ion/src/spec/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,7 @@ macro_rules! function_spec {
)
};
($function:expr, $name:expr, $nargs:expr) => {
function_spec!(
$function,
$name,
$nargs,
$crate::flags::PropertyFlags::CONSTANT_ENUMERATED
)
function_spec!($function, $name, $nargs, $crate::flags::PropertyFlags::ENUMERATE)
};
($function:expr, $nargs:expr) => {
function_spec!($function, ::std::stringify!($function), $nargs)
Expand All @@ -83,7 +78,7 @@ macro_rules! function_spec_symbol {
$function,
$symbol,
$nargs,
$crate::flags::PropertyFlags::CONSTANT_ENUMERATED
$crate::flags::PropertyFlags:ENUMERATE:
)
};
}
4 changes: 2 additions & 2 deletions modules/src/path/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ const FUNCTIONS: &[JSFunctionSpec] = &[
];

const PROPERTIES: &[JSPropertySpec] = &[
create_property_spec_string("separator", SEPARATOR, PropertyFlags::CONSTANT_ENUMERATED),
create_property_spec_string("delimiter", DELIMITER, PropertyFlags::CONSTANT_ENUMERATED),
create_property_spec_string("separator", SEPARATOR, PropertyFlags::ENUMERATE),
create_property_spec_string("delimiter", DELIMITER, PropertyFlags::ENUMERATE),
JSPropertySpec::ZERO,
];

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/globals/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,5 +465,5 @@ const METHODS: &[JSFunctionSpec] = &[
pub fn define(cx: &Context, global: &Object) -> bool {
let console = Object::new(cx);
(unsafe { console.define_methods(cx, METHODS) })
&& global.define_as(cx, "console", &console, PropertyFlags::CONSTANT_ENUMERATED)
&& global.define_as(cx, "console", &console, PropertyFlags::ENUMERATE)
}
2 changes: 1 addition & 1 deletion runtime/src/globals/microtasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ pub fn define(cx: &Context, global: &Object) -> bool {
cx,
"queueMicrotask",
&Function::from_spec(cx, &FUNCTION),
PropertyFlags::CONSTANT_ENUMERATED,
PropertyFlags::ENUMERATE,
)
}
2 changes: 1 addition & 1 deletion runtime/src/module/standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn init_global_module<M: NativeModule>(cx: &Context, global: &Object) -> boo
let module = M::module(cx);

if let Some(module) = module {
global.define_as(cx, M::NAME, &module, PropertyFlags::CONSTANT_ENUMERATED)
global.define_as(cx, M::NAME, &module, PropertyFlags::ENUMERATE)
} else {
false
}
Expand Down

0 comments on commit 01184df

Please sign in to comment.