From c586479abe5ec10376ca5625e4e5fb1d4b7c4795 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 16 Feb 2013 00:15:34 +0100 Subject: [PATCH] Minor cleanup Change-Id: I8c3fea7c6b330c3e32b10c945f6e7b96a06daa8e Reviewed-by: Simon Hausmann --- src/v4/qv4functionobject.cpp | 12 ++---------- src/v4/qv4functionobject.h | 8 ++++---- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/v4/qv4functionobject.cpp b/src/v4/qv4functionobject.cpp index 013bdca..437ea70 100644 --- a/src/v4/qv4functionobject.cpp +++ b/src/v4/qv4functionobject.cpp @@ -390,12 +390,8 @@ Value ScriptFunction::call(Managed *that, ExecutionContext *context, const Value ctx->thisObject = thisObject; if (!f->strictMode && !thisObject.isObject()) { - // Built-in functions allow for the this object to be null or undefined. This overrides - // the behaviour of changing thisObject to the global object if null/undefined and allows - // the built-in functions for example to throw a type error if null is passed. if (thisObject.isUndefined() || thisObject.isNull()) { - if (!f->isBuiltinFunction) - ctx->thisObject = context->engine->globalObject; + ctx->thisObject = context->engine->globalObject; } else { ctx->thisObject = Value::fromObject(thisObject.toObject(context)); } @@ -441,12 +437,8 @@ Value BuiltinFunctionOld::call(Managed *that, ExecutionContext *context, const V // Built-in functions allow for the this object to be null or undefined. This overrides // the behaviour of changing thisObject to the global object if null/undefined and allows // the built-in functions for example to throw a type error if null is passed. - if (thisObject.isUndefined() || thisObject.isNull()) { - if (!f->isBuiltinFunction) - ctx->thisObject = context->engine->globalObject; - } else { + if (!thisObject.isUndefined() && !thisObject.isNull()) ctx->thisObject = Value::fromObject(thisObject.toObject(context)); - } } ctx->function = f; diff --git a/src/v4/qv4functionobject.h b/src/v4/qv4functionobject.h index 69d0436..bbe6306 100644 --- a/src/v4/qv4functionobject.h +++ b/src/v4/qv4functionobject.h @@ -125,10 +125,10 @@ struct Function { Lookup *lookups; - bool hasNestedFunctions : 1; - bool hasDirectEval : 1; - bool usesArgumentsObject : 1; - bool isStrict : 1; + bool hasNestedFunctions; + bool hasDirectEval; + bool usesArgumentsObject; + bool isStrict; Function(String *name) : name(name) -- 2.7.4