|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
/** @import { ArrowFunctionExpression, CallExpression, Expression, FunctionDeclaration, FunctionExpression, Identifier, VariableDeclarator } from 'estree' */
|
|
|
|
|
/** @import { ArrowFunctionExpression, CallExpression, Expression, FunctionDeclaration, FunctionExpression, Identifier, MemberExpression, VariableDeclarator } from 'estree' */
|
|
|
|
|
/** @import { AST } from '#compiler' */
|
|
|
|
|
/** @import { Context } from '../types' */
|
|
|
|
|
import { get_rune } from '../../scope.js';
|
|
|
|
|
import * as e from '../../../errors.js';
|
|
|
|
|
import { get_parent, unwrap_optional } from '../../../utils/ast.js';
|
|
|
|
|
import { get_parent, object, unwrap_optional } from '../../../utils/ast.js';
|
|
|
|
|
import { is_pure, is_safe_identifier } from './shared/utils.js';
|
|
|
|
|
import { dev, locate_node, source } from '../../../state.js';
|
|
|
|
|
import * as b from '../../../utils/builders.js';
|
|
|
|
@ -121,10 +121,18 @@ export function CallExpression(node, context) {
|
|
|
|
|
}
|
|
|
|
|
if (arg.type === 'MemberExpression') {
|
|
|
|
|
if (arg.object.type !== 'ThisExpression') {
|
|
|
|
|
const obj = object((arg = /** @type {MemberExpression} */ (context.visit(arg))));
|
|
|
|
|
if (obj?.type === 'Identifier') {
|
|
|
|
|
// there isn't really a good way to tell because of stuff like `notproxied = proxied`
|
|
|
|
|
break;
|
|
|
|
|
} else if (obj?.type !== 'ThisExpression') {
|
|
|
|
|
e.state_invalidate_nonreactive_argument(node);
|
|
|
|
|
}
|
|
|
|
|
} else if (arg.computed) {
|
|
|
|
|
e.state_invalidate_invalid_this_property(node);
|
|
|
|
|
}
|
|
|
|
|
const class_body = context.path.findLast((parent) => parent.type === 'ClassBody');
|
|
|
|
|
if (arg.computed || !class_body) {
|
|
|
|
|
if (!class_body) {
|
|
|
|
|
e.state_invalidate_invalid_this_property(node);
|
|
|
|
|
}
|
|
|
|
|
const possible_this_bindings = context.path.filter((parent, index) => {
|
|
|
|
|