Exemple #1
0
    def getVariableObjectAccessCode(cls, to_name, needs_check,
                                    variable_code_name, variable, emit,
                                    context):
        template = template_read_shared_unclear

        emit(template % {
            "tmp_name": to_name,
            "identifier": variable_code_name
        })

        if needs_check:
            getLocalVariableReferenceErrorCode(variable=variable,
                                               condition="%s == NULL" %
                                               to_name,
                                               emit=emit,
                                               context=context)
        else:
            getCheckObjectCode(check_name=to_name, emit=emit)
Exemple #2
0
    def getDeleteObjectCode(cls, variable_code_name, needs_check, tolerant,
                            variable, emit, context):
        if not needs_check:
            emit(template_del_local_known % {"identifier": variable_code_name})
        elif tolerant:
            emit(template_del_local_tolerant %
                 {"identifier": variable_code_name})
        else:
            res_name = context.getBoolResName()

            emit(template_del_local_intolerant % {
                "identifier": variable_code_name,
                "result": res_name
            })

            if variable.isLocalVariable():
                getLocalVariableReferenceErrorCode(variable=variable,
                                                   condition="%s == false" %
                                                   res_name,
                                                   emit=emit,
                                                   context=context)
            else:
                getAssertionCode(check="%s != false" % res_name, emit=emit)
Exemple #3
0
    def getDeleteObjectCode(cls, variable_code_name, needs_check, tolerant,
                            variable, emit, context):
        if not needs_check:
            emit("%s = NUITKA_BOOL_UNASSIGNED;" % variable_code_name)
        elif tolerant:
            emit("%s = NUITKA_BOOL_UNASSIGNED;" % variable_code_name)
        else:
            res_name = context.getBoolResName()

            emit("%s = %s == NUITKA_BOOL_UNASSIGNED;" % (
                res_name,
                variable_code_name,
            ))
            emit("%s = NUITKA_BOOL_UNASSIGNED;" % variable_code_name)

            if variable.isLocalVariable():
                getLocalVariableReferenceErrorCode(variable=variable,
                                                   condition="%s == false" %
                                                   res_name,
                                                   emit=emit,
                                                   context=context)
            else:
                getAssertionCode(check="%s != false" % res_name, emit=emit)