mirror of https://github.com/Wilfred/difftastic/
Add Scala support
parent
c2ec55f46a
commit
cc651ad14a
@ -0,0 +1,21 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
import foo.Baz
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
|
||||||
|
private def blah(): Other {
|
||||||
|
throw new Exception("after");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Option.empty[T]
|
||||||
|
val fn = pf.lift
|
||||||
|
object traverser extends SimpleTraverser {
|
||||||
|
override def apply(t: Tree): Unit = {
|
||||||
|
result = fn(t).orElse(result)
|
||||||
|
if (result.nonEmpty) {
|
||||||
|
super.apply(t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
import foo.Bar
|
||||||
|
|
||||||
|
class Foo {
|
||||||
|
|
||||||
|
def blah(): Int {
|
||||||
|
throw new Exception("before");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Option.empty[T]
|
||||||
|
object traverser extends SimpleTraverser {
|
||||||
|
override def apply(t: Tree): Unit = {
|
||||||
|
if (result.isEmpty && pf.isDefinedAt(t)) {
|
||||||
|
result = Some(pf(t))
|
||||||
|
} else if (result.isEmpty) {
|
||||||
|
super.apply(t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
tree-sitter-scala/src
|
||||||
Loading…
Reference in New Issue