dillon1000/react
Commit
Browse files First-class representation of builtin jsx tags
We previously represented JsxExpressions using builtin tags - `<div>`, `<b>` etc
- by lowering the tag name to a Primitive with the string name of the tag.
However, by lowering into an independent value, it was possible that the lowered
tag name could be grouped into a different memo slot, such that we ended up with
output like:
```javascript
let t0;
if (c_1) {
...
t0 = "div"
...
} else { ... }
return <t0>{children}</t0>
```
This is obviously wrong. It's also wrong to rename `t0` -> `T0`, because React
treats that as a custom component, not a builtin. The right thing is to
explicitly model builtin components, which this PR does by making
`JsxExpression.tag` be a union of Place | BuiltinTag.Changed paths13 files
First-parent comparisoncompiler/forget/src/HIR/BuildHIR.ts ModifiedM compiler/forget/src/HIR/HIR.ts ModifiedM compiler/forget/src/HIR/PrintHIR.ts ModifiedM compiler/forget/src/HIR/visitors.ts ModifiedM compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedM compiler/forget/src/ReactiveScopes/MemoizeFbtOperandsInSameScope.ts ModifiedM compiler/forget/src/ReactiveScopes/PromoteUsedTemporaries.ts ModifiedM compiler/forget/src/ReactiveScopes/PruneNonEscapingScopes.ts ModifiedR compiler/forget/src/__tests__/fixtures/compiler/_bug.builtin-jsx-tag-lowered-between-mutations.expect.md →compiler/forget/src/__tests__/fixtures/compiler/builtin-jsx-tag-lowered-between-mutations.expect.md RenamedR compiler/forget/src/__tests__/fixtures/compiler/_bug.builtin-jsx-tag-lowered-between-mutations.js →compiler/forget/src/__tests__/fixtures/compiler/builtin-jsx-tag-lowered-between-mutations.js RenamedM compiler/forget/src/__tests__/fixtures/compiler/error.mutate-after-freeze.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md ModifiedM compiler/forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-static.expect.md ModifiedPatch
Files changed
Rendering syntax-highlighted changes…