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

how to get object by sourcecode Macro #79

Closed
jijingg opened this issue Nov 8, 2019 · 1 comment
Closed

how to get object by sourcecode Macro #79

jijingg opened this issue Nov 8, 2019 · 1 comment

Comments

@jijingg
Copy link

jijingg commented Nov 8, 2019

hi @lihaoyi, i used the soucecode, it's wonderful, solved most of my problems, But I have another special need

val x = myobj.func()

i want get myobj AST then do some on myobj
something like this:

val x = {
myobj.dofunc1
myobj.dofunc2
myobj.dofunc3
}

do you have any suggestion how to implement that in somethingImpl

def func()(implicit x: sourcecode.Something)

def somethingImpl(c: Context) = {
  import c.universe._
  dose there any method get q"myobj" from AST of "val x = myobj.func()" by Context
  q"""{
   $myobj.dofunc1
   $myobj.dofunc2
   $myobj.dofunc3
  """
}
@lihaoyi
Copy link
Member

lihaoyi commented Nov 8, 2019

questions go in the gitter channel

@lihaoyi lihaoyi closed this as completed Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants