mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-03 14:04:33 +00:00
WIP: Impl DataPack type checking
This commit is contained in:
parent
e7898c094e
commit
263c43d74b
7 changed files with 119 additions and 58 deletions
|
@ -897,6 +897,7 @@ impl Call {
|
|||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub struct DataPack {
|
||||
pub class: Box<Expr>,
|
||||
pub connector: Token,
|
||||
pub args: Record,
|
||||
}
|
||||
|
||||
|
@ -915,9 +916,10 @@ impl Locational for DataPack {
|
|||
}
|
||||
|
||||
impl DataPack {
|
||||
pub fn new(class: Expr, args: Record) -> Self {
|
||||
pub fn new(class: Expr, connector: Token, args: Record) -> Self {
|
||||
Self {
|
||||
class: Box::new(class),
|
||||
connector,
|
||||
args,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ impl Desugarer {
|
|||
let class = self.rec_desugar_shortened_record(*pack.class);
|
||||
let rec = self.desugar_shortened_record_inner(rec);
|
||||
let args = Record::Normal(rec);
|
||||
Expr::DataPack(DataPack::new(class, args))
|
||||
Expr::DataPack(DataPack::new(class, pack.connector, args))
|
||||
} else {
|
||||
Expr::DataPack(pack)
|
||||
}
|
||||
|
|
|
@ -997,7 +997,7 @@ impl Parser {
|
|||
.map_err(|_| self.stack_dec())?;
|
||||
match container {
|
||||
BraceContainer::Record(args) => {
|
||||
let pack = DataPack::new(maybe_class, args);
|
||||
let pack = DataPack::new(maybe_class, vis, args);
|
||||
stack.push(ExprOrOp::Expr(Expr::DataPack(pack)));
|
||||
}
|
||||
BraceContainer::Dict(dict) => todo!("{dict}"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue