diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2022-03-08 21:02:10 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2022-03-10 22:18:23 +0000 |
commit | fe27e3d2ba1fc872f91053b38ec768d1916dc18a (patch) | |
tree | e66a50241d61a76b573d2c277a7c0ec5e4731c29 | |
parent | e53f51b89d482863280dad607cc2269910cc9946 (diff) | |
download | swig-fe27e3d2ba1fc872f91053b38ec768d1916dc18a.tar.gz |
Language::unrollVirtualMethods variable initialisation refactor
-rw-r--r-- | Source/Modules/lang.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 196ff47a9..1d3513599 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1855,10 +1855,6 @@ static String *vtable_method_id(Node *n) { * Language::unrollVirtualMethods() * ---------------------------------------------------------------------- */ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_director, int &virtual_destructor, int protectedbase) { - Node *ni; - String *nodeType; - String *classname; - String *decl; bool first_base = false; // recurse through all base classes to build the vtable List *bl = Getattr(n, "bases"); @@ -1883,10 +1879,10 @@ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_ } } // find the methods that need directors - classname = Getattr(n, "name"); - for (ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) { + String *classname = Getattr(n, "name"); + for (Node *ni = Getattr(n, "firstChild"); ni; ni = nextSibling(ni)) { /* we only need to check the virtual members */ - nodeType = Getattr(ni, "nodeType"); + String *nodeType = Getattr(ni, "nodeType"); int is_using = (Cmp(nodeType, "using") == 0); Node *nn = is_using ? firstChild(ni) : ni; /* assume there is only one child node for "using" nodes */ if (is_using) { @@ -1902,7 +1898,7 @@ int Language::unrollVirtualMethods(Node *n, Node *parent, List *vm, int default_ /* we need to add methods(cdecl) and destructor (to check for throw decl) */ int is_destructor = (Cmp(nodeType, "destructor") == 0); if ((Cmp(nodeType, "cdecl") == 0) || is_destructor) { - decl = Getattr(nn, "decl"); + String *decl = Getattr(nn, "decl"); /* extra check for function type and proper access */ if (SwigType_isfunction(decl) && (((!protectedbase || dirprot_mode()) && is_public(nn)) || need_nonpublic_member(nn))) { String *name = Getattr(nn, "name"); |