forked from AbleOS/holey-bytes
fixing infinite recusrion bug
This commit is contained in:
parent
2a4d27d8e6
commit
1ee8d464c6
|
@ -759,9 +759,16 @@ impl Codegen {
|
||||||
use {Expr as E, TokenKind as T};
|
use {Expr as E, TokenKind as T};
|
||||||
let value = match *expr {
|
let value = match *expr {
|
||||||
E::Mod { id, .. } => Some(Value::ty(ty::Kind::Module(id).compress())),
|
E::Mod { id, .. } => Some(Value::ty(ty::Kind::Module(id).compress())),
|
||||||
E::Struct { captured, .. } => {
|
E::Struct { captured, packed, fields, .. } => {
|
||||||
if captured.is_empty() {
|
if captured.is_empty() {
|
||||||
Some(Value::ty(self.ty(expr)))
|
Some(Value::ty(
|
||||||
|
ty::Kind::Struct(self.build_struct(
|
||||||
|
self.ci.file,
|
||||||
|
packed.then_some(1),
|
||||||
|
fields,
|
||||||
|
))
|
||||||
|
.compress(),
|
||||||
|
))
|
||||||
} else {
|
} else {
|
||||||
let values = captured
|
let values = captured
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -705,6 +705,14 @@ impl Types {
|
||||||
}
|
}
|
||||||
ty
|
ty
|
||||||
}
|
}
|
||||||
|
Expr::Slice { size: None, item, .. } => {
|
||||||
|
let ty = self.ty(file, item, files)?;
|
||||||
|
self.make_array(ty, ArrayLen::MAX)
|
||||||
|
}
|
||||||
|
//Expr::Slice { size: Some(&Expr::Number { value, .. }), item, .. } => {
|
||||||
|
// let ty = self.ty(file, item, files)?;
|
||||||
|
// self.make_array(ty, value as _)
|
||||||
|
//}
|
||||||
Expr::Struct { pos, fields, packed, .. } => {
|
Expr::Struct { pos, fields, packed, .. } => {
|
||||||
let sym = SymKey { file, ident: pos };
|
let sym = SymKey { file, ident: pos };
|
||||||
if let Some(&ty) = self.syms.get(&sym) {
|
if let Some(&ty) = self.syms.get(&sym) {
|
||||||
|
|
Loading…
Reference in a new issue