Skip to content

Commit 1c2ec05

Browse files
committed
reduce postfixops in scalap
1 parent 9144329 commit 1c2ec05

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

src/scalap/scala/tools/scalap/scalax/rules/Rules.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ package scala.tools.scalap
1414
package scalax
1515
package rules
1616

17-
import language.postfixOps
18-
1917
trait Name {
2018
def name: String
2119
override def toString = name
@@ -129,7 +127,7 @@ trait StateRules {
129127
/** Create a rule that succeeds with a list of all the provided rules that succeed.
130128
@param rules the rules to apply in sequence.
131129
*/
132-
def anyOf[A, X](rules: Seq[Rule[A, X]]) = allOf(rules.map(_ ?)) ^^ { opts => opts.flatMap(x => x) }
130+
def anyOf[A, X](rules: Seq[Rule[A, X]]) = allOf(rules.map(_.?)) ^^ { opts => opts.flatMap(x => x) }
133131

134132
/** Repeatedly apply a rule from initial value until finished condition is met. */
135133
def repeatUntil[T, X](rule: Rule[T => T, X])(finished: T => Boolean)(initial: T) = apply {

src/scalap/scala/tools/scalap/scalax/rules/SeqRule.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class SeqRule[S, +A, +X](rule: Rule[S, S, A, X]) {
5252

5353
/** Creates a rule that always succeeds with a Boolean value.
5454
* Value is 'true' if this rule succeeds, 'false' otherwise */
55-
def -? = ? map { _ isDefined }
55+
def -? = ? map (_.isDefined)
5656

5757
def * = from[S] {
5858
// tail-recursive function with reverse list accumulator

src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ trait ByteCodeReader extends RulesWithState {
9696
type S = ByteCode
9797
type Parser[A] = Rule[A, String]
9898

99-
val byte = apply(_ nextByte)
99+
val byte = apply(_.nextByte)
100100

101101
val u1 = byte ^^ (_ & 0xFF)
102-
val u2 = bytes(2) ^^ (_ toInt)
103-
val u4 = bytes(4) ^^ (_ toInt) // should map to Long??
102+
val u2 = bytes(2) ^^ (_.toInt)
103+
val u4 = bytes(4) ^^ (_.toInt) // should map to Long??
104104

105105
def bytes(n: Int) = apply(_ next n)
106106
}
@@ -111,7 +111,7 @@ object ClassFileParser extends ByteCodeReader {
111111

112112
val magicNumber = (u4 filter (_ == 0xCAFEBABE)) | error("Not a valid class file")
113113
val version = u2 ~ u2 ^^ { case minor ~ major => (major, minor) }
114-
val constantPool = (u2 ^^ ConstantPool) >> repeatUntil(constantPoolEntry)(_ isFull)
114+
val constantPool = (u2 ^^ ConstantPool) >> repeatUntil(constantPoolEntry)(_.isFull)
115115

116116
// NOTE currently most constants just evaluate to a string description
117117
// TODO evaluate to useful values

src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSig.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ package scalax
1515
package rules
1616
package scalasig
1717

18-
import scala.language.postfixOps
1918
import scala.language.implicitConversions
19+
import scala.language.postfixOps
2020

2121
import ClassFileParser._
2222
import scala.reflect.internal.pickling.ByteCodecs
@@ -92,7 +92,7 @@ object ScalaSigAttributeParsers extends ByteCodeReader {
9292
val scalaSig = nat ~ nat ~ symtab ^~~^ ScalaSig
9393

9494
val utf8 = read(x => x.fromUTF8StringAndBytes.string)
95-
val longValue = read(_ toLong)
95+
val longValue = read(_.toLong)
9696
}
9797

9898
case class ScalaSig(majorVersion: Int, minorVersion: Int, table: Seq[Int ~ ByteCode]) extends DefaultMemoisable {

0 commit comments

Comments
 (0)