Fixing typeof for boolean arguments.

This commit is contained in:
Ruben Ayrapetyan 2014-10-15 18:02:10 +04:00
parent 49d990ad32
commit e8d728f8ce
4 changed files with 5 additions and 7 deletions

View File

@ -1464,13 +1464,9 @@ opfunc_typeof (opcode_t opdata, /**< operation data */
break;
}
case ECMA_SIMPLE_VALUE_FALSE:
{
type_str_p = ecma_get_magic_string (ECMA_MAGIC_STRING_FALSE);
break;
}
case ECMA_SIMPLE_VALUE_TRUE:
{
type_str_p = ecma_get_magic_string (ECMA_MAGIC_STRING_TRUE);
type_str_p = ecma_get_magic_string (ECMA_MAGIC_STRING_BOOLEAN);
break;
}
case ECMA_SIMPLE_VALUE_EMPTY:

View File

@ -647,6 +647,7 @@ typedef enum
ECMA_MAGIC_STRING_NULL, /**< "null" */
ECMA_MAGIC_STRING_FALSE, /**< "false" */
ECMA_MAGIC_STRING_TRUE, /**< "true" */
ECMA_MAGIC_STRING_BOOLEAN, /**< "boolean" */
ECMA_MAGIC_STRING_NUMBER, /**< "number" */
ECMA_MAGIC_STRING_STRING, /**< "string" */
ECMA_MAGIC_STRING_OBJECT, /**< "object" */

View File

@ -1284,6 +1284,7 @@ ecma_get_magic_string_zt (ecma_magic_string_id_t id) /**< magic string id */
case ECMA_MAGIC_STRING_NULL: return (ecma_char_t*) "null";
case ECMA_MAGIC_STRING_FALSE: return (ecma_char_t*) "false";
case ECMA_MAGIC_STRING_TRUE: return (ecma_char_t*) "true";
case ECMA_MAGIC_STRING_BOOLEAN: return (ecma_char_t*) "boolean";
case ECMA_MAGIC_STRING_NUMBER: return (ecma_char_t*) "number";
case ECMA_MAGIC_STRING_STRING: return (ecma_char_t*) "string";
case ECMA_MAGIC_STRING_OBJECT: return (ecma_char_t*) "object";

View File

@ -19,8 +19,8 @@ function f()
assert(typeof(a) === "undefined");
assert(typeof(null) === "object");
assert(typeof(false) === "false");
assert(typeof(true) === "true");
assert(typeof(false) === "boolean");
assert(typeof(true) === "boolean");
assert(typeof(1) === "number");
assert(typeof(1.1) === "number");
assert(typeof('abcd') === "string");