Skip to content

Commit 8f7d2ed

Browse files
committed
COMMON: fix call by parenthesis
1 parent b85e2c4 commit 8f7d2ed

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

samples/distro-examples/tests/call_tau.bas

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,12 @@ tau.build_ta
1919
rem check system-variables
2020
predef.prsys
2121

22+
x=PI
23+
foyer.name= "PI"
24+
tau.addRoom(foyer,x)
2225

26+
sub addRoom(the_thing, d)
27+
print the_thing.name, d
28+
end
29+
30+
addRoom(foyer,x)

samples/distro-examples/tests/output/call_tau.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ message from tau
1111
[1,2,3,4]
1212
Predefined Variables
1313
PI =3.14159265358979
14+
PI 3.14159265358979
15+
PI 3.14159265358979

samples/distro-examples/tests/tau.bas

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Unit Tau
22
Import TauChild
33

44
Export expvar, foof, foop
5+
export addRoom
56
export print_expvar, ta, build_ta, cerr
67

78
expvar = "Tau's exported variable"
@@ -35,6 +36,10 @@ sub cerr
3536
rte 2
3637
end
3738

39+
sub addRoom(the_thing,d)
40+
print the_thing.name,d
41+
end
42+
3843
rem initialization
3944
? "Tau::initilized"
4045
?

src/common/scan.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,10 +2546,14 @@ void comp_text_line(char *text) {
25462546
if (udp > -1) {
25472547
bc_add_extpcode(&comp_prog, comp_extproctable[udp].lib_id,
25482548
comp_extproctable[udp].symbol_index);
2549-
bc_add_code(&comp_prog, kwTYPE_LEVEL_BEGIN);
25502549
char *next = trim_empty_parentheses(comp_bc_parm);
2551-
comp_expression(next, 0);
2552-
bc_add_code(&comp_prog, kwTYPE_LEVEL_END);
2550+
if (comp_is_parenthesized(next)) {
2551+
comp_expression(next, 0);
2552+
} else {
2553+
bc_add_code(&comp_prog, kwTYPE_LEVEL_BEGIN);
2554+
comp_expression(next, 0);
2555+
bc_add_code(&comp_prog, kwTYPE_LEVEL_END);
2556+
}
25532557
} else {
25542558
udp = comp_udp_id(comp_bc_name, 1);
25552559
if (udp == -1) {

0 commit comments

Comments
 (0)