Skip to content

Fix #3876: Implement Expr.AsFunction #3880

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

Merged
merged 4 commits into from
Jan 22, 2018

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

val x1 = SyntheticValDef(NameKinds.UniqueName.fresh("x".toTermName), x)
def x1Ref() = ref(x1.symbol)
def rec(f: Tree): Tree = f match {
case Block((ddef: DefDef) :: Nil, _: Closure) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the closure extractor instead (in TreeInfo).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closure only extracts the Closure and here we also need its DefDef. I will instead factor out a common extractor from closureBody and this me method.

@odersky odersky assigned nicolasstucki and unassigned odersky Jan 21, 2018
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

@@ -534,9 +534,18 @@ trait TypedTreeInfo extends TreeInfo[Type] { self: Trees.Instance[Type] =>
}
}

/** An extractor for closures with their def contained in a block. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename it to closureDef and return just the def. The closure part is used nowhere.

@odersky odersky assigned nicolasstucki and unassigned odersky Jan 22, 2018
@nicolasstucki nicolasstucki merged commit 0094097 into scala:master Jan 22, 2018
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

Successfully merging this pull request may close these issues.

2 participants