Created
February 14, 2017 21:33
-
-
Save Daxten/7b1396eff91d4ba937f2d73e29c1d6ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isCaseClass(tree: Tree): Boolean = { | |
tree.is[Defn.Class] && tree.children.exists(_.is[Mod.Case]) || | |
tree.parent.exists(_.is[Defn.Class]) && tree.parent.exists(_.children.exists(_.is[Mod.Case])) | |
} | |
def isCaseObject(tree: Tree): Boolean = { | |
tree.is[Defn.Object] && tree.children.exists(_.is[Mod.Case]) || | |
tree.parent.exists(_.is[Defn.Object]) && tree.parent.exists(_.children.exists(_.is[Mod.Case])) | |
} | |
def isFinalClass(tree: Tree): Boolean = { | |
tree.is[Defn.Class] && tree.children.exists(_.is[Mod.Final]) || | |
tree.parent.exists(_.is[Defn.Class]) && tree.parent.exists(_.children.exists(_.is[Mod.Final])) | |
} | |
def isBasicClass(tree: Tree): Boolean = { | |
tree.is[Defn.Class] && !tree.children.exists(e => e.is[Mod.Final] || e.is[Mod.Case]) || | |
tree.parent.exists(_.is[Defn.Class]) && !tree.parent.exists(_.children.exists(e => e.is[Mod.Final] || e.is[Mod.Case])) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment