Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple top-level declarations #24

Open
abhinav opened this issue Jun 8, 2021 · 0 comments
Open

Multiple top-level declarations #24

abhinav opened this issue Jun 8, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@abhinav
Copy link
Contributor

abhinav commented Jun 8, 2021

It's currently impossible to have a patch that introduces a new top-level declaration while modifying another one.

For example, given,

func foo() {
  re := regexp.MustCompile("foo")
  // ...
}

We cannot build a patch that would turn it into the following.

var re = regexp.MustCompile("foo")

func foo() {
  // ...
}

That's because we don't yet support patches with multiple top-level declarations in them so the following will fail to parse.

@@
var f, re identifier
var regex expression
@@
+var re = regexp.MustCompile(regex)

 func f() {
-  re := regexp.MustCompile(regex)
   ...
 }

See also #3, #4

@sywhang sywhang added the enhancement New feature or request label Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants