Fix faulty `as` vararg in `set-constant` scriptlet

This commit is contained in:
Raymond Hill 2023-11-16 13:18:39 -05:00
parent bd8a91ed3a
commit c292a90b90
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 5 additions and 4 deletions

View File

@ -436,14 +436,15 @@ function setConstantCore(
return; return;
} }
if ( extraArgs.as !== undefined ) { if ( extraArgs.as !== undefined ) {
const value = cValue;
if ( extraArgs.as === 'function' ) { if ( extraArgs.as === 'function' ) {
cValue = ( ) => cValue; cValue = ( ) => value;
} else if ( extraArgs.as === 'callback' ) { } else if ( extraArgs.as === 'callback' ) {
cValue = ( ) => (( ) => cValue); cValue = ( ) => (( ) => value);
} else if ( extraArgs.as === 'resolved' ) { } else if ( extraArgs.as === 'resolved' ) {
cValue = Promise.resolve(cValue); cValue = Promise.resolve(value);
} else if ( extraArgs.as === 'rejected' ) { } else if ( extraArgs.as === 'rejected' ) {
cValue = Promise.reject(cValue); cValue = Promise.reject(value);
} }
} }
let aborted = false; let aborted = false;