summaryrefslogtreecommitdiff
path: root/Source/Modules/javascript.cxx
diff options
context:
space:
mode:
authorOliver Buchtala <oliver.buchtala@googlemail.com>2013-09-09 15:05:11 +0300
committerOliver Buchtala <oliver.buchtala@googlemail.com>2013-09-09 15:05:11 +0300
commitb6c9c97b96bc3039ccb291d76a64d009fc81fbb7 (patch)
tree3a7578013ccda973307b093c704216d5de7f6222 /Source/Modules/javascript.cxx
parent108143951da3859e0c056780706b6841231febb3 (diff)
downloadswig-b6c9c97b96bc3039ccb291d76a64d009fc81fbb7.tar.gz
Fix Javascript generator to use %renamed variable names.
Diffstat (limited to 'Source/Modules/javascript.cxx')
-rw-r--r--Source/Modules/javascript.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/Modules/javascript.cxx b/Source/Modules/javascript.cxx
index 54135d852..5bd22f710 100644
--- a/Source/Modules/javascript.cxx
+++ b/Source/Modules/javascript.cxx
@@ -793,8 +793,18 @@ int JSEmitter::enterFunction(Node *n) {
int JSEmitter::enterVariable(Node *n) {
+ // reset the state information for variables.
state.variable(true);
- state.variable(NAME, Swig_scopename_last(Getattr(n, "name")));
+
+ // Retrieve a pure symbol name. Using 'sym:name' as a basis, as it considers %renamings.
+
+ if (Equal(Getattr(n, "view"), "memberconstantHandler")) {
+ // Note: this is kind of hacky/experimental
+ // For constants/enums 'sym:name' contains e.g., 'Foo_Hello' instead of 'Hello'
+ state.variable(NAME, Getattr(n, "memberconstantHandler:sym:name"));
+ } else {
+ state.variable(NAME, Swig_scopename_last(Getattr(n, "sym:name")));
+ }
if(Equal(Getattr(n, "storage"), "static")) {
SetFlag(state.variable(), IS_STATIC);