Example #1
0
def progmem_array(id, rhs):
    rhs = safe_exp(rhs)
    obj = MockObj(id, u'.')
    assignment = ProgmemAssignmentExpression(id.type, id, rhs, obj)
    CORE.add(assignment)
    CORE.register_variable(id, obj)
    obj.requires.append(assignment)
    return obj
Example #2
0
def variable(
        id,  # type: ID
        rhs,  # type: Expression
        type=None  # type: MockObj
):
    # type: (...) -> MockObj
    rhs = safe_exp(rhs)
    obj = MockObj(id, u'.')
    id.type = type or id.type
    assignment = AssignmentExpression(id.type, '', id, rhs, obj)
    CORE.add(assignment)
    CORE.register_variable(id, obj)
    obj.requires.append(assignment)
    return obj
Example #3
0
def Pvariable(
        id,  # type: ID
        rhs,  # type: Expression
        has_side_effects=True,  # type: bool
        type=None  # type: MockObj
):
    # type: (...) -> MockObj
    rhs = safe_exp(rhs)
    if not has_side_effects and hasattr(rhs, '_has_side_effects'):
        # pylint: disable=attribute-defined-outside-init, protected-access
        rhs._has_side_effects = False
    obj = MockObj(id, u'->', has_side_effects=has_side_effects)
    id.type = type or id.type
    assignment = AssignmentExpression(id.type, '*', id, rhs, obj)
    CORE.add(assignment)
    CORE.register_variable(id, obj)
    obj.requires.append(assignment)
    return obj
Example #4
0
def add(
        expression,  # type: Union[Expression, Statement]
        require=True  # type: bool
):
    # type: (...) -> None
    CORE.add(expression, require=require)
Example #5
0
def setup_component(obj, config):
    if CONF_SETUP_PRIORITY in config:
        CORE.add(obj.set_setup_priority(config[CONF_SETUP_PRIORITY]))