Ignore:
Timestamp:
11/17/12 16:03:15 (12 years ago)
Author:
tbretz
Message:
Allow to call subscriptpion as none constructor to access an existing subscription.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/InterpreterV8.cc

    r14641 r14642  
    11181118Handle<Value> InterpreterV8::FuncSubscription(const Arguments &args)
    11191119{
    1120     if (!args.IsConstructCall())
    1121         return ThrowException(String::New("Subscription must be calles as constructor."));
    1122 
    11231120    if (args.Length()!=1)
    11241121        return ThrowException(String::New("Number of arguments must be exactly 1."));
     
    11291126    const String::Utf8Value str(args[0]);
    11301127
    1131     const auto it = fReverseMap.find(*str);
    1132     if (it!=fReverseMap.end())
    1133         return it->second;
     1128    if (!args.IsConstructCall())
     1129    {
     1130        const auto it = fReverseMap.find(*str);
     1131        if (it!=fReverseMap.end())
     1132            return it->second;
     1133
     1134        return Undefined();
     1135    }
    11341136
    11351137    void *ptr = JsSubscribe(*str);
     
    11481150    fReverseMap[*str] = Persistent<Object>::New(This);
    11491151
    1150     return Undefined();//handle_scope.Close(obj);
     1152    return Undefined();
    11511153
    11521154    // Persistent<Object> p = Persistent<Object>::New(obj->NewInstance());
Note: See TracChangeset for help on using the changeset viewer.