Skip to content

Commit

Permalink
Handle lvalue lowering for upcasts on numeric literals
Browse files Browse the repository at this point in the history
  • Loading branch information
kyouko-taiga committed Oct 3, 2023
1 parent ea99094 commit b327b8b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Sources/IR/Emitter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2079,10 +2079,24 @@ struct Emitter {
/// Inserts the IR for lvalue `e`.
private mutating func emitLValue(_ e: CastExpr.ID) -> Operand {
switch ast[e].direction {
case .up:
return emitLValue(upcast: e)
case .pointerConversion:
return emitLValue(pointerConversion: e)
default:
UNIMPLEMENTED()
UNIMPLEMENTED("lvalue lowering for cast expressions #1049")
}
}

/// Inserts the IR for lvalue `e`.
private mutating func emitLValue(upcast e: CastExpr.ID) -> Operand {
switch ast[e].left.kind {
case FloatLiteralExpr.self:
emitStore(value: ast[e].left)
case IntegerLiteralExpr.self:
emitStore(value: ast[e].left)
default:
UNIMPLEMENTED("lvalue lowering for cast expressions #1049")
}
}

Expand Down

0 comments on commit b327b8b

Please sign in to comment.