rename link_state to linked_state for grammatical consistency

pull/12545/head
Rich Harris 2 years ago
parent b5b989ba47
commit ef978ce87e

@ -927,7 +927,7 @@ const runes_scope_js_tweaker = {
rune === '$state'
? 'state'
: rune === '$state.link'
? 'link_state'
? 'linked_state'
: rune === '$state.frozen'
? 'frozen_state'
: 'derived';
@ -973,7 +973,7 @@ const runes_scope_tweaker = {
: rune === '$state.frozen'
? 'frozen_state'
: rune === '$state.link'
? 'link_state'
? 'linked_state'
: rune === '$derived' || rune === '$derived.by'
? 'derived'
: path.is_rest
@ -1288,7 +1288,7 @@ const common_visitors = {
context.state.function_depth === binding.scope.function_depth &&
// If we have $state that can be proxied or frozen and isn't re-assigned, then that means
// it's likely not using a primitive value and thus this warning isn't that helpful.
(((binding.kind === 'state' || binding.kind === 'link_state') &&
(((binding.kind === 'state' || binding.kind === 'linked_state') &&
(binding.reassigned ||
(binding.initial?.type === 'CallExpression' &&
binding.initial.arguments.length === 1 &&

@ -395,7 +395,7 @@ const validation = {
!binding ||
(binding.kind !== 'state' &&
binding.kind !== 'frozen_state' &&
binding.kind !== 'link_state' &&
binding.kind !== 'linked_state' &&
binding.kind !== 'prop' &&
binding.kind !== 'bindable_prop' &&
binding.kind !== 'each' &&
@ -878,7 +878,7 @@ function validate_export(node, scope, name) {
if (
(binding.kind === 'state' ||
binding.kind === 'frozen_state' ||
binding.kind === 'link_state') &&
binding.kind === 'linked_state') &&
binding.reassigned
) {
e.state_invalid_export(node);

@ -73,7 +73,7 @@ export interface ComponentClientTransformState extends ClientTransformState {
}
export interface StateField {
kind: 'state' | 'frozen_state' | 'link_state' | 'derived' | 'derived_call';
kind: 'state' | 'frozen_state' | 'linked_state' | 'derived' | 'derived_call';
id: PrivateIdentifier;
}

@ -105,7 +105,7 @@ export function serialize_get_binding(node, state) {
return b.member(b.id('$$props'), node);
}
if (binding.kind === 'link_state') {
if (binding.kind === 'linked_state') {
return b.call(node);
}
@ -291,7 +291,7 @@ export function serialize_set_binding(node, context, fallback, prefix, options)
if (
binding.kind !== 'state' &&
binding.kind !== 'frozen_state' &&
binding.kind !== 'link_state' &&
binding.kind !== 'linked_state' &&
binding.kind !== 'prop' &&
binding.kind !== 'bindable_prop' &&
binding.kind !== 'each' &&
@ -312,7 +312,7 @@ export function serialize_set_binding(node, context, fallback, prefix, options)
if (
(binding.kind === 'prop' ||
binding.kind === 'bindable_prop' ||
binding.kind === 'link_state') &&
binding.kind === 'linked_state') &&
!is_initial_proxy
) {
return b.call(left, value);
@ -343,7 +343,7 @@ export function serialize_set_binding(node, context, fallback, prefix, options)
} else if (
(binding.kind === 'prop' ||
binding.kind === 'bindable_prop' ||
binding.kind === 'link_state') &&
binding.kind === 'linked_state') &&
is_initial_proxy
) {
call = b.call(
@ -351,7 +351,7 @@ export function serialize_set_binding(node, context, fallback, prefix, options)
context.state.analysis.runes &&
!options?.skip_proxy_and_freeze &&
should_proxy_or_freeze(value, context.state.scope) &&
(binding.kind === 'bindable_prop' || binding.kind === 'link_state')
(binding.kind === 'bindable_prop' || binding.kind === 'linked_state')
? serialize_proxy_reassignment(value, left_name, state)
: value
);

@ -70,7 +70,7 @@ export const global_visitors = {
if (
binding?.kind === 'state' ||
binding?.kind === 'frozen_state' ||
binding?.kind === 'link_state' ||
binding?.kind === 'linked_state' ||
binding?.kind === 'each' ||
binding?.kind === 'legacy_reactive' ||
binding?.kind === 'prop' ||
@ -88,7 +88,7 @@ export const global_visitors = {
args.push(serialize_get_binding(b.id(name), state), b.call('$' + name));
} else {
if (binding.kind === 'prop' || binding.kind === 'bindable_prop') fn += '_prop';
if (binding.kind === 'link_state') fn += '_link';
if (binding.kind === 'linked_state') fn += '_link';
args.push(b.id(name));
}

@ -58,7 +58,7 @@ export const javascript_visitors_runes = {
: rune === '$state.frozen'
? 'frozen_state'
: rune === '$state.link'
? 'link_state'
? 'linked_state'
: rune === '$derived.by'
? 'derived_call'
: 'derived',
@ -120,7 +120,7 @@ export const javascript_visitors_runes = {
'$.source',
should_proxy_or_freeze(init, state.scope) ? b.call('$.proxy', init) : init
)
: field.kind === 'link_state'
: field.kind === 'linked_state'
? b.call(
'$.source_link',
should_proxy_or_freeze(init, state.scope)
@ -147,7 +147,7 @@ export const javascript_visitors_runes = {
const member = b.member(b.this, field.id);
body.push(b.prop_def(field.id, value));
if (field.kind === 'link_state') {
if (field.kind === 'linked_state') {
// get foo() { return this.#foo; }
body.push(b.method('get', definition.key, [], [b.return(b.call(member))]));
@ -344,7 +344,7 @@ export const javascript_visitors_runes = {
value
);
}
if (binding.kind === 'link_state') {
if (binding.kind === 'linked_state') {
return b.call('$.source_link', b.thunk(value));
}
if (is_state_source(binding, state)) {

@ -280,7 +280,7 @@ export interface Binding {
| 'rest_prop'
| 'state'
| 'frozen_state'
| 'link_state'
| 'linked_state'
| 'derived'
| 'each'
| 'snippet'

@ -930,7 +930,7 @@ declare module 'svelte/compiler' {
| 'rest_prop'
| 'state'
| 'frozen_state'
| 'link_state'
| 'linked_state'
| 'derived'
| 'each'
| 'snippet'
@ -1239,9 +1239,9 @@ declare module 'svelte/compiler' {
| LegacyCssNode
| Text;
class Scope {
constructor(root: ScopeRoot, parent: Scope | null, porous: boolean);
root: ScopeRoot;
/**
* The immediate parent scope
@ -1269,25 +1269,25 @@ declare module 'svelte/compiler' {
* which is usually an error. Block statements do not increase this value
*/
function_depth: number;
declare(node: Identifier, kind: Binding["kind"], declaration_kind: DeclarationKind, initial?: null | Expression | FunctionDeclaration | ClassDeclaration | ImportDeclaration | EachBlock): Binding;
child(porous?: boolean): Scope;
generate(preferred_name: string): string;
get(name: string): Binding | null;
get_bindings(node: VariableDeclarator | LetDirective): Binding[];
owner(name: string): Scope | null;
reference(node: Identifier, path: SvelteNode[]): void;
#private;
}
class ScopeRoot {
conflicts: Set<string>;
unique(preferred_name: string): Identifier;
}
namespace Css {
@ -2188,21 +2188,21 @@ declare module 'svelte/reactivity' {
/** @deprecated Use `SvelteURLSearchParams` instead */
function URLSearchParams_1(): void;
export class SvelteDate extends Date {
constructor(...params: any[]);
#private;
}
export class SvelteSet<T> extends Set<T> {
constructor(value?: Iterable<T> | null | undefined);
add(value: T): this;
#private;
}
export class SvelteMap<K, V> extends Map<K, V> {
constructor(value?: Iterable<readonly [K, V]> | null | undefined);
set(key: K, value: V): this;
#private;
}
@ -2212,7 +2212,7 @@ declare module 'svelte/reactivity' {
}
const REPLACE: unique symbol;
export class SvelteURLSearchParams extends URLSearchParams {
[REPLACE](params: URLSearchParams): void;
#private;
}
@ -3212,4 +3212,4 @@ declare function $inspect<T extends any[]>(
*/
declare function $host<El extends HTMLElement = HTMLElement>(): El;
//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map

Loading…
Cancel
Save