Skip to content

script: always let cx = &mut cx in codegen and support cx in Constructor#42712

Merged
TimvdLippe merged 1 commit intoservo:mainfrom
sagudev:cons-cx
Feb 19, 2026
Merged

script: always let cx = &mut cx in codegen and support cx in Constructor#42712
TimvdLippe merged 1 commit intoservo:mainfrom
sagudev:cons-cx

Conversation

@sagudev
Copy link
Copy Markdown
Member

@sagudev sagudev commented Feb 19, 2026

#42681 did not actually allowed using cx in Constructor, but it did most heavy lifting. Now we need to pass cx to Constructor call (and skip CanGc) if cx is requested in Bindings.conf. This PR also test this on testbindings.

Also we now always use let cx = &mut cx, so we can always use just cx (compiler will automatically deref it into &cx if needed). This is important because codegen stuff is called from many places to it make sense/easier to just unify this.

Testing: It compiles

@sagudev sagudev requested a review from gterzian as a code owner February 19, 2026 07:40
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 19, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Feb 19, 2026
@TimvdLippe TimvdLippe added this pull request to the merge queue Feb 19, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 19, 2026
}

fn new(
cx: &mut js::context::JSContext,
Copy link
Copy Markdown
Contributor

@Gae24 Gae24 Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So regarding the discussion in #42638, we should prefer passing cx as first argument?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's the preference

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, unofficially.

Merged via the queue into servo:main with commit 3cde834 Feb 19, 2026
34 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 19, 2026
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.

4 participants