Extractors
Type members
Classlikes
Matches predicate(bar) or predicateT where predicate can be a simple method or something selected from something else e.g: foo.method(bar) or foo.methodT
Matches case class Person(first: String, last: String)
creation of the forms:
Person("Joe","Bloggs")
new Person("Joe","Bloggs")
Matches case class Person(first: String, last: String)
creation of the forms:
Person("Joe","Bloggs")
new Person("Joe","Bloggs")
Ignore case where there happens to be an apply e.g. java functions where "str".length in scala
will translate into "str".lenth() since for java methods () is automatically added in.
Hence it's Apply( Select(Literal(IntConstant("str")), "length") )
Not just Select(Literal(IntConstant("str")), "length")
Ignore case where there happens to be an apply e.g. java functions where "str".length in scala
will translate into "str".lenth() since for java methods () is automatically added in.
Hence it's Apply( Select(Literal(IntConstant("str")), "length") )
Not just Select(Literal(IntConstant("str")), "length")
Note maybe there's even a case where you want multiple empty-applies e.g. foo()() to be ignored
hence this would be done recursively like Untype
Since things like the QueryParser slow are because Quoted matching is slow (or at least slower then I'd like them to be),
a simple performance optimization is to check if there's a single-method being matched and if so, what is it's name.
Since Scala matches unapply causes left-to-right (nested and recursively), we can add a unapply clause
that will grab the name of the method (if it is a single one being matched which in most cases of the
QueryParser is exaclty what we're looking for) and then match it to a name that we expect it to have.
For example, if we're trying to match this:
{{
case '{ ($o: Option[t]).map(${Lambda1(id, idType, body)}) } =>
}}
We can do the following:
{{
case "map" -@> '{ ($o: Option[t]).map(${Lambda1(id, idType, body)}) } =>
}}
This will check that there's a Apply(TypeApply(Select(_, "map"), _), _)
being called
and then only proceecd into the quoted-matcher if that is the case.
Since things like the QueryParser slow are because Quoted matching is slow (or at least slower then I'd like them to be),
a simple performance optimization is to check if there's a single-method being matched and if so, what is it's name.
Since Scala matches unapply causes left-to-right (nested and recursively), we can add a unapply clause
that will grab the name of the method (if it is a single one being matched which in most cases of the
QueryParser is exaclty what we're looking for) and then match it to a name that we expect it to have.
For example, if we're trying to match this:
{{
case '{ ($o: Option[t]).map(${Lambda1(id, idType, body)}) } =>
}}
We can do the following:
{{
case "map" -@> '{ ($o: Option[t]).map(${Lambda1(id, idType, body)}) } =>
}}
This will check that there's a Apply(TypeApply(Select(_, "map"), _), _)
being called
and then only proceecd into the quoted-matcher if that is the case.
Uninline the term no matter what (TODO should reove the unapply case) that pattern always matches and is too confusing
Uninline the term no matter what (TODO should reove the unapply case) that pattern always matches and is too confusing
Value members
Concrete methods
Check whether one numeric from
can be primitively assigned to a variable of another into
i.e. short can fit into a int, int can fit into a long. Same with float into a double.
This is used to determine what can be assigned into what (e.g. in a insert(_.age -> 4.toShort) statement)
and still be considered a valid transpilation.
Check whether one numeric from
can be primitively assigned to a variable of another into
i.e. short can fit into a int, int can fit into a long. Same with float into a double.
This is used to determine what can be assigned into what (e.g. in a insert(_.age -> 4.toShort) statement)
and still be considered a valid transpilation.