-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler][patch] Don't wrap non-ascii jsx operands in JSXExpressionC…
…ontainer ghstack-source-id: 4b5505aa5e58d1bcc0813452762e9921c74417d7 Pull Request resolved: #30389
- Loading branch information
Showing
12 changed files
with
227 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
...src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-newline.expect.md
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
.../src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-quotes.expect.md
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
...src/__tests__/fixtures/compiler/fbt/error.todo-fbt-param-with-unicode.expect.md
This file was deleted.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
...t-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-newline.expect.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
import fbt from "fbt"; | ||
|
||
function Component(props) { | ||
const element = ( | ||
<fbt desc={"Dialog to show to user"}> | ||
Hello{" "} | ||
<fbt:param | ||
name="a really long description | ||
that got split into multiple lines" | ||
> | ||
{props.name} | ||
</fbt:param> | ||
</fbt> | ||
); | ||
return element.toString(); | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{ name: "Jason" }], | ||
}; | ||
|
||
``` | ||
|
||
## Code | ||
|
||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; | ||
import fbt from "fbt"; | ||
|
||
function Component(props) { | ||
const $ = _c(4); | ||
let t0; | ||
if ($[0] !== props.name) { | ||
t0 = fbt._( | ||
"Hello {a really long description that got split into multiple lines}", | ||
[ | ||
fbt._param( | ||
"a really long description that got split into multiple lines", | ||
|
||
props.name, | ||
), | ||
], | ||
{ hk: "1euPUp" }, | ||
); | ||
$[0] = props.name; | ||
$[1] = t0; | ||
} else { | ||
t0 = $[1]; | ||
} | ||
const element = t0; | ||
let t1; | ||
if ($[2] !== element) { | ||
t1 = element.toString(); | ||
$[2] = element; | ||
$[3] = t1; | ||
} else { | ||
t1 = $[3]; | ||
} | ||
return t1; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{ name: "Jason" }], | ||
}; | ||
|
||
``` | ||
### Eval output | ||
(kind: ok) "Hello Jason" |
File renamed without changes.
61 changes: 61 additions & 0 deletions
61
...ct-compiler/src/__tests__/fixtures/compiler/fbt/fbt-param-with-quotes.expect.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
import fbt from "fbt"; | ||
|
||
function Component(props) { | ||
const element = ( | ||
<fbt desc={"Dialog to show to user"}> | ||
Hello <fbt:param name='"user" name'>{props.name}</fbt:param> | ||
</fbt> | ||
); | ||
return element.toString(); | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{ name: "Jason" }], | ||
}; | ||
|
||
``` | ||
|
||
## Code | ||
|
||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; | ||
import fbt from "fbt"; | ||
|
||
function Component(props) { | ||
const $ = _c(4); | ||
let t0; | ||
if ($[0] !== props.name) { | ||
t0 = fbt._('Hello {"user" name}', [fbt._param('"user" name', props.name)], { | ||
hk: "S0vMe", | ||
}); | ||
$[0] = props.name; | ||
$[1] = t0; | ||
} else { | ||
t0 = $[1]; | ||
} | ||
const element = t0; | ||
let t1; | ||
if ($[2] !== element) { | ||
t1 = element.toString(); | ||
$[2] = element; | ||
$[3] = t1; | ||
} else { | ||
t1 = $[3]; | ||
} | ||
return t1; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Component, | ||
params: [{ name: "Jason" }], | ||
}; | ||
|
||
``` | ||
### Eval output | ||
(kind: ok) "Hello Jason" |
File renamed without changes.
Oops, something went wrong.