181 link = scope.lookup(desc, request);
182
183 if (link != null) {
184 return fixScopeCallSite(link, name, null);
185 }
186
187 return null;
188 }
189
190 /**
191 * Overridden to try to find the property first in the expression object (and its prototypes), and only then in this
192 * object (and its prototypes).
193 *
194 * @param key Property key.
195 * @param deep Whether the search should look up proto chain.
196 * @param start the object on which the lookup was originally initiated
197 *
198 * @return FindPropertyData or null if not found.
199 */
200 @Override
201 FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
202 // We call findProperty on 'expression' with 'expression' itself as start parameter.
203 // This way in ScriptObject.setObject we can tell the property is from a 'with' expression
204 // (as opposed from another non-scope object in the proto chain such as Object.prototype).
205 final FindProperty exprProperty = expression.findProperty(key, true, expression);
206 if (exprProperty != null) {
207 return exprProperty;
208 }
209 return super.findProperty(key, deep, start);
210 }
211
212 @Override
213 protected Object invokeNoSuchProperty(final String name, final int programPoint) {
214 FindProperty find = expression.findProperty(NO_SUCH_PROPERTY_NAME, true);
215 if (find != null) {
216 final Object func = find.getObjectValue();
217 if (func instanceof ScriptFunction) {
218 return ScriptRuntime.apply((ScriptFunction)func, expression, name);
219 }
220 }
221
|
181 link = scope.lookup(desc, request);
182
183 if (link != null) {
184 return fixScopeCallSite(link, name, null);
185 }
186
187 return null;
188 }
189
190 /**
191 * Overridden to try to find the property first in the expression object (and its prototypes), and only then in this
192 * object (and its prototypes).
193 *
194 * @param key Property key.
195 * @param deep Whether the search should look up proto chain.
196 * @param start the object on which the lookup was originally initiated
197 *
198 * @return FindPropertyData or null if not found.
199 */
200 @Override
201 protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
202 // We call findProperty on 'expression' with 'expression' itself as start parameter.
203 // This way in ScriptObject.setObject we can tell the property is from a 'with' expression
204 // (as opposed from another non-scope object in the proto chain such as Object.prototype).
205 final FindProperty exprProperty = expression.findProperty(key, true, expression);
206 if (exprProperty != null) {
207 return exprProperty;
208 }
209 return super.findProperty(key, deep, start);
210 }
211
212 @Override
213 protected Object invokeNoSuchProperty(final String name, final int programPoint) {
214 FindProperty find = expression.findProperty(NO_SUCH_PROPERTY_NAME, true);
215 if (find != null) {
216 final Object func = find.getObjectValue();
217 if (func instanceof ScriptFunction) {
218 return ScriptRuntime.apply((ScriptFunction)func, expression, name);
219 }
220 }
221
|