Skip to content

Commit

Permalink
Fix #365
Browse files Browse the repository at this point in the history
  • Loading branch information
alex999990009 committed Jun 21, 2024
1 parent 301a524 commit e0b7c1e
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/main/kotlin/org/arend/tracer/ArendTraceAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,24 @@ class ArendTraceAction : ArendPopupAction() {
is ArendDefData -> {
val body = def.dataBody ?: return null
val constructors = body.constructorList
val constructor = constructors.firstOrNull()
?: body.constructorClauseList.find { it.constructors.isNotEmpty() }?.constructors?.firstOrNull()
constructor?.parameters?.firstOrNull()?.typedExpr?.type
val constructor = constructors.find {
it.parameters.isNotEmpty()
} ?: body.constructorClauseList.find {
it.constructors.any { constructor -> constructor.parameters.isNotEmpty() }
}?.constructors?.find {
it.parameters.isNotEmpty()
}
constructor?.parameters?.firstOrNull()?.type
}
is ArendDefClass -> {
val classStat = def.classStatList.firstOrNull() ?: return null
classStat.classField?.returnExpr?.type
?: classStat.classImplement?.expr
?: classStat.coClause?.expr
?: classStat.overriddenField?.returnExpr?.type
val classStat = def.classStatList.firstOrNull()
classStat?.classField?.returnExpr?.type
?: classStat?.classImplement?.expr?.type
?: classStat?.coClause?.expr?.type
?: classStat?.overriddenField?.returnExpr?.type
?: def.classFieldList.firstOrNull()?.returnExpr?.type
?: def.classImplementList.firstOrNull()?.expr?.type
?: def.fieldTeleList.firstOrNull()?.type
}
else -> return null
} ?: return null
Expand Down

0 comments on commit e0b7c1e

Please sign in to comment.