mirror of
https://github.com/nushell/nushell.git
synced 2025-04-17 09:48:19 +02:00
Merge e3ae9e48a6
into 885b87a842
This commit is contained in:
commit
b2614ee11e
@ -128,7 +128,6 @@ impl Module {
|
|||||||
} else {
|
} else {
|
||||||
// Import pattern was just name without any members
|
// Import pattern was just name without any members
|
||||||
let mut decls = vec![];
|
let mut decls = vec![];
|
||||||
let mut const_vids = vec![];
|
|
||||||
let mut const_rows = vec![];
|
let mut const_rows = vec![];
|
||||||
let mut errors = vec![];
|
let mut errors = vec![];
|
||||||
|
|
||||||
@ -154,7 +153,6 @@ impl Module {
|
|||||||
decls.push((new_name, sub_decl_id));
|
decls.push((new_name, sub_decl_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
const_vids.extend(sub_results.constants);
|
|
||||||
const_rows.extend(sub_results.constant_values);
|
const_rows.extend(sub_results.constant_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,10 +160,7 @@ impl Module {
|
|||||||
|
|
||||||
for (name, var_id) in self.consts() {
|
for (name, var_id) in self.consts() {
|
||||||
match working_set.get_constant(var_id) {
|
match working_set.get_constant(var_id) {
|
||||||
Ok(const_val) => {
|
Ok(const_val) => const_rows.push((name, const_val.clone())),
|
||||||
const_vids.push((name.clone(), var_id));
|
|
||||||
const_rows.push((name, const_val.clone()))
|
|
||||||
}
|
|
||||||
Err(err) => errors.push(err),
|
Err(err) => errors.push(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,7 +187,7 @@ impl Module {
|
|||||||
ResolvedImportPattern::new(
|
ResolvedImportPattern::new(
|
||||||
decls,
|
decls,
|
||||||
vec![(final_name.clone(), self_id)],
|
vec![(final_name.clone(), self_id)],
|
||||||
const_vids,
|
vec![],
|
||||||
constant_values,
|
constant_values,
|
||||||
),
|
),
|
||||||
errors,
|
errors,
|
||||||
|
@ -143,6 +143,10 @@ fn export_module_which_defined_const() -> TestResult {
|
|||||||
run_test(
|
run_test(
|
||||||
r#"module spam { export const b = 3; export const c = 4 }; use spam; $spam.b + $spam.c"#,
|
r#"module spam { export const b = 3; export const c = 4 }; use spam; $spam.b + $spam.c"#,
|
||||||
"7",
|
"7",
|
||||||
|
)?;
|
||||||
|
fail_test(
|
||||||
|
r#"module spam { export const b = 3; export const c = 4 }; use spam; $b"#,
|
||||||
|
"variable not found",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user