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),
|
multiinput(0),
|
||||||
cplus_runtime(0),
|
cplus_runtime(0),
|
||||||
directors(0) {
|
directors(0) {
|
||||||
addScope(""); // create top level/global symbol table scope
|
symbolAddScope(""); // create top level/global symbol table scope
|
||||||
argc_template_string = NewString("argc");
|
argc_template_string = NewString("argc");
|
||||||
argv_template_string = NewString("argv[%d]");
|
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 );
|
//Printf( stdout, "addSymbol: %s %s\n", s, scope );
|
||||||
Hash *symbols = Getattr(symtabs, scope ? scope : "");
|
Hash *symbols = Getattr(symtabs, scope ? scope : "");
|
||||||
if (!symbols) {
|
if (!symbols) {
|
||||||
symbols = addScope(scope);
|
symbols = symbolAddScope(scope);
|
||||||
} else {
|
} else {
|
||||||
Node *c = Getattr(symbols, s);
|
Node *c = Getattr(symbols, s);
|
||||||
if (c && (c != n)) {
|
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,
|
* 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.
|
* you don't have to call it - addSymbols will lazily create scopes automatically.
|
||||||
* If scope with given name already exists, then do nothing.
|
* If scope with given name already exists, then do nothing.
|
||||||
* Returns newly created (or already existing) scope.
|
* Returns newly created (or already existing) scope.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
Hash* Language::addScope(const_String_or_char_ptr scope) {
|
Hash* Language::symbolAddScope(const_String_or_char_ptr scope) {
|
||||||
Hash *symbols = scopeLookup(scope);
|
Hash *symbols = symbolScopeLookup(scope);
|
||||||
if(!symbols) {
|
if(!symbols) {
|
||||||
// Order in which to following parts are executed is important. In Lanugage
|
// Order in which to following parts are executed is important. In Lanugage
|
||||||
// constructor addScope("") is called to create a top level scope itself.
|
// 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
|
* Lookup and returns a symtable (hash) representing given scope. Hash contains
|
||||||
* all symbols in this scope.
|
* 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 : "");
|
Hash *symbols = Getattr(symtabs, scope ? scope : "");
|
||||||
return symbols;
|
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
|
* 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,
|
* 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
|
* There is no difference from symbolLookup() method except for signature
|
||||||
* and return type.
|
* and return type.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
Hash* Language::scopeSymbolLookup( const_String_or_char_ptr scope )
|
Hash* Language::symbolScopePseudoSymbolLookup( const_String_or_char_ptr scope )
|
||||||
{
|
{
|
||||||
/* Getting top scope */
|
/* Getting top scope */
|
||||||
const_String_or_char_ptr 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
|
* A small helper to hide impelementation of how CArrays hashes are stored
|
||||||
* ---------------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------------- */
|
||||||
Hash *rawGetCArraysHash(const_String_or_char_ptr name) {
|
Hash *rawGetCArraysHash(const_String_or_char_ptr name) {
|
||||||
Hash *scope = scopeLookup( name ? name : "" );
|
Hash *scope = symbolScopeLookup( name ? name : "" );
|
||||||
if(!scope)
|
if(!scope)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -1694,10 +1694,10 @@ public:
|
||||||
* only at first call (a.k.a when nspace is created).
|
* only at first call (a.k.a when nspace is created).
|
||||||
* ---------------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------------- */
|
||||||
Hash *getCArraysHash(String *nspace, bool reg = true) {
|
Hash *getCArraysHash(String *nspace, bool reg = true) {
|
||||||
Hash *scope = scopeLookup(nspace ? nspace : "");
|
Hash *scope = symbolScopeLookup(nspace ? nspace : "");
|
||||||
if(!scope) {
|
if(!scope) {
|
||||||
addScope( nspace ? nspace : "" );
|
symbolAddScope( nspace ? nspace : "" );
|
||||||
scope = scopeLookup(nspace ? nspace : "");
|
scope = symbolScopeLookup(nspace ? nspace : "");
|
||||||
assert(scope);
|
assert(scope);
|
||||||
}
|
}
|
||||||
Hash *carrays_hash = Getattr(scope, "lua:cdata");
|
Hash *carrays_hash = Getattr(scope, "lua:cdata");
|
||||||
|
|
@ -1979,14 +1979,14 @@ public:
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void closeNamespaces(File *dataOutput) {
|
void closeNamespaces(File *dataOutput) {
|
||||||
// Special handling for empty module.
|
// 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
|
// Module is empty. Create hash for global scope in order to have swig__Module
|
||||||
// variable in resulting file
|
// variable in resulting file
|
||||||
getCArraysHash(0);
|
getCArraysHash(0);
|
||||||
}
|
}
|
||||||
// Because we cant access directly 'symtabs', instead we access
|
// Because we cant access directly 'symtabs', instead we access
|
||||||
// top-level scope and look on all scope pseudo-symbols in it.
|
// top-level scope and look on all scope pseudo-symbols in it.
|
||||||
Hash *top_scope = scopeLookup("");
|
Hash *top_scope = symbolScopeLookup("");
|
||||||
assert(top_scope);
|
assert(top_scope);
|
||||||
Iterator ki = First(top_scope);
|
Iterator ki = First(top_scope);
|
||||||
List *to_close = NewList();
|
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 int addSymbol(const String *s, const Node *n, const_String_or_char_ptr scope = ""); /* Add symbol */
|
||||||
virtual void dumpSymbols();
|
virtual void dumpSymbols();
|
||||||
virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */
|
virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */
|
||||||
virtual Hash* addScope(const_String_or_char_ptr scope);
|
virtual Hash* symbolAddScope(const_String_or_char_ptr scope);
|
||||||
virtual Hash* scopeLookup( const_String_or_char_ptr scope );
|
virtual Hash* symbolScopeLookup( const_String_or_char_ptr scope );
|
||||||
virtual Hash* scopeSymbolLookup( 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 *classLookup(const SwigType *s) const; /* Class lookup */
|
||||||
virtual Node *enumLookup(SwigType *s); /* Enum lookup */
|
virtual Node *enumLookup(SwigType *s); /* Enum lookup */
|
||||||
virtual int abstractClassTest(Node *n); /* Is class really abstract? */
|
virtual int abstractClassTest(Node *n); /* Is class really abstract? */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue