Exemple #1
0
// do note that this version only works for non-overloaded functions!
Function *Function::lookup(const string& nm)
{
    PEntry pe = Parser::symbol_lookup(nm);
    if (!pe || !pe->type.is_signature()) return NULL;
    FunctionEntry *pfe = (FunctionEntry *)pe->data;   // shd be a method, really
    return pfe->back();
}
Exemple #2
0
// a var encodes in three distinct ways
// a NULL reference means that this is relative to TOS!
void UCContext::emit_reference(PExpr ex, int flags, int tcode)
{
 if (ex) {
   PEntry pe = ex->entry();
   Type t = ex->type();
  // *add 1.1.4 bit fields have their own instruction
   if (pe->is_bitfield()) {
     emit ((flags & LVALUE ? POPIF : PUSHIF),ex);
   } else
// special encoding for _function_ IREFs.  Clearly this is not
// complete - it assumes that there is only one fn in the set!
   if (t.is_function()) {
        FunctionEntry *pfe = (FunctionEntry *)pe->data;
        emit_push_int((int) pfe->back()->fun_block());
   } else
// *fix 1.2.0 Special case for regular references; their 'value' is a pointer
   if ((flags & AS_PTR) && ! t.is_plain_reference()) emit(PEA,ex);
   else emit ( (flags & LVALUE ? POPC : PUSHC) + tcode,ex);
 } else {
  if (!(flags & AS_PTR)) emit( (flags & LVALUE ? POPSC : PUSHSC)+tcode,NONE,0);
 }
}