Beispiel #1
0
def call(methodname, receiver, arguments, builtins):
    method = primitives[methodname]
    args = []

    args.append(receiver.getvalue('').intvalue())

    for a in arguments:
        if a:
            args.append(a.intvalue())
        else:
            args.append(0)

    my_int = W_Integer(method(args))
    my_int.builtins = builtins
    return my_int
Beispiel #2
0
 def op_int_literal(self, arg):
     i = W_Integer(arg)
     i.builtins = self.interpreter.builtins
     self.stack.append(i)
Beispiel #3
0
def test_integer():
    w1 = W_Integer(5)
    assert w1.value == 5
    # W_Integer objects cannot have custom attributes,
    # so getvalue() returns None.
    assert w1.getvalue('abc') is None
Beispiel #4
0
 def eval_IntLiteral(self, ast, context):
     int = W_Integer(ast.value)
     int.builtins = self.builtins
     return int