Skip to content

Comments

fix(parser): forbid accessors named constructor#14017

Merged
Boshen merged 1 commit intooxc-project:mainfrom
DonIsaac:don/parser/fix/accessor-constructor2
Sep 23, 2025
Merged

fix(parser): forbid accessors named constructor#14017
Boshen merged 1 commit intooxc-project:mainfrom
DonIsaac:don/parser/fix/accessor-constructor2

Conversation

@DonIsaac
Copy link
Contributor

Re-creation of #14015. Closes #14014.

Copilot AI review requested due to automatic review settings September 23, 2025 03:09
@graphite-app
Copy link
Contributor

graphite-app bot commented Sep 23, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-parser Area - Parser C-bug Category - Bug labels Sep 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a parser issue by adding validation to forbid accessor properties named 'constructor' in classes. This addresses a specific parsing edge case where accessor properties with the name 'constructor' should be invalid according to JavaScript/TypeScript language rules.

  • Adds validation to detect accessor properties named 'constructor' and report an error
  • Introduces a new diagnostic error message for this specific case

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_parser/src/js/class.rs Adds validation logic to check for 'constructor' named accessors and trigger error
crates/oxc_parser/src/diagnostics.rs Defines new diagnostic error message for constructor accessor validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 23, 2025

CodSpeed Instrumentation Performance Report

Merging #14017 will not alter performance

Comparing DonIsaac:don/parser/fix/accessor-constructor2 (21019d4) with main (36ac0fb)

Summary

✅ 37 untouched

@Boshen Boshen merged commit f4d6790 into oxc-project:main Sep 23, 2025
30 checks passed
@overlookmotel
Copy link
Member

He's back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forbid accessor named constructor

3 participants