Resolve fields on expressions/non-objects also.
git-svn-id: http://voip.null.ro/svn/yate@5586 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
53834559a2
commit
1c5160f54d
|
@ -49,10 +49,10 @@ public:
|
|||
virtual bool runField(ObjList& stack, const ExpOperation& oper, GenObject* context);
|
||||
virtual bool runAssign(ObjList& stack, const ExpOperation& oper, GenObject* context);
|
||||
GenObject* resolve(ObjList& stack, String& name, GenObject* context);
|
||||
private:
|
||||
GenObject* resolveTop(ObjList& stack, const String& name, GenObject* context);
|
||||
bool runStringFunction(GenObject* obj, const String& name, ObjList& stack, const ExpOperation& oper, GenObject* context);
|
||||
bool runStringField(GenObject* obj, const String& name, ObjList& stack, const ExpOperation& oper, GenObject* context);
|
||||
private:
|
||||
GenObject* resolveTop(ObjList& stack, const String& name, GenObject* context);
|
||||
};
|
||||
|
||||
class JsNull : public JsObject
|
||||
|
@ -2060,12 +2060,24 @@ bool JsCode::runOperation(ObjList& stack, const ExpOperation& oper, GenObject* c
|
|||
return gotError("Expecting field names",oper.lineNumber());
|
||||
}
|
||||
if (op1->opcode() != OpcField) {
|
||||
// try to obtain an object on which to run the field
|
||||
ScriptContext* ctx = YOBJECT(ScriptContext,op1);
|
||||
if (ctx && ctx->runField(stack,*op2,context)) {
|
||||
TelEngine::destruct(op1);
|
||||
TelEngine::destruct(op2);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// op1 is not an object, it's a string
|
||||
JsContext* jsCtx = 0;
|
||||
if (sr)
|
||||
jsCtx = static_cast<JsContext*>(sr->context());
|
||||
if (jsCtx && jsCtx->runStringField(op1,op2->name(),stack,*op2,context)) {
|
||||
TelEngine::destruct(op1);
|
||||
TelEngine::destruct(op2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TelEngine::destruct(op1);
|
||||
TelEngine::destruct(op2);
|
||||
return gotError("Expecting field names",oper.lineNumber());
|
||||
|
|
Loading…
Reference in New Issue