Commit 21dc1582 authored by Artem Sakhatskiy's avatar Artem Sakhatskiy
Browse files

fixed bug with assignments

parent e3aaca9d
Pipeline #3637951 passed with stages
in 3 minutes and 22 seconds
{
"name": "expression.ts",
"version": "1.0.1",
"version": "1.0.4",
"description": "TypeScript expressions interface",
"main": "",
"main": "src/expression.ts",
"directories": {
"test": "tests"
},
"scripts": {
"install": "mkdir lib || cp ./node_modules/expression.ts/src/expression.ts ./lib/expression.ts",
"test": "karma start --single-run"
},
"repository": {
......
......@@ -183,7 +183,7 @@ module Expression
if (expressionParts.token != expressionToken)
throw new Error(`Expression body is not correlated to token. Body: "${expressionParts.propertyExpressionBody}", token: "${expressionParts.token}".`);
let restrictedSymbols = [",", "(", ")", "{", "}", "+", "-", "!", "?", "<", ">", "*", "/"];
let restrictedSymbols = [",", "(", ")", "{", "}", "+", "-", "!", "?", "<", ">", "*", "/", "="];
restrictedSymbols.forEach(symbol => {
if (property.indexOf(symbol) >= 0)
throw new Error(`Invalid property expression. Body: "${expressionParts.propertyExpressionBody}".`);
......
......@@ -194,4 +194,13 @@ describe("An expression", () =>
expect(isValid).toThrowError("Invalid property expression. Body: \"target.func()\".");
});
it("should not be an assignment statement.", () =>
{
let expression: Expression<A, void> = (target) => target.value = "asd";
let isValid = () => Expression.validate(expression);
expect(isValid).toThrowError("Invalid property expression. Body: \"target.value = \"asd\"\".");
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment