Return compile error (llvm) for setting immutable global

This commit is contained in:
Brandon Fish
2019-08-13 17:59:04 -06:00
parent d12ea66f90
commit 137ac206af
2 changed files with 3 additions and 2 deletions

View File

@ -1151,7 +1151,9 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
builder.build_store(ptr_to_value, value);
}
GlobalCache::Const { value: _ } => {
unreachable!("cannot set non-mutable globals")
return Err(CodegenError {
message: "global is immutable".to_string(),
});
}
}
}