All non-class e2e tests passing.
This commit is contained in:
parent
f15ff43df8
commit
c69098db71
@ -9,14 +9,13 @@ use crate::ir::ir_operation::IrOperation;
|
||||
use crate::ir::ir_parameter::IrParameter;
|
||||
use crate::ir::ir_return::IrReturn;
|
||||
use crate::ir::ir_statement::IrStatement;
|
||||
use crate::ir::ir_type_info::{IrTypeInfo, IrTypeInfoId};
|
||||
use crate::ir::ir_variable::{IrVariable, IrVariableId};
|
||||
use crate::ir::ir_type_info::IrTypeInfo;
|
||||
use crate::ir::ir_variable::IrVariable;
|
||||
use crate::ir::variable_locations::{VariableLocation, VariableLocations};
|
||||
use dvm_lib::instruction::{
|
||||
AddOperand, Instruction, Location, LocationOrInteger, LocationOrNumber, MoveOperand,
|
||||
MultiplyOperand, PushOperand, ReturnOperand, SubtractOperand,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
struct FunctionAssemblyContext<'a> {
|
||||
variable_locations: &'a VariableLocations,
|
||||
@ -73,9 +72,15 @@ fn assemble_ir_assign(ir_assign: &IrAssign, ctx: &mut FunctionAssemblyContext) {
|
||||
.get_variable_location(&ir_assign.destination()),
|
||||
);
|
||||
match ir_assign.initializer() {
|
||||
IrOperation::GetFieldRef(_) => {}
|
||||
IrOperation::GetFieldRefMut(_) => {}
|
||||
IrOperation::ReadField(_) => {}
|
||||
IrOperation::GetFieldRef(_) => {
|
||||
todo!()
|
||||
}
|
||||
IrOperation::GetFieldRefMut(_) => {
|
||||
todo!()
|
||||
}
|
||||
IrOperation::ReadField(_) => {
|
||||
todo!()
|
||||
}
|
||||
IrOperation::Load(ir_expression) => {
|
||||
let move_operand = to_move_operand(ir_expression, ctx);
|
||||
let instruction = Instruction::Move(move_operand, destination_location);
|
||||
@ -137,8 +142,11 @@ fn assemble_ir_assign(ir_assign: &IrAssign, ctx: &mut FunctionAssemblyContext) {
|
||||
|
||||
ctx.instructions.push(instruction);
|
||||
}
|
||||
IrOperation::Call(_) => {
|
||||
todo!()
|
||||
IrOperation::Call(ir_call) => {
|
||||
// pop top of stack after call into destination
|
||||
assemble_ir_call(ir_call, ctx);
|
||||
ctx.instructions
|
||||
.push(Instruction::Pop(Some(destination_location)));
|
||||
}
|
||||
IrOperation::Allocate(_) => {
|
||||
todo!()
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
use crate::ast::NodeId;
|
||||
use crate::ast::assign_statement::AssignStatement;
|
||||
use crate::ast::binary_expression::BinaryExpression;
|
||||
use crate::ast::call::Call;
|
||||
@ -10,7 +11,6 @@ use crate::ast::let_statement::LetStatement;
|
||||
use crate::ast::negative_expression::NegativeExpression;
|
||||
use crate::ast::parameter::Parameter;
|
||||
use crate::ast::statement::Statement;
|
||||
use crate::ast::NodeId;
|
||||
use crate::diagnostic::Diagnostics;
|
||||
use crate::diagnostic_factories::symbol_not_found;
|
||||
use crate::semantic_analysis::scope::{Scope, ScopeId};
|
||||
|
||||
@ -266,6 +266,11 @@ fn resolve_types_negative_expression(
|
||||
fn resolve_types_call(call: &Call, ctx: &mut ResolveTypesContext) {
|
||||
resolve_types_expression(call.callee(), ctx);
|
||||
|
||||
// get types of arguments
|
||||
for argument in call.arguments() {
|
||||
resolve_types_expression(argument, ctx);
|
||||
}
|
||||
|
||||
let callee_type_info_id = ctx.nodes_to_type_infos[&call.callee().node_id()];
|
||||
let callee_type_info = &ctx.type_infos[callee_type_info_id];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user