Skip to content

Implement CallSite.prototype.isConstructor()#1584

Merged
saghul merged 1 commit into
quickjs-ng:masterfrom
littledivy:fix/callsite-isconstructor
Jul 17, 2026
Merged

Implement CallSite.prototype.isConstructor()#1584
saghul merged 1 commit into
quickjs-ng:masterfrom
littledivy:fix/callsite-isconstructor

Conversation

@littledivy

@littledivy littledivy commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The Error.prepareStackTrace CallSite objects expose isNative, getFileName, getFunctionName and the position getters, but not isConstructor(), which V8 provides.

This tracks whether each stack frame was entered as a constructor (JS_CALL_FLAG_CONSTRUCTOR) and exposes it on the CallSite.

Error.prepareStackTrace = (_, frames) => frames;
function Thing() { this.e = new Error(); }
(new Thing()).e.stack[0].isConstructor();  // true

Disclaimer: This is an AI-assisted patch from the v8x project.

The Error.prepareStackTrace CallSite objects exposed isNative, getFileName,
getFunctionName and the position getters but not isConstructor(), which V8
provides. Track whether each stack frame was entered as a constructor
(JS_CALL_FLAG_CONSTRUCTOR) and expose it on the CallSite.
@saghul
saghul merged commit a3f1b38 into quickjs-ng:master Jul 17, 2026
128 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants