Created
February 15, 2016 09:47
-
-
Save olafurpg/6263a2045d9cdad432fd 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 numberOfStatements(tree: Tree): Int = { | |
var n = 0 | |
def loop(x: Tree): Unit = { | |
x match { | |
case t: Source => n += t.stats.length | |
case t: internal.ast.Pkg => n += t.stats.length | |
case t: internal.ast.Term.Match => n += t.cases.length | |
case t: internal.ast.Term.PartialFunction => n += t.cases.length | |
case t: internal.ast.Term.Block => n += t.stats.length | |
case t: internal.ast.Template if t.stats.isDefined => | |
n += t.stats.get.length | |
case _ => // Nothing | |
} | |
x.children.foreach(loop) | |
} | |
loop(tree) | |
n | |
} | |
Main.scala:339: value stats is not a member of scala.meta.Source | |
case t: Source => n += t.stats.length | |
^ | |
Compilation Failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment