Files
ivy/doc/sample/Person.iasm

209 lines
3.2 KiB
Plaintext

@constpool
#0: "Received "
#1: ", "
#2: @ident[cout]
#3: @selector[-put:]
#4: @atom[years]
#5: @atom[months]
#6: @atom[days]
#7: @ident[_.Person_exampleProperty_get]
#8: @ident[_.Person_exampleProperty_set]
#9: @ident[_.Person_exampleProperty3_get]
#10: @ident[_.Person_exampleProperty3_set]
#11: @ident[_.Person_exampleProperty4_get]
#12: #42
#13: @ident[#13]
#14: @selector[-init(name:age:)]
#15: @selector[-test(param:_:)]
#16: @selector[-name]
#17: @selector[-age]
#18: @selector[-ageInMonths]
#19: @selector[-setName:]
#20: @selector[-setAge:]
#21: @selector[-setAge:inUnits:]
#22: @selector[-getAgeInUnits:]
#23: @ident[std.io]
#24: @ident[exampleProperty]
#25: @ident[exampleProperty2]
#26: @ident[exampleProperty3]
#27: @ident[exampleProperty4]
@end
@import [package:#23]
@lambda [ident:#7]
ldr x0, [self, #2]
ret
@end
@lambda [ident:#8]
ldr x0, [bp, #-1]
str x0, [self, #2]
ret
@end
@lambda [ident:#9]
ldr x0, [self, #3]
ret
@end
@lambda [ident:#10]
ldr x0, [bp, #-1]
str x0, [self, #3]
ret
@end
@lambda [ident:#11]
ldr x0, [self, #4]
ret
@end
@class [ident:#13]
@property[ident:#24 get:#7 set:#8]
@property[ident:#25 get:#12]
@property[ident:#26 set:#10]
@property[ident:#27 get:#11]
#0: name
#1: age
#2: val
#3: __exampleProperty3
#4: __exampleProperty4
@end
@msgh [recipient:#13 selector:#14]
ldr x0, [bp, #-1]
str x0, [self, #0]
ldr x0, [bp, #-2]
str x0, [self, #1]
ret.n
@end
@msgh [recipient:#13 selector:#15]
ldr x0, [pool, #0]
ldr x1, [bp, #-1]
add x0, x1, x0
ldr x1, [pool, #1]
add x0, x1, x0
ldr x1, [bp, #-2]
add x0, x1, x0
push x0
ldr x1, [pool, #2]
ldr x2, [pool, #3]
msg x1, x2, #1
ret.n
@end
@msgh [recipient:#13 selector:#16]
ldr x0, [self, #0]
ret
@end
@msgh [recipient:#13 selector:#17]
ldr x0, [self, #1]
ret
@end
@msgh [recipient:#13 selector:#18]
ldr x0, [self, #1]
ldr x1, #12
mul x0, x1, x0
ret
@end
@msgh [recipient:#13 selector:#19]
ldr x0, [bp, #-1]
str x0, [self, #0]
ret.n
@end
@msgh [recipient:#13 selector:#20]
ldr x0, [bp, #-1]
str x0, [self, #1]
ret.n
@end
@msgh [recipient:#13 selector:#21]
ldr x0, [bp, #-1]
ldr x1, [bp, #-2]
ldr x2, [pool, #4]
cmp x1, x2
b.eq L0001
ldr x2, [pool, #5]
cmp x1, x2
b.eq L0002
ldr x2, [pool, #6]
cmp x1, x2
b.eq L0003
ldr x0, #0
str x0, [self, #1]
br L0004
L0001: str x0, [self, #2]
br L0004
L0002: ldr x3, #12
div x3, x0, x3
str x3, [self, #2]
br L0004
L0003: ldr x3, #365
div x3, x0, x3
str x3, [self, #2]
br L0004
L0004:
ret.n
@end
@msgh [recipient:#13 selector:#22]
ldr x1, [bp, #-1] ; x1 = units
ldr x2, [pool, #4] ; x2 = #years
cmp x1, x2
b.eq L0001 ; [jump] if units == #years
ldr x2, [pool, #5] ; x2 = #months
cmp x1, x2
b.eq L0002 ; [jump] if units == #years
ldr x2, [pool, #6] ; x2 = #days
cmp x1, x2
b.eq L0003 ; [jump] if units == #days
ldr x0, #0 ; else
ret ; return 0
L0001: ldr x0, [self, #1] ; [code] if units == #years
ret ; return self.age
L0002: ldr x0, [self, #1] ; [code] if units == #months
ldr x1, #12
div x0, x1, x0
ret ; return self.age / 12
L0003: ldr x0, [self, #1] ; [code] if units == #months
ldr x1, #365
div x0, x1, x0
ret ; return self.age / 365
@end