mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 12:24:45 +00:00
Fix import
to be called from anywhere
This commit is contained in:
parent
f548f9e6ef
commit
23a6f630c9
21 changed files with 979 additions and 549 deletions
|
@ -509,7 +509,28 @@ impl Parser {
|
|||
let local = ConstLocal::new(local.name.into_token());
|
||||
Ok(ConstExpr::Accessor(ConstAccessor::Local(local)))
|
||||
}
|
||||
// TODO: App, Array, Record, BinOp, UnaryOp,
|
||||
Expr::Array(array) => match array {
|
||||
Array::Normal(arr) => {
|
||||
let (elems, _, _) = arr.elems.deconstruct();
|
||||
let mut const_elems = vec![];
|
||||
for elem in elems.into_iter() {
|
||||
let const_expr = self.validate_const_expr(elem.expr)?;
|
||||
const_elems.push(ConstPosArg::new(const_expr));
|
||||
}
|
||||
let elems = ConstArgs::new(const_elems, vec![], None);
|
||||
let const_arr = ConstArray::new(arr.l_sqbr, arr.r_sqbr, elems, None);
|
||||
Ok(ConstExpr::Array(const_arr))
|
||||
}
|
||||
other => {
|
||||
self.errs.push(ParseError::feature_error(
|
||||
line!() as usize,
|
||||
other.loc(),
|
||||
"???",
|
||||
));
|
||||
Err(())
|
||||
}
|
||||
},
|
||||
// TODO: App, Record, BinOp, UnaryOp,
|
||||
other => {
|
||||
self.errs.push(ParseError::syntax_error(
|
||||
0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue