improvements

pull/15820/head
S. Elliott Johnson 1 year ago
parent 005ba29968
commit 4d6422cca4

@ -1,6 +1,7 @@
/** @import { AssignmentExpression, PropertyDefinition, Expression } from 'estree' */
/** @import { AST } from '#compiler' */
/** @import { Context } from '../../types' */
/** @import { StateCreationRuneName } from '../../../../../utils.js' */
import { get_parent } from '../../../../utils/ast.js';
import { get_rune } from '../../../scope.js';
@ -8,19 +9,11 @@ import * as e from '../../../../errors.js';
import { locate_node } from '../../../../state.js';
import { is_state_creation_rune } from '../../../../../utils.js';
/** @typedef {'$state' | '$state.raw' | '$derived' | '$derived.by' | 'regular'} PropertyAssignmentType */
/** @typedef { StateCreationRuneName | 'regular'} PropertyAssignmentType */
/** @typedef {{ type: PropertyAssignmentType; node: AssignmentExpression | PropertyDefinition; }} PropertyAssignmentDetails */
const reassignable_assignments = new Set(['$state', '$state.raw', 'regular']);
const property_assignment_types = new Set([
'$state',
'$state.raw',
'$derived',
'$derived.by',
'regular'
]);
export class ClassAnalysis {
// TODO: Probably need to include property definitions here too
/** @type {Map<string, PropertyAssignmentDetails>} */

@ -121,7 +121,7 @@ export class ClassAnalysis {
const rune = get_rune(node.right, context.state.scope);
if (!rune || !is_state_creation_rune(rune)) {
return false;
return;
}
const id = this.#deconflict(name);

Loading…
Cancel
Save