Advertisement
snake5

new lang more progress

Jan 15th, 2015
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.62 KB | None | 0 0
  1. /// CODE ///
  2. func __getindex( index : int32 ) : T
  3. {
  4. if( index < 0 || index >= m_size )
  5. {
  6. WARNING( "array index out of bounds" );
  7. return T();
  8. }
  9. return m_data[ index ];
  10. }
  11. /// OUTPUT ///
  12. FUNC (struct=6 op=30 opsub=0 tt=75)
  13. {
  14. name = 'data1.__getindex'
  15. orig_datatype = 'T'
  16. datatype = ''
  17. orig_typeinfo:
  18. IDENT (struct=12 op=1 opsub=0 tt=78)
  19. name = 'T'
  20. typeinfo: <null>
  21. params:
  22. ARG (struct=2 op=10 opsub=0 tt=78)
  23. {
  24. name = 'index'
  25. orig_datatype = 'int32'
  26. datatype = ''
  27. orig_typeinfo:
  28. IDENT (struct=12 op=1 opsub=0 tt=78)
  29. name = 'int32'
  30. typeinfo: <null>
  31. value: <null>
  32. }
  33. code:
  34. BLOCK (struct=4 op=21 opsub=0 tt=75)
  35. {
  36. locals: <null>
  37. code:
  38. {
  39. IF/ELSE (struct=9 op=22 opsub=0 tt=75)
  40. {
  41. test:
  42. || (struct=7 op=4 opsub=0 tt=226)
  43. {
  44. arg:
  45. {
  46. < (struct=7 op=4 opsub=0 tt=206)
  47. {
  48. arg:
  49. {
  50. IDENT (struct=12 op=1 opsub=0 tt=78)
  51. name = 'index'
  52. uint8(0) (struct=13 op=3 opsub=0 tt=86)
  53. }
  54. }
  55. >= (struct=7 op=4 opsub=0 tt=205)
  56. {
  57. arg:
  58. {
  59. IDENT (struct=12 op=1 opsub=0 tt=78)
  60. name = 'index'
  61. IDENT (struct=12 op=1 opsub=0 tt=78)
  62. name = 'm_size'
  63. }
  64. }
  65. }
  66. }
  67. ontrue:
  68. BLOCK (struct=4 op=21 opsub=0 tt=78)
  69. {
  70. locals: <null>
  71. code:
  72. {
  73. FCALL (struct=7 op=6 opsub=0 tt=40)
  74. {
  75. arg:
  76. {
  77. IDENT (struct=12 op=1 opsub=0 tt=78)
  78. name = 'WARNING'
  79. EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
  80. {
  81. arg:
  82. str(array index out of bounds) (struct=13 op=3 opsub=0 tt=83)
  83. }
  84. }
  85. }
  86. RETURN (struct=7 op=18 opsub=0 tt=78)
  87. {
  88. arg:
  89. FCALL (struct=7 op=6 opsub=0 tt=40)
  90. {
  91. arg:
  92. {
  93. IDENT (struct=12 op=1 opsub=0 tt=78)
  94. name = 'T'
  95. EXPR_LIST (struct=7 op=15 opsub=0 tt=40)
  96. {
  97. arg: <null>
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. onfalse: <null>
  105. }
  106. RETURN (struct=7 op=18 opsub=0 tt=78)
  107. {
  108. arg:
  109. INDEX (struct=7 op=7 opsub=0 tt=91)
  110. {
  111. arg:
  112. {
  113. IDENT (struct=12 op=1 opsub=0 tt=78)
  114. name = 'm_data'
  115. IDENT (struct=12 op=1 opsub=0 tt=78)
  116. name = 'index'
  117. }
  118. }
  119. }
  120. }
  121. }
  122. bytecode:
  123. DECLARG <int32> index [11]
  124. IF
  125. CONST <uint8> 0 [25] : 00
  126. LT <bool> 1 [28] <= index [11], 0 [25]
  127. GTEQ <> 2 [29] <= index [11], m_size [13]
  128. BLN_OR <bool> 3 [30] <= 1 [28], 2 [29]
  129. DO
  130. FCALL <> 4 [31] <= func:WARNING [14] args(0):
  131. FCALL <> 5 [32] <= func:T [12] args(0):
  132. RETURN 5 [32]
  133. ENDO
  134. RETURN [0]
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement