Skip to content

Commit

Permalink
Try to handle symbols with matching names from different addons, fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrv committed Jan 14, 2017
1 parent 5ec27df commit 6454816
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/nbind/BindClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ class BindClassBase {
void visit() { visited = true; }
void unvisit() { visited = false; }

bool isReady() { return(ready); }
void setReady() { ready = true; }

protected:

TYPEID idList[2];
Expand Down Expand Up @@ -170,7 +173,8 @@ class BindClassBase {

cbFunction *valueConstructorJS = nullptr;

bool visited;
bool visited = false;
bool ready = false;

};

Expand Down
6 changes: 6 additions & 0 deletions src/v8/Binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ static void initModule(Handle<Object> exports) {
bindClass->visit();
++posPrev;

if(bindClass->isReady()) continue;

param = new SignatureParam();
param->overloadNum = bindClass->wrapperConstructorNum;

Expand All @@ -309,6 +311,8 @@ static void initModule(Handle<Object> exports) {
// Define inheritance between class constructor templates and add methods.

for(auto *bindClass : classList) {
if(bindClass->isReady()) continue;

Local<FunctionTemplate> constructorTemplate = Nan::New(bindClass->constructorTemplate);

auto superClassList = bindClass->getSuperClassList();
Expand Down Expand Up @@ -349,6 +353,8 @@ static void initModule(Handle<Object> exports) {
Nan::New<String>(bindClass->getName()).ToLocalChecked(),
jsConstructor
);

bindClass->setReady();
}
}

Expand Down

0 comments on commit 6454816

Please sign in to comment.