Fixed broken tests
This commit is contained in:
parent
265d234266
commit
14d25b3b9d
|
@ -1193,6 +1193,7 @@ pub fn gen_expr<'ctx, 'a, G: CodeGenerator>(
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.to_basic_value_enum(ctx, generator)
|
.to_basic_value_enum(ctx, generator)
|
||||||
.into_int_value();
|
.into_int_value();
|
||||||
|
let raw_index = ctx.builder.build_int_s_extend(raw_index, generator.get_size_type(ctx.ctx), "sext");
|
||||||
// handle negative index
|
// handle negative index
|
||||||
let is_negative = ctx.builder.build_int_compare(inkwell::IntPredicate::SLT, raw_index,
|
let is_negative = ctx.builder.build_int_compare(inkwell::IntPredicate::SLT, raw_index,
|
||||||
generator.get_size_type(ctx.ctx).const_zero(), "is_neg");
|
generator.get_size_type(ctx.ctx).const_zero(), "is_neg");
|
||||||
|
|
|
@ -29,8 +29,8 @@ def run() -> int32:
|
||||||
output_int32_list(data[m2::m1])
|
output_int32_list(data[m2::m1])
|
||||||
|
|
||||||
# work around https://git.m-labs.hk/M-Labs/nac3/issues/188
|
# work around https://git.m-labs.hk/M-Labs/nac3/issues/188
|
||||||
#get_list_slice()
|
get_list_slice()
|
||||||
#list_slice_assignment()
|
list_slice_assignment()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def get_list_slice():
|
def get_list_slice():
|
||||||
|
|
|
@ -17,6 +17,7 @@ pub struct ResolverInternal {
|
||||||
pub id_to_def: Mutex<HashMap<StrRef, DefinitionId>>,
|
pub id_to_def: Mutex<HashMap<StrRef, DefinitionId>>,
|
||||||
pub class_names: Mutex<HashMap<StrRef, Type>>,
|
pub class_names: Mutex<HashMap<StrRef, Type>>,
|
||||||
pub module_globals: Mutex<HashMap<StrRef, SymbolValue>>,
|
pub module_globals: Mutex<HashMap<StrRef, SymbolValue>>,
|
||||||
|
pub str_store: Mutex<HashMap<String, i32>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResolverInternal {
|
impl ResolverInternal {
|
||||||
|
@ -71,7 +72,14 @@ impl SymbolResolver for Resolver {
|
||||||
self.0.id_to_def.lock().get(&id).cloned()
|
self.0.id_to_def.lock().get(&id).cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_string_id(&self, _: &str) -> i32 {
|
fn get_string_id(&self, s: &str) -> i32 {
|
||||||
unimplemented!()
|
let mut str_store = self.0.str_store.lock();
|
||||||
|
if let Some(id) = str_store.get(s) {
|
||||||
|
*id
|
||||||
|
} else {
|
||||||
|
let id = str_store.len() as i32;
|
||||||
|
str_store.insert(s.to_string(), id);
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ fn main() {
|
||||||
id_to_def: builtins_def.into(),
|
id_to_def: builtins_def.into(),
|
||||||
class_names: Default::default(),
|
class_names: Default::default(),
|
||||||
module_globals: Default::default(),
|
module_globals: Default::default(),
|
||||||
|
str_store: Default::default(),
|
||||||
}
|
}
|
||||||
.into();
|
.into();
|
||||||
let resolver =
|
let resolver =
|
||||||
|
|
Loading…
Reference in New Issue