mirror of https://github.com/sveltejs/svelte
feat: allow `let props = $props()`, optimize prop read access (#12201)
- allow to write `let props = $props()` - optimize read access of props.x to use `$$props` argument directly; closes #11055pull/12219/head
parent
d959d4afbe
commit
33e44ea697
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
feat: allow `let props = $props()` and optimize prop read access
|
@ -0,0 +1,17 @@
|
||||
import "svelte/internal/disclose-version";
|
||||
import * as $ from "svelte/internal/client";
|
||||
|
||||
export default function Props_identifier($$anchor, $$props) {
|
||||
$.push($$props, true);
|
||||
|
||||
let props = $.rest_props($$props, ["$$slots", "$$events", "$$legacy"]);
|
||||
|
||||
$$props.a;
|
||||
props[a];
|
||||
$$props.a.b;
|
||||
$$props.a.b = true;
|
||||
props.a = true;
|
||||
props[a] = true;
|
||||
props;
|
||||
$.pop();
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import * as $ from "svelte/internal/server";
|
||||
|
||||
export default function Props_identifier($$payload, $$props) {
|
||||
$.push();
|
||||
|
||||
let props = $$props;
|
||||
|
||||
props.a;
|
||||
props[a];
|
||||
props.a.b;
|
||||
props.a.b = true;
|
||||
props.a = true;
|
||||
props[a] = true;
|
||||
props;
|
||||
$.pop();
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
let props = $props();
|
||||
props.a;
|
||||
props[a];
|
||||
props.a.b;
|
||||
props.a.b = true;
|
||||
props.a = true;
|
||||
props[a] = true;
|
||||
props;
|
||||
</script>
|
Loading…
Reference in new issue