Anonymous avatar Anonymous committed b991fb3

correct worse, split value and stack

Comments (0)

Files changed (1)

src/builtins/say.pir

     $P0 = new 'Hash'
     $P0['name']  = char
     $P1 = new 'ResizableIntegerArray'
-    push $P1, 0
-    $P0['value'] = $P1
+    $P0['value']= 0
+    $P0['list'] = $P1
     $P0['onstage'] = 0
     set_global char, $P0
 
 .sub 'better'
     .param int a
     .param int b
+    $I0 = a > b
     new $P0, 'Integer'
-    $I0 = a > b
     set $P0, $I0
     set_global 'the_condition', $P0
-    .return ($P0)
 .end
 
 .sub 'worse'
     .param int a
     .param int b
-    $P0 =  'better'(a,b)
-    $P0 = not $P0
+    $I0 =  a < b
+    new $P0, 'Integer'
+    set $P0, $I0
     set_global 'the_condition', $P0
-    .return ($P0)
 .end
 
 .sub 'equal'
     .param int b
     $I0 = a == b
     new $P0, 'Integer'
-    $P0 = $I0
+    set $P0, $I0
     set_global 'the_condition', $P0
-    .return ($P0)
 .end
     
 .sub 'push'
     .param int a
     $P0 = 'find_other'()
-    $P1 = $P0['value']
+    $P1 = $P0['list']
     push $P1, a
 .end
 
 .sub 'pop'
     $P0 = 'find_other'()
-    $P1 = $P0['value']
+    $P1 = $P0['list']
     $I1 = pop $P1
+    $P0['value']=$I1
 .end
 
 .sub 'open_heart'
 
 .sub 'valget'
     .param pmc char
-    $P1 = char['value']
-    $I0 = $P1
-    $I0 -= 1
-    $I2 = $P1[$I0]
+    $I2 = char['value']
     .return ($I2)
 .end
 
 .sub 'valset'
     .param pmc char
     .param int val
-    $P1 = char['value']
-    $I0 = $P1
-    $I0 -= 1
-    $P1[$I0] = val
+    char['value'] = val
 .end
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.