Commit 30d209be authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix declaration of local variables in procedures (access type)

parent cc3d4814
......@@ -1701,7 +1701,7 @@ def _inner_procedure(proc):
if varbty.kind in ('SequenceOfType', 'OctetStringType'):
dstr = array_content(def_value, dstr, varbty)
assert not dst and not dlocal, 'Ground expression error'
code.append(u'l_{name} : {sort}{default};'
code.append(u'l_{name} : aliased {sort}{default};'
.format(name=var_name,
sort=typename,
default=' := ' + dstr if def_value else ''))
......
......@@ -269,7 +269,7 @@ class Output(VerticalSymbol):
# Output parameter: return the list of variables of this type
output_name = unicode(self).split('(')[0].strip().lower()
asn1_filter = [sig['type'] for sig in CONTEXT.output_signals if
sig['name'] == output_name]
hasattr(sig, 'type') and sig['name'] == output_name]
return variables_autocompletion(self, asn1_filter)
else:
# Return the list of output signals
......
......@@ -23,21 +23,21 @@ dcl choice choice;
dcl opt SeqOpt := { A TRUE, b FALSE }; -- test optional fields
/* CIF ENDTEXT */
/* CIF PROCEDURE (792, 315), (91, 35) */
/* CIF PROCEDURE (760, 371), (91, 35) */
PROCEDURE numProc;
/* CIF START (225, 61), (70, 35) */
/* CIF START (161, 82), (70, 35) */
START;
/* CIF DECISION (199, 111), (121, 50) */
DECISION num(myEnum);
/* CIF ANSWER (270, 181), (70, 23) */
/* CIF DECISION (135, 132), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (163, 202), (70, 23) */
else:
ENDDECISION;
/* CIF DECISION (199, 219), (121, 50) */
DECISION num(myEnum);
/* CIF ANSWER (270, 289), (70, 23) */
/* CIF DECISION (135, 240), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (163, 310), (70, 23) */
else:
ENDDECISION;
/* CIF RETURN (242, 327), (35, 35) */
/* CIF RETURN (178, 348), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF PROCEDURE (727, 175), (106, 35) */
......@@ -58,98 +58,98 @@ dcl opt SeqOpt := { A TRUE, b FALSE }; -- test optional fields
ENDDECISION;
/* CIF DECISION (481, 433), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (460, 488), (70, 23) */
/* CIF ANSWER (460, 503), (70, 23) */
(0):
/* CIF ANSWER (550, 488), (70, 23) */
/* CIF ANSWER (550, 503), (70, 23) */
else:
ENDDECISION;
/* CIF DECISION (492, 526), (99, 50) */
/* CIF DECISION (492, 541), (99, 50) */
DECISION 'informal'
/* CIF COMMENT (611, 503), (179, 53) */
/* CIF COMMENT (611, 533), (179, 53) */
COMMENT 'Informal decision -
check that it is ignored
by the code generator';
/* CIF ANSWER (462, 581), (70, 33) */
/* CIF ANSWER (462, 611), (70, 33) */
('a'):
/* CIF ANSWER (550, 581), (70, 33) */
/* CIF ANSWER (550, 611), (70, 33) */
('2'):
ENDDECISION;
/* CIF TASK (430, 629), (223, 38) */
/* CIF TASK (430, 659), (223, 38) */
TASK seqboolean := {true, false},
seqboolean := not {true, false};
/* CIF TASK (438, 682), (208, 83) */
/* CIF TASK (438, 712), (208, 83) */
TASK for x in seqen:
call writeln(num(x));
call writeln(num(myenum));
call writeln(num(myenum));
endfor
/* CIF COMMENT (666, 706), (174, 38) */
/* CIF COMMENT (666, 736), (174, 38) */
COMMENT 'Check that num is not
declared twice';
/* CIF TASK (460, 780), (164, 53) */
/* CIF TASK (460, 810), (164, 53) */
TASK for x in seqen2:
call writeln(num(x));
endfor;
/* CIF TASK (461, 848), (162, 53) */
/* CIF TASK (461, 878), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor
/* CIF COMMENT (643, 857), (168, 38) */
/* CIF COMMENT (643, 887), (168, 38) */
COMMENT 'FOR with a basic type';
/* CIF TASK (431, 916), (222, 35) */
/* CIF TASK (431, 946), (222, 35) */
TASK seqboolean := not seqboolean
/* CIF COMMENT (673, 916), (279, 35) */
/* CIF COMMENT (673, 946), (279, 35) */
COMMENT 'check NOT on a SEQUENCE of BOOLEAN';
/* CIF TASK (461, 966), (162, 53) */
/* CIF TASK (461, 996), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor;
/* CIF TASK (479, 1034), (126, 38) */
/* CIF TASK (479, 1064), (126, 38) */
TASK fixed := 'hello';
/* CIF TASK (467, 1087), (149, 35) */
/* CIF TASK (467, 1117), (149, 35) */
TASK variable := 'HELLO';
/* CIF PROCEDURECALL (454, 1137), (176, 35) */
/* CIF PROCEDURECALL (454, 1167), (176, 35) */
CALL writeln(variable // '!!!');
/* CIF PROCEDURECALL (406, 1187), (272, 35) */
/* CIF PROCEDURECALL (406, 1217), (272, 35) */
CALL writeln(variable // variable // variable);
/* CIF TASK (496, 1237), (91, 35) */
/* CIF TASK (496, 1267), (91, 35) */
TASK seq := {1};
/* CIF TASK (465, 1287), (153, 35) */
/* CIF TASK (465, 1317), (153, 35) */
TASK seq := {1} // {2} // {3};
/* CIF TASK (456, 1337), (172, 35) */
/* CIF TASK (456, 1367), (172, 35) */
TASK seq := seq // {2} // {1};
/* CIF DECISION (507, 1387), (70, 50) */
/* CIF DECISION (507, 1417), (70, 50) */
DECISION any;
/* CIF ANSWER (462, 1457), (70, 23) */
/* CIF ANSWER (462, 1487), (70, 23) */
('a'):
/* CIF ANSWER (552, 1457), (70, 23) */
/* CIF ANSWER (552, 1487), (70, 23) */
('b'):
ENDDECISION;
/* CIF DECISION (497, 1495), (89, 50) */
/* CIF DECISION (497, 1525), (89, 50) */
DECISION myenum
/* CIF COMMENT (606, 1502), (183, 35) */
/* CIF COMMENT (606, 1532), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (314, 1565), (70, 23) */
/* CIF ANSWER (314, 1595), (70, 23) */
(a):
/* CIF ANSWER (394, 1565), (70, 23) */
/* CIF ANSWER (394, 1595), (70, 23) */
(B):
/* CIF ANSWER (474, 1565), (70, 23) */
/* CIF ANSWER (474, 1595), (70, 23) */
(c):
/* CIF ANSWER (552, 1565), (70, 23) */
/* CIF ANSWER (552, 1595), (70, 23) */
(d):
/* CIF ANSWER (640, 1565), (70, 23) */
/* CIF ANSWER (640, 1595), (70, 23) */
(Ee):
ENDDECISION;
/* CIF DECISION (473, 1603), (138, 50) */
/* CIF DECISION (473, 1633), (138, 50) */
DECISION present(choice)
/* CIF COMMENT (630, 1610), (183, 35) */
/* CIF COMMENT (630, 1640), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (425, 1673), (70, 23) */
/* CIF ANSWER (425, 1703), (70, 23) */
(cde2):
/* CIF ANSWER (596, 1673), (70, 23) */
/* CIF ANSWER (596, 1703), (70, 23) */
ELSE:
ENDDECISION;
/* CIF NEXTSTATE (483, 1711), (116, 33) */
/* CIF NEXTSTATE (483, 1741), (116, 33) */
NEXTSTATE Wait_for_GUI;
/* CIF STATE (438, 163), (116, 33) */
STATE Wait_for_GUI;
......
......@@ -7,7 +7,7 @@ use dv comment 'dataview-uniq.asn';
--use dv2 comment 'dataview2.asn';
signal dd(Type2);
signal we;
signal we(Some_Thing);
procedure hehe;
fpar in/out a_param Type2;
......@@ -30,7 +30,25 @@ external;
dcl haha SeqOf;
dcl hihi type2;
dcl test Some_Thing := 4;
/* CIF ENDTEXT */
/* CIF PROCEDURE (404, 228), (73, 35) */
PROCEDURE aProc;
/* CIF TEXT (542, 127), (287, 140) */
dcl tmp Some_Thing := 1;
/* CIF ENDTEXT */
/* CIF START (164, 113), (70, 35) */
START;
/* CIF OUTPUT (154, 163), (89, 35) */
OUTPUT we(test);
/* CIF OUTPUT (155, 213), (88, 35) */
OUTPUT we(tmp)
/* CIF COMMENT (263, 213), (269, 35) */
COMMENT 'check that local variables can be sent';
/* CIF RETURN (181, 263), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF START (155, 216), (70, 35) */
START;
/* CIF NEXTSTATE (155, 266), (70, 35) */
......@@ -41,7 +59,9 @@ dcl hihi type2;
INPUT dd(hihi);
/* CIF PROCEDURECALL (281, 336), (100, 35) */
CALL hehe(hihi);
/* CIF NEXTSTATE (296, 386), (70, 35) */
/* CIF OUTPUT (286, 386), (89, 35) */
OUTPUT we(test);
/* CIF NEXTSTATE (296, 436), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
ENDPROCESS og;
......
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