@@ -6,39 +6,157 @@ use std::io::prelude::*;
66use std:: io:: { Read , Seek , Write } ;
77use std:: os:: fd:: AsFd ;
88use std:: rc:: { Rc , Weak } ;
9- pub fn get_0 ( t : Local ) -> i32 {
10- let t: Value < Local > = Rc :: new ( RefCell :: new ( t) ) ;
9+ pub fn get_0 ( t : Local_1 ) -> i32 {
10+ let t: Value < Local_1 > = Rc :: new ( RefCell :: new ( t) ) ;
11+ return ( ( * ( * t. borrow ( ) ) . x . borrow ( ) ) as i32 ) ;
12+ }
13+ pub fn get_2 ( t : Local_3 ) -> i32 {
14+ let t: Value < Local_3 > = Rc :: new ( RefCell :: new ( t) ) ;
15+ return ( * ( * t. borrow ( ) ) . x . borrow ( ) ) ;
16+ }
17+ pub fn get_4 ( t : Local_5 ) -> i32 {
18+ let t: Value < Local_5 > = Rc :: new ( RefCell :: new ( t) ) ;
1119 return ( * ( * t. borrow ( ) ) . x . borrow ( ) ) ;
1220}
13- pub fn twice_1 ( t : Local ) -> i32 {
14- let t: Value < Local > = Rc :: new ( RefCell :: new ( t) ) ;
21+ pub fn get_6 ( t : Local_7 ) -> i32 {
22+ let t: Value < Local_7 > = Rc :: new ( RefCell :: new ( t) ) ;
23+ return ( ( * ( * t. borrow ( ) ) . x . borrow ( ) ) as i32 ) ;
24+ }
25+ pub fn twice_8 ( t : Local_3 ) -> i32 {
26+ let t: Value < Local_3 > = Rc :: new ( RefCell :: new ( t) ) ;
1527 return ( ( * ( * t. borrow ( ) ) . x . borrow ( ) ) * 2 ) ;
1628}
29+ pub fn wrap_9 ( v : i32 ) -> i32 {
30+ let v: Value < i32 > = Rc :: new ( RefCell :: new ( v) ) ;
31+ let l: Value < Local_5 > = Rc :: new ( RefCell :: new ( Local_5 {
32+ x : Rc :: new ( RefCell :: new ( ( * v. borrow ( ) ) ) ) ,
33+ } ) ) ;
34+ return ( { get_4 ( ( * l. borrow ( ) ) . clone ( ) ) } ) ;
35+ }
36+ pub fn wrap_10 ( v : i64 ) -> i32 {
37+ let v: Value < i64 > = Rc :: new ( RefCell :: new ( v) ) ;
38+ let l: Value < Local_7 > = Rc :: new ( RefCell :: new ( Local_7 {
39+ x : Rc :: new ( RefCell :: new ( ( * v. borrow ( ) ) ) ) ,
40+ } ) ) ;
41+ return ( { get_6 ( ( * l. borrow ( ) ) . clone ( ) ) } ) ;
42+ }
43+ #[ derive( Default ) ]
44+ pub struct Local_5 {
45+ pub x : Value < i32 > ,
46+ }
47+ impl Clone for Local_5 {
48+ fn clone ( & self ) -> Self {
49+ let __this: Value < Local_5 > = Rc :: new ( RefCell :: new ( Self {
50+ x : Rc :: new ( RefCell :: new ( ( * self . x . borrow ( ) ) ) ) ,
51+ } ) ) ;
52+ let this: Ptr < Local_5 > = __this. as_pointer ( ) ;
53+ Rc :: try_unwrap ( __this) . ok ( ) . unwrap ( ) . into_inner ( )
54+ }
55+ }
56+ impl ByteRepr for Local_5 {
57+ fn byte_size ( ) -> usize {
58+ 4
59+ }
60+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
61+ ( * self . x . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..4 ] ) ;
62+ }
63+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
64+ Self {
65+ x : Rc :: new ( RefCell :: new ( <i32 >:: from_bytes ( & buf[ 0 ..4 ] ) ) ) ,
66+ }
67+ }
68+ }
69+ #[ derive( Default ) ]
70+ pub struct Local_7 {
71+ pub x : Value < i64 > ,
72+ }
73+ impl Clone for Local_7 {
74+ fn clone ( & self ) -> Self {
75+ let __this: Value < Local_7 > = Rc :: new ( RefCell :: new ( Self {
76+ x : Rc :: new ( RefCell :: new ( ( * self . x . borrow ( ) ) ) ) ,
77+ } ) ) ;
78+ let this: Ptr < Local_7 > = __this. as_pointer ( ) ;
79+ Rc :: try_unwrap ( __this) . ok ( ) . unwrap ( ) . into_inner ( )
80+ }
81+ }
82+ impl ByteRepr for Local_7 {
83+ fn byte_size ( ) -> usize {
84+ 8
85+ }
86+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
87+ ( * self . x . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..8 ] ) ;
88+ }
89+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
90+ Self {
91+ x : Rc :: new ( RefCell :: new ( <i64 >:: from_bytes ( & buf[ 0 ..8 ] ) ) ) ,
92+ }
93+ }
94+ }
95+ pub fn other_11 ( ) -> i32 {
96+ let l: Value < Local_1 > = Rc :: new ( RefCell :: new ( Local_1 {
97+ x : Rc :: new ( RefCell :: new ( 3_i64 ) ) ,
98+ y : Rc :: new ( RefCell :: new ( 4_i64 ) ) ,
99+ } ) ) ;
100+ return ( ( { get_0 ( ( * l. borrow ( ) ) . clone ( ) ) } ) + ( ( * ( * l. borrow ( ) ) . y . borrow ( ) ) as i32 ) ) ;
101+ }
102+ #[ derive( Default ) ]
103+ pub struct Local_1 {
104+ pub x : Value < i64 > ,
105+ pub y : Value < i64 > ,
106+ }
107+ impl Clone for Local_1 {
108+ fn clone ( & self ) -> Self {
109+ let __this: Value < Local_1 > = Rc :: new ( RefCell :: new ( Self {
110+ x : Rc :: new ( RefCell :: new ( ( * self . x . borrow ( ) ) ) ) ,
111+ y : Rc :: new ( RefCell :: new ( ( * self . y . borrow ( ) ) ) ) ,
112+ } ) ) ;
113+ let this: Ptr < Local_1 > = __this. as_pointer ( ) ;
114+ Rc :: try_unwrap ( __this) . ok ( ) . unwrap ( ) . into_inner ( )
115+ }
116+ }
117+ impl ByteRepr for Local_1 {
118+ fn byte_size ( ) -> usize {
119+ 16
120+ }
121+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
122+ ( * self . x . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..8 ] ) ;
123+ ( * self . y . borrow ( ) ) . to_bytes ( & mut buf[ 8 ..16 ] ) ;
124+ }
125+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
126+ Self {
127+ x : Rc :: new ( RefCell :: new ( <i64 >:: from_bytes ( & buf[ 0 ..8 ] ) ) ) ,
128+ y : Rc :: new ( RefCell :: new ( <i64 >:: from_bytes ( & buf[ 8 ..16 ] ) ) ) ,
129+ }
130+ }
131+ }
17132pub fn main ( ) {
18133 std:: process:: exit ( main_0 ( ) ) ;
19134}
20135fn main_0 ( ) -> i32 {
21- let l: Value < Local > = Rc :: new ( RefCell :: new ( Local {
136+ let l: Value < Local_3 > = Rc :: new ( RefCell :: new ( Local_3 {
22137 x : Rc :: new ( RefCell :: new ( 7 ) ) ,
23138 } ) ) ;
24- assert ! ( ( ( { get_0( ( * l. borrow( ) ) . clone( ) , ) } ) == 7 ) ) ;
25- assert ! ( ( ( { twice_1( ( * l. borrow( ) ) . clone( ) , ) } ) == 14 ) ) ;
139+ assert ! ( ( ( { get_2( ( * l. borrow( ) ) . clone( ) , ) } ) == 7 ) ) ;
140+ assert ! ( ( ( { twice_8( ( * l. borrow( ) ) . clone( ) , ) } ) == 14 ) ) ;
141+ assert ! ( ( ( { other_11( ) } ) == 7 ) ) ;
142+ assert ! ( ( ( { wrap_9( 5 , ) } ) == 5 ) ) ;
143+ assert ! ( ( ( { wrap_10( 6_i64 , ) } ) == 6 ) ) ;
26144 return 0 ;
27145}
28146#[ derive( Default ) ]
29- pub struct Local {
147+ pub struct Local_3 {
30148 pub x : Value < i32 > ,
31149}
32- impl Clone for Local {
150+ impl Clone for Local_3 {
33151 fn clone ( & self ) -> Self {
34- let __this: Value < Local > = Rc :: new ( RefCell :: new ( Self {
152+ let __this: Value < Local_3 > = Rc :: new ( RefCell :: new ( Self {
35153 x : Rc :: new ( RefCell :: new ( ( * self . x . borrow ( ) ) ) ) ,
36154 } ) ) ;
37- let this: Ptr < Local > = __this. as_pointer ( ) ;
155+ let this: Ptr < Local_3 > = __this. as_pointer ( ) ;
38156 Rc :: try_unwrap ( __this) . ok ( ) . unwrap ( ) . into_inner ( )
39157 }
40158}
41- impl ByteRepr for Local {
159+ impl ByteRepr for Local_3 {
42160 fn byte_size ( ) -> usize {
43161 4
44162 }
0 commit comments