src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java

Print this page
rev 970 : 8058545: With strict mode, bean property assignment of a non-existent property should result in TypeError
Reviewed-by: hannesw, lagergren

+8058545: With strict mode, bean property assignment of a non-existent property should result in TypeError

*** 129,143 **** if (desc.getOperand() != null) { return getInvocation(EMPTY_PROP_GETTER, self, linkerServices, desc); } return getInvocation(EMPTY_ELEM_GETTER, self, linkerServices, desc); case "setProp": ! case "setElem": if (desc.getOperand() != null) { return getInvocation(EMPTY_PROP_SETTER, self, linkerServices, desc); } return getInvocation(EMPTY_ELEM_SETTER, self, linkerServices, desc); default: break; } throw new AssertionError("unknown call type " + desc); } --- 129,148 ---- if (desc.getOperand() != null) { return getInvocation(EMPTY_PROP_GETTER, self, linkerServices, desc); } return getInvocation(EMPTY_ELEM_GETTER, self, linkerServices, desc); case "setProp": ! case "setElem": { ! final boolean strict = NashornCallSiteDescriptor.isStrict(desc); ! if (strict) { ! throw typeError("cant.set.property", getArgument(linkRequest), ScriptRuntime.safeToString(self)); ! } if (desc.getOperand() != null) { return getInvocation(EMPTY_PROP_SETTER, self, linkerServices, desc); } return getInvocation(EMPTY_ELEM_SETTER, self, linkerServices, desc); + } default: break; } throw new AssertionError("unknown call type " + desc); }