Merge remote-tracking branch 'dthorpe/master'

This commit is contained in:
Ryan X. Charles 2014-04-11 14:23:02 -03:00
commit 7074618049
1 changed files with 15 additions and 9 deletions

View File

@ -160,20 +160,26 @@ Key::New()
Handle<Value>
Key::New(const Arguments& args)
{
if (!args.IsConstructCall()) {
return FromConstructorTemplate(s_ct, args);
}
HandleScope scope;
Key* key = new Key();
if (key->lastError != NULL) {
return VException(key->lastError);
// this was invoked as Key() not new Key()
if (!args.IsConstructCall()) {
// return FromConstructorTemplate(s_ct, args);
const int argc = 1;
Local<Value> argv[argc] = { args[0] };
return scope.Close(s_ct->GetFunction()->NewInstance(argc, argv));
}
else{
Key* key = new Key();
if (key->lastError != NULL) {
return VException(key->lastError);
}
key->Wrap(args.Holder());
key->Wrap(args.Holder());
return scope.Close(args.This());
return scope.Close(args.This());
}
}
Handle<Value>