Ejemplo n.º 1
0
 def generate_Apply(self, out, ruleName, codeName, rawArgs, debugname=None):
     for arg in rawArgs.args:
         self._generateNode(out, arg, debugname)
         out.emit(t.Push())
     if ruleName.data == "super":
         out.emit(t.SuperCall(codeName))
     else:
         out.emit(t.Call(ruleName))
Ejemplo n.º 2
0
 def test_apply(self):
     one = t.Action("1")
     x = t.Action("x")
     a = t.Apply("foo", "main", [one, x])
     self.assertEqual(writeBytecode(a),
                      [t.Python('1'),
                       t.Push(),
                       t.Python('x'),
                       t.Push(),
                       t.Call('foo')])
 def test_bind_apply(self):
     x = t.Apply("members", "object", [])
     b = t.Bind("m", x)
     self.assertEqual(writeBytecode(b), [t.Call('members'), t.Bind('m')])