Rename methods to make it clear what 'symbols table' they operate on.
This commit is contained in:
parent
00f59ac497
commit
4eef510e33
3 changed files with 18 additions and 18 deletions
|
|
@ -319,7 +319,7 @@ overloading(0),
|
|||
multiinput(0),
|
||||
cplus_runtime(0),
|
||||
directors(0) {
|
||||
addScope(""); // create top level/global symbol table scope
|
||||
symbolAddScope(""); // create top level/global symbol table scope
|
||||
argc_template_string = NewString("argc");
|
||||
argv_template_string = NewString("argv[%d]");
|
||||
|
||||
|
|
@ -3060,7 +3060,7 @@ int Language::addSymbol(const String *s, const Node *n, const_String_or_char_ptr
|
|||
//Printf( stdout, "addSymbol: %s %s\n", s, scope );
|
||||
Hash *symbols = Getattr(symtabs, scope ? scope : "");
|
||||
if (!symbols) {
|
||||
symbols = addScope(scope);
|
||||
symbols = symbolAddScope(scope);
|
||||
} else {
|
||||
Node *c = Getattr(symbols, s);
|
||||
if (c && (c != n)) {
|
||||
|
|
@ -3077,15 +3077,15 @@ int Language::addSymbol(const String *s, const Node *n, const_String_or_char_ptr
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Lanugage::addScope( const_String_or_char_ptr scopeName )
|
||||
* Lanugage::symbolAddScope( const_String_or_char_ptr scopeName )
|
||||
*
|
||||
* Creates a scope (symbols Hash) for given name. This method is auxilary,
|
||||
* you don't have to call it - addSymbols will lazily create scopes automatically.
|
||||
* If scope with given name already exists, then do nothing.
|
||||
* Returns newly created (or already existing) scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
Hash* Language::addScope(const_String_or_char_ptr scope) {
|
||||
Hash *symbols = scopeLookup(scope);
|
||||
Hash* Language::symbolAddScope(const_String_or_char_ptr scope) {
|
||||
Hash *symbols = symbolScopeLookup(scope);
|
||||
if(!symbols) {
|
||||
// Order in which to following parts are executed is important. In Lanugage
|
||||
// constructor addScope("") is called to create a top level scope itself.
|
||||
|
|
@ -3108,18 +3108,18 @@ Hash* Language::addScope(const_String_or_char_ptr scope) {
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Lanugage::scopeLookup( const_String_or_char_ptr scope )
|
||||
* Lanugage::symbolSscopeLookup( const_String_or_char_ptr scope )
|
||||
*
|
||||
* Lookup and returns a symtable (hash) representing given scope. Hash contains
|
||||
* all symbols in this scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
Hash* Language::scopeLookup( const_String_or_char_ptr scope ) {
|
||||
Hash* Language::symbolScopeLookup( const_String_or_char_ptr scope ) {
|
||||
Hash *symbols = Getattr(symtabs, scope ? scope : "");
|
||||
return symbols;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Lanugage::scopeSymbolLookup( const_String_or_char_ptr scope )
|
||||
* Lanugage::symbolScopeSymbolLookup( const_String_or_char_ptr scope )
|
||||
*
|
||||
* For every scope there is a special pseudo-symbol in the top scope (""). It
|
||||
* exists solely to detect name clashes. This pseudo symbol may contain a few properties,
|
||||
|
|
@ -3133,7 +3133,7 @@ Hash* Language::scopeLookup( const_String_or_char_ptr scope ) {
|
|||
* There is no difference from symbolLookup() method except for signature
|
||||
* and return type.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
Hash* Language::scopeSymbolLookup( const_String_or_char_ptr scope )
|
||||
Hash* Language::symbolScopePseudoSymbolLookup( const_String_or_char_ptr scope )
|
||||
{
|
||||
/* Getting top scope */
|
||||
const_String_or_char_ptr top_scope = "";
|
||||
|
|
|
|||
|
|
@ -1669,7 +1669,7 @@ public:
|
|||
* A small helper to hide impelementation of how CArrays hashes are stored
|
||||
* ---------------------------------------------------------------------------- */
|
||||
Hash *rawGetCArraysHash(const_String_or_char_ptr name) {
|
||||
Hash *scope = scopeLookup( name ? name : "" );
|
||||
Hash *scope = symbolScopeLookup( name ? name : "" );
|
||||
if(!scope)
|
||||
return 0;
|
||||
|
||||
|
|
@ -1694,10 +1694,10 @@ public:
|
|||
* only at first call (a.k.a when nspace is created).
|
||||
* ---------------------------------------------------------------------------- */
|
||||
Hash *getCArraysHash(String *nspace, bool reg = true) {
|
||||
Hash *scope = scopeLookup(nspace ? nspace : "");
|
||||
Hash *scope = symbolScopeLookup(nspace ? nspace : "");
|
||||
if(!scope) {
|
||||
addScope( nspace ? nspace : "" );
|
||||
scope = scopeLookup(nspace ? nspace : "");
|
||||
symbolAddScope( nspace ? nspace : "" );
|
||||
scope = symbolScopeLookup(nspace ? nspace : "");
|
||||
assert(scope);
|
||||
}
|
||||
Hash *carrays_hash = Getattr(scope, "lua:cdata");
|
||||
|
|
@ -1979,14 +1979,14 @@ public:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
void closeNamespaces(File *dataOutput) {
|
||||
// Special handling for empty module.
|
||||
if (scopeLookup("") == 0 || rawGetCArraysHash("") == 0) {
|
||||
if (symbolScopeLookup("") == 0 || rawGetCArraysHash("") == 0) {
|
||||
// Module is empty. Create hash for global scope in order to have swig__Module
|
||||
// variable in resulting file
|
||||
getCArraysHash(0);
|
||||
}
|
||||
// Because we cant access directly 'symtabs', instead we access
|
||||
// top-level scope and look on all scope pseudo-symbols in it.
|
||||
Hash *top_scope = scopeLookup("");
|
||||
Hash *top_scope = symbolScopeLookup("");
|
||||
assert(top_scope);
|
||||
Iterator ki = First(top_scope);
|
||||
List *to_close = NewList();
|
||||
|
|
|
|||
|
|
@ -216,9 +216,9 @@ public:
|
|||
virtual int addSymbol(const String *s, const Node *n, const_String_or_char_ptr scope = ""); /* Add symbol */
|
||||
virtual void dumpSymbols();
|
||||
virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */
|
||||
virtual Hash* addScope(const_String_or_char_ptr scope);
|
||||
virtual Hash* scopeLookup( const_String_or_char_ptr scope );
|
||||
virtual Hash* scopeSymbolLookup( const_String_or_char_ptr scope );
|
||||
virtual Hash* symbolAddScope(const_String_or_char_ptr scope);
|
||||
virtual Hash* symbolScopeLookup( const_String_or_char_ptr scope );
|
||||
virtual Hash* symbolScopePseudoSymbolLookup( const_String_or_char_ptr scope );
|
||||
virtual Node *classLookup(const SwigType *s) const; /* Class lookup */
|
||||
virtual Node *enumLookup(SwigType *s); /* Enum lookup */
|
||||
virtual int abstractClassTest(Node *n); /* Is class really abstract? */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue