mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
chore(StrToNum): layout is always a Struct, we don't need the Union case
This commit is contained in:
parent
a85fdda07a
commit
d2f95bde63
2 changed files with 2 additions and 4 deletions
|
@ -5322,7 +5322,6 @@ fn run_low_level<'a, 'ctx, 'env>(
|
||||||
let (string, _string_layout) = load_symbol_and_layout(scope, &args[0]);
|
let (string, _string_layout) = load_symbol_and_layout(scope, &args[0]);
|
||||||
|
|
||||||
let number_layout = match layout {
|
let number_layout = match layout {
|
||||||
Layout::Union(UnionLayout::NonRecursive(tags)) => tags[1][0],
|
|
||||||
Layout::Struct(fields) => fields[0], // TODO: why is it sometimes a struct?
|
Layout::Struct(fields) => fields[0], // TODO: why is it sometimes a struct?
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use roc_builtins::bitcode::{self, FloatWidth};
|
use roc_builtins::bitcode::{self, FloatWidth};
|
||||||
use roc_module::low_level::{LowLevel, LowLevel::*};
|
use roc_module::low_level::{LowLevel, LowLevel::*};
|
||||||
use roc_module::symbol::Symbol;
|
use roc_module::symbol::Symbol;
|
||||||
use roc_mono::layout::{Builtin, Layout, UnionLayout};
|
use roc_mono::layout::{Builtin, Layout};
|
||||||
use roc_reporting::internal_error;
|
use roc_reporting::internal_error;
|
||||||
|
|
||||||
use crate::layout::{StackMemoryFormat::*, WasmLayout};
|
use crate::layout::{StackMemoryFormat::*, WasmLayout};
|
||||||
|
@ -50,8 +50,7 @@ pub fn dispatch_low_level<'a>(
|
||||||
StrCountGraphemes => return BuiltinCall(bitcode::STR_COUNT_GRAPEHEME_CLUSTERS),
|
StrCountGraphemes => return BuiltinCall(bitcode::STR_COUNT_GRAPEHEME_CLUSTERS),
|
||||||
StrToNum => {
|
StrToNum => {
|
||||||
let number_layout = match mono_layout {
|
let number_layout = match mono_layout {
|
||||||
Layout::Union(UnionLayout::NonRecursive(tags)) => tags[1][0],
|
Layout::Struct(fields) => fields[0],
|
||||||
Layout::Struct(fields) => fields[0], // TODO: why is it sometimes a struct?
|
|
||||||
_ => internal_error!("Unexpected mono layout {:?} for StrToNum", mono_layout),
|
_ => internal_error!("Unexpected mono layout {:?} for StrToNum", mono_layout),
|
||||||
};
|
};
|
||||||
// match on the return layout to figure out which zig builtin we need
|
// match on the return layout to figure out which zig builtin we need
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue