< prev index next >
src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java
Print this page
*** 143,154 ****
private SetMethod createExistingPropertySetter() {
final Property property = find.getProperty();
final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
final MethodHandle methodHandle;
! if (NashornCallSiteDescriptor.isDeclaration(desc)) {
! assert property.needsDeclaration();
// This is a LET or CONST being declared. The property is already there but flagged as needing declaration.
// We create a new PropertyMap with the flag removed. The map is installed with a fast compare-and-set
// method if the pre-callsite map is stable (which should be the case for function scopes except for
// non-strict functions containing eval() with var). Otherwise we have to use a slow setter that creates
// a new PropertyMap on the fly.
--- 143,153 ----
private SetMethod createExistingPropertySetter() {
final Property property = find.getProperty();
final boolean isStrict = NashornCallSiteDescriptor.isStrict(desc);
final MethodHandle methodHandle;
! if (NashornCallSiteDescriptor.isDeclaration(desc) && property.needsDeclaration()) {
// This is a LET or CONST being declared. The property is already there but flagged as needing declaration.
// We create a new PropertyMap with the flag removed. The map is installed with a fast compare-and-set
// method if the pre-callsite map is stable (which should be the case for function scopes except for
// non-strict functions containing eval() with var). Otherwise we have to use a slow setter that creates
// a new PropertyMap on the fly.
< prev index next >