Allow Object members on unknown types
This commit is contained in:
1 parent
47654aee38
commit
1fab2702dd
7 files changed
+34
-35
No files matched your search
@@ -2027,10 +2027,14 @@ class BytecodeCompiler(
|
||||
|
||||
private fun compileFieldRef(ref: FieldRef): CompiledValue? {
|
||||
val receiverClass = resolveReceiverClass(ref.target)
|
||||
?: throw BytecodeCompileException(
|
||||
"Member access requires compile-time receiver type: ${ref.name}",
|
||||
Pos.builtIn
|
||||
)
|
||||
?: if (isAllowedObjectMember(ref.name)) {
|
||||
Obj.rootObjectType
|
||||
} else {
|
||||
throw BytecodeCompileException(
|
||||
"Member access requires compile-time receiver type: ${ref.name}",
|
||||
Pos.builtIn
|
||||
)
|
||||
}
|
||||
val fieldId = receiverClass.instanceFieldIdMap()[ref.name]
|
||||
val methodId = receiverClass.instanceMethodIdMap(includeAbstract = true)[ref.name]
|
||||
val receiver = compileRefWithFallback(ref.target, null, Pos.builtIn) ?: return null
|
||||
|
||||
@@ -291,7 +291,7 @@ override fun List<T>.toString() {
|
||||
var result = "["
|
||||
for (item in this) {
|
||||
if (!first) result += ","
|
||||
result += (item as Object).toString()
|
||||
result += item.toString()
|
||||
first = false
|
||||
}
|
||||
result + "]"
|
||||
@@ -311,7 +311,7 @@ fun List<T>.sort(): Void {
|
||||
fun Exception.printStackTrace(): Void {
|
||||
println(this)
|
||||
for( entry in stackTrace ) {
|
||||
println("\tat "+(entry as Object).toString())
|
||||
println("\tat "+entry.toString())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user