refactor(compiler): add details while throw error during expression convert (#32760)

Fixes #32759

PR Close #32760
This commit is contained in:
mohax
2019-09-19 00:44:21 +03:00
committed by Alex Rickabaugh
parent b7c012f91b
commit 6d06d9d3c6
2 changed files with 7 additions and 4 deletions

View File

@ -551,7 +551,10 @@ class _AstToIrVisitor implements cdAst.AstVisitor {
this.usesImplicitReceiver = prevUsesImplicitReceiver;
} else {
// Otherwise it's an error.
throw new Error('Cannot assign to a reference or variable!');
const receiver = ast.name;
const value = (ast.value instanceof cdAst.PropertyRead) ? ast.value.name : undefined;
throw new Error(
`Cannot assign value "${value}" to template variable "${receiver}". Template variables are read-only.`);
}
}
}