macr2tree(): after a=1:2, b=a(2) is pseudocoded as a funcall instead of as an extraction operation (Scilab 6.0 regression)
Reported by Samuel GOUGEON (@sgougeon)
BUG DESCRIPTION:
----------------
In Scilab 5.5.2:
-->function test()
-->a = 3
-->b = a(1)
-->endfunction
-->code_552 = macr2tree(test);
-->save("code_552.sod","code_552") // to load it in 6.1.1 and display it with a compact display
--> // Scilab 6.1.1
--> load code_552.sod
--> clear tmp; tmp.code_552 = code_552
tmp =
code_552: [program] tlist with fields:
name = "test"
outputs: empty list()
inputs: empty list()
statements: list:
(1) : list:
(1) = "EOL"
(2) : [equal] tlist with fields:
expression: [cste] tlist with fields:
value = 3
lhs: list:
(1) : [variable] tlist with fields:
name = "a"
endsymbol = ""
(3) : list:
(1) = "EOL"
(4) : [equal] tlist with fields:
expression: [operation] tlist with fields: <<<<<<<<
operands: list:
(1) : [variable] tlist with fields:
name = "a"
(2) : [cste] tlist with fields:
value = 1
operator = "ext" <<<<<<<< a(1) is encoded as an extraction operation
lhs: list:
(1) : [variable] tlist with fields:
name = "b"
endsymbol = ""
(5) : list:
(1) = "EOL"
(6) : list:
(1) = "EOL"
(7) : [funcall] tlist with fields:
rhs = []
name = "return"
lhsnb = 0
(8) : list:
(1) = "EOL"
nblines = 6
In Scilab 6.1.1:
--> function test()
> a = 2
> b = a(1)
> endfunction
--> clear tmp; tmp.code_611 = macr2tree(test)
tmp =
code_611: [program] tlist with fields:
name = "test"
outputs: empty list()
inputs: empty list()
statements: list:
(1) : list:
(1) = "EOL"
(2) : [equal] tlist with fields:
expression: [cste] tlist with fields:
value = 2
lhs: list:
(1) : [variable] tlist with fields:
name = "a"
endsymbol = ""
(3) : list:
(1) = "EOL"
(4) : [equal] tlist with fields:
expression: [funcall] tlist with fields: <<<<<<<<<<<
rhs: list:
(1) : [cste] tlist with fields:
value = 1
name = "a" <<<< a(1) is encoded as an funcall with
lhsnb = 1 <<<< 1 argout
lhs: list:
(1) : [variable] tlist with fields:
name = "b" <<<< named b (ok)
endsymbol = ""
(5) : list:
(1) = "EOL"
(6) : [funcall] tlist with fields:
rhs = []
name = "return"
lhsnb = 0
(7) : list:
(1) = "EOL"
nblines = 4
This bug makes big troubles for the m2sci converter.
ERROR LOG:
----------
HOW TO REPRODUCE THE BUG:
-------------------------
function test()
a = 2
b = a(1)
endfunction
code = macr2tree(test);
code = code.statements(4);
clear tmp; tmp.code = code
code.expression
OTHER INFORMATION:
------------------
Already in Scilab 6.0.0 (but without the nice list and struct display for the pseudocode)