translator: loglevel fix
This commit is contained in:
@@ -26,7 +26,7 @@ class ClassCodegen(state: TranslationState,
|
||||
override val type: LLVMReferenceType
|
||||
|
||||
init {
|
||||
type = LLVMReferenceType(structName, "class", align = state.pointerAllign, size = state.pointerSize, byRef = true)
|
||||
type = LLVMReferenceType(structName, "class", align = state.pointerAlign, size = state.pointerSize, byRef = true)
|
||||
if (parentCodegen != null) {
|
||||
type.location.addAll(parentCodegen.type.location)
|
||||
type.location.add(parentCodegen.structName)
|
||||
@@ -43,7 +43,7 @@ class ClassCodegen(state: TranslationState,
|
||||
|
||||
calculateTypeSize()
|
||||
type.size = size
|
||||
type.align = state.pointerAllign
|
||||
type.align = state.pointerAlign
|
||||
}
|
||||
|
||||
private fun indexFields(parameters: MutableList<KtParameter>) {
|
||||
|
||||
@@ -20,7 +20,7 @@ class ObjectCodegen(state: TranslationState,
|
||||
override val type: LLVMReferenceType
|
||||
|
||||
init {
|
||||
type = LLVMReferenceType(structName, "class", align = state.pointerAllign, size = state.pointerSize, byRef = true)
|
||||
type = LLVMReferenceType(structName, "class", align = state.pointerAlign, size = state.pointerSize, byRef = true)
|
||||
if (parentCodegen != null) {
|
||||
type.location.addAll(parentCodegen.type.location)
|
||||
type.location.add(parentCodegen.structName)
|
||||
@@ -29,7 +29,7 @@ class ObjectCodegen(state: TranslationState,
|
||||
|
||||
calculateTypeSize()
|
||||
type.size = size
|
||||
type.align = state.pointerAllign
|
||||
type.align = state.pointerAlign
|
||||
}
|
||||
|
||||
override fun prepareForGenerate() {
|
||||
|
||||
@@ -34,7 +34,7 @@ class TranslationState(val environment: KotlinCoreEnvironment, val bindingContex
|
||||
var objects = HashMap<String, ObjectCodegen>()
|
||||
var properties = HashMap<String, PropertyCodegen>()
|
||||
val codeBuilder = LLVMBuilder(arm)
|
||||
val pointerAllign = if (arm) 4 else 8
|
||||
val pointerAlign = if (arm) 4 else 8
|
||||
val pointerSize = if (arm) 4 else 8
|
||||
val extensionFunctions = HashMap<String, HashMap<String, FunctionCodegen>>()
|
||||
}
|
||||
@@ -48,8 +48,12 @@ fun parseAndAnalyze(sources: List<String>, disposer: Disposable, arm: Boolean =
|
||||
override fun hasErrors(): Boolean = hasError
|
||||
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation) {
|
||||
System.err.println("[${severity.toString()}]${location.path} ${location.line}:${location.column} $message")
|
||||
hasError = severity.isError || hasError
|
||||
if (!severity.isError) {
|
||||
return
|
||||
}
|
||||
|
||||
System.err.println("[${severity.toString()}]${location.path} ${location.line}:${location.column} $message")
|
||||
hasError = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ fun LLVMInstanceOfStandardType(name: String, type: KotlinType, scope: LLVMScope
|
||||
type.isUnit() -> LLVMVariable("", LLVMVoidType(), name, scope)
|
||||
type.isMarkedNullable -> LLVMVariable(name, LLVMReferenceType(type.toString().dropLast(1), prefix = "class"), name, scope, pointer = 1)
|
||||
else -> {
|
||||
val refType = state.classes[type.toString()]?.type ?: LLVMReferenceType(type.toString(), align = state.pointerAllign, prefix = "class")
|
||||
val refType = state.classes[type.toString()]?.type ?: LLVMReferenceType(type.toString(), align = state.pointerAlign, prefix = "class")
|
||||
|
||||
val result = LLVMVariable(name, refType, name, scope, pointer = 1)
|
||||
refType.location.addAll(type.getSubtypesPredicate().toString().split(".").dropLast(1))
|
||||
|
||||
@@ -1,28 +1,4 @@
|
||||
|
||||
enum class WireType(val id: Int) {
|
||||
VARINT(0), // int32, int64, uint32, uint64, sint32, sint64, bool, enum
|
||||
FIX_64(1), // fixed64, sfixed64, double
|
||||
LENGTH_DELIMITED(2), // string, bytes, embedded messages, packed repeated fields
|
||||
START_GROUP(3), // groups (deprecated)
|
||||
END_GROUP(4), // groups (deprecated)
|
||||
FIX_32(5), // fixed32, sfixed32, float
|
||||
UNDEFINED(6); // indicates error when parsing from Int
|
||||
|
||||
companion object {
|
||||
fun from (value: Byte): WireType {
|
||||
return when (value) {
|
||||
0.toByte() -> VARINT
|
||||
1.toByte() -> FIX_64
|
||||
2.toByte() -> LENGTH_DELIMITED
|
||||
3.toByte() -> START_GROUP
|
||||
4.toByte() -> END_GROUP
|
||||
5.toByte() -> FIX_32
|
||||
else -> UNDEFINED
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun enum_field_test1(i: Byte): Int {
|
||||
return WireType.from(i).id
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user