parser: make the RHS object in module entries optional
This commit is contained in:
parent
8f1f746a82
commit
d17524a7d2
|
@ -26,7 +26,8 @@ pub struct Entry {
|
|||
pub nloc: Location,
|
||||
// technically this is a set, but that would just waste space here...
|
||||
pub args: Box<[Atom]>,
|
||||
pub obj: Object,
|
||||
// might be a dummy
|
||||
pub obj: Option<Object>,
|
||||
// we use a bitflag here to conserve memory
|
||||
pub flags: EntryFlags,
|
||||
}
|
||||
|
@ -347,12 +348,15 @@ impl Module {
|
|||
}
|
||||
}
|
||||
|
||||
ctx.expect_token(Token::Assign, "=")?;
|
||||
|
||||
let obj = Object::parse_high(ctx)?;
|
||||
if let Object::Code { cfe: true, .. } = obj {
|
||||
flags |= EntryFlags::CTRLFE;
|
||||
}
|
||||
let obj = if ctx.maybe_eat_token(Token::Assign).is_some() {
|
||||
let obj = Object::parse_high(ctx)?;
|
||||
if let Object::Code { cfe: true, .. } = obj {
|
||||
flags |= EntryFlags::CTRLFE;
|
||||
}
|
||||
Some(obj)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// code object
|
||||
ret.entries.insert(
|
||||
|
|
Loading…
Reference in New Issue