JavaScript: recognize assignation to a parenthesized expression

This commit is contained in:
Colomban Wendling 2014-08-03 19:07:59 +02:00
parent b596aa14e8
commit 3ff01aeeb3
3 changed files with 8 additions and 0 deletions

View File

@ -1433,6 +1433,8 @@ static boolean parseStatement (tokenInfo *const token, boolean is_inside_class)
/*
* Handle nameless functions
* this.method_name = () {}
* Also assignments starting with parentheses
* var foo = (1 + 2) * 3;
*/
skipArgumentList(token);
@ -1446,6 +1448,8 @@ static boolean parseStatement (tokenInfo *const token, boolean is_inside_class)
}
else if (isType (token, TOKEN_CLOSE_CURLY))
is_terminated = FALSE;
else if (token->nestLevel == 0 && is_global)
makeJsTag (name, JSTAG_VARIABLE);
}
else if (isType (token, TOKEN_OPEN_CURLY))
{

View File

@ -1,4 +1,6 @@
var x = 1;
var z = {};
var y = [];
var a = (42 + 1) * 2;
var b = 2 * (42 + 1);

View File

@ -1,4 +1,6 @@
# format=tagmanager
aフ16384ヨ0
bフ16384ヨ0
xÌ16384Ö0
yÌ16384Ö0
zÌ16384Ö0