|
|
|
@ -789,7 +789,7 @@ export default class Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let deep = false;
|
|
|
|
let deep = false;
|
|
|
|
let names: string[] | null;
|
|
|
|
let names: string[] | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
if (node.type === 'AssignmentExpression') {
|
|
|
|
if (node.type === 'AssignmentExpression') {
|
|
|
|
deep = node.left.type === 'MemberExpression';
|
|
|
|
deep = node.left.type === 'MemberExpression';
|
|
|
|
@ -804,8 +804,18 @@ export default class Component {
|
|
|
|
|
|
|
|
|
|
|
|
if (names) {
|
|
|
|
if (names) {
|
|
|
|
names.forEach(name => {
|
|
|
|
names.forEach(name => {
|
|
|
|
const variable = component.var_lookup.get(name);
|
|
|
|
let current_scope = scope;
|
|
|
|
if (variable && variable.writable === false && !deep) {
|
|
|
|
let declaration;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (current_scope) {
|
|
|
|
|
|
|
|
if (current_scope.declarations.has(name)) {
|
|
|
|
|
|
|
|
declaration = current_scope.declarations.get(name);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
current_scope = current_scope.parent;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (declaration && declaration.kind === 'const' && !deep) {
|
|
|
|
component.error(node as any, {
|
|
|
|
component.error(node as any, {
|
|
|
|
code: 'assignment-to-const',
|
|
|
|
code: 'assignment-to-const',
|
|
|
|
message: 'You are assigning to a const'
|
|
|
|
message: 'You are assigning to a const'
|
|
|
|
|