Skip to content

Commit 6da4424

Browse files
committed
ffi: simplify Symbol.dispose assignment
Use a direct prototype assignment for DynamicLibrary.prototype[Symbol.dispose], matching the style used elsewhere in the codebase (e.g. Timers).
1 parent a49e8e4 commit 6da4424

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

lib/ffi.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const {
4-
ObjectDefineProperty,
54
ObjectFreeze,
65
ObjectPrototypeToString,
76
SymbolDispose,
@@ -55,14 +54,9 @@ const {
5554
toArrayBuffer,
5655
} = internalBinding('ffi');
5756

58-
ObjectDefineProperty(DynamicLibrary.prototype, SymbolDispose, {
59-
__proto__: null,
60-
configurable: true,
61-
writable: true,
62-
value: function dispose() {
63-
this.close();
64-
},
65-
});
57+
DynamicLibrary.prototype[SymbolDispose] = function() {
58+
this.close();
59+
};
6660

6761
function checkFFIPermission() {
6862
if (!permission.isEnabled() || permission.has('ffi')) {

0 commit comments

Comments
 (0)