Parse assignment RTL instead of LTR, fixes multiple assignment (bug 5420).
authorMichael Busby <prodigysim@gmail.com>
Mon Jun 10 01:50:18 2013 +0100 (2013-06-10)
changeset 26470b8f318c379
parent 263 ba85a47ee414
child 265 3a903b89a514
Parse assignment RTL instead of LTR, fixes multiple assignment (bug 5420).
src/compiler/Parser.cpp
tests/basic/multipleassignment.out
tests/basic/multipleassignment.sp
     1.1 --- a/src/compiler/Parser.cpp	Mon Jun 10 01:04:43 2013 +0100
     1.2 +++ b/src/compiler/Parser.cpp	Mon Jun 10 01:50:18 2013 +0100
     1.3 @@ -632,7 +632,7 @@
     1.4              break;
     1.5          scanner_.scan();
     1.6          SourcePosition pos = scanner_.begin();
     1.7 -        Expression *expr = ternary();
     1.8 +        Expression *expr = assignment();
     1.9          if (!expr)
    1.10              return NULL;
    1.11  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tests/basic/multipleassignment.out	Mon Jun 10 01:50:18 2013 +0100
     2.3 @@ -0,0 +1,1 @@
     2.4 +33
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tests/basic/multipleassignment.sp	Mon Jun 10 01:50:18 2013 +0100
     3.3 @@ -0,0 +1,10 @@
     3.4 +native PrintNum(num);
     3.5 +
     3.6 +public main()
     3.7 +{
     3.8 +    new one, two;
     3.9 +    one = two = 3;
    3.10 +
    3.11 +    PrintNum(one);
    3.12 +    PrintNum(two);
    3.13 +}