Skip to content

Commit

Permalink
Changed MockStatement from abstract class to interface
Browse files Browse the repository at this point in the history
  • Loading branch information
davidepalladino-apuliasoft committed Mar 22, 2024
1 parent 27678a4 commit 35f3c4c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ private val modules = SerializersModule {
subclass(FieldDefinition::class)
subclass(DataDefinition::class)
}
polymorphic(MockStatement::class) {
subclass(ExfmtStmt::class)
subclass(ReadcStmt::class)
subclass(UnlockStmt::class)
subclass(FeodStmt::class)
}
polymorphic(Statement::class) {
subclass(AddStmt::class)
subclass(CabStmt::class)
Expand All @@ -66,6 +60,8 @@ private val modules = SerializersModule {
subclass(DOWxxStmt::class)
subclass(EvalStmt::class)
subclass(ExecuteSubroutine::class)
subclass(ExfmtStmt::class)
subclass(FeodStmt::class)
subclass(ForStmt::class)
subclass(GotoStmt::class)
subclass(IfStmt::class)
Expand All @@ -84,6 +80,7 @@ private val modules = SerializersModule {
subclass(OccurStmt::class)
subclass(OpenStmt::class)
subclass(PlistStmt::class)
subclass(ReadcStmt::class)
subclass(ReadEqualStmt::class)
subclass(ReadPreviousStmt::class)
subclass(ReadPreviousEqualStmt::class)
Expand All @@ -102,6 +99,7 @@ private val modules = SerializersModule {
subclass(SubstStmt::class)
subclass(TagStmt::class)
subclass(TimeStmt::class)
subclass(UnlockStmt::class)
subclass(UpdateStmt::class)
subclass(XFootStmt::class)
subclass(XlateStmt::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ abstract class Statement(
abstract fun execute(interpreter: InterpreterCore)
}

@Serializable
abstract class MockStatement (
@Transient override val position: Position? = null,
) : Statement(position) { }
interface MockStatement

interface CompositeStatement {
val body: List<Statement>
Expand Down Expand Up @@ -2060,27 +2057,27 @@ data class ResetStmt(
@Serializable
data class ExfmtStmt(
override val position: Position? = null
) : MockStatement(position) {
) : Statement(position), MockStatement {
override fun execute(interpreter: InterpreterCore) { }
}

@Serializable
data class ReadcStmt(
override val position: Position? = null
) : MockStatement(position) {
) : Statement(position), MockStatement {
override fun execute(interpreter: InterpreterCore) { }
}

@Serializable
data class UnlockStmt(
override val position: Position? = null
) : MockStatement(position) {
) : Statement(position), MockStatement {
override fun execute(interpreter: InterpreterCore) { }
}

@Serializable
data class FeodStmt(
override val position: Position? = null
) : MockStatement(position) {
) : Statement(position), MockStatement {
override fun execute(interpreter: InterpreterCore) { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -1983,25 +1983,25 @@ internal fun CsRESETContext.toAst(conf: ToAstConfiguration = ToAstConfiguration(
}

// TODO
internal fun CsEXFMTContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): MockStatement {
internal fun CsEXFMTContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): Statement {
val position = toPosition(conf.considerPosition)
return ExfmtStmt(position)
}

// TODO
internal fun CsREADCContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): MockStatement {
internal fun CsREADCContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): Statement {
val position = toPosition(conf.considerPosition)
return ReadcStmt(position)
}

// TODO
internal fun CsUNLOCKContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): MockStatement {
internal fun CsUNLOCKContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): Statement {
val position = toPosition(conf.considerPosition)
return UnlockStmt(position)
}

// TODO
internal fun CsFEODContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): MockStatement {
internal fun CsFEODContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): Statement {
val position = toPosition(conf.considerPosition)
return FeodStmt(position)
}
Expand Down

0 comments on commit 35f3c4c

Please sign in to comment.