         }
         output.append("""
                         }
-                        releaseResult[i]?.forEach { runtime.results[$0] = nil }
+                        releaseResult[i]?.forEach { stack[last].results[$0] = nil }
                     }
                     if !function.hasReturnStep { return nil }
                     let returnValue = value(function.returnStep, in: stack)

                output.append("            case .\(name):\n                ")
            }
            if functionType.returnType != nil {
                output.append("runtime.results[i] = symbols.\(name)(")
            } else {
                output.append("symbols.\(name)(")
            }

            output.append("        case \(name)Type\n")
        }
        if parser.subtypesMap.isEmpty {
            output.append("    }\n\n    private let supertypes: [DeclarationType: [DeclarationType]] = [:]\n\n")
        } else {
            output.append("    }\n\n    private let supertypes: [DeclarationType: [DeclarationType]] = [\n")
            for (subtype, types) in parser.subtypesMap {
