Merge branch 'contrib/TekuConcept'

* contrib/TekuConcept:
  Dev Checkpoint 201908200213
  Dev Checkpoint 201906261312
  Dev Checkpoint 201906252227
  Dev Checkpoint 201906252221
  Dev Checkpoint 201906252210
  Dev Checkpoint 201906252113
  Add JS Native Directive Testcase
  JS Example Campatibility Update
  Add Native Directive Example
  Update JavaScript Documentation
  Add JS Native Wrapper API
This commit is contained in:
William S Fulton 2019-08-20 18:53:02 +01:00
commit 6925ec796b
11 changed files with 189 additions and 1 deletions

View file

@ -197,6 +197,11 @@ public:
*/
virtual int emitWrapperFunction(Node *n);
/**
* Invoked by nativeWrapper callback
*/
virtual int emitNativeFunction(Node *n);
/**
* Invoked from constantWrapper after call to Language::constantWrapper.
**/
@ -311,6 +316,7 @@ public:
virtual int classHandler(Node *n);
virtual int functionWrapper(Node *n);
virtual int constantWrapper(Node *n);
virtual int nativeWrapper(Node *n);
virtual void main(int argc, char *argv[]);
virtual int top(Node *n);
@ -441,6 +447,18 @@ int JAVASCRIPT::constantWrapper(Node *n) {
return SWIG_OK;
}
/* ---------------------------------------------------------------------
* nativeWrapper()
*
* Function wrapper for generating placeholders for native functions
* --------------------------------------------------------------------- */
int JAVASCRIPT::nativeWrapper(Node *n) {
emitter->emitNativeFunction(n);
return SWIG_OK;
}
/* ---------------------------------------------------------------------
* classHandler()
*
@ -768,6 +786,14 @@ int JSEmitter::emitWrapperFunction(Node *n) {
return ret;
}
int JSEmitter::emitNativeFunction(Node *n) {
String *wrapname = Getattr(n, "wrap:name");
enterFunction(n);
state.function(WRAPPER_NAME, wrapname);
exitFunction(n);
return SWIG_OK;
}
int JSEmitter::enterClass(Node *n) {
state.clazz(RESET);
state.clazz(NAME, Getattr(n, "sym:name"));