well redesigned class vals and vars, classScope introduced for class functions
This commit is contained in:
parent
63b2808109
commit
2c2dae4d85
@ -1655,7 +1655,6 @@ class Compiler(
|
||||
// return
|
||||
currentInitScope += statement {
|
||||
val initValue = initialExpression?.execute(this)?.byValueCopy() ?: ObjNull
|
||||
// todo: get rid of classfield!
|
||||
(thisObj as ObjClass).createClassField(name, initValue, isMutable, visibility, pos)
|
||||
addItem(name, isMutable, initValue, visibility, ObjRecord.Type.Field)
|
||||
ObjVoid
|
||||
|
@ -44,6 +44,7 @@ class CompilerContext(val tokens: List<Token>) {
|
||||
if (type != it.type) throw ScriptError(it.pos, message)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun syntaxError(at: Pos, message: String = "Syntax error"): Nothing {
|
||||
throw ScriptError(at, message)
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class ObjInstance(override val objClass: ObjClass) : Obj() {
|
||||
scope.raiseIllegalArgument("serialized vars has bigger size than instance vars")
|
||||
println("deser state vars $vars")
|
||||
for ((i, v) in vars.withIndex()) {
|
||||
localVars[i].value = vars[i]
|
||||
localVars[i].value = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user