1// Copyright JS Foundation and other contributors, http://js.foundation 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15function member_str() { 16 return "member"; 17} 18 19switch (true) { 20default: 21 var obj = { 22 ["val" + "ue"]: 0, 23 set[member_str()](x) { 24 // Multiple statements. 25 this.value = x + 4; 26 this.value += 2; 27 }, 28 get[member_str() ? member_str() : ""]() { 29 // Multiple statements. 30 this.value = this.value + 1; 31 return this.value; 32 }, 33 get 34 [1 + 2] 35 () 36 { 37 return 3; 38 }, 39 [false ? member_str() 40 : ""] 41 :8 42 } 43} 44 45obj["member"] = 10; 46assert(obj.member === 17); 47assert(obj.member === 18); 48 49assert(obj[3] === 3); 50assert(obj["3"] === 3); 51 52assert(obj[""] === 8); 53