some code for const processing
This commit is contained in:
parent
19d480719e
commit
3559e5fa0e
@ -4023,7 +4023,33 @@ static int compile_class_level_consts (moo_t* moo)
|
||||
{
|
||||
if (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT)
|
||||
{
|
||||
/* TODO */
|
||||
/* TODO: */
|
||||
#if 0
|
||||
if (add_class_level_const(moo, TOKEN_NAME(moo), TOKEN_LOC(moo)) <= -1) return -1;
|
||||
|
||||
GET_TOKEN (moo);
|
||||
|
||||
if (TOKEN_TYPE(moo) == MOO_IOTOK_ASSIGN)
|
||||
{
|
||||
moo_oop_t lit;
|
||||
|
||||
GET_TOKEN (moo);
|
||||
|
||||
/* only a single literal token is allowed as a value for now.
|
||||
* TODO: extend to support simple constant expression */
|
||||
lit = token_to_literal(moo, 1);
|
||||
if (!lit) return -1;
|
||||
|
||||
if (set_class_level_const_value(moo, cc->_const.count - 1, lit) <= -1) return -1;
|
||||
|
||||
GET_TOKEN (moo);
|
||||
}
|
||||
else
|
||||
{
|
||||
moo_setsynerr (moo, MOO_SYNERR_ASSIGN, TOKEN_LOC(moo), TOKEN_NAME(moo));
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (TOKEN_TYPE(moo) == MOO_IOTOK_COMMA || TOKEN_TYPE(moo) == MOO_IOTOK_EOF || TOKEN_TYPE(moo) == MOO_IOTOK_PERIOD)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user