Permalink
Browse files

Minor code improvements after Lua changes.

  • Loading branch information...
1 parent 0da97a9 commit d957d3763612f7de5796ff7ae378d8eb6090b216 @wsfulton wsfulton committed Feb 28, 2014
Showing with 17 additions and 19 deletions.
  1. +13 −14 Source/Modules/lang.cxx
  2. +2 −3 Source/Modules/lua.cxx
  3. +2 −2 Source/Modules/swigmod.h
View
@@ -2993,7 +2993,7 @@ int Language::variableWrapper(Node *n) {
Setattr(n, "varset", "1");
functionWrapper(n);
} else {
- Setattr(n, "feature:immutable", "1");
+ SetFlag(n, "feature:immutable");
}
/* Restore parameters */
Setattr(n, "sym:name", symname);
@@ -3079,20 +3079,20 @@ int Language::addSymbol(const String *s, const Node *n, const_String_or_char_ptr
}
/* -----------------------------------------------------------------------------
- * Lanugage::symbolAddScope( const_String_or_char_ptr scopeName )
+ * Language::symbolAddScope()
*
- * Creates a scope (symbols Hash) for given name. This method is auxilary,
+ * Creates a scope (symbols Hash) for given name. This method is auxiliary,
* 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::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.
- // Thus we must first add symbols hash to symtab and only then add pseudo
- // symbol to top-level scope
+ // The order in which the following code is executed is important. In the Language
+ // constructor addScope("") is called to create a top level scope.
+ // Thus we must first add a symbols hash to symtab and only then add pseudo
+ // symbols to the top-level scope.
// New scope which has not been added by the target language - lazily created.
symbols = NewHash();
@@ -3103,14 +3103,14 @@ Hash* Language::symbolAddScope(const_String_or_char_ptr scope) {
const_String_or_char_ptr top_scope = "";
Hash *topscope_symbols = Getattr(symtabs, top_scope);
Hash *pseudo_symbol = NewHash();
- Setattr(pseudo_symbol, "sym:is_scope", "1");
+ Setattr(pseudo_symbol, "sym:scope", "1");
Setattr(topscope_symbols, scope, pseudo_symbol);
}
return symbols;
}
/* -----------------------------------------------------------------------------
- * Lanugage::symbolSscopeLookup( const_String_or_char_ptr scope )
+ * Language::symbolScopeLookup()
*
* Lookup and returns a symtable (hash) representing given scope. Hash contains
* all symbols in this scope.
@@ -3121,17 +3121,16 @@ Hash* Language::symbolScopeLookup( const_String_or_char_ptr scope ) {
}
/* -----------------------------------------------------------------------------
- * Lanugage::symbolScopeSymbolLookup( const_String_or_char_ptr scope )
+ * Language::symbolScopePseudoSymbolLookup()
*
* 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,
- * but you can more if you need to. This is also true fro top level scope ("").
+ * but more could be added. This is also true for the top level scope ("").
* It contains a pseudo symbol with name "" (empty). Pseudo symbol contains the
* following properties:
- * sym:scope = "1" - a flag that this is scope pseudo symbol
+ * sym:scope = "1" - a flag that this is a scope pseudo symbol
*
- * Pseudo symbols are a Hash*, not a Node* (not that there is a difference
- * in DOH)
+ * Pseudo symbols are a Hash*, not a Node*.
* There is no difference from symbolLookup() method except for signature
* and return type.
* ----------------------------------------------------------------------------- */
View
@@ -2096,9 +2096,8 @@ class LUA:public Language {
List *to_close = NewList();
while (ki.key) {
assert(ki.item);
- if (Getattr(ki.item, "sym:is_scope")) {
- // We have a pseudo symbol. Lets get actuall scope for this
- // pseudo symbol
+ if (Getattr(ki.item, "sym:scope")) {
+ // We have a pseudo symbol. Lets get actual scope for this pseudo symbol
Hash *carrays_hash = rawGetCArraysHash(ki.key);
assert(carrays_hash);
if (Getattr(carrays_hash, "lua:closed") == 0)
View
@@ -217,8 +217,8 @@ class Language:public Dispatcher {
virtual void dumpSymbols();
virtual Node *symbolLookup(String *s, const_String_or_char_ptr scope = ""); /* Symbol lookup */
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 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? */

0 comments on commit d957d37

Please sign in to comment.