Javascript: preparations for using Language::getNSpace().
This commit is contained in:
parent
7824322b14
commit
0c42158723
1 changed files with 22 additions and 2 deletions
|
|
@ -318,6 +318,10 @@ public:
|
||||||
**/
|
**/
|
||||||
virtual int fragmentDirective(Node *n);
|
virtual int fragmentDirective(Node *n);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual String *getNSpace() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
JSEmitter *emitter;
|
JSEmitter *emitter;
|
||||||
|
|
@ -467,6 +471,10 @@ int JAVASCRIPT::fragmentDirective(Node *n) {
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String *JAVASCRIPT::getNSpace() const {
|
||||||
|
return Language::getNSpace();
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------
|
/* ---------------------------------------------------------------------
|
||||||
* top()
|
* top()
|
||||||
*
|
*
|
||||||
|
|
@ -1346,14 +1354,26 @@ int JSEmitter::switchNamespace(Node *n) {
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
String *nspace = Getattr(n, "sym:nspace");
|
|
||||||
|
|
||||||
// if nspace is deactivated, everything goes into the global scope
|
// if nspace is deactivated, everything goes into the global scope
|
||||||
if (!GetFlag(n, "feature:nspace")) {
|
if (!GetFlag(n, "feature:nspace")) {
|
||||||
current_namespace = Getattr(namespaces, "::");
|
current_namespace = Getattr(namespaces, "::");
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EXPERIMENTAL: we want to use Language::getNSpace() here
|
||||||
|
// However, it is not working yet.
|
||||||
|
// For namespace functions Language::getNSpace() does not give a valid result
|
||||||
|
#if 0
|
||||||
|
JAVASCRIPT *lang = static_cast<JAVASCRIPT*>(Language::instance());
|
||||||
|
String *_nspace = lang->getNSpace();
|
||||||
|
if (!Equal(nspace, _nspace)) {
|
||||||
|
Printf(stdout, "##### Custom vs Language::getNSpace(): %s | %s\n", nspace, _nspace);
|
||||||
|
Swig_print_node(n);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
String *nspace = Getattr(n, "sym:nspace");
|
||||||
|
|
||||||
if (nspace == NULL) {
|
if (nspace == NULL) {
|
||||||
// It seems that only classes have 'sym:nspace' set.
|
// It seems that only classes have 'sym:nspace' set.
|
||||||
// We try to get the namespace from the qualified name (i.e., everything before the last '::')
|
// We try to get the namespace from the qualified name (i.e., everything before the last '::')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue