Page MenuHomeFeedback Tracker

Enforce Script closing parentheses of function call on separate line cause syntax error
Assigned, NormalPublic

Description

When dealing with long parameter lists in code, I am inclined to pass the parameters on separate lines to the called function:

myFunc(
    param1,
    param2,
    ...
    paramN
);

However, putting the closing parentheses ");" on a seperate line will cause a compiler error.
To me, this is a baffling, unexpected behaviour, since all languages (C, C++, Java, Python) that I deal with regularly, allow this syntax.
I am steadfast of the opinion, that also Enforce Script should support this syntax.
Interestingly the follwing syntax works, but looks weird (closing parens on same line as last argument):

myFunc(
    param1,
    param2,
    ...
    paramN);

Details

Severity
Tweak
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
Scripting
Steps To Reproduce

Make a call to any function and put the closing parentheses and semicolon on a separate line.

E.g.

void test(int foo, string bar)
{
        Print("test: " + foo + " " + bar);
}

void main()
{       
        test(
                1,
                "hello"
        );
}
13:45:22 SCRIPT    (W): @"$CurrentDir:mpmissions\empty.banov\init.c,15": Missing ';' at the end of line
13:45:22 SCRIPT    (E): @"$CurrentDir:mpmissions\empty.banov\init.c,15": Expected ',' or ')', not a 'hello'
13:45:22 SCRIPT    (E): @"$CurrentDir:mpmissions\empty.banov\init.c,15": Invalid statement 'hello'
13:45:22 SCRIPT    (E): @"$CurrentDir:mpmissions\empty.banov\init.c,16": Unexpected statement ')'
13:45:22 SCRIPT    (E): Can't compile mission init script'!
Additional Information

Happens on all OSs

Event Timeline

Schard created this task.Feb 22 2022, 1:58 PM
Schard updated the task description. (Show Details)Feb 22 2022, 2:05 PM
Geez changed the task status from New to Assigned.Feb 24 2022, 4:40 PM