remove module_resolution_error (#2035)
This commit is contained in:
@@ -341,26 +341,6 @@ impl MachineState {
|
|||||||
culprit.type_error(self, valid_type)
|
culprit.type_error(self, valid_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn module_resolution_error(
|
|
||||||
&mut self,
|
|
||||||
mod_name: Atom,
|
|
||||||
name: Atom,
|
|
||||||
arity: usize,
|
|
||||||
) -> MachineError {
|
|
||||||
let h = self.heap.len();
|
|
||||||
|
|
||||||
let res_stub = functor!(atom!(":"), [atom(mod_name), atom(name)]);
|
|
||||||
let ind_stub = functor!(atom!("/"), [str(h + 2, 0), fixnum(arity)], [res_stub]);
|
|
||||||
|
|
||||||
let stub = functor!(atom!("evaluation_error"), [str(h, 0)], [ind_stub]);
|
|
||||||
|
|
||||||
MachineError {
|
|
||||||
stub,
|
|
||||||
location: None,
|
|
||||||
from: ErrorProvenance::Constructed,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn existence_error(&mut self, err: ExistenceError) -> MachineError {
|
pub(super) fn existence_error(&mut self, err: ExistenceError) -> MachineError {
|
||||||
match err {
|
match err {
|
||||||
ExistenceError::Module(name) => {
|
ExistenceError::Module(name) => {
|
||||||
@@ -375,6 +355,20 @@ impl MachineState {
|
|||||||
from: ErrorProvenance::Received,
|
from: ErrorProvenance::Received,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ExistenceError::QualifiedProcedure { module_name, name, arity } => {
|
||||||
|
let h = self.heap.len();
|
||||||
|
|
||||||
|
let ind_stub = functor!(atom!("/"), [atom(name), fixnum(arity)]);
|
||||||
|
let res_stub = functor!(atom!(":"), [atom(module_name), str(h + 3, 0)], [ind_stub]);
|
||||||
|
|
||||||
|
let stub = functor!(atom!("existence_error"), [atom(atom!("procedure")), str(h, 0)], [res_stub]);
|
||||||
|
|
||||||
|
MachineError {
|
||||||
|
stub,
|
||||||
|
location: None,
|
||||||
|
from: ErrorProvenance::Constructed,
|
||||||
|
}
|
||||||
|
}
|
||||||
ExistenceError::Procedure(name, arity) => {
|
ExistenceError::Procedure(name, arity) => {
|
||||||
let culprit = functor!(atom!("/"), [atom(name), fixnum(arity)]);
|
let culprit = functor!(atom!("/"), [atom(name), fixnum(arity)]);
|
||||||
|
|
||||||
@@ -992,6 +986,7 @@ pub enum ExistenceError {
|
|||||||
Module(Atom),
|
Module(Atom),
|
||||||
ModuleSource(ModuleSource),
|
ModuleSource(ModuleSource),
|
||||||
Procedure(Atom, usize),
|
Procedure(Atom, usize),
|
||||||
|
QualifiedProcedure { module_name: Atom, name: Atom, arity: usize },
|
||||||
SourceSink(HeapCellValue),
|
SourceSink(HeapCellValue),
|
||||||
Stream(HeapCellValue),
|
Stream(HeapCellValue),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1167,7 +1167,7 @@ impl Machine {
|
|||||||
let stub = functor_stub(name, arity);
|
let stub = functor_stub(name, arity);
|
||||||
let err = self
|
let err = self
|
||||||
.machine_st
|
.machine_st
|
||||||
.module_resolution_error(module_name, name, arity);
|
.existence_error(ExistenceError::QualifiedProcedure { module_name, name, arity });
|
||||||
|
|
||||||
Err(self.machine_st.error_form(err, stub))
|
Err(self.machine_st.error_form(err, stub))
|
||||||
}
|
}
|
||||||
@@ -1195,7 +1195,7 @@ impl Machine {
|
|||||||
let stub = functor_stub(name, arity);
|
let stub = functor_stub(name, arity);
|
||||||
let err = self
|
let err = self
|
||||||
.machine_st
|
.machine_st
|
||||||
.module_resolution_error(module_name, name, arity);
|
.existence_error(ExistenceError::QualifiedProcedure { module_name, name, arity });
|
||||||
|
|
||||||
Err(self.machine_st.error_form(err, stub))
|
Err(self.machine_st.error_form(err, stub))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user