extract get_signature()
for working sets analogous to the same function on the engine state
This commit is contained in:
parent
368ab10efe
commit
8637a2f1a2
|
@ -954,12 +954,7 @@ pub fn parse_internal_call(
|
||||||
let _ = working_set.add_span(call.head);
|
let _ = working_set.add_span(call.head);
|
||||||
|
|
||||||
let decl = working_set.get_decl(decl_id);
|
let decl = working_set.get_decl(decl_id);
|
||||||
let signature = if let Some(block_id) = decl.block_id() {
|
let signature = working_set.get_signature(decl);
|
||||||
let block = working_set.get_block(block_id);
|
|
||||||
*block.signature.clone()
|
|
||||||
} else {
|
|
||||||
decl.signature()
|
|
||||||
};
|
|
||||||
let output = signature.get_output_type();
|
let output = signature.get_output_type();
|
||||||
|
|
||||||
// storing the var ID for later due to borrowing issues
|
// storing the var ID for later due to borrowing issues
|
||||||
|
|
|
@ -5,7 +5,7 @@ use crate::{
|
||||||
StateDelta, Variable, VirtualPath, Visibility,
|
StateDelta, Variable, VirtualPath, Visibility,
|
||||||
},
|
},
|
||||||
BlockId, Category, CompileError, Config, DeclId, FileId, GetSpan, Module, ModuleId, ParseError,
|
BlockId, Category, CompileError, Config, DeclId, FileId, GetSpan, Module, ModuleId, ParseError,
|
||||||
ParseWarning, Span, SpanId, Type, Value, VarId, VirtualPathId,
|
ParseWarning, Signature, Span, SpanId, Type, Value, VarId, VirtualPathId,
|
||||||
};
|
};
|
||||||
use core::panic;
|
use core::panic;
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -708,6 +708,14 @@ impl<'a> StateWorkingSet<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_signature(&self, decl: &dyn Command) -> Signature {
|
||||||
|
if let Some(block_id) = decl.block_id() {
|
||||||
|
*self.get_block(block_id).signature.clone()
|
||||||
|
} else {
|
||||||
|
decl.signature()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn find_commands_by_predicate(
|
pub fn find_commands_by_predicate(
|
||||||
&self,
|
&self,
|
||||||
predicate: impl Fn(&[u8]) -> bool,
|
predicate: impl Fn(&[u8]) -> bool,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user