Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpiler must rename symbols banned in strict mode #1724

Closed
Jarred-Sumner opened this issue Jan 5, 2023 · 2 comments · Fixed by #2312
Closed

Transpiler must rename symbols banned in strict mode #1724

Jarred-Sumner opened this issue Jan 5, 2023 · 2 comments · Fixed by #2312
Labels
bug Something isn't working transpiler parser || printer

Comments

@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented Jan 5, 2023

Examples:

  • interface
  • public

This currently breaks serve when used with bunx

bunx --bun serve
341 | 		break;
342 | 	}
343 |
344 | 	if (entry) {
345 | 		const {public} = config;
346 | 		config.public = path.relative(cwd, (public ? path.resolve(entry, public) : entry));
     ^
SyntaxError: Cannot use abbreviated destructuring syntax for reserved name 'public' in strict mode.
      at /usr/lib/node_modules/serve/bin/serve.js:346:2

Since bun only supports ESM & strict mode, this is necessary to do.

@Jarred-Sumner Jarred-Sumner added bug Something isn't working transpiler parser || printer labels Jan 5, 2023
@Jarred-Sumner
Copy link
Collaborator Author

An alternative approach is commenting out these lines in Keywords.table

# Reserved for future use in strict code.
implements      RESERVED_IF_STRICT
interface       RESERVED_IF_STRICT
package         RESERVED_IF_STRICT
private         RESERVED_IF_STRICT
protected       RESERVED_IF_STRICT
public          RESERVED_IF_STRICT
static          RESERVED_IF_STRICT

@paperdave
Copy link
Member

paperdave commented Mar 19, 2023

I think this is related: arguments needs to be renamed in addition to these keywords.

This is breaking runtime checks on the bundle test default/ArgumentsSpecialCaseNoBundle in this file, which are currently just set to use node.

Edit: There's definetly some other symbols to handle too: var eval = 2; not sure on all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transpiler parser || printer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants