Fix to not error when using imported whole modules (#5161)
* Fix to not error when using imported whole modules * Add TODO about adding a warning
This commit is contained in:
@ -2642,15 +2642,20 @@ impl ExecutorContext {
|
||||
let (result, _, _) = self
|
||||
.exec_module(module_id, exec_state, ExecutionKind::Normal, metadata.source_range)
|
||||
.await?;
|
||||
result.ok_or_else(|| {
|
||||
KclError::Semantic(KclErrorDetails {
|
||||
message: format!(
|
||||
"Evaluating module `{}` as part of an assembly did not produce a result",
|
||||
identifier.name
|
||||
),
|
||||
source_ranges: vec![metadata.source_range, meta[0].source_range],
|
||||
})
|
||||
})?
|
||||
result.unwrap_or_else(|| {
|
||||
// The module didn't have a return value. Currently,
|
||||
// the only way to have a return value is with the final
|
||||
// statement being an expression statement.
|
||||
//
|
||||
// TODO: Make a warning when we support them in the
|
||||
// execution phase.
|
||||
let mut new_meta = vec![metadata.to_owned()];
|
||||
new_meta.extend(meta);
|
||||
KclValue::KclNone {
|
||||
value: Default::default(),
|
||||
meta: new_meta,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user