Added copy_constructing when returning
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import to_import: simple_print, simple_println, a, b, string_id
|
||||
|
||||
fun something(param: int): Something {
|
||||
var to_ret.construct_with_param(param): Something
|
||||
return to_ret
|
||||
}
|
||||
obj Something (ObjectTrait) {
|
||||
var member: int
|
||||
fun construct(): *Something {
|
||||
@@ -35,6 +39,15 @@ fun some_other_function(in: bool): float {
|
||||
}
|
||||
*/
|
||||
fun main(): int {
|
||||
var test_methods = something(77)
|
||||
var test_methods_param.construct_with_param(10090): Something
|
||||
simple_println("Constructing an object and printint its member, copy-constructing it, and printing that out, then letting both be destructed")
|
||||
simple_println(test_methods.member)
|
||||
simple_println(test_methods_param.member)
|
||||
var second_obj = test_methods
|
||||
second_obj.member += 5
|
||||
simple_println(second_obj.member)
|
||||
return 0
|
||||
/*
|
||||
var a_declaration:int
|
||||
simple_print(1 + 2)
|
||||
@@ -99,16 +112,5 @@ fun main(): int {
|
||||
return 0
|
||||
}
|
||||
*/
|
||||
var test_methods.construct(): Something
|
||||
var test_methods_param.construct_with_param(10090): Something
|
||||
/*var test_methods: Something*/
|
||||
test_methods.member = 10
|
||||
simple_println("Constructing an object and printint its member, copy-constructing it, and printing that out, then letting both be destructed")
|
||||
simple_println(test_methods.member)
|
||||
simple_println(test_methods_param.member)
|
||||
var second_obj = test_methods
|
||||
second_obj.member += 5
|
||||
simple_println(second_obj.member)
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user