dillon1000/react
Commit
Browse files [hir] Strip JSXEmptyExpression syntax
`JSXEmptyExpression` is never added to a React element's children [in `react.buildChildren`](https://github.com/babel/babel/blob/main/packages/babel-types/src/builders/react/buildChildren.ts), which is [used by](https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts#L649) `plugin-transform-react-jsx`]. An alternative would be to represent JSX expressions differently in HIR, then codegen `JSXEmptyExpression`s back when we encounter an `EmptyExpression` ```js - children: Array<Place>, - children: Array<Place | "EmptyExpression">, ``` (We could also retain `JSXEmptyExpression` as an `InstructionValue` that produces a Primitive. However, this would make babel types in Codegen a bit more messy, as `JSXEmptyExpression` does not extend `Expression` (which currently is the result of every `InstructionValue`).)
Changed paths4 files
First-parent comparisoncompiler/forget/src/HIR/BuildHIR.ts ModifiedM compiler/forget/src/__tests__/fixtures/compiler/error.todo-kitchensink.expect.md ModifiedA compiler/forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md AddedA compiler/forget/src/__tests__/fixtures/compiler/jsx-empty-expression.js AddedPatch
Files changed
Rendering syntax-highlighted changes…