Quick fix compilation errors in old AST code.
This commit is contained in:
parent
1150b03a29
commit
85e29367a8
@ -385,7 +385,7 @@ impl AssignStatement {
|
|||||||
get_or_init_mut_field_pointer_variable(builder, &field_symbol, field_type)
|
get_or_init_mut_field_pointer_variable(builder, &field_symbol, field_type)
|
||||||
.clone();
|
.clone();
|
||||||
let ir_set_field = IrSetField::new(
|
let ir_set_field = IrSetField::new(
|
||||||
&mut_field_pointer_variable,
|
todo!(),
|
||||||
self.value
|
self.value
|
||||||
.to_ir_expression(builder, symbol_table, types_table)
|
.to_ir_expression(builder, symbol_table, types_table)
|
||||||
.expect("Attempt to convert non-value to value"),
|
.expect("Attempt to convert non-value to value"),
|
||||||
@ -395,7 +395,7 @@ impl AssignStatement {
|
|||||||
ExpressibleSymbol::Variable(variable_symbol) => {
|
ExpressibleSymbol::Variable(variable_symbol) => {
|
||||||
let vr_variable = builder.local_variables().get(&variable_symbol).unwrap();
|
let vr_variable = builder.local_variables().get(&variable_symbol).unwrap();
|
||||||
let ir_assign = IrAssign::new(
|
let ir_assign = IrAssign::new(
|
||||||
vr_variable.clone(),
|
todo!(),
|
||||||
self.value
|
self.value
|
||||||
.to_ir_operation(builder, symbol_table, types_table),
|
.to_ir_operation(builder, symbol_table, types_table),
|
||||||
);
|
);
|
||||||
@ -432,7 +432,7 @@ impl AssignStatement {
|
|||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let ir_set_field = IrSetField::new(
|
let ir_set_field = IrSetField::new(
|
||||||
&mut_field_pointer_variable,
|
todo!(),
|
||||||
self.value.lower_to_ir_expression(
|
self.value.lower_to_ir_expression(
|
||||||
builder,
|
builder,
|
||||||
nodes_to_symbols,
|
nodes_to_symbols,
|
||||||
@ -445,7 +445,7 @@ impl AssignStatement {
|
|||||||
ExpressibleSymbol::Variable(variable_symbol) => {
|
ExpressibleSymbol::Variable(variable_symbol) => {
|
||||||
let ir_variable = builder.local_variables().get(&variable_symbol).unwrap();
|
let ir_variable = builder.local_variables().get(&variable_symbol).unwrap();
|
||||||
let ir_assign = IrAssign::new(
|
let ir_assign = IrAssign::new(
|
||||||
ir_variable.clone(),
|
todo!(),
|
||||||
self.value.lower_to_ir_operation(
|
self.value.lower_to_ir_operation(
|
||||||
builder,
|
builder,
|
||||||
nodes_to_symbols,
|
nodes_to_symbols,
|
||||||
|
|||||||
@ -603,17 +603,13 @@ impl BinaryExpression {
|
|||||||
types_table: &TypesTable,
|
types_table: &TypesTable,
|
||||||
) -> IrExpression {
|
) -> IrExpression {
|
||||||
let ir_operation = self.to_ir_operation(builder, symbol_table, types_table);
|
let ir_operation = self.to_ir_operation(builder, symbol_table, types_table);
|
||||||
let t_var = IrVariable::new_vr(
|
let t_var = IrVariable::new(&builder.new_t_var(), todo!());
|
||||||
builder.new_t_var().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
self.type_info(),
|
|
||||||
);
|
|
||||||
let as_rc = Rc::new(RefCell::new(t_var));
|
let as_rc = Rc::new(RefCell::new(t_var));
|
||||||
let ir_assign = IrAssign::new(as_rc.clone(), ir_operation);
|
let ir_assign = IrAssign::new(todo!(), ir_operation);
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(ir_assign));
|
.add_statement(IrStatement::Assign(ir_assign));
|
||||||
IrExpression::Variable(as_rc)
|
IrExpression::Variable(todo!())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn lower_to_ir_expression(
|
pub fn lower_to_ir_expression(
|
||||||
@ -628,16 +624,12 @@ impl BinaryExpression {
|
|||||||
|
|
||||||
let type_info = nodes_to_types.get(&self.node_id).unwrap();
|
let type_info = nodes_to_types.get(&self.node_id).unwrap();
|
||||||
|
|
||||||
let t_var = Rc::new(RefCell::new(IrVariable::new_vr(
|
let t_var = Rc::new(RefCell::new(todo!()));
|
||||||
builder.new_t_var().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
type_info,
|
|
||||||
)));
|
|
||||||
|
|
||||||
let ir_assign = IrAssign::new(t_var.clone(), ir_operation);
|
let ir_assign = IrAssign::new(todo!(), ir_operation);
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(ir_assign));
|
.add_statement(IrStatement::Assign(ir_assign));
|
||||||
IrExpression::Variable(t_var)
|
IrExpression::Variable(todo!())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -213,7 +213,7 @@ impl Constructor {
|
|||||||
let offset = (parameters_count as isize).neg() + i as isize;
|
let offset = (parameters_count as isize).neg() + i as isize;
|
||||||
let ir_parameter = Rc::new(IrParameter::new(
|
let ir_parameter = Rc::new(IrParameter::new(
|
||||||
parameter_symbol.declared_name(),
|
parameter_symbol.declared_name(),
|
||||||
parameter_type.clone(),
|
todo!(),
|
||||||
offset,
|
offset,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -227,19 +227,14 @@ impl Constructor {
|
|||||||
let entry_block_id = ir_builder.new_block();
|
let entry_block_id = ir_builder.new_block();
|
||||||
|
|
||||||
// first, allocate the object into a t var
|
// first, allocate the object into a t var
|
||||||
let alloc_assign_destination = IrVariable::new_vr(
|
let alloc_assign_destination = todo!();
|
||||||
ir_builder.new_t_var().into(),
|
|
||||||
ir_builder.current_block().id(),
|
|
||||||
&TypeInfo::Class(class_symbol.clone()),
|
|
||||||
);
|
|
||||||
let self_variable = Rc::new(RefCell::new(alloc_assign_destination));
|
let self_variable = Rc::new(RefCell::new(alloc_assign_destination));
|
||||||
|
|
||||||
// save self variable so statements can assign stuff to self's fields
|
// save self variable so statements can assign stuff to self's fields
|
||||||
ir_builder
|
ir_builder.set_self_parameter_or_variable(IrParameterOrVariable::Variable(todo!()));
|
||||||
.set_self_parameter_or_variable(IrParameterOrVariable::Variable(self_variable.clone()));
|
|
||||||
|
|
||||||
let alloc_assign = IrAssign::new(
|
let alloc_assign = IrAssign::new(
|
||||||
self_variable.clone(),
|
todo!(),
|
||||||
IrOperation::Allocate(IrAllocate::new(class_symbol.declared_name_owned())),
|
IrOperation::Allocate(IrAllocate::new(class_symbol.declared_name_owned())),
|
||||||
);
|
);
|
||||||
ir_builder
|
ir_builder
|
||||||
@ -255,19 +250,13 @@ impl Constructor {
|
|||||||
let field_type = types_table.field_types().get(&field_symbol).unwrap();
|
let field_type = types_table.field_types().get(&field_symbol).unwrap();
|
||||||
// get a mut ref to the field
|
// get a mut ref to the field
|
||||||
let ir_get_field_ref_mut = IrGetFieldRefMut::new(
|
let ir_get_field_ref_mut = IrGetFieldRefMut::new(
|
||||||
IrParameterOrVariable::Variable(self_variable.clone()),
|
IrParameterOrVariable::Variable(todo!()),
|
||||||
field_symbol.field_index(),
|
field_symbol.field_index(),
|
||||||
);
|
);
|
||||||
let field_mut_ref_variable_name: Rc<str> = ir_builder.new_t_var().into();
|
let field_mut_ref_variable_name: Rc<str> = ir_builder.new_t_var().into();
|
||||||
let field_mut_ref_variable = Rc::new(RefCell::new(IrVariable::new_vr(
|
let field_mut_ref_variable = Rc::new(RefCell::new(todo!()));
|
||||||
field_mut_ref_variable_name.clone(),
|
let field_mut_ref_assign =
|
||||||
ir_builder.current_block().id(),
|
IrAssign::new(todo!(), IrOperation::GetFieldRefMut(ir_get_field_ref_mut));
|
||||||
field_type,
|
|
||||||
)));
|
|
||||||
let field_mut_ref_assign = IrAssign::new(
|
|
||||||
field_mut_ref_variable.clone(),
|
|
||||||
IrOperation::GetFieldRefMut(ir_get_field_ref_mut),
|
|
||||||
);
|
|
||||||
ir_builder
|
ir_builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(field_mut_ref_assign));
|
.add_statement(IrStatement::Assign(field_mut_ref_assign));
|
||||||
@ -288,7 +277,7 @@ impl Constructor {
|
|||||||
.to_ir_expression(&mut ir_builder, symbol_table, types_table)
|
.to_ir_expression(&mut ir_builder, symbol_table, types_table)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let ir_set_field = IrSetField::new(
|
let ir_set_field = IrSetField::new(
|
||||||
&field_mut_ref_variable, // dumb that we clone it and then ref it
|
todo!(), // dumb that we clone it and then ref it
|
||||||
ir_expression,
|
ir_expression,
|
||||||
);
|
);
|
||||||
ir_builder
|
ir_builder
|
||||||
@ -303,9 +292,8 @@ impl Constructor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return complete self object
|
// return complete self object
|
||||||
let ir_return_statement = IrStatement::Return(IrReturn::new(Some(IrExpression::Variable(
|
let ir_return_statement =
|
||||||
self_variable.clone(),
|
IrStatement::Return(IrReturn::new(Some(IrExpression::Variable(todo!()))));
|
||||||
))));
|
|
||||||
ir_builder
|
ir_builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(ir_return_statement);
|
.add_statement(ir_return_statement);
|
||||||
@ -316,12 +304,7 @@ impl Constructor {
|
|||||||
let constructor_symbol = symbol_table
|
let constructor_symbol = symbol_table
|
||||||
.get_constructor_symbol(self.scope_id.unwrap())
|
.get_constructor_symbol(self.scope_id.unwrap())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
IrFunction::new(
|
todo!()
|
||||||
fqn_parts_to_string(constructor_symbol.fqn_parts()),
|
|
||||||
ir_parameters,
|
|
||||||
&TypeInfo::Class(class_symbol.clone()),
|
|
||||||
entry_block.clone(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn lower_to_ir(
|
pub fn lower_to_ir(
|
||||||
@ -341,11 +324,7 @@ impl Constructor {
|
|||||||
let symbol = nodes_to_symbols.get(¶meter.node_id()).unwrap();
|
let symbol = nodes_to_symbols.get(¶meter.node_id()).unwrap();
|
||||||
let parameter_type = symbols_to_types.get(symbol).unwrap();
|
let parameter_type = symbols_to_types.get(symbol).unwrap();
|
||||||
let offset = base_offset + i as isize;
|
let offset = base_offset + i as isize;
|
||||||
let ir_parameter = Rc::new(IrParameter::new(
|
let ir_parameter = Rc::new(IrParameter::new(symbol.declared_name(), todo!(), offset));
|
||||||
symbol.declared_name(),
|
|
||||||
parameter_type.clone(),
|
|
||||||
offset,
|
|
||||||
));
|
|
||||||
|
|
||||||
// save in builder
|
// save in builder
|
||||||
ir_builder.push_parameter(symbol.unwrap_parameter_symbol(), ir_parameter.clone());
|
ir_builder.push_parameter(symbol.unwrap_parameter_symbol(), ir_parameter.clone());
|
||||||
@ -358,104 +337,101 @@ impl Constructor {
|
|||||||
let entry_block_id = ir_builder.new_block();
|
let entry_block_id = ir_builder.new_block();
|
||||||
|
|
||||||
// PART 1: Make self object
|
// PART 1: Make self object
|
||||||
let self_variable = Rc::new(RefCell::new(IrVariable::new_vr(
|
let self_variable = Rc::new(RefCell::new(todo!()));
|
||||||
ir_builder.new_t_var().into(),
|
//
|
||||||
ir_builder.current_block().id(),
|
// // save self variable in builder
|
||||||
&TypeInfo::ParameterizedClass(class_symbol.clone(), Vec::new()), // todo: figure out the correct TypeInfo for this
|
// ir_builder
|
||||||
)));
|
// .set_self_parameter_or_variable(IrParameterOrVariable::Variable(self_variable.clone()));
|
||||||
|
//
|
||||||
|
// // allocate the self object
|
||||||
|
// let ir_assign = IrAssign::new(
|
||||||
|
// self_variable.clone(),
|
||||||
|
// IrOperation::Allocate(IrAllocate::new(class_symbol.declared_name_owned())),
|
||||||
|
// );
|
||||||
|
// ir_builder
|
||||||
|
// .current_block_mut()
|
||||||
|
// .add_statement(IrStatement::Assign(ir_assign));
|
||||||
|
//
|
||||||
|
// // PART 2: Initialize fields that are initialized OUTSIDE the constructor
|
||||||
|
// for field in fields {
|
||||||
|
// if let Some(initializer) = field.initializer() {
|
||||||
|
// let symbol = nodes_to_symbols.get(&field.node_id()).unwrap();
|
||||||
|
// let field_type = symbols_to_types.get(symbol).unwrap();
|
||||||
|
// let field_symbol = symbol.unwrap_field_symbol();
|
||||||
|
//
|
||||||
|
// // 1. Get a mut ref to the field
|
||||||
|
// // mut t_var: Type = &mut self.x
|
||||||
|
// let ir_get_field_ref_mut = IrGetFieldRefMut::new(
|
||||||
|
// IrParameterOrVariable::Variable(self_variable.clone()),
|
||||||
|
// field_symbol.field_index(),
|
||||||
|
// );
|
||||||
|
// let field_ref_mut_ir_variable = Rc::new(RefCell::new(IrVariable::new_vr(
|
||||||
|
// ir_builder.new_t_var().into(),
|
||||||
|
// ir_builder.current_block().id(),
|
||||||
|
// field_type,
|
||||||
|
// )));
|
||||||
|
// let ir_assign = IrAssign::new(
|
||||||
|
// field_ref_mut_ir_variable.clone(),
|
||||||
|
// IrOperation::GetFieldRefMut(ir_get_field_ref_mut),
|
||||||
|
// );
|
||||||
|
// ir_builder
|
||||||
|
// .current_block_mut()
|
||||||
|
// .add_statement(IrStatement::Assign(ir_assign));
|
||||||
|
//
|
||||||
|
// // save the mut ref for later uses if needed
|
||||||
|
// ir_builder.field_mut_pointer_variables_mut().insert(
|
||||||
|
// field.declared_name_owned(),
|
||||||
|
// field_ref_mut_ir_variable.clone(),
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// // 2. Evaluate initializer and save result to mut field ref
|
||||||
|
// let ir_expression = initializer.lower_to_ir_expression(
|
||||||
|
// &mut ir_builder,
|
||||||
|
// nodes_to_symbols,
|
||||||
|
// symbols_to_types,
|
||||||
|
// nodes_to_types,
|
||||||
|
// );
|
||||||
|
// let ir_set_field = IrSetField::new(&field_ref_mut_ir_variable, ir_expression);
|
||||||
|
// ir_builder
|
||||||
|
// .current_block_mut()
|
||||||
|
// .add_statement(IrStatement::SetField(ir_set_field));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // PART 3. Constructor statements
|
||||||
|
// for statement in &self.statements {
|
||||||
|
// statement.lower_to_ir(
|
||||||
|
// &mut ir_builder,
|
||||||
|
// nodes_to_symbols,
|
||||||
|
// symbols_to_types,
|
||||||
|
// nodes_to_types,
|
||||||
|
// false,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // PART 4. Return finished self object
|
||||||
|
// let ir_return_statement = IrStatement::Return(IrReturn::new(Some(IrExpression::Variable(
|
||||||
|
// self_variable.clone(),
|
||||||
|
// ))));
|
||||||
|
// ir_builder
|
||||||
|
// .current_block_mut()
|
||||||
|
// .add_statement(ir_return_statement);
|
||||||
|
//
|
||||||
|
// // Finish up the builder and return IrFunction
|
||||||
|
// ir_builder.finish_block();
|
||||||
|
// let entry_block = ir_builder.get_block(entry_block_id);
|
||||||
|
//
|
||||||
|
// let constructor_symbol = nodes_to_symbols
|
||||||
|
// .get(&self.node_id)
|
||||||
|
// .unwrap()
|
||||||
|
// .unwrap_constructor_symbol();
|
||||||
|
|
||||||
// save self variable in builder
|
// IrFunction::new(
|
||||||
ir_builder
|
// fqn_parts_to_string(constructor_symbol.fqn_parts()),
|
||||||
.set_self_parameter_or_variable(IrParameterOrVariable::Variable(self_variable.clone()));
|
// ir_parameters,
|
||||||
|
// &TypeInfo::Class(class_symbol.clone()), // TODO
|
||||||
// allocate the self object
|
// entry_block.clone(),
|
||||||
let ir_assign = IrAssign::new(
|
// )
|
||||||
self_variable.clone(),
|
todo!()
|
||||||
IrOperation::Allocate(IrAllocate::new(class_symbol.declared_name_owned())),
|
|
||||||
);
|
|
||||||
ir_builder
|
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(IrStatement::Assign(ir_assign));
|
|
||||||
|
|
||||||
// PART 2: Initialize fields that are initialized OUTSIDE the constructor
|
|
||||||
for field in fields {
|
|
||||||
if let Some(initializer) = field.initializer() {
|
|
||||||
let symbol = nodes_to_symbols.get(&field.node_id()).unwrap();
|
|
||||||
let field_type = symbols_to_types.get(symbol).unwrap();
|
|
||||||
let field_symbol = symbol.unwrap_field_symbol();
|
|
||||||
|
|
||||||
// 1. Get a mut ref to the field
|
|
||||||
// mut t_var: Type = &mut self.x
|
|
||||||
let ir_get_field_ref_mut = IrGetFieldRefMut::new(
|
|
||||||
IrParameterOrVariable::Variable(self_variable.clone()),
|
|
||||||
field_symbol.field_index(),
|
|
||||||
);
|
|
||||||
let field_ref_mut_ir_variable = Rc::new(RefCell::new(IrVariable::new_vr(
|
|
||||||
ir_builder.new_t_var().into(),
|
|
||||||
ir_builder.current_block().id(),
|
|
||||||
field_type,
|
|
||||||
)));
|
|
||||||
let ir_assign = IrAssign::new(
|
|
||||||
field_ref_mut_ir_variable.clone(),
|
|
||||||
IrOperation::GetFieldRefMut(ir_get_field_ref_mut),
|
|
||||||
);
|
|
||||||
ir_builder
|
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(IrStatement::Assign(ir_assign));
|
|
||||||
|
|
||||||
// save the mut ref for later uses if needed
|
|
||||||
ir_builder.field_mut_pointer_variables_mut().insert(
|
|
||||||
field.declared_name_owned(),
|
|
||||||
field_ref_mut_ir_variable.clone(),
|
|
||||||
);
|
|
||||||
|
|
||||||
// 2. Evaluate initializer and save result to mut field ref
|
|
||||||
let ir_expression = initializer.lower_to_ir_expression(
|
|
||||||
&mut ir_builder,
|
|
||||||
nodes_to_symbols,
|
|
||||||
symbols_to_types,
|
|
||||||
nodes_to_types,
|
|
||||||
);
|
|
||||||
let ir_set_field = IrSetField::new(&field_ref_mut_ir_variable, ir_expression);
|
|
||||||
ir_builder
|
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(IrStatement::SetField(ir_set_field));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PART 3. Constructor statements
|
|
||||||
for statement in &self.statements {
|
|
||||||
statement.lower_to_ir(
|
|
||||||
&mut ir_builder,
|
|
||||||
nodes_to_symbols,
|
|
||||||
symbols_to_types,
|
|
||||||
nodes_to_types,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// PART 4. Return finished self object
|
|
||||||
let ir_return_statement = IrStatement::Return(IrReturn::new(Some(IrExpression::Variable(
|
|
||||||
self_variable.clone(),
|
|
||||||
))));
|
|
||||||
ir_builder
|
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(ir_return_statement);
|
|
||||||
|
|
||||||
// Finish up the builder and return IrFunction
|
|
||||||
ir_builder.finish_block();
|
|
||||||
let entry_block = ir_builder.get_block(entry_block_id);
|
|
||||||
|
|
||||||
let constructor_symbol = nodes_to_symbols
|
|
||||||
.get(&self.node_id)
|
|
||||||
.unwrap()
|
|
||||||
.unwrap_constructor_symbol();
|
|
||||||
|
|
||||||
IrFunction::new(
|
|
||||||
fqn_parts_to_string(constructor_symbol.fqn_parts()),
|
|
||||||
ir_parameters,
|
|
||||||
&TypeInfo::Class(class_symbol.clone()), // TODO
|
|
||||||
entry_block.clone(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -479,17 +479,13 @@ impl Expression {
|
|||||||
.add_statement(IrStatement::Call(ir_call));
|
.add_statement(IrStatement::Call(ir_call));
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let t_var = IrVariable::new_vr(
|
let t_var = todo!();
|
||||||
builder.new_t_var().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
call.return_type_info(symbol_table, types_table),
|
|
||||||
);
|
|
||||||
let as_rc = Rc::new(RefCell::new(t_var));
|
let as_rc = Rc::new(RefCell::new(t_var));
|
||||||
let assign = IrAssign::new(as_rc.clone(), IrOperation::Call(ir_call));
|
let assign = IrAssign::new(todo!(), IrOperation::Call(ir_call));
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(assign));
|
.add_statement(IrStatement::Assign(assign));
|
||||||
Some(IrExpression::Variable(as_rc))
|
Some(IrExpression::Variable(todo!()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expression::Identifier(identifier) => {
|
Expression::Identifier(identifier) => {
|
||||||
|
|||||||
@ -419,11 +419,8 @@ impl Function {
|
|||||||
.get(¶meter_symbol)
|
.get(¶meter_symbol)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let stack_offset = (self.parameters.len() as isize).neg() + (i as isize);
|
let stack_offset = (self.parameters.len() as isize).neg() + (i as isize);
|
||||||
let ir_parameter = IrParameter::new(
|
let ir_parameter =
|
||||||
parameter_symbol.declared_name(),
|
IrParameter::new(parameter_symbol.declared_name(), todo!(), stack_offset);
|
||||||
parameter_type_info.clone(),
|
|
||||||
stack_offset,
|
|
||||||
);
|
|
||||||
let as_rc = Rc::new(ir_parameter);
|
let as_rc = Rc::new(ir_parameter);
|
||||||
builder.push_parameter(¶meter_symbol, as_rc.clone());
|
builder.push_parameter(¶meter_symbol, as_rc.clone());
|
||||||
}
|
}
|
||||||
@ -435,7 +432,7 @@ impl Function {
|
|||||||
if class_context.is_some() {
|
if class_context.is_some() {
|
||||||
let parameter_0 = builder.parameters()[0].clone();
|
let parameter_0 = builder.parameters()[0].clone();
|
||||||
// put it in the self parameter
|
// put it in the self parameter
|
||||||
builder.set_self_parameter_or_variable(IrParameterOrVariable::Parameter(parameter_0));
|
builder.set_self_parameter_or_variable(IrParameterOrVariable::Parameter(todo!()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,9 +485,10 @@ impl Function {
|
|||||||
let entry_block = builder.get_block(entry_block_id).clone();
|
let entry_block = builder.get_block(entry_block_id).clone();
|
||||||
IrFunction::new(
|
IrFunction::new(
|
||||||
fqn_parts_to_string(function_symbol.fqn_parts()),
|
fqn_parts_to_string(function_symbol.fqn_parts()),
|
||||||
builder.parameters().iter().map(|p| (*p).clone()).collect(),
|
todo!(),
|
||||||
&Self::get_return_type_info(types_table, function_symbol),
|
todo!(),
|
||||||
entry_block,
|
todo!(),
|
||||||
|
todo!(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,7 +513,7 @@ impl Function {
|
|||||||
let stack_offset = (function_symbol.parameters().len() as isize).neg() + (i as isize);
|
let stack_offset = (function_symbol.parameters().len() as isize).neg() + (i as isize);
|
||||||
let ir_parameter = Rc::new(IrParameter::new(
|
let ir_parameter = Rc::new(IrParameter::new(
|
||||||
parameter_symbol.declared_name(),
|
parameter_symbol.declared_name(),
|
||||||
parameter_type_info.clone(),
|
todo!(),
|
||||||
stack_offset,
|
stack_offset,
|
||||||
));
|
));
|
||||||
builder.push_parameter(parameter_symbol, ir_parameter);
|
builder.push_parameter(parameter_symbol, ir_parameter);
|
||||||
@ -544,9 +542,10 @@ impl Function {
|
|||||||
let entry_block = builder.get_block(entry_block_id).clone();
|
let entry_block = builder.get_block(entry_block_id).clone();
|
||||||
IrFunction::new(
|
IrFunction::new(
|
||||||
fqn_parts_to_string(function_symbol.fqn_parts()),
|
fqn_parts_to_string(function_symbol.fqn_parts()),
|
||||||
builder.parameters().iter().map(|p| (*p).clone()).collect(),
|
todo!(),
|
||||||
return_type_info,
|
todo!(),
|
||||||
entry_block,
|
todo!(),
|
||||||
|
todo!(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -570,39 +570,21 @@ impl Identifier {
|
|||||||
}
|
}
|
||||||
ExpressibleSymbol::Field(field_symbol) => {
|
ExpressibleSymbol::Field(field_symbol) => {
|
||||||
let field_type = symbols_to_types.get(symbol).unwrap();
|
let field_type = symbols_to_types.get(symbol).unwrap();
|
||||||
let read_destination = Rc::new(RefCell::new(IrVariable::new_vr(
|
let read_destination = Rc::new(RefCell::new(todo!()));
|
||||||
builder.new_t_var().into(),
|
let ir_read_field = IrReadField::new(todo!());
|
||||||
builder.current_block().id(),
|
|
||||||
field_type,
|
|
||||||
)));
|
|
||||||
let ir_read_field = IrReadField::new(
|
|
||||||
get_or_init_field_pointer_variable(builder, field_symbol, field_type).clone(),
|
|
||||||
);
|
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(IrAssign::new(
|
.add_statement(IrStatement::Assign(IrAssign::new(
|
||||||
read_destination.clone(),
|
todo!(),
|
||||||
IrOperation::ReadField(ir_read_field),
|
IrOperation::ReadField(ir_read_field),
|
||||||
)));
|
)));
|
||||||
IrExpression::Variable(read_destination)
|
IrExpression::Variable(todo!())
|
||||||
}
|
}
|
||||||
ExpressibleSymbol::Function(_function_symbol) => {
|
ExpressibleSymbol::Function(_function_symbol) => {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
ExpressibleSymbol::Parameter(parameter_symbol) => IrExpression::Parameter(
|
ExpressibleSymbol::Parameter(parameter_symbol) => IrExpression::Parameter(todo!()),
|
||||||
builder
|
ExpressibleSymbol::Variable(variable_symbol) => IrExpression::Variable(todo!()),
|
||||||
.parameters_map()
|
|
||||||
.get(parameter_symbol)
|
|
||||||
.unwrap()
|
|
||||||
.clone(),
|
|
||||||
),
|
|
||||||
ExpressibleSymbol::Variable(variable_symbol) => IrExpression::Variable(
|
|
||||||
builder
|
|
||||||
.local_variables()
|
|
||||||
.get(variable_symbol)
|
|
||||||
.unwrap()
|
|
||||||
.clone(),
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,22 +603,16 @@ impl Identifier {
|
|||||||
}
|
}
|
||||||
ExpressibleSymbol::Field(field_symbol) => {
|
ExpressibleSymbol::Field(field_symbol) => {
|
||||||
let field_type = types_table.field_types().get(&field_symbol).unwrap();
|
let field_type = types_table.field_types().get(&field_symbol).unwrap();
|
||||||
let read_destination = IrVariable::new_vr(
|
let read_destination = todo!();
|
||||||
builder.new_t_var().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
field_type,
|
|
||||||
);
|
|
||||||
let read_destination_as_rc = Rc::new(RefCell::new(read_destination));
|
let read_destination_as_rc = Rc::new(RefCell::new(read_destination));
|
||||||
let ir_read_field = IrReadField::new(
|
let ir_read_field = IrReadField::new(todo!());
|
||||||
get_or_init_field_pointer_variable(builder, &field_symbol, field_type).clone(),
|
|
||||||
);
|
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(IrAssign::new(
|
.add_statement(IrStatement::Assign(IrAssign::new(
|
||||||
read_destination_as_rc.clone(),
|
todo!(),
|
||||||
IrOperation::ReadField(ir_read_field),
|
IrOperation::ReadField(ir_read_field),
|
||||||
)));
|
)));
|
||||||
IrExpression::Variable(read_destination_as_rc)
|
IrExpression::Variable(todo!())
|
||||||
}
|
}
|
||||||
ExpressibleSymbol::Function(_) => {
|
ExpressibleSymbol::Function(_) => {
|
||||||
panic!("Cannot yet get ir-variable for FunctionSymbol")
|
panic!("Cannot yet get ir-variable for FunctionSymbol")
|
||||||
@ -644,11 +620,11 @@ impl Identifier {
|
|||||||
ExpressibleSymbol::Parameter(parameter_symbol) => {
|
ExpressibleSymbol::Parameter(parameter_symbol) => {
|
||||||
let parameters_map = builder.parameters_map();
|
let parameters_map = builder.parameters_map();
|
||||||
let ir_parameter = parameters_map.get(¶meter_symbol).unwrap();
|
let ir_parameter = parameters_map.get(¶meter_symbol).unwrap();
|
||||||
IrExpression::Parameter(ir_parameter.clone())
|
IrExpression::Parameter(todo!())
|
||||||
}
|
}
|
||||||
ExpressibleSymbol::Variable(variable_symbol) => {
|
ExpressibleSymbol::Variable(variable_symbol) => {
|
||||||
let ir_variable = builder.local_variables().get(&variable_symbol).unwrap();
|
let ir_variable = builder.local_variables().get(&variable_symbol).unwrap();
|
||||||
IrExpression::Variable(ir_variable.clone())
|
IrExpression::Variable(todo!())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,18 +21,14 @@ pub fn get_or_init_field_pointer_variable<'a>(
|
|||||||
.field_pointer_variables()
|
.field_pointer_variables()
|
||||||
.contains_key(field_symbol.declared_name())
|
.contains_key(field_symbol.declared_name())
|
||||||
{
|
{
|
||||||
let field_ref_variable = IrVariable::new_vr(
|
let field_ref_variable = todo!();
|
||||||
builder.new_t_var().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
field_type,
|
|
||||||
);
|
|
||||||
let as_rc = Rc::new(RefCell::new(field_ref_variable));
|
let as_rc = Rc::new(RefCell::new(field_ref_variable));
|
||||||
let to_insert = as_rc.clone();
|
let to_insert = as_rc.clone();
|
||||||
let self_parameter_or_variable = builder.self_parameter_or_variable().clone();
|
let self_parameter_or_variable = builder.self_parameter_or_variable().clone();
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(IrAssign::new(
|
.add_statement(IrStatement::Assign(IrAssign::new(
|
||||||
as_rc,
|
todo!(),
|
||||||
IrOperation::GetFieldRef(IrGetFieldRef::new(
|
IrOperation::GetFieldRef(IrGetFieldRef::new(
|
||||||
self_parameter_or_variable.clone(),
|
self_parameter_or_variable.clone(),
|
||||||
field_symbol.field_index(),
|
field_symbol.field_index(),
|
||||||
@ -57,18 +53,14 @@ pub fn get_or_init_mut_field_pointer_variable<'a>(
|
|||||||
.field_mut_pointer_variables()
|
.field_mut_pointer_variables()
|
||||||
.contains_key(field_symbol.declared_name())
|
.contains_key(field_symbol.declared_name())
|
||||||
{
|
{
|
||||||
let mut_field_pointer_variable = IrVariable::new_vr(
|
let mut_field_pointer_variable = todo!();
|
||||||
builder.new_t_var().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
field_type,
|
|
||||||
);
|
|
||||||
let as_rc = Rc::new(RefCell::new(mut_field_pointer_variable));
|
let as_rc = Rc::new(RefCell::new(mut_field_pointer_variable));
|
||||||
let to_insert = as_rc.clone();
|
let to_insert = as_rc.clone();
|
||||||
let self_parameter_or_variable = builder.self_parameter_or_variable().clone();
|
let self_parameter_or_variable = builder.self_parameter_or_variable().clone();
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(IrAssign::new(
|
.add_statement(IrStatement::Assign(IrAssign::new(
|
||||||
as_rc,
|
todo!(),
|
||||||
IrOperation::GetFieldRefMut(IrGetFieldRefMut::new(
|
IrOperation::GetFieldRefMut(IrGetFieldRefMut::new(
|
||||||
self_parameter_or_variable.clone(),
|
self_parameter_or_variable.clone(),
|
||||||
field_symbol.field_index(),
|
field_symbol.field_index(),
|
||||||
|
|||||||
@ -254,11 +254,7 @@ impl LetStatement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn make_vr_variable(&self, builder: &mut IrBuilder, destination_type: &TypeInfo) -> IrVariable {
|
fn make_vr_variable(&self, builder: &mut IrBuilder, destination_type: &TypeInfo) -> IrVariable {
|
||||||
IrVariable::new_vr(
|
todo!()
|
||||||
self.declared_name().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
destination_type,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_stack_variable(
|
fn make_stack_variable(
|
||||||
@ -267,12 +263,7 @@ impl LetStatement {
|
|||||||
destination_type: &TypeInfo,
|
destination_type: &TypeInfo,
|
||||||
offset: isize,
|
offset: isize,
|
||||||
) -> IrVariable {
|
) -> IrVariable {
|
||||||
IrVariable::new_stack_with_offset(
|
todo!()
|
||||||
self.declared_name().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
destination_type,
|
|
||||||
offset,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_destination_symbol(&self, symbol_table: &SymbolTable) -> Rc<VariableSymbol> {
|
pub fn get_destination_symbol(&self, symbol_table: &SymbolTable) -> Rc<VariableSymbol> {
|
||||||
@ -301,7 +292,7 @@ impl LetStatement {
|
|||||||
let destination_vr_variable = self.make_vr_variable(builder, destination_type);
|
let destination_vr_variable = self.make_vr_variable(builder, destination_type);
|
||||||
|
|
||||||
let as_rc = Rc::new(RefCell::new(destination_vr_variable));
|
let as_rc = Rc::new(RefCell::new(destination_vr_variable));
|
||||||
let ir_assign = IrAssign::new(as_rc.clone(), init_operation);
|
let ir_assign = IrAssign::new(todo!(), init_operation);
|
||||||
|
|
||||||
builder
|
builder
|
||||||
.local_variables_mut()
|
.local_variables_mut()
|
||||||
@ -330,7 +321,7 @@ impl LetStatement {
|
|||||||
let destination_stack_variable =
|
let destination_stack_variable =
|
||||||
self.make_stack_variable(builder, destination_type, destination_stack_offset);
|
self.make_stack_variable(builder, destination_type, destination_stack_offset);
|
||||||
let as_rc = Rc::new(RefCell::new(destination_stack_variable));
|
let as_rc = Rc::new(RefCell::new(destination_stack_variable));
|
||||||
let ir_assign = IrAssign::new(as_rc.clone(), init_operation);
|
let ir_assign = IrAssign::new(todo!(), init_operation);
|
||||||
// do not need to save variable to builder as a new one is created for each repl function
|
// do not need to save variable to builder as a new one is created for each repl function
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
@ -354,11 +345,7 @@ impl LetStatement {
|
|||||||
|
|
||||||
let destination_symbol = nodes_to_symbols.get(&self.node_id).unwrap();
|
let destination_symbol = nodes_to_symbols.get(&self.node_id).unwrap();
|
||||||
let destination_type_info = symbols_to_types.get(destination_symbol).unwrap();
|
let destination_type_info = symbols_to_types.get(destination_symbol).unwrap();
|
||||||
let vr_variable = Rc::new(RefCell::new(IrVariable::new_vr(
|
let vr_variable = Rc::new(RefCell::new(todo!()));
|
||||||
self.declared_name().into(),
|
|
||||||
builder.current_block().id(),
|
|
||||||
destination_type_info,
|
|
||||||
)));
|
|
||||||
|
|
||||||
// save local variable to builder
|
// save local variable to builder
|
||||||
builder.local_variables_mut().insert(
|
builder.local_variables_mut().insert(
|
||||||
@ -366,7 +353,7 @@ impl LetStatement {
|
|||||||
vr_variable.clone(),
|
vr_variable.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let ir_assign = IrAssign::new(vr_variable, init_operation);
|
let ir_assign = IrAssign::new(todo!(), init_operation);
|
||||||
builder
|
builder
|
||||||
.current_block_mut()
|
.current_block_mut()
|
||||||
.add_statement(IrStatement::Assign(ir_assign));
|
.add_statement(IrStatement::Assign(ir_assign));
|
||||||
|
|||||||
@ -184,55 +184,47 @@ impl NegativeExpression {
|
|||||||
|
|
||||||
match base_ir_expression {
|
match base_ir_expression {
|
||||||
IrExpression::Parameter(ir_parameter) => {
|
IrExpression::Parameter(ir_parameter) => {
|
||||||
let destination = Rc::new(RefCell::new(IrVariable::new_vr(
|
let destination = Rc::new(RefCell::new(todo!()));
|
||||||
builder.new_t_var().into(),
|
todo!()
|
||||||
builder.current_block().id(),
|
// let rhs = match todo!() {
|
||||||
ir_parameter.type_info(),
|
// TypeInfo::Integer => IrExpression::Int(-1),
|
||||||
)));
|
// TypeInfo::Double => IrExpression::Double(-1.0),
|
||||||
|
// _ => panic!(),
|
||||||
let rhs = match ir_parameter.type_info() {
|
// };
|
||||||
TypeInfo::Integer => IrExpression::Int(-1),
|
//
|
||||||
TypeInfo::Double => IrExpression::Double(-1.0),
|
// let operation = IrOperation::Binary(IrBinaryOperation::new(
|
||||||
_ => panic!(),
|
// IrExpression::Parameter(ir_parameter),
|
||||||
};
|
// rhs,
|
||||||
|
// IrBinaryOperator::Multiply,
|
||||||
let operation = IrOperation::Binary(IrBinaryOperation::new(
|
// ));
|
||||||
IrExpression::Parameter(ir_parameter),
|
//
|
||||||
rhs,
|
// let ir_assign = IrAssign::new(destination.clone(), operation);
|
||||||
IrBinaryOperator::Multiply,
|
// builder
|
||||||
));
|
// .current_block_mut()
|
||||||
|
// .add_statement(IrStatement::Assign(ir_assign));
|
||||||
let ir_assign = IrAssign::new(destination.clone(), operation);
|
//
|
||||||
builder
|
// IrExpression::Variable(destination)
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(IrStatement::Assign(ir_assign));
|
|
||||||
|
|
||||||
IrExpression::Variable(destination)
|
|
||||||
}
|
}
|
||||||
IrExpression::Variable(ir_variable) => {
|
IrExpression::Variable(ir_variable) => {
|
||||||
let destination = Rc::new(RefCell::new(IrVariable::new_vr(
|
let destination = Rc::new(RefCell::new(todo!()));
|
||||||
builder.new_t_var().into(),
|
todo!()
|
||||||
builder.current_block().id(),
|
// let rhs = match ir_variable.borrow().type_info() {
|
||||||
ir_variable.borrow().type_info(),
|
// TypeInfo::Integer => IrExpression::Int(-1),
|
||||||
)));
|
// TypeInfo::Double => IrExpression::Double(-1.0),
|
||||||
|
// _ => panic!(),
|
||||||
let rhs = match ir_variable.borrow().type_info() {
|
// };
|
||||||
TypeInfo::Integer => IrExpression::Int(-1),
|
//
|
||||||
TypeInfo::Double => IrExpression::Double(-1.0),
|
// let operation = IrOperation::Binary(IrBinaryOperation::new(
|
||||||
_ => panic!(),
|
// IrExpression::Variable(ir_variable),
|
||||||
};
|
// rhs,
|
||||||
|
// IrBinaryOperator::Multiply,
|
||||||
let operation = IrOperation::Binary(IrBinaryOperation::new(
|
// ));
|
||||||
IrExpression::Variable(ir_variable),
|
//
|
||||||
rhs,
|
// let ir_assign = IrAssign::new(destination.clone(), operation);
|
||||||
IrBinaryOperator::Multiply,
|
// builder
|
||||||
));
|
// .current_block_mut()
|
||||||
|
// .add_statement(IrStatement::Assign(ir_assign));
|
||||||
let ir_assign = IrAssign::new(destination.clone(), operation);
|
// IrExpression::Variable(destination)
|
||||||
builder
|
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(IrStatement::Assign(ir_assign));
|
|
||||||
IrExpression::Variable(destination)
|
|
||||||
}
|
}
|
||||||
IrExpression::Int(i) => IrExpression::Int(i * -1),
|
IrExpression::Int(i) => IrExpression::Int(i * -1),
|
||||||
IrExpression::Double(d) => IrExpression::Double(d * -1.0),
|
IrExpression::Double(d) => IrExpression::Double(d * -1.0),
|
||||||
@ -256,56 +248,48 @@ impl NegativeExpression {
|
|||||||
|
|
||||||
match operand_as_ir {
|
match operand_as_ir {
|
||||||
IrExpression::Parameter(parameter) => {
|
IrExpression::Parameter(parameter) => {
|
||||||
let destination = Rc::new(RefCell::new(IrVariable::new_vr(
|
let destination = Rc::new(RefCell::new(todo!()));
|
||||||
builder.new_t_var().into(),
|
todo!()
|
||||||
builder.current_block().id(),
|
// let rhs = match todo!() {
|
||||||
parameter.type_info(),
|
// TypeInfo::Integer => IrExpression::Int(-1),
|
||||||
)));
|
// TypeInfo::Double => IrExpression::Double(-1.0),
|
||||||
|
// _ => panic!("Trying to multiply with a non-integer/double"),
|
||||||
let rhs = match parameter.type_info() {
|
// };
|
||||||
TypeInfo::Integer => IrExpression::Int(-1),
|
//
|
||||||
TypeInfo::Double => IrExpression::Double(-1.0),
|
// let operation = IrOperation::Binary(IrBinaryOperation::new(
|
||||||
_ => panic!("Trying to multiply with a non-integer/double"),
|
// IrExpression::Parameter(parameter),
|
||||||
};
|
// rhs,
|
||||||
|
// IrBinaryOperator::Multiply,
|
||||||
let operation = IrOperation::Binary(IrBinaryOperation::new(
|
// ));
|
||||||
IrExpression::Parameter(parameter),
|
//
|
||||||
rhs,
|
// let assign = IrAssign::new(destination.clone(), operation);
|
||||||
IrBinaryOperator::Multiply,
|
// builder
|
||||||
));
|
// .current_block_mut()
|
||||||
|
// .add_statement(IrStatement::Assign(assign));
|
||||||
let assign = IrAssign::new(destination.clone(), operation);
|
//
|
||||||
builder
|
// IrExpression::Variable(destination)
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(IrStatement::Assign(assign));
|
|
||||||
|
|
||||||
IrExpression::Variable(destination)
|
|
||||||
}
|
}
|
||||||
IrExpression::Variable(variable) => {
|
IrExpression::Variable(variable) => {
|
||||||
let destination = Rc::new(RefCell::new(IrVariable::new_vr(
|
let destination = Rc::new(RefCell::new(todo!()));
|
||||||
builder.new_t_var().into(),
|
todo!()
|
||||||
builder.current_block().id(),
|
// let rhs = match variable.borrow().type_info() {
|
||||||
variable.borrow().type_info(),
|
// TypeInfo::Integer => IrExpression::Int(-1),
|
||||||
)));
|
// TypeInfo::Double => IrExpression::Double(-1.0),
|
||||||
|
// _ => panic!("Trying to multiply with a non-integer/double"),
|
||||||
let rhs = match variable.borrow().type_info() {
|
// };
|
||||||
TypeInfo::Integer => IrExpression::Int(-1),
|
//
|
||||||
TypeInfo::Double => IrExpression::Double(-1.0),
|
// let operation = IrOperation::Binary(IrBinaryOperation::new(
|
||||||
_ => panic!("Trying to multiply with a non-integer/double"),
|
// IrExpression::Variable(variable),
|
||||||
};
|
// rhs,
|
||||||
|
// IrBinaryOperator::Multiply,
|
||||||
let operation = IrOperation::Binary(IrBinaryOperation::new(
|
// ));
|
||||||
IrExpression::Variable(variable),
|
//
|
||||||
rhs,
|
// let assign = IrAssign::new(destination.clone(), operation);
|
||||||
IrBinaryOperator::Multiply,
|
// builder
|
||||||
));
|
// .current_block_mut()
|
||||||
|
// .add_statement(IrStatement::Assign(assign));
|
||||||
let assign = IrAssign::new(destination.clone(), operation);
|
//
|
||||||
builder
|
// IrExpression::Variable(destination)
|
||||||
.current_block_mut()
|
|
||||||
.add_statement(IrStatement::Assign(assign));
|
|
||||||
|
|
||||||
IrExpression::Variable(destination)
|
|
||||||
}
|
}
|
||||||
IrExpression::Int(i) => IrExpression::Int(i * -1),
|
IrExpression::Int(i) => IrExpression::Int(i * -1),
|
||||||
IrExpression::Double(d) => IrExpression::Double(d * -1.0),
|
IrExpression::Double(d) => IrExpression::Double(d * -1.0),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user