Skip to content

Variadic expression parameters #179

@fyfyrchik

Description

@fyfyrchik

I want to do something like this:

@@
var s, low, up expression
@@
+import "slices"
-s = append(s[:low], s[up:]...)
+s = slices.Delete(s, low, up)

It doesn't work:

load patch "delete.patch": parse: delete.patch/0.minus.augmented:4:27: missing ',' in argument list

Supposably because ... is considered as a hole.
Using identifier instead of s[up:] works correctly, which matches the code

func (f *finder) ident() {
f.next() // IDENT
// foo...
if f.tok == token.ELLIPSIS {
f.next() // leave unchanged
}
}

I haven't found a quick way to fix this, because it is not obvious what context we need to track and remember.

Metadata

Metadata

Assignees

No one assigned

    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