Skip to content

Commit

Permalink
tidy up jswGetSymbolListForObject code
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Dec 15, 2017
1 parent 9f4e747 commit 6e08b61
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/build_jswrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,16 @@ def removeBlacklistForWrapper(blacklistfile,datas):
codeOut('')

codeOut('const JswSymList *jswGetSymbolListForObject(JsVar *parent) {')
nativeTestStr = "jsvIsNativeFunction(parent) && ";
codeOut(" if (jsvIsNativeFunction(parent)) {");
for className in builtins:
builtin = builtins[className]
if not className in ["parent","!parent"] and not builtin["isProto"]:
if not className in ["parent","!parent"] and not builtin["isProto"] and className.startswith(nativeTestStr):
codeOut(" if ("+className[len(nativeTestStr):]+") return &jswSymbolTables["+builtin["indexName"]+"];");
codeOut(" }");
for className in builtins:
builtin = builtins[className]
if not className in ["parent","!parent"] and not builtin["isProto"] and not className.startswith(nativeTestStr):
codeOut(" if ("+className+") return &jswSymbolTables["+builtin["indexName"]+"];");
codeOut(" if (parent==execInfo.root) return &jswSymbolTables[jswSymbolIndex_global];");
codeOut(" return 0;")
Expand All @@ -475,7 +482,7 @@ def removeBlacklistForWrapper(blacklistfile,datas):
if jsondata["type"]=="constructor" and jsondata["name"]==builtin["className"]:
check = "(void*)parent->varData.native.ptr==(void*)"+jsondata["generate"]

codeOut(" if ("+check+") return &jswSymbolTables["+builtin["indexName"]+"];");
codeOut(" if ("+check+") return &jswSymbolTables["+builtin["indexName"]+"];");
codeOut(' }')
codeOut(' JsVar *constructor = jsvIsObject(parent)?jsvSkipNameAndUnLock(jsvFindChildFromString(parent, JSPARSE_CONSTRUCTOR_VAR, false)):0;')
codeOut(' if (constructor && jsvIsNativeFunction(constructor)) {')
Expand Down

0 comments on commit 6e08b61

Please sign in to comment.