mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 21:21:33 +00:00
language: introduce the requirement to use return to return a value from a function
This commit is contained in:
@ -30,6 +30,7 @@ class StubOpEmitter(val compiler: Compiler, val symbol: CompilableSymbol) : Func
|
||||
|
||||
fun exit() {
|
||||
code.localState.popScope()
|
||||
code.emit(Opcode.None)
|
||||
code.emit(Opcode.Return)
|
||||
}
|
||||
|
||||
@ -211,6 +212,11 @@ class StubOpEmitter(val compiler: Compiler, val symbol: CompilableSymbol) : Func
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitReturn(node: Return) {
|
||||
node.value.visit(this)
|
||||
code.emit(Opcode.Return)
|
||||
}
|
||||
|
||||
override fun visitSetAssignment(node: SetAssignment) {
|
||||
val stubVarOrCall = code.localState.resolve(node.symbol)
|
||||
if (stubVarOrCall.stubVar == null) {
|
||||
|
Reference in New Issue
Block a user