from compiler.types.BooleanType import BooleanType
from .Expression import Expression
from grammar.SmallCParser import SmallCParser


class Disjunction(Expression):

    def __init__(self, environment, expr_disjunction, expr_conjunction):
        super().__init__(environment)
        self.type = SmallCParser.DISJUNCTION
        self.disjunction = expr_disjunction
        self.conjunction = expr_conjunction
        self.addChild(self.disjunction)
        self.addChild(self.conjunction)
        self.operand_type = BooleanType()
        self.result_type = BooleanType()

    def getDisplayableText(self):
        return " || "

    def generateCode(self, out):
        # first get the operands on top of the stack
        self.disjunction.generateCode(out)
        self.cast(self.disjunction, out)
        self.conjunction.generateCode(out)
        self.cast(self.conjunction, out)
        # execute the operation on the operands
        self.writeInstruction("or", out)

699be31d525fdd657f68741784569bdf5bc712ac
<mask token>


class Disjunction(Expression):
    <mask token>
    <mask token>
    <mask token>

<mask token>


class Disjunction(Expression):
    <mask token>

    def getDisplayableText(self):
        return ' || '

    def generateCode(self, out):
        self.disjunction.generateCode(out)
        self.cast(self.disjunction, out)
        self.conjunction.generateCode(out)
        self.cast(self.conjunction, out)
        self.writeInstruction('or', out)

<mask token>


class Disjunction(Expression):

    def __init__(self, environment, expr_disjunction, expr_conjunction):
        super().__init__(environment)
        self.type = SmallCParser.DISJUNCTION
        self.disjunction = expr_disjunction
        self.conjunction = expr_conjunction
        self.addChild(self.disjunction)
        self.addChild(self.conjunction)
        self.operand_type = BooleanType()
        self.result_type = BooleanType()

    def getDisplayableText(self):
        return ' || '

    def generateCode(self, out):
        self.disjunction.generateCode(out)
        self.cast(self.disjunction, out)
        self.conjunction.generateCode(out)
        self.cast(self.conjunction, out)
        self.writeInstruction('or', out)

from compiler.types.BooleanType import BooleanType
from .Expression import Expression
from grammar.SmallCParser import SmallCParser


class Disjunction(Expression):

    def __init__(self, environment, expr_disjunction, expr_conjunction):
        super().__init__(environment)
        self.type = SmallCParser.DISJUNCTION
        self.disjunction = expr_disjunction
        self.conjunction = expr_conjunction
        self.addChild(self.disjunction)
        self.addChild(self.conjunction)
        self.operand_type = BooleanType()
        self.result_type = BooleanType()

    def getDisplayableText(self):
        return ' || '

    def generateCode(self, out):
        self.disjunction.generateCode(out)
        self.cast(self.disjunction, out)
        self.conjunction.generateCode(out)
        self.cast(self.conjunction, out)
        self.writeInstruction('or', out)

from compiler.types.BooleanType import BooleanType
from .Expression import Expression
from grammar.SmallCParser import SmallCParser


class Disjunction(Expression):

    def __init__(self, environment, expr_disjunction, expr_conjunction):
        super().__init__(environment)
        self.type = SmallCParser.DISJUNCTION
        self.disjunction = expr_disjunction
        self.conjunction = expr_conjunction
        self.addChild(self.disjunction)
        self.addChild(self.conjunction)
        self.operand_type = BooleanType()
        self.result_type = BooleanType()

    def getDisplayableText(self):
        return " || "

    def generateCode(self, out):
        # first get the operands on top of the stack
        self.disjunction.generateCode(out)
        self.cast(self.disjunction, out)
        self.conjunction.generateCode(out)
        self.cast(self.conjunction, out)
        # execute the operation on the operands
        self.writeInstruction("or", out)
