Fix bug in for-in bytecode replacement

JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
This commit is contained in:
Youngil Choi
2016-08-30 12:50:12 +09:00
parent a6d2e792f8
commit 9f65b76013
2 changed files with 29 additions and 1 deletions
+1 -1
View File
@@ -789,7 +789,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
}
else if (opcode == CBC_PUSH_PROP_LITERAL)
{
opcode = CBC_PUSH_PROP_LITERAL_REFERENCE;
opcode = CBC_ASSIGN_PROP_LITERAL;
context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;
}
else if (opcode == CBC_PUSH_PROP_LITERAL_LITERAL)
+28
View File
@@ -0,0 +1,28 @@
// Copyright 2016 Samsung Electronics Co., Ltd.
// Copyright 2016 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.
var array = [ [0] ];
var obj = { prop : "" };
var i = 0;
var count = 0;
(function () {
for (array[0][i] in obj)
count++;
})();
assert(array[0][0] == "prop");
assert(count == 1);