|
1 | 1 | /* |
2 | | - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * The Universal Permissive License (UPL), Version 1.0 |
|
82 | 82 | import com.oracle.truffle.js.runtime.SafeInteger; |
83 | 83 | import com.oracle.truffle.js.runtime.Strings; |
84 | 84 | import com.oracle.truffle.js.runtime.Symbol; |
| 85 | +import com.oracle.truffle.js.runtime.builtins.JSGlobal; |
| 86 | +import com.oracle.truffle.js.runtime.builtins.JSGlobalObject; |
85 | 87 | import com.oracle.truffle.js.runtime.builtins.JSString; |
86 | 88 | import com.oracle.truffle.js.runtime.objects.JSDynamicObject; |
87 | 89 | import com.oracle.truffle.js.runtime.objects.JSObject; |
|
91 | 93 | /** |
92 | 94 | * 11.4.1 The delete Operator ({@code delete object[property]}). |
93 | 95 | */ |
94 | | -@ImportStatic(JSConfig.class) |
| 96 | +@ImportStatic({JSConfig.class, JSGlobal.class}) |
95 | 97 | @NodeInfo(shortName = "delete") |
96 | 98 | public abstract class DeletePropertyNode extends JSTargetableNode { |
97 | 99 | protected final boolean strict; |
@@ -194,8 +196,15 @@ protected final boolean doJSOrdinaryObject(JSDynamicObject targetObject, Object |
194 | 196 | } |
195 | 197 | } |
196 | 198 |
|
| 199 | + @Specialization |
| 200 | + protected final boolean doJSGlobalObject(JSGlobalObject targetObject, Object key, |
| 201 | + @Shared("toPropertyKey") @Cached JSToPropertyKeyNode toPropertyKeyNode, |
| 202 | + @CachedLibrary(limit = "InteropLibraryLimit") DynamicObjectLibrary dynamicObjectLib) { |
| 203 | + return doJSOrdinaryObject(targetObject, key, toPropertyKeyNode, dynamicObjectLib); |
| 204 | + } |
| 205 | + |
197 | 206 | @SuppressWarnings("truffle-static-method") |
198 | | - @Specialization(guards = {"!isJSOrdinaryObject(targetObject)"}) |
| 207 | + @Specialization(guards = {"!isJSOrdinaryObject(targetObject)", "!isJSGlobalObject(targetObject)"}) |
199 | 208 | protected final boolean doJSObject(JSDynamicObject targetObject, Object key, |
200 | 209 | @Bind("this") Node node, |
201 | 210 | @Cached("createIsFastArray()") IsArrayNode isArrayNode, |
|
0 commit comments