Skip to content
This repository has been archived by the owner on Apr 18, 2020. It is now read-only.

Replace[A, B] based generator methods #35

Open
DavidDudson opened this issue Dec 29, 2017 · 1 comment
Open

Replace[A, B] based generator methods #35

DavidDudson opened this issue Dec 29, 2017 · 1 comment

Comments

@DavidDudson
Copy link
Member

DavidDudson commented Dec 29, 2017

This is one that I believe will be useful for a lot of situations.

This is similar to the scalameta/paradise, by being fairly generic, however, instead of having to pattern match we target owners of specific data in tree subclasses.

object ProfileAll extends ManipulationGenerator("ProfileAll") {
  def extend(a: A: StatReplacer): A = 
    a.withStats(a.extract[Stat].map(somefunction))
}

This could be used in the situation below (useless example, but you get the idea)

Before

@ProfileAll
object Foo {
 def bar = 2
 def baz = 4
 val ban = "foo"
}
@ProfileAll
object Foo {
 def bar = time(2)
 def baz = time(4)
 val ban = time("foo")
}
@DavidDudson
Copy link
Member Author

Blocked by #44

@DavidDudson DavidDudson added this to the Version 0.1 milestone Jan 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant