forked from M-Labs/nac3
[meta] Move variables declarations closer to where they are first used
This commit is contained in:
parent
fe06b2806f
commit
a43b59539c
|
@ -853,10 +853,9 @@ pub fn gen_func_impl<
|
|||
builder.position_at_end(init_bb);
|
||||
let body_bb = context.append_basic_block(fn_val, "body");
|
||||
|
||||
// Store non-vararg argument values into local variables
|
||||
let mut var_assignment = HashMap::new();
|
||||
let offset = u32::from(has_sret);
|
||||
|
||||
// Store non-vararg argument values into local variables
|
||||
for (n, arg) in args.iter().enumerate().filter(|(_, arg)| !arg.is_vararg) {
|
||||
let param = fn_val.get_nth_param((n as u32) + offset).unwrap();
|
||||
let local_type = get_llvm_type(
|
||||
|
|
|
@ -500,6 +500,7 @@ impl TopLevelComposer {
|
|||
}
|
||||
Ok(())
|
||||
};
|
||||
|
||||
let mut errors = HashSet::new();
|
||||
for (class_def, class_ast) in def_list.iter().skip(self.builtin_num) {
|
||||
if class_ast.is_none() {
|
||||
|
@ -853,7 +854,6 @@ impl TopLevelComposer {
|
|||
let unifier = self.unifier.borrow_mut();
|
||||
let primitives_store = &self.primitives_ty;
|
||||
|
||||
let mut errors = HashSet::new();
|
||||
let mut analyze = |function_def: &Arc<RwLock<TopLevelDef>>, function_ast: &Option<Stmt>| {
|
||||
let mut function_def = function_def.write();
|
||||
let function_def = &mut *function_def;
|
||||
|
@ -1128,6 +1128,8 @@ impl TopLevelComposer {
|
|||
})?;
|
||||
Ok(())
|
||||
};
|
||||
|
||||
let mut errors = HashSet::new();
|
||||
for (function_def, function_ast) in def_list.iter().skip(self.builtin_num) {
|
||||
if function_ast.is_none() {
|
||||
continue;
|
||||
|
@ -1702,7 +1704,6 @@ impl TopLevelComposer {
|
|||
}
|
||||
}
|
||||
|
||||
let mut errors = HashSet::new();
|
||||
let mut analyze = |i, def: &Arc<RwLock<TopLevelDef>>, ast: &Option<Stmt>| {
|
||||
let class_def = def.read();
|
||||
if let TopLevelDef::Class {
|
||||
|
@ -1845,6 +1846,8 @@ impl TopLevelComposer {
|
|||
}
|
||||
Ok(())
|
||||
};
|
||||
|
||||
let mut errors = HashSet::new();
|
||||
for (i, (def, ast)) in definition_ast_list.iter().enumerate().skip(self.builtin_num) {
|
||||
if ast.is_none() {
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue