Skip to content

Commit

Permalink
missed a few spots
Browse files Browse the repository at this point in the history
  • Loading branch information
hubertp committed Aug 19, 2024
1 parent 365e2f0 commit e24591a
Show file tree
Hide file tree
Showing 9 changed files with 251 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ case object AliasAnalysis extends IRPass {
"The body of a method should always be a function."
)
}
case m @ definition.Method.Explicit(_, body, _, _, _) =>
body match {
case m: definition.Method.Explicit =>
m.body match {
case _: Function =>
m.copy(
body = analyseExpression(
body,
m.body,
topLevelGraph,
topLevelGraph.rootScope,
lambdaReuseScope = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,24 @@ object CallArgument {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Specified = {
val res = Specified(
name,
value,
location,
passData,
diagnostics
)
res.id = id
res
if (
name != this.name
|| value != this.value
|| location != this.location
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res = Specified(
name,
value,
location,
passData,
diagnostics
)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,28 @@ object DefinitionArgument {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Specified = {
val res = Specified(
name,
ascribedType,
defaultValue,
suspended,
location,
passData,
diagnostics
)
res.id = id
res
if (
name != this.name
|| ascribedType != this.ascribedType
|| defaultValue != this.defaultValue
|| suspended != this.suspended
|| location != this.location
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res = Specified(
name,
ascribedType,
defaultValue,
suspended,
location,
passData,
diagnostics
)
res.id = id
res
} else this
}

override def withName(ir: Name): DefinitionArgument = copy(name = ir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ sealed case class Empty(
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Empty = {
val res = Empty(location, passData, diagnostics)
res.id = id
res
if (
location != this.location
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res = Empty(location, passData, diagnostics)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,26 @@ object Expression {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Block = {
val res = Block(
expressions,
returnValue,
location,
suspended,
passData,
diagnostics
)
res.id = id
res
if (
expressions != this.expressions
|| returnValue != this.returnValue
|| suspended != this.suspended
|| location != this.location
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res = Block(
expressions,
returnValue,
location,
suspended,
passData,
diagnostics
)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down Expand Up @@ -210,9 +220,18 @@ object Expression {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Binding = {
val res = Binding(name, expression, location, passData, diagnostics)
res.id = id
res
if (
name != this.name
|| expression != this.expression
|| location != this.location
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res = Binding(name, expression, location, passData, diagnostics)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,27 @@ object Function {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Lambda = {
val res =
Lambda(
arguments,
Persistance.Reference.of(body, false),
location,
canBeTCO,
passData,
diagnostics
)
res.id = id
res
if (
arguments != this.arguments
|| body != this.body
|| location != this.location
|| canBeTCO != this.canBeTCO
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res =
Lambda(
arguments,
Persistance.Reference.of(body, false),
location,
canBeTCO,
passData,
diagnostics
)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down Expand Up @@ -255,19 +265,31 @@ object Function {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Binding = {
val res =
Binding(
name,
arguments,
body,
isPrivate,
location,
canBeTCO,
passData,
diagnostics
)
res.id = id
res
if (
name != this.name
|| arguments != this.arguments
|| body != this.body
|| isPrivate != this.isPrivate
|| location != this.location
|| canBeTCO != this.canBeTCO
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res =
Binding(
name,
arguments,
body,
isPrivate,
location,
canBeTCO,
passData,
diagnostics
)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,18 @@ object Literal {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Number = {
val res = Number(base, value, location, passData, diagnostics)
res.id = id
res
if (
base != this.base
|| value != this.value
|| location != this.location
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res = Number(base, value, location, passData, diagnostics)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down Expand Up @@ -187,9 +196,17 @@ object Literal {
diagnostics: DiagnosticStorage = diagnostics,
id: UUID @Identifier = id
): Text = {
val res = Text(text, location, passData, diagnostics)
res.id = id
res
if (
text != this.text
|| location != this.location
|| passData != this.passData
|| diagnostics != this.diagnostics
|| id != this.id
) {
val res = Text(text, location, passData, diagnostics)
res.id = id
res
} else this
}

/** @inheritdoc */
Expand Down
Loading

0 comments on commit e24591a

Please sign in to comment.