Start compiling identifiers.

We'll need this if we support the "L == foobar" syntax, and besides
it should really be up to the parser client whether or not they use
identifiers with no function call or property reference.

It also allows us to generate error messages for unknown identifers.
This commit is contained in:
Jeff Young 2020-07-27 19:51:54 +01:00
parent be957e0105
commit 2ea5528cd0
1 changed files with 23 additions and 0 deletions

View File

@ -748,6 +748,29 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
break;
}
case TR_IDENTIFIER:
{
VAR_REF* vref = aCode->createVarRef( this, node->value.str, "" );
if( m_errorStatus.pendingError )
{
m_errorStatus.pendingError = true;
m_errorStatus.stage = ERROR_STATUS::CST_CODEGEN;
if( m_errorStatus.message == "var" )
{
m_errorStatus.message.Printf( _( "Unrecognized item '%s'" ),
node->value.str );
m_errorStatus.srcPos = node->srcPos - strlen( node->value.str );
}
return false;
}
node->uop = makeUop( TR_UOP_PUSH_VALUE, vref );
break;
}
default:
node->uop = makeUop( node->op );
break;