diff options
author | Lars Knoll <lars.knoll@digia.com> | 2012-12-07 20:31:19 -0800 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-12-08 05:33:51 +0100 |
commit | 806b5fb4c14b9da712d57525c35b6333665cf26d (patch) | |
tree | ea29875d2dbd9ed0b04a51dda8e1a32e119c931c /qmljs_runtime.h | |
parent | 852cc7f443f2321b0c53077f3fc0cee577903199 (diff) |
Fix typeof to work with undefined references
Change-Id: I90cd2b34a25476dfee1ec01315275b6c179d11dc
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qmljs_runtime.h')
-rw-r--r-- | qmljs_runtime.h | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/qmljs_runtime.h b/qmljs_runtime.h index adcdae6601..6675920cb3 100644 --- a/qmljs_runtime.h +++ b/qmljs_runtime.h @@ -98,7 +98,11 @@ Value __qmljs_construct_activation_property(ExecutionContext *, String *name, Va Value __qmljs_construct_property(ExecutionContext *context, Value base, String *name, Value *args, int argc); Value __qmljs_construct_value(ExecutionContext *context, Value func, Value *args, int argc); -Value __qmljs_builtin_typeof(Value val, ExecutionContext *context); +Value __qmljs_builtin_typeof(Value val, ExecutionContext *ctx); +Value __qmljs_builtin_typeof_name(String *name, ExecutionContext *context); +Value __qmljs_builtin_typeof_member(Value base, String *name, ExecutionContext *context); +Value __qmljs_builtin_typeof_element(Value base, Value index, ExecutionContext *context); + void __qmljs_builtin_throw(Value val, ExecutionContext *context); void __qmljs_builtin_push_with(Value o, ExecutionContext *ctx); void __qmljs_builtin_pop_with(ExecutionContext *ctx); @@ -179,7 +183,6 @@ Value __qmljs_delete_subscript(ExecutionContext *ctx, Value base, Value index); Value __qmljs_delete_member(ExecutionContext *ctx, Value base, String *name); Value __qmljs_delete_name(ExecutionContext *ctx, String *name); -Value __qmljs_typeof(Value value, ExecutionContext *ctx); void __qmljs_throw(Value value, ExecutionContext *context); // actually returns a jmp_buf * void *__qmljs_create_exception_handler(ExecutionContext *context); @@ -443,34 +446,6 @@ inline Value __qmljs_default_value(Value value, ExecutionContext *ctx, int typeH } -// unary operators -inline Value __qmljs_typeof(Value value, ExecutionContext *ctx) -{ - switch (value.type()) { - case Value::Undefined_Type: - return __qmljs_string_literal_undefined(ctx); - break; - case Value::Null_Type: - return __qmljs_string_literal_object(ctx); - break; - case Value::Boolean_Type: - return __qmljs_string_literal_boolean(ctx); - break; - case Value::String_Type: - return __qmljs_string_literal_string(ctx); - break; - case Value::Object_Type: - if (__qmljs_is_callable(value, ctx)) - return __qmljs_string_literal_function(ctx); - else - return __qmljs_string_literal_object(ctx); // ### implementation-defined - break; - default: - return __qmljs_string_literal_number(ctx); - break; - } -} - inline Value __qmljs_uplus(Value value, ExecutionContext *ctx) { TRACE1(value); |