on second thoughts

pull/15820/head
Rich Harris 4 months ago
parent 75680a9a5e
commit 2ffb863b5d

@ -1,6 +1,6 @@
import type { Scope } from '../scope.js'; import type { Scope } from '../scope.js';
import type { ComponentAnalysis, ReactiveStatement } from '../types.js'; import type { ComponentAnalysis, ReactiveStatement } from '../types.js';
import type { AST, ExpressionMetadata, StateFields, ValidatedCompileOptions } from '#compiler'; import type { AST, ExpressionMetadata, StateField, ValidatedCompileOptions } from '#compiler';
import type { ClassBody } from 'estree'; import type { ClassBody } from 'estree';
export interface AnalysisState { export interface AnalysisState {
@ -21,8 +21,8 @@ export interface AnalysisState {
expression: ExpressionMetadata | null; expression: ExpressionMetadata | null;
/** Used to analyze class state. */ /** Used to analyze class state. */
classes: Map<ClassBody, StateFields>; classes: Map<ClassBody, Record<string, StateField>>;
state_fields: StateFields | null; state_fields: Record<string, StateField> | null;
function_depth: number; function_depth: number;

@ -1,5 +1,5 @@
/** @import { AssignmentExpression, ClassBody, PropertyDefinition, Expression, PrivateIdentifier, MethodDefinition } from 'estree' */ /** @import { AssignmentExpression, ClassBody, PropertyDefinition, Expression, PrivateIdentifier, MethodDefinition } from 'estree' */
/** @import { StateFields } from '#compiler' */ /** @import { StateField } from '#compiler' */
/** @import { Context } from '../types' */ /** @import { Context } from '../types' */
import { get_rune } from '../../scope.js'; import { get_rune } from '../../scope.js';
import * as e from '../../../errors.js'; import * as e from '../../../errors.js';
@ -15,7 +15,7 @@ export function ClassBody(node, context) {
return; return;
} }
/** @type {StateFields} */ /** @type {Record<string, StateField>} */
const state_fields = {}; const state_fields = {};
/** @type {string[]} */ /** @type {string[]} */

@ -271,11 +271,9 @@ export interface ExpressionMetadata {
has_call: boolean; has_call: boolean;
} }
export interface StateFields { export interface StateField {
[name: string]: { type: StateCreationRuneName;
type: StateCreationRuneName; node: PropertyDefinition | AssignmentExpression;
node: PropertyDefinition | AssignmentExpression;
};
} }
export * from './template.js'; export * from './template.js';

Loading…
Cancel
Save