refactor(ir): drop the dead call-statement representation
The pre-RFC link-form block-quote call was removed by RFC-LANG-0002, but the IR still carried Stmt::Call, CallSite and CallTarget with matching branches in the runtime, infer, call validation, loader, analysis projection and JSON output. No mapper produces that variant any more, so it was a second call representation that could never be reached. - remove Stmt::Call, CallSite and CallTarget from marqdo-ir - remove the runtime exec_call_site path and every exhaustive match arm - remove the 'call_site' Analysis node and its JSON helpers - state in spec/analysis-v2.md that calls are expressions; keep v1 as history with a note that call_site is not produced by the current language Verified: cargo clippy --workspace --all-targets -D warnings clean and cargo test --workspace --locked green (62 targets).
This commit is contained in:
1 parent
b38b769932
commit
361a6cc341
8 files changed
+10
-123
No files matched your search
@@ -8,9 +8,7 @@
|
||||
use std::path::Path;
|
||||
|
||||
use marqdo_expression::{BinaryOp, Expr, UnaryOp};
|
||||
use marqdo_ir::{
|
||||
CallTarget, Function, Module, ModuleId, PlaceTarget, Resource, SignatureKind, Stmt, UnitKind,
|
||||
};
|
||||
use marqdo_ir::{Function, Module, ModuleId, PlaceTarget, Resource, SignatureKind, Stmt, UnitKind};
|
||||
use marqdo_span::Span;
|
||||
use serde_json::{json, Value};
|
||||
use sha2::{Digest, Sha256};
|
||||
@@ -273,12 +271,6 @@ fn stmt_json(stmt: &Stmt) -> Value {
|
||||
"value": expr_json(expr),
|
||||
"span": span_json(*span),
|
||||
}),
|
||||
Stmt::Call { call, span } => json!({
|
||||
"kind": "call_site",
|
||||
"target": call_target_json(&call.target),
|
||||
"args": call.args.iter().map(arg_json).collect::<Vec<_>>(),
|
||||
"span": span_json(*span),
|
||||
}),
|
||||
Stmt::Branch { arms, span } => json!({
|
||||
"kind": "branch",
|
||||
"arms": arms.iter().map(|arm| json!({
|
||||
@@ -378,19 +370,6 @@ fn arg_json(arg: &marqdo_expression::Arg) -> Value {
|
||||
})
|
||||
}
|
||||
|
||||
fn call_target_json(target: &CallTarget) -> Value {
|
||||
match target {
|
||||
CallTarget::Function { name } => json!({"kind":"function","name":name}),
|
||||
CallTarget::Qualified {
|
||||
module_alias,
|
||||
function,
|
||||
} => json!({"kind":"qualified","module_alias":module_alias,"function":function}),
|
||||
CallTarget::Resolved { module, function } => {
|
||||
json!({"kind":"resolved","module":module.to_string(),"function":function})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn reference_edges(project: &LoadedProject, module_id: &marqdo_ir::ModuleId) -> Vec<Value> {
|
||||
let Some(file) = project.files.get(module_id) else {
|
||||
return Vec::new();
|
||||
@@ -532,12 +511,6 @@ fn collect_calls(
|
||||
}
|
||||
Stmt::Eval { expr: value, .. } => expr_calls(project, module, function, value, calls),
|
||||
Stmt::Return { value, .. } => expr_calls(project, module, function, value, calls),
|
||||
Stmt::Call { call, span } => calls.push(json!({
|
||||
"function": function.id.to_string(),
|
||||
"span": span_json(*span),
|
||||
"callee": call_target_json(&call.target),
|
||||
"state": "resolved",
|
||||
})),
|
||||
Stmt::Branch { arms, .. } => {
|
||||
for arm in arms {
|
||||
expr_calls(project, module, function, &arm.condition, calls);
|
||||
|
||||
@@ -540,7 +540,6 @@ fn stmts_use_print(stmts: &[Stmt]) -> bool {
|
||||
target_uses || expr_uses_print(value)
|
||||
}
|
||||
Stmt::Eval { expr, .. } | Stmt::Return { value: expr, .. } => expr_uses_print(expr),
|
||||
Stmt::Call { call, .. } => call.args.iter().any(|arg| expr_uses_print(&arg.value)),
|
||||
Stmt::Branch { arms, .. } => arms
|
||||
.iter()
|
||||
.any(|arm| expr_uses_print(&arm.condition) || stmts_use_print(&arm.body)),
|
||||
|
||||
Reference in new issue
Block a user