public
Description: a ruby-to-pyc compiler
Clone URL: git://github.com/why/unholy.git
Search Repo:
 * lib/unholy/pyasm.rb: jump opcode and empty arrays.
why (author)
Thu May 15 08:11:54 -0700 2008
commit  ea44e7aaf62d17574d85407d85af286c9879c366
tree    56d106053b97094ba516f5f5e42ecea507d17502
parent  12d52c4ce7154d3cd8300be129d15ed7e57e8b1e
...
81
82
83
84
 
85
86
87
...
96
97
98
 
 
 
99
100
101
...
81
82
83
 
84
85
86
87
...
96
97
98
99
100
101
102
103
104
0
@@ -81,7 +81,7 @@ class Pyasm
0
     bc(0x66, n, 0x0)
0
   end
0
   def build_list(n)
0
- @stack.slice! -(n-1), (n-1)
0
+ @stack.slice! -(n-1), (n-1) if n > 0
0
     bc(0x67, n, 0x0)
0
   end
0
   def load_attr(name)
0
@@ -96,6 +96,9 @@ class Pyasm
0
   def import_from(name)
0
     bc 0x6c, add_sym(name), 0x0
0
   end
0
+ def jump(n)
0
+ mark_jump n, bc(0x6e, n, 0x0)
0
+ end
0
   def jump_if_false(n)
0
     mark_jump n, bc(0x6f, n, 0x0)
0
   end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
0
@@ -0,0 +1,27 @@
0
+# 123
0
+# 123
0
+# 456
0
+# 123
0
+a = []
0
+if true
0
+ a << 123
0
+end
0
+puts a[0]
0
+
0
+a = []
0
+if true
0
+ a << 123
0
+else
0
+ a << 456
0
+end
0
+puts a[0]
0
+
0
+a = []
0
+if false
0
+ a << 123
0
+else
0
+ a << 456
0
+end
0
+puts a[0]
0
+
0
+puts 123 if true

Comments

    No one has commented yet.