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

fix #334: support automatic JSX runtime #2349

Merged
merged 24 commits into from
Jul 28, 2022
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions internal/js_parser/js_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,6 @@ func (p *parser) importJSXSymbol(loc logger.Loc, jsx JSXImport) js_ast.Expr {
p.recordUsage(ref)
return p.handleIdentifier(loc, &js_ast.EIdentifier{Ref: ref}, identifierOpts{
wasOriginallyIdentifier: true,
matchAgainstDefines: true, // Allow defines to rewrite imported JSX symbols
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I was clearly missing context here.

})
}

Expand Down Expand Up @@ -12245,8 +12244,8 @@ func (p *parser) visitExprInOut(expr js_ast.Expr, in exprIn) (js_ast.Expr, exprO
wasOriginallyIdentifier: true,
matchAgainstDefines: true, // Allow defines to rewrite the JSX factory
})
p.warnAboutImportNamespaceCall(target, exprKindCall)
}
p.warnAboutImportNamespaceCall(target, exprKindCall)
return js_ast.Expr{Loc: expr.Loc, Data: &js_ast.ECall{
Target: target,
Args: args,
Expand Down Expand Up @@ -12371,10 +12370,8 @@ func (p *parser) visitExprInOut(expr js_ast.Expr, in exprIn) (js_ast.Expr, exprO
jsx = JSXImportJSXS
}

target := p.importJSXSymbol(expr.Loc, jsx)
p.warnAboutImportNamespaceCall(target, exprKindCall)
return js_ast.Expr{Loc: expr.Loc, Data: &js_ast.ECall{
Target: target,
Target: p.importJSXSymbol(expr.Loc, jsx),
Args: args,
CloseParenLoc: e.CloseLoc,

Expand Down