Beispiel #1
0
    def eval(self, ctx):
        value = ctx.stack.pop()
        name = ctx.stack.pop()
        left = ctx.stack.pop()

        typ = type(left)
        if typ in PRIMITIVES:
            if typ is NULL_TYPE:
                raise MakeError(
                    'TypeError',
                    "Cannot set property '%s' of null" % to_string(name))
            elif typ is UNDEFINED_TYPE:
                raise MakeError(
                    'TypeError',
                    "Cannot set property '%s' of undefined" % to_string(name))
            ctx.stack.append(BINARY_OPERATIONS[self.op](value,
                                                        get_member(
                                                            left, name,
                                                            ctx.space)))
            return
        else:
            ctx.stack.append(BINARY_OPERATIONS[self.op](value,
                                                        get_member(
                                                            left, name,
                                                            ctx.space)))
            left.put_member(name, ctx.stack[-1])
Beispiel #2
0
    def eval(self, ctx):
        prop = ctx.stack.pop()
        base = ctx.stack.pop()

        func = get_member(base, prop, ctx.space)

        return bytecode_call(ctx, func, base, ())
Beispiel #3
0
    def eval(self, ctx):
        prop = ctx.stack.pop()
        base = ctx.stack.pop()

        func = get_member(base, prop, ctx.space)

        return bytecode_call(ctx, func, base, ())
Beispiel #4
0
    def eval(self, ctx):
        value = ctx.stack.pop()
        name = ctx.stack.pop()
        left = ctx.stack.pop()

        typ = type(left)
        if typ in PRIMITIVES:
            if typ is NULL_TYPE:
                raise MakeError('TypeError', "Cannot set property '%s' of null" % to_string(name))
            elif typ is UNDEFINED_TYPE:
                raise MakeError('TypeError', "Cannot set property '%s' of undefined" % to_string(name))
            ctx.stack.append(BINARY_OPERATIONS[self.op](get_member(left, name, ctx.space), value))
            return
        else:
            ctx.stack.append(BINARY_OPERATIONS[self.op](get_member(left, name, ctx.space), value))
            left.put_member(name, ctx.stack[-1])
Beispiel #5
0
    def eval(self, ctx):
        name = ctx.stack.pop()
        left = ctx.stack.pop()

        target = to_number(get_member(left, name, ctx.space)) + self.cb
        if type(left) not in PRIMITIVES:
            left.put_member(name, target)

        ctx.stack.append(target + self.ca)
Beispiel #6
0
    def eval(self, ctx):
        name = ctx.stack.pop()
        left = ctx.stack.pop()

        target = to_number(get_member(left, name, ctx.space)) + self.cb
        if type(left) not in PRIMITIVES:
            left.put_member(name, target)

        ctx.stack.append(target + self.ca)
Beispiel #7
0
 def eval(self, ctx):
     prop = ctx.stack.pop()
     obj = ctx.stack.pop()
     ctx.stack.append(get_member(obj, prop, ctx.space))
Beispiel #8
0
 def eval(self, ctx):
     prop = ctx.stack.pop()
     obj = ctx.stack.pop()
     ctx.stack.append(get_member(obj, prop, ctx.space))