Skip to content

Fix Jessie syntax parsing edge cases#39

Open
davejcameron wants to merge 3 commits into
dy:mainfrom
davejcameron:dc.jessie-syntax-parsing
Open

Fix Jessie syntax parsing edge cases#39
davejcameron wants to merge 3 commits into
dy:mainfrom
davejcameron:dc.jessie-syntax-parsing

Conversation

@davejcameron
Copy link
Copy Markdown
Contributor

Problem

A few valid Jessie/JavaScript syntax forms currently fail to parse:

0.95.toFixed(2)
switch (x) { case 1: ({ default: a }) }
class A { async m(a) { await a } }

Decimal literals can consume the member-access dot, case/default boundary detection can reject object properties inside switch case bodies, and async method shorthand is parsed as an async call before the method parser can see the body.

Fix

Parse decimal numbers in phases so member access remains available after a decimal literal.

Respect property-name context when reserving case and default as switch case-body boundaries.

Let the async parser preserve plain async method names for the existing method-shorthand parser, then wrap the method value in an async AST node.

Validation

  • node --import ./test/https-loader.js test/feature/async-class.js
  • Direct Jessie parse checks for decimal member access, switch object properties, and async method shorthand
  • pnpm test passes except existing unicode: many non-ASCII identifiers (scaling): Maximum call stack size exceeded

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.

1 participant