Skip to content

Inconsistent domain for argument iteration scope #2930

@AndreasArvidsson

Description

@AndreasArvidsson

For a formal arguments we use the entire function as the iteration scope to main:

[Domain] = 0:0-0:29
>-----------------------------<
0| function myFunk(aaa, bbb) { }

But for actual arguments we only use the argument list (including parentheses):

[Domain] = 0:3-0:13
>----------<
0| aaa(bbb, ccc);

I can't remember the discussion around this decision, but I think the reason why the actual argument domain doesn't include the function name is the case when you have a function call as an argument:

foo(|bar(1), baz(2))

"every arg" refers to bar(1) and baz(2) today, but if bar was part of the iteration domain the result would just have been just 1 instead.

That is of course useful. On the other hand it creates an inconsistency and you can always use item instead of arg. Maybe the fact that item and argument does the same thing in this case is an indication that argument is not correct according to the syntax tree?

Also in this scenario I think people would be surprised what "every arg" refers to.

function foo(value: number) {

    b|ar(1, 2, 3);

}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions