Fix PropertyName not to be resolved as a local variable
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
This commit is contained in:
@@ -325,8 +325,6 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s
|
|||||||
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
#define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \
|
||||||
if (opcode == VM_OP_ ## opcode_name_uppercase) \
|
if (opcode == VM_OP_ ## opcode_name_uppercase) \
|
||||||
{ \
|
{ \
|
||||||
JERRY_STATIC_ASSERT (((arg1_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0); \
|
|
||||||
\
|
|
||||||
/*
|
/*
|
||||||
* See also:
|
* See also:
|
||||||
* The loop below
|
* The loop below
|
||||||
@@ -334,6 +332,8 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s
|
|||||||
\
|
\
|
||||||
JERRY_ASSERT ((opcode == VM_OP_ASSIGNMENT && (arg2_type) == VM_OP_ARG_TYPE_TYPE_OF_NEXT) \
|
JERRY_ASSERT ((opcode == VM_OP_ASSIGNMENT && (arg2_type) == VM_OP_ARG_TYPE_TYPE_OF_NEXT) \
|
||||||
|| (opcode != VM_OP_ASSIGNMENT && ((arg2_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0)); \
|
|| (opcode != VM_OP_ASSIGNMENT && ((arg2_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0)); \
|
||||||
|
JERRY_ASSERT ((opcode == VM_OP_META && ((arg1_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) != 0) \
|
||||||
|
|| (opcode != VM_OP_META && ((arg1_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0)); \
|
||||||
JERRY_STATIC_ASSERT (((arg3_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0); \
|
JERRY_STATIC_ASSERT (((arg3_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0); \
|
||||||
args_num = 3; \
|
args_num = 3; \
|
||||||
}
|
}
|
||||||
@@ -343,7 +343,8 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s
|
|||||||
for (int arg_index = 0; arg_index < args_num; arg_index++)
|
for (int arg_index = 0; arg_index < args_num; arg_index++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* This is the only opcode with statically unspecified argument type (checked by assertions above)
|
* 'assignment' and 'meta' are the only opcodes with statically unspecified argument type
|
||||||
|
* (checked by assertions above)
|
||||||
*/
|
*/
|
||||||
if (opcode == VM_OP_ASSIGNMENT
|
if (opcode == VM_OP_ASSIGNMENT
|
||||||
&& arg_index == 1
|
&& arg_index == 1
|
||||||
@@ -352,6 +353,15 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opcode == VM_OP_META
|
||||||
|
&& (om.op.data.meta.type == OPCODE_META_TYPE_VARG_PROP_DATA
|
||||||
|
|| om.op.data.meta.type == OPCODE_META_TYPE_VARG_PROP_GETTER
|
||||||
|
|| om.op.data.meta.type == OPCODE_META_TYPE_VARG_PROP_SETTER)
|
||||||
|
&& arg_index == 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (om.lit_id[arg_index].packed_value == lit_cp.packed_value)
|
if (om.lit_id[arg_index].packed_value == lit_cp.packed_value)
|
||||||
{
|
{
|
||||||
om.lit_id[arg_index] = NOT_A_LITERAL;
|
om.lit_id[arg_index] = NOT_A_LITERAL;
|
||||||
|
|||||||
@@ -298,7 +298,8 @@ VM_OP_3 (reg_var_decl, REG_VAR_DECL,
|
|||||||
arg_regs_num, VM_OP_ARG_TYPE_INTEGER_CONST)
|
arg_regs_num, VM_OP_ARG_TYPE_INTEGER_CONST)
|
||||||
|
|
||||||
VM_OP_3 (meta, META,
|
VM_OP_3 (meta, META,
|
||||||
type, VM_OP_ARG_TYPE_INTEGER_CONST,
|
type, VM_OP_ARG_TYPE_INTEGER_CONST |
|
||||||
|
VM_OP_ARG_TYPE_TYPE_OF_NEXT,
|
||||||
data_1, VM_OP_ARG_TYPE_INTEGER_CONST |
|
data_1, VM_OP_ARG_TYPE_INTEGER_CONST |
|
||||||
VM_OP_ARG_TYPE_STRING |
|
VM_OP_ARG_TYPE_STRING |
|
||||||
VM_OP_ARG_TYPE_VARIABLE,
|
VM_OP_ARG_TYPE_VARIABLE,
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2015 Samsung Electronics Co., Ltd.
|
||||||
|
// Copyright 2015 University of Szeged.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
function f(a, b) {
|
||||||
|
return {
|
||||||
|
a: a,
|
||||||
|
b: b
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var o = f('1', '2');
|
||||||
|
|
||||||
|
assert(o.a == '1');
|
||||||
|
assert(o.b == '2');
|
||||||
Reference in New Issue
Block a user