mirror of https://github.com/sveltejs/svelte
parent
255603111b
commit
c7e8422ceb
@ -1,23 +0,0 @@
|
|||||||
/** @import { MemberExpression } from 'estree' */
|
|
||||||
/** @import { Context } from '../types.js' */
|
|
||||||
import * as b from '#compiler/builders';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {MemberExpression} node
|
|
||||||
* @param {Context} context
|
|
||||||
*/
|
|
||||||
export function MemberExpression(node, context) {
|
|
||||||
if (
|
|
||||||
context.state.analysis.runes &&
|
|
||||||
node.object.type === 'ThisExpression' &&
|
|
||||||
node.property.type === 'PrivateIdentifier'
|
|
||||||
) {
|
|
||||||
const field = context.state.private_derived.get(node.property.name);
|
|
||||||
|
|
||||||
if (field) {
|
|
||||||
return b.call(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.next();
|
|
||||||
}
|
|
@ -1,10 +1,14 @@
|
|||||||
import type { Scope } from '../scope.js';
|
import type { Scope } from '../scope.js';
|
||||||
import type { AST, ValidatedModuleCompileOptions } from '#compiler';
|
import type { AST, StateField, ValidatedModuleCompileOptions } from '#compiler';
|
||||||
import type { Analysis } from '../types.js';
|
import type { Analysis } from '../types.js';
|
||||||
|
import type { PrivateIdentifier } from 'estree';
|
||||||
|
|
||||||
export interface TransformState {
|
export interface TransformState {
|
||||||
readonly analysis: Analysis;
|
readonly analysis: Analysis;
|
||||||
readonly options: ValidatedModuleCompileOptions;
|
readonly options: ValidatedModuleCompileOptions;
|
||||||
readonly scope: Scope;
|
readonly scope: Scope;
|
||||||
readonly scopes: Map<AST.SvelteNode, Scope>;
|
readonly scopes: Map<AST.SvelteNode, Scope>;
|
||||||
|
|
||||||
|
readonly state_fields: Record<string, StateField>;
|
||||||
|
readonly backing_fields: Record<string, PrivateIdentifier>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue