return Value::undefinedValue();
}
+Value ExecutionContext::getPropertyAndBase(String *name, Object **base)
+{
+ *base = 0;
+
+ if (name == engine->id_this)
+ return thisObject;
+
+ for (ExecutionContext *ctx = this; ctx; ctx = ctx->outer()) {
+ if (With *w = ctx->withObject) {
+ while (w) {
+ bool hasProperty = false;
+ Value v = w->object->__get__(ctx, name, &hasProperty);
+ if (hasProperty) {
+ *base = w->object;
+ return v;
+ }
+ w = w->next;
+ }
+ }
+
+ if (FunctionObject *f = ctx->function) {
+ if (f->needsActivation || ctx->withObject) {
+ for (unsigned int i = 0; i < f->varCount; ++i)
+ if (f->varList[i]->isEqualTo(name))
+ return ctx->locals[i];
+ for (int i = (int)f->formalParameterCount - 1; i >= 0; --i)
+ if (f->formalParameterList[i]->isEqualTo(name))
+ return ctx->arguments[i];
+ }
+ }
+ if (ctx->activation) {
+ bool hasProperty = false;
+ Value v = ctx->activation->__get__(ctx, name, &hasProperty);
+ if (hasProperty)
+ return v;
+ }
+ }
+ throwReferenceError(Value::fromString(name));
+ return Value::undefinedValue();
+}
+
void ExecutionContext::inplaceBitOp(Value value, String *name, BinOp op)
void setProperty(String *name, Value value);
Value getProperty(String *name);
Value getPropertyNoThrow(String *name);
+ Value getPropertyAndBase(String *name, Object **base);
void inplaceBitOp(Value value, String *name, BinOp op);
bool deleteProperty(String *name);
return false;
}
-// TODO: remove this function. Backends should just generate a __qmljs_get_activation_property followed by a __qmljs_call_value
Value __qmljs_call_activation_property(ExecutionContext *context, String *name, Value *args, int argc)
{
- Value func = context->getProperty(name);
+ Object *base;
+ Value func = context->getPropertyAndBase(name, &base);
Object *o = func.asObject();
if (!o)
context->throwTypeError();
- return o->call(context, Value::undefinedValue(), args, argc);
+ Value thisObject = base ? Value::fromObject(base) : Value::undefinedValue();
+
+ return o->call(context, thisObject, args, argc);
}
Value __qmljs_call_property(ExecutionContext *context, Value that, String *name, Value *args, int argc)
S15.1.2.2_A9.3 failing
S15.1.2.2_A9.4 failing
S15.1.2.2_A9.7 failing
-S15.10.6.2_A1_T2 failing
S15.11.4.2_A1 failing
S15.11.4.2_A2 failing
15.12.1.1-g6-3 failing
S15.4.4.7_A3 failing
S15.4.4.7_A4_T2 failing
S15.4.4.7_A4_T3 failing
-S15.5.4.10_A1_T10 failing
-S15.5.4.11_A1_T10 failing
S15.5.4.11_A5_T1 failing
-S15.5.4.12_A1_T10 failing
-S15.5.4.13_A1_T10 failing
S15.4.4.8_A1_T1 failing
S15.4.4.8_A1_T2 failing
S15.4.4.8_A2_T1 failing
S15.5.4.14_A4_T7 failing
S15.5.4.14_A4_T8 failing
S15.5.4.14_A4_T9 failing
-S15.5.4.15_A1_T10 failing
S15.5.4.15_A1_T2 failing
S15.5.4.15_A1_T7 failing
S15.5.4.15_A1_T8 failing
S15.5.4.15_A1_T9 failing
15.5.4.20-4-1 failing
-S15.5.4.5_A1_T10 failing
-S15.5.4.6_A1_T10 failing
-S15.5.4.7_A1_T10 failing
S15.5.4.7_A1_T11 failing
-S15.5.4.4_A1_T10 failing
-S15.5.4.8_A1_T10 failing
S15.5.4.8_A1_T12 failing
S15.5.4.8_A1_T4 failing
S15.7.4_A3.3 failing
15.4.4.21-8-b-iii-1-6 failing
15.12.3_4-1-1
-15.12.3_4-1-3
+15.12.3_4-1-3
\ No newline at end of file