Simply interned strings dict.
This commit is contained in:
parent
2d73468723
commit
36aa827e15
@ -52,7 +52,7 @@ mod fn_ptr_functions {
|
|||||||
fn collect_fn_metadata(ctx: NativeCallContext) -> Array {
|
fn collect_fn_metadata(ctx: NativeCallContext) -> Array {
|
||||||
// Create a metadata record for a function.
|
// Create a metadata record for a function.
|
||||||
fn make_metadata(
|
fn make_metadata(
|
||||||
dict: &HashMap<String, ImmutableString>,
|
dict: &HashMap<&str, ImmutableString>,
|
||||||
namespace: Option<ImmutableString>,
|
namespace: Option<ImmutableString>,
|
||||||
f: SharedScriptFnDef,
|
f: SharedScriptFnDef,
|
||||||
) -> Map {
|
) -> Map {
|
||||||
@ -90,7 +90,7 @@ fn collect_fn_metadata(ctx: NativeCallContext) -> Array {
|
|||||||
// Recursively scan modules for script-defined functions.
|
// Recursively scan modules for script-defined functions.
|
||||||
fn scan_module(
|
fn scan_module(
|
||||||
list: &mut Array,
|
list: &mut Array,
|
||||||
dict: &HashMap<String, ImmutableString>,
|
dict: &HashMap<&str, ImmutableString>,
|
||||||
namespace: ImmutableString,
|
namespace: ImmutableString,
|
||||||
module: &Module,
|
module: &Module,
|
||||||
) {
|
) {
|
||||||
@ -104,14 +104,20 @@ fn collect_fn_metadata(ctx: NativeCallContext) -> Array {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Intern strings
|
// Intern strings
|
||||||
let mut dict = HashMap::<String, ImmutableString>::with_capacity(8);
|
let mut dict = HashMap::<&str, ImmutableString>::with_capacity(8);
|
||||||
dict.insert("namespace".into(), "namespace".into());
|
[
|
||||||
dict.insert("name".into(), "name".into());
|
"namespace",
|
||||||
dict.insert("access".into(), "access".into());
|
"name",
|
||||||
dict.insert("public".into(), "public".into());
|
"access",
|
||||||
dict.insert("private".into(), "private".into());
|
"public",
|
||||||
dict.insert("is_anonymous".into(), "is_anonymous".into());
|
"private",
|
||||||
dict.insert("params".into(), "params".into());
|
"is_anonymous",
|
||||||
|
"params",
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.for_each(|&s| {
|
||||||
|
dict.insert(s, s.into());
|
||||||
|
});
|
||||||
|
|
||||||
let mut list: Array = Default::default();
|
let mut list: Array = Default::default();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user