#include <symbol.h>
Public Types | |
enum | { NO_STATE = 0xFFFFFFFF } |
Public Member Functions | |
void | addAttrib (const String &name, VarDef *value) |
Adds an attribute. | |
Symbol * | addLocal (Symbol *sym) |
Symbol * | addParameter (Symbol *sym) |
Symbol * | addUndefined (Symbol *sym) |
AttribMap * | attributes () const |
Returns a map of String& -> VarDef* containing metadata about this symbol. | |
uint32 | basePC () const |
BasePC at which this symbol was declared. | |
void | basePC (uint32 pc) |
void | code (byte *b) |
byte * | code () const |
void | codeSize (uint32 p) |
uint32 | codeSize () const |
FuncDef (byte *code, uint32 codeSize) | |
Constructor for external generators. | |
bool | load (Module *mod, Stream *in) |
void | locals (uint16 l) |
uint16 | locals () const |
uint32 | onceItemId () const |
void | onceItemId (uint32 id) |
void | params (uint16 p) |
uint16 | params () const |
void | recount () |
Counts the parameters and the local variables that this funcdef has in its symtab. | |
bool | save (Stream *out) const |
SymbolTable & | symtab () |
const SymbolTable & | symtab () const |
void | undefined (uint16 u) |
uint16 | undefined () const |
~FuncDef () | |
Public Attributes | |
enum Falcon::FuncDef:: { ... } | enum_NO_STATE |
A callable symbol has many more fields to keep track of. It has a back-pointer to the owning module, because the module contains the bytecode where data is held. It has also a symbol table pointer holding variable only symbols in it.
Constructor for external generators.
Requires that the funcdef is provided with a previously allocated code. The code is owned by the FuncDef and destroyed with this instance.
Falcon::FuncDef::~FuncDef | ( | ) |
Adds an attribute.
The first attribute added will cause the map to be created.
AttribMap* Falcon::FuncDef::attributes | ( | ) | const [inline] |
Returns a map of String& -> VarDef* containing metadata about this symbol.
May return if the item has no attributes.
uint32 Falcon::FuncDef::basePC | ( | ) | const [inline] |
BasePC at which this symbol was declared.
This is useful only to find lines in the code of this function in the global line table.
The line that generated a certain function is found through basepc + VM->pc.
void Falcon::FuncDef::basePC | ( | uint32 | pc | ) | [inline] |
void Falcon::FuncDef::code | ( | byte * | b | ) | [inline] |
byte* Falcon::FuncDef::code | ( | ) | const [inline] |
void Falcon::FuncDef::codeSize | ( | uint32 | p | ) | [inline] |
uint32 Falcon::FuncDef::codeSize | ( | ) | const [inline] |
Reimplemented in Falcon::ClassDef.
void Falcon::FuncDef::locals | ( | uint16 | l | ) | [inline] |
uint16 Falcon::FuncDef::locals | ( | ) | const [inline] |
uint32 Falcon::FuncDef::onceItemId | ( | ) | const [inline] |
void Falcon::FuncDef::onceItemId | ( | uint32 | id | ) | [inline] |
void Falcon::FuncDef::params | ( | uint16 | p | ) | [inline] |
uint16 Falcon::FuncDef::params | ( | ) | const [inline] |
void Falcon::FuncDef::recount | ( | ) |
Counts the parameters and the local variables that this funcdef has in its symtab.
Useful when the function object is created by the compiler, that won't use addParameter() and addLocal(). Those two metods are for API implementors and extensions, while the compiler has to add symbols to the function symbol table; for this reason, at the end of the function the compiler calls this method to cache the count of locals and parameters that the linker must create.
bool Falcon::FuncDef::save | ( | Stream * | out | ) | const |
Reimplemented in Falcon::ClassDef.
SymbolTable& Falcon::FuncDef::symtab | ( | ) | [inline] |
const SymbolTable& Falcon::FuncDef::symtab | ( | ) | const [inline] |
void Falcon::FuncDef::undefined | ( | uint16 | u | ) | [inline] |
uint16 Falcon::FuncDef::undefined | ( | ) | const [inline] |
enum { ... } Falcon::FuncDef::enum_NO_STATE |