2021-10-29 14:20:53 +00:00
|
|
|
package prog8tests.helpers
|
2021-07-30 15:39:43 +00:00
|
|
|
|
|
|
|
import prog8.ast.IBuiltinFunctions
|
2021-10-29 14:20:53 +00:00
|
|
|
import prog8.ast.base.DataType
|
2021-07-30 15:39:43 +00:00
|
|
|
import prog8.ast.base.Position
|
|
|
|
import prog8.ast.expressions.Expression
|
|
|
|
import prog8.ast.expressions.InferredTypes
|
|
|
|
import prog8.ast.expressions.NumericLiteralValue
|
2021-10-29 21:25:18 +00:00
|
|
|
import prog8.compilerinterface.IMemSizer
|
2021-10-29 22:05:55 +00:00
|
|
|
import prog8.compilerinterface.IStringEncoding
|
2021-07-30 15:39:43 +00:00
|
|
|
|
2021-10-29 14:20:53 +00:00
|
|
|
internal val DummyFunctions = object : IBuiltinFunctions {
|
2021-07-30 15:39:43 +00:00
|
|
|
override val names: Set<String> = emptySet()
|
|
|
|
override val purefunctionNames: Set<String> = emptySet()
|
|
|
|
override fun constValue(
|
|
|
|
name: String,
|
|
|
|
args: List<Expression>,
|
|
|
|
position: Position,
|
|
|
|
): NumericLiteralValue? = null
|
|
|
|
|
|
|
|
override fun returnType(name: String, args: MutableList<Expression>) = InferredTypes.InferredType.unknown()
|
2021-10-29 00:42:10 +00:00
|
|
|
}
|
2021-10-29 14:20:53 +00:00
|
|
|
|
|
|
|
internal val DummyMemsizer = object : IMemSizer {
|
2021-11-20 23:48:23 +00:00
|
|
|
override fun memorySize(dt: DataType) = 0
|
2021-10-29 14:20:53 +00:00
|
|
|
}
|
2021-10-29 22:05:55 +00:00
|
|
|
|
|
|
|
internal val DummyStringEncoder = object : IStringEncoding {
|
2021-11-20 23:07:17 +00:00
|
|
|
override fun encodeString(str: String, altEncoding: Boolean): List<UByte> {
|
2021-10-29 22:05:55 +00:00
|
|
|
return emptyList()
|
|
|
|
}
|
|
|
|
|
2021-11-20 23:07:17 +00:00
|
|
|
override fun decodeString(bytes: List<UByte>, altEncoding: Boolean): String {
|
2021-10-29 22:05:55 +00:00
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|