codegen: emit Store for Assign exprs
This commit is contained in:
parent
5d8efd657f
commit
f84eb16490
1 changed files with 7 additions and 13 deletions
|
@ -210,22 +210,16 @@ pub const Codegen = struct {
|
|||
);
|
||||
},
|
||||
|
||||
// TODO finish this
|
||||
.Assign => |assign| {
|
||||
// TODO find assign.name on the "parent context", we should have
|
||||
// a way to do name resolution that is completely relative to
|
||||
// where we currently are, and go up in scope. so that we find
|
||||
// the LLVMValueRef.
|
||||
|
||||
// we will also need to repeat the step for the type resolver
|
||||
|
||||
//var typ = self.findCurrent(assign.name);
|
||||
@panic("TODO finish Assign emitting");
|
||||
|
||||
const name = assign.name.lexeme;
|
||||
var meta = self.ctx.current_scope.?.meta_map.get(name).?.value;
|
||||
var assign_expr = try self.emitExpr(builder, assign.value);
|
||||
var llvm_alloca: llvm.LLVMValueRef = switch (meta.using) {
|
||||
.Function => meta.from_function.?.parameters.get(name).?.value.llvm_alloca.?,
|
||||
.Scope => meta.llvm_alloca.?,
|
||||
};
|
||||
|
||||
// TODO rm null
|
||||
return llvm.LLVMBuildStore(builder, null, assign_expr);
|
||||
return llvm.LLVMBuildStore(builder, assign_expr, llvm_alloca);
|
||||
},
|
||||
|
||||
.Variable => |vari| {
|
||||
|
|
Loading…
Reference in a new issue