Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't recompute IR children #9915

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ default List<IR> preorder() {
List<IR> ordered = children().flatMap(c -> c.preorder());
IR element = this;
return $colon$colon$.MODULE$.apply(
element, ordered); // ordered.prepended(element) is reporeted as ambiguous
element, ordered); // ordered.prepended(element) is reported as ambiguous
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ object CallArgument {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] =
override lazy val children: List[IR] =
name.map(List(_, value)).getOrElse(List(value))

/** @inheritdoc */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ object DefinitionArgument {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] =
override lazy val children: List[IR] =
name :: ascribedType.toList ++ defaultValue.toList

/** @inheritdoc */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ sealed case class Empty(
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = "IR.Empty"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ object Expression {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = expressions :+ returnValue
override lazy val children: List[IR] = expressions :+ returnValue

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down Expand Up @@ -268,7 +268,7 @@ object Expression {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(name, expression)
override lazy val children: List[IR] = List(name, expression)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ object Function {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = arguments :+ body
override lazy val children: List[IR] = arguments :+ body

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down Expand Up @@ -336,7 +336,7 @@ object Function {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = (name :: arguments) :+ body
override lazy val children: List[IR] = (name :: arguments) :+ body

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ object Literal {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = if (this.base.isDefined) {
Expand Down Expand Up @@ -230,7 +230,7 @@ object Literal {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = s""""$text""""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ final case class Module(
}

/** @inheritdoc */
override def children: List[IR] = imports ++ exports ++ bindings
override lazy val children: List[IR] = imports ++ exports ++ bindings

/** String representation. */
override def toString: String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ object Name {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] =
override lazy val children: List[IR] =
typePointer.map(_ :: methodName :: Nil).getOrElse(methodName :: Nil)

/** @inheritdoc */
Expand Down Expand Up @@ -353,7 +353,7 @@ object Name {
|""".stripMargin

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = "_"
Expand Down Expand Up @@ -423,7 +423,7 @@ object Name {
|)
|""".stripMargin

override def children: List[IR] = List()
override def children: List[IR] = Nil

override def showCode(indent: Int): String = name
}
Expand Down Expand Up @@ -526,7 +526,7 @@ object Name {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = name
Expand Down Expand Up @@ -630,7 +630,7 @@ object Name {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = s"@$name"
Expand Down Expand Up @@ -719,7 +719,7 @@ object Name {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(expression)
override lazy val children: List[IR] = List(expression)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down Expand Up @@ -799,7 +799,7 @@ object Name {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved

/** @inheritdoc */
override def showCode(indent: Int): String = name
Expand Down Expand Up @@ -875,7 +875,7 @@ object Name {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object Pattern {
copy(location = location)

/** @inheritdoc */
override def children: List[IR] = List(name)
override lazy val children: List[IR] = List(name)

/** @inheritdoc */
override def showCode(indent: Int): String = name.showCode(indent)
Expand Down Expand Up @@ -264,7 +264,7 @@ object Pattern {
): Constructor = copy(location = location)

/** @inheritdoc */
override def children: List[IR] = constructor :: fields
override lazy val children: List[IR] = constructor :: fields

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down Expand Up @@ -359,7 +359,7 @@ object Pattern {
copy(location = location)

/** @inheritdoc */
override def children: List[IR] = List(literal)
override lazy val children: List[IR] = List(literal)

/** @inheritdoc */
override def showCode(indent: Int): String = literal.showCode(indent)
Expand Down Expand Up @@ -463,7 +463,7 @@ object Pattern {
copy(location = location)

/** @inheritdoc */
override def children: List[IR] = List(name, tpe)
override lazy val children: List[IR] = List(name, tpe)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ object Type {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = args :+ result
override lazy val children: List[IR] = args :+ result

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down Expand Up @@ -218,7 +218,7 @@ object Type {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(typed, signature)
override lazy val children: List[IR] = List(typed, signature)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down Expand Up @@ -323,7 +323,7 @@ object Type {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(typed, context)
override lazy val children: List[IR] = List(typed, context)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down Expand Up @@ -426,7 +426,7 @@ object Type {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(typed, error)
override lazy val children: List[IR] = List(typed, error)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object Application {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = function :: arguments
override lazy val children: List[IR] = function :: arguments

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down Expand Up @@ -216,7 +216,7 @@ object Application {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(target)
override lazy val children: List[IR] = List(target)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down Expand Up @@ -328,8 +328,8 @@ object Application {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] =
expression.map(List(_)).getOrElse(List())
override lazy val children: List[IR] =
expression.map(List(_)).getOrElse(Nil)

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ object Case {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = scrutinee :: branches.toList
override lazy val children: List[IR] = scrutinee :: branches.toList

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down Expand Up @@ -298,7 +298,7 @@ object Case {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(pattern, expression)
override lazy val children: List[IR] = List(pattern, expression)

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ object Comment {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ object Error {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(ir)
override lazy val children: List[IR] = List(ir)

/** @inheritdoc */
override def message(source: (IdentifiedLocation => String)): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object Foreign {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List()
override def children: List[IR] = Nil

/** @inheritdoc */
override def showCode(indent: Int): String = "FOREIGN DEF"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ object Operator {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(left, operator, right)
override lazy val children: List[IR] = List(left, operator, right)

/** @inheritdoc */
override def showCode(indent: Int): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ object Section {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(arg, operator)
override lazy val children: List[IR] = List(arg, operator)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down Expand Up @@ -216,7 +216,7 @@ object Section {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(operator)
override lazy val children: List[IR] = List(operator)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down Expand Up @@ -322,7 +322,7 @@ object Section {
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(operator, arg)
override lazy val children: List[IR] = List(operator, arg)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ sealed case class Conversion(
}

/** @inheritdoc */
override def children: List[IR] = List(storedIr)
override lazy val children: List[IR] = List(storedIr)

/** @inheritdoc */
override def showCode(indent: Int): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ sealed case class ImportExport(
|""".toSingleLine

/** @inheritdoc */
override def children: List[IR] = List(ir)
override lazy val children: List[IR] = List(ir)

/** @inheritdoc */
override def message(source: (IdentifiedLocation => String)): String =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ sealed case class Pattern(
override val location: Option[IdentifiedLocation] =
originalPattern.location

override def children: List[IR] = List(originalPattern)
override lazy val children: List[IR] = List(originalPattern)

override def showCode(indent: Int): String =
originalPattern.showCode(indent)
Expand Down
Loading
Loading