GeezerVison is showing github.com — src,lib: group properties used as constants from `util` binding · nodejs/node@90e8418
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/buffer.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -67,11 +67,11 @@ const { | 67 | 67 | kStringMaxLength | 68 | 68 | } = internalBinding('buffer'); | 69 | 69 | const { | 70 | | - getOwnNonIndexProperties, | 71 | | - propertyFilter: { | | 70 | + constants: { | 72 | 71 | ALL_PROPERTIES, | 73 | | - ONLY_ENUMERABLE | | 72 | + ONLY_ENUMERABLE, | 74 | 73 | }, | | 74 | + getOwnNonIndexProperties, | 75 | 75 | } = internalBinding('util'); | 76 | 76 | const { | 77 | 77 | customInspectSymbol, | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/util/comparisons.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -46,11 +46,11 @@ const { | 46 | 46 | isFloat64Array, | 47 | 47 | } = types; | 48 | 48 | const { | 49 | | - getOwnNonIndexProperties, | 50 | | - propertyFilter: { | | 49 | + constants: { | 51 | 50 | ONLY_ENUMERABLE, | 52 | | - SKIP_SYMBOLS | 53 | | - } | | 51 | + SKIP_SYMBOLS, | | 52 | + }, | | 53 | + getOwnNonIndexProperties, | 54 | 54 | } = internalBinding('util'); | 55 | 55 |
| 56 | 56 | const kStrict = true; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/util/inspect.js +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -97,18 +97,18 @@ const { | 97 | 97 | } = primordials; | 98 | 98 |
| 99 | 99 | const { | | 100 | + constants: { | | 101 | + ALL_PROPERTIES, | | 102 | + ONLY_ENUMERABLE, | | 103 | + kPending, | | 104 | + kRejected, | | 105 | + }, | 100 | 106 | getOwnNonIndexProperties, | 101 | 107 | getPromiseDetails, | 102 | 108 | getProxyDetails, | 103 | | - kPending, | 104 | | - kRejected, | 105 | 109 | previewEntries, | 106 | 110 | getConstructorName: internalGetConstructorName, | 107 | 111 | getExternalValue, | 108 | | - propertyFilter: { | 109 | | - ALL_PROPERTIES, | 110 | | - ONLY_ENUMERABLE | 111 | | - } | 112 | 112 | } = internalBinding('util'); | 113 | 113 |
| 114 | 114 | const { | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/webstreams/util.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,8 +40,10 @@ const { | 40 | 40 | } = require('util'); | 41 | 41 |
| 42 | 42 | const { | | 43 | + constants: { | | 44 | + kPending, | | 45 | + }, | 43 | 46 | getPromiseDetails, | 44 | | - kPending, | 45 | 47 | } = internalBinding('util'); | 46 | 48 |
| 47 | 49 | const assert = require('internal/assert'); | |
Collapse file Copy file name to clipboardExpand all lines: lib/repl.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -166,11 +166,11 @@ const { | 166 | 166 | setupReverseSearch, | 167 | 167 | } = require('internal/repl/utils'); | 168 | 168 | const { | 169 | | - getOwnNonIndexProperties, | 170 | | - propertyFilter: { | | 169 | + constants: { | 171 | 170 | ALL_PROPERTIES, | 172 | | - SKIP_SYMBOLS | 173 | | - } | | 171 | + SKIP_SYMBOLS, | | 172 | + }, | | 173 | + getOwnNonIndexProperties, | 174 | 174 | } = internalBinding('util'); | 175 | 175 | const { | 176 | 176 | startSigintWatchdog, | |
Collapse file Copy file name to clipboardExpand all lines: src/node_util.cc +30-18Lines changed: 30 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -387,16 +387,38 @@ void Initialize(Local<Object> target, | 387 | 387 | .Check(); | 388 | 388 | } | 389 | 389 |
| 390 | | -#define V(name) \ | 391 | | - target->Set(context, \ | 392 | | - FIXED_ONE_BYTE_STRING(env->isolate(), #name), \ | 393 | | - Integer::New(env->isolate(), Promise::PromiseState::name)) \ | 394 | | - .FromJust() | 395 | | - V(kPending); | 396 | | - V(kFulfilled); | 397 | | - V(kRejected); | | 390 | + { | | 391 | + Local<Object> constants = Object::New(isolate); | | 392 | +#define V(name) \ | | 393 | + constants \ | | 394 | + ->Set(context, \ | | 395 | + FIXED_ONE_BYTE_STRING(isolate, #name), \ | | 396 | + Integer::New(isolate, Promise::PromiseState::name)) \ | | 397 | + .Check(); | | 398 | + | | 399 | + V(kPending); | | 400 | + V(kFulfilled); | | 401 | + V(kRejected); | | 402 | +#undef V | | 403 | + | | 404 | +#define V(name) \ | | 405 | + constants \ | | 406 | + ->Set(context, \ | | 407 | + FIXED_ONE_BYTE_STRING(isolate, #name), \ | | 408 | + Integer::New(isolate, PropertyFilter::name)) \ | | 409 | + .Check(); | | 410 | + | | 411 | + V(ALL_PROPERTIES); | | 412 | + V(ONLY_WRITABLE); | | 413 | + V(ONLY_ENUMERABLE); | | 414 | + V(ONLY_CONFIGURABLE); | | 415 | + V(SKIP_STRINGS); | | 416 | + V(SKIP_SYMBOLS); | 398 | 417 | #undef V | 399 | 418 |
| | 419 | + target->Set(context, env->constants_string(), constants).Check(); | | 420 | + } | | 421 | + | 400 | 422 | SetMethodNoSideEffect( | 401 | 423 | context, target, "getPromiseDetails", GetPromiseDetails); | 402 | 424 | SetMethodNoSideEffect(context, target, "getProxyDetails", GetProxyDetails); | @@ -410,16 +432,6 @@ void Initialize(Local<Object> target, | 410 | 432 |
| 411 | 433 | SetMethod( | 412 | 434 | context, target, "arrayBufferViewHasBuffer", ArrayBufferViewHasBuffer); | 413 | | - Local<Object> constants = Object::New(env->isolate()); | 414 | | - NODE_DEFINE_CONSTANT(constants, ALL_PROPERTIES); | 415 | | - NODE_DEFINE_CONSTANT(constants, ONLY_WRITABLE); | 416 | | - NODE_DEFINE_CONSTANT(constants, ONLY_ENUMERABLE); | 417 | | - NODE_DEFINE_CONSTANT(constants, ONLY_CONFIGURABLE); | 418 | | - NODE_DEFINE_CONSTANT(constants, SKIP_STRINGS); | 419 | | - NODE_DEFINE_CONSTANT(constants, SKIP_SYMBOLS); | 420 | | - target->Set(context, | 421 | | - FIXED_ONE_BYTE_STRING(env->isolate(), "propertyFilter"), | 422 | | - constants).Check(); | 423 | 435 |
| 424 | 436 | Local<String> should_abort_on_uncaught_toggle = | 425 | 437 | FIXED_ONE_BYTE_STRING(env->isolate(), "shouldAbortOnUncaughtToggle"); | |
|