Skip to content

Refactor resultingTypeForBinaryOp function #390

@rkalis

Description

@rkalis

There used to be 1 function called resultingType, which was used to get the "output" type of a binary op node, to get the type of an array, and to determine whether a binary op should compile to a numeric opcode (e.g. NUMEQUAL instead of EQUAL). This was a terrible abstraction since these things barely have anything in common.

We ran into that issue some time ago when adding bitshifts. Back then we split up the function into resultingTypeForArrayElements and resultingTypeForBinaryOp. Then today we refactored the use case for numeric opcodes, so that that doesn't use either of these functions at all.

resultingTypeForBinaryOp is still a bit of an awkward function, so we want to refactor the type checking code for binary ops at some point in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cashc-compilerRelates to the cashc compilerrefactorInternal refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions