Beispiel #1
0
def _build_global_variable(state, addr, slot):
    node = nodes.TableElement()
    node.table = nodes.Identifier()
    node.table.type = nodes.Identifier.T_BUILTIN
    node.table.name = "_env"

    node.key = _build_string_constant(state, slot)

    return node
Beispiel #2
0
def _build_table_element(state, addr, instruction):
    node = nodes.TableElement()
    node.table = _build_slot(state, addr, instruction.B)

    if instruction.CD_type == ins.T_VAR:
        node.key = _build_slot(state, addr, instruction.CD)
    else:
        node.key = _build_const_expression(state, addr, instruction)

    return node
Beispiel #3
0
def _build_table_mass_assignment(state, addr, instruction):
    assignment = nodes.Assignment()

    base = instruction.A

    destination = nodes.TableElement()
    destination.key = nodes.MULTRES()
    destination.table = _build_slot(state, addr, base - 1)

    assignment.destinations.contents = [destination]
    assignment.expressions.contents = [nodes.MULTRES()]

    return assignment