Merge branch 'main' into rust-1-72-upgrade

This commit is contained in:
On vacation 2024-01-26 13:39:34 +01:00 committed by GitHub
commit 4ee3431428
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
162 changed files with 6605 additions and 23223 deletions

View file

@ -1,33 +1,33 @@
on: on:
workflow_call: workflow_call:
name: Macos x86-64 rust tests name: Macos x86-64 rust tests
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
jobs: jobs:
test-rust-macos-x86-64: test-rust-macos-x86-64:
runs-on: [self-hosted, macOS, X64] runs-on: [self-hosted, macOS, X64]
timeout-minutes: 90 timeout-minutes: 90
env: env:
RUSTC_WRAPPER: /Users/username1/.cargo/bin/sccache RUSTC_WRAPPER: /Users/username1/.cargo/bin/sccache
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: set LLVM_SYS_160_PREFIX - name: set LLVM_SYS_160_PREFIX
run: echo "LLVM_SYS_160_PREFIX=$(brew --prefix llvm@16)" >> $GITHUB_ENV run: echo "LLVM_SYS_160_PREFIX=$(brew --prefix llvm@16)" >> $GITHUB_ENV
- name: Update PATH to use zig 11 - name: Update PATH to use zig 11
run: | run: |
echo "PATH=/Users/username1/Downloads/zig-macos-x86_64-0.11.0:$PATH" >> $GITHUB_ENV echo "PATH=/Users/username1/Downloads/zig-macos-x86_64-0.11.0:$PATH" >> $GITHUB_ENV
- run: zig version
- name: test_gen llvm tests - run: zig version
run: cargo nextest-gen-llvm --release --no-fail-fast --locked -E "package(test_gen) - test(gen_str::str_append_scalar)"
- name: regular rust tests - name: test_gen llvm tests
run: cargo test --locked --release -- --skip opaque_wrap_function --skip gen_list::bool_list_literal --skip platform_switching_swift --skip swift_ui --skip gen_str::str_append_scalar --skip gen_tags::phantom_polymorphic_record && sccache --show-stats run: cargo nextest-gen-llvm --release --no-fail-fast --locked -E "package(test_gen) - test(gen_str::str_append_scalar)"
# swift tests are skipped because of "Could not find or use auto-linked library 'swiftCompatibilityConcurrency'" on macos-11 x86_64 CI machine
# this issue may be caused by using older versions of XCode - name: regular rust tests
run: cargo test --locked --release -- --skip opaque_wrap_function --skip gen_list::bool_list_literal --skip platform_switching_swift --skip swift_ui --skip gen_tags::phantom_polymorphic_record && sccache --show-stats
# swift tests are skipped because of "Could not find or use auto-linked library 'swiftCompatibilityConcurrency'" on macos-11 x86_64 CI machine
# this issue may be caused by using older versions of XCode

View file

@ -1,63 +1,62 @@
on: on:
# pull_request: # pull_request:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '0 9 * * *' # 9=9am utc+0 - cron: "0 9 * * *" # 9=9am utc+0
name: Nightly Release macOS x86_64 name: Nightly Release macOS x86_64
env: env:
LLVM_SYS_160_PREFIX: /usr/local/opt/llvm@16 LLVM_SYS_160_PREFIX: /usr/local/opt/llvm@16
jobs: jobs:
test-build-upload: test-build-upload:
name: build, test, package and upload nightly release name: build, test, package and upload nightly release
runs-on: [self-hosted, macOS, X64] runs-on: [self-hosted, macOS, X64]
timeout-minutes: 120 timeout-minutes: 120
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Update PATH to use zig 11 - name: Update PATH to use zig 11
run: | run: |
echo "PATH=/Users/username1/Downloads/zig-macos-x86_64-0.11.0:$PATH" >> $GITHUB_ENV echo "PATH=/Users/username1/Downloads/zig-macos-x86_64-0.11.0:$PATH" >> $GITHUB_ENV
- run: zig version
- name: write version to file
run: ./ci/write_version.sh
- name: execute rust tests
run: cargo test --release --locked -- --skip opaque_wrap_function --skip gen_list::bool_list_literal --skip platform_switching_swift --skip swift_ui --skip gen_str::str_append_scalar --skip gen_tags::phantom_polymorphic_record
# swift tests are skipped because of "Could not find or use auto-linked library 'swiftCompatibilityConcurrency'" on macos-11 x86_64 CI machine
# this issue may be caused by using older versions of XCode
- name: build release - run: zig version
run: RUSTFLAGS="-C target-cpu=x86-64" cargo build --profile=release-with-lto --locked --bin roc --bin roc_ls
# target-cpu=x86-64 -> For maximal compatibility for all CPU's.
- name: get commit SHA
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
- name: get date
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
- name: build file name
env:
DATE: ${{ env.DATE }}
SHA: ${{ env.SHA }}
run: echo "RELEASE_FOLDER_NAME=roc_nightly-macos_x86_64-$DATE-$SHA" >> $GITHUB_ENV
# this makes the roc binary a lot smaller - name: write version to file
- name: strip debug info run: ./ci/write_version.sh
run: strip ./target/release-with-lto/roc
- name: package release
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
- name: Upload artifact. Actually uploading to github releases has to be done manually.
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
retention-days: 4
- name: execute rust tests
run: cargo test --release --locked -- --skip opaque_wrap_function --skip gen_list::bool_list_literal --skip platform_switching_swift --skip swift_ui --skip gen_tags::phantom_polymorphic_record
# swift tests are skipped because of "Could not find or use auto-linked library 'swiftCompatibilityConcurrency'" on macos-11 x86_64 CI machine
# this issue may be caused by using older versions of XCode
- name: build release
run: RUSTFLAGS="-C target-cpu=x86-64" cargo build --profile=release-with-lto --locked --bin roc --bin roc_ls
# target-cpu=x86-64 -> For maximal compatibility for all CPU's.
- name: get commit SHA
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
- name: get date
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV
- name: build file name
env:
DATE: ${{ env.DATE }}
SHA: ${{ env.SHA }}
run: echo "RELEASE_FOLDER_NAME=roc_nightly-macos_x86_64-$DATE-$SHA" >> $GITHUB_ENV
# this makes the roc binary a lot smaller
- name: strip debug info
run: strip ./target/release-with-lto/roc
- name: package release
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
- name: Upload artifact. Actually uploading to github releases has to be done manually.
uses: actions/upload-artifact@v3
with:
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
retention-days: 4

9
.gitignore vendored
View file

@ -109,4 +109,11 @@ www/content/examples
www/examples-main.zip www/examples-main.zip
www/examples-main www/examples-main
examples/static-site-gen/**/*.html examples/static-site-gen/**/*.html
# glue auto-generated fixture code
crates/glue/tests/fixtures/*/Cargo.toml
crates/glue/tests/fixtures/*/build.rs
crates/glue/tests/fixtures/*/host.c
crates/glue/tests/fixtures/*/src/main.rs
crates/glue/tests/fixtures/*/test_glue/

View file

@ -68,6 +68,7 @@ pub const FLAG_STDIN: &str = "stdin";
pub const FLAG_STDOUT: &str = "stdout"; pub const FLAG_STDOUT: &str = "stdout";
pub const FLAG_WASM_STACK_SIZE_KB: &str = "wasm-stack-size-kb"; pub const FLAG_WASM_STACK_SIZE_KB: &str = "wasm-stack-size-kb";
pub const FLAG_OUTPUT: &str = "output"; pub const FLAG_OUTPUT: &str = "output";
pub const FLAG_FUZZ: &str = "fuzz";
pub const ROC_FILE: &str = "ROC_FILE"; pub const ROC_FILE: &str = "ROC_FILE";
pub const ROC_DIR: &str = "ROC_DIR"; pub const ROC_DIR: &str = "ROC_DIR";
pub const GLUE_DIR: &str = "GLUE_DIR"; pub const GLUE_DIR: &str = "GLUE_DIR";
@ -139,6 +140,12 @@ pub fn build_app() -> Command {
.value_parser(value_parser!(u32)) .value_parser(value_parser!(u32))
.required(false); .required(false);
let flag_fuzz = Arg::new(FLAG_FUZZ)
.long(FLAG_FUZZ)
.help("Instrument the roc binary for fuzzing with roc-fuzz")
.action(ArgAction::SetTrue)
.required(false);
let roc_file_to_run = Arg::new(ROC_FILE) let roc_file_to_run = Arg::new(ROC_FILE)
.help("The .roc file of an app to run") .help("The .roc file of an app to run")
.value_parser(value_parser!(PathBuf)) .value_parser(value_parser!(PathBuf))
@ -175,6 +182,7 @@ pub fn build_app() -> Command {
.arg(flag_time.clone()) .arg(flag_time.clone())
.arg(flag_linker.clone()) .arg(flag_linker.clone())
.arg(flag_prebuilt.clone()) .arg(flag_prebuilt.clone())
.arg(flag_fuzz.clone())
.arg(flag_wasm_stack_size_kb) .arg(flag_wasm_stack_size_kb)
.arg( .arg(
Arg::new(FLAG_TARGET) Arg::new(FLAG_TARGET)
@ -225,6 +233,7 @@ pub fn build_app() -> Command {
.arg(flag_time.clone()) .arg(flag_time.clone())
.arg(flag_linker.clone()) .arg(flag_linker.clone())
.arg(flag_prebuilt.clone()) .arg(flag_prebuilt.clone())
.arg(flag_fuzz.clone())
.arg( .arg(
Arg::new(ROC_FILE) Arg::new(ROC_FILE)
.help("The .roc file for the main module") .help("The .roc file for the main module")
@ -248,6 +257,7 @@ pub fn build_app() -> Command {
.arg(flag_time.clone()) .arg(flag_time.clone())
.arg(flag_linker.clone()) .arg(flag_linker.clone())
.arg(flag_prebuilt.clone()) .arg(flag_prebuilt.clone())
.arg(flag_fuzz.clone())
.arg(roc_file_to_run.clone()) .arg(roc_file_to_run.clone())
.arg(args_for_app.clone().last(true)) .arg(args_for_app.clone().last(true))
) )
@ -262,11 +272,12 @@ pub fn build_app() -> Command {
.arg(flag_time.clone()) .arg(flag_time.clone())
.arg(flag_linker.clone()) .arg(flag_linker.clone())
.arg(flag_prebuilt.clone()) .arg(flag_prebuilt.clone())
.arg(flag_fuzz.clone())
.arg(roc_file_to_run.clone()) .arg(roc_file_to_run.clone())
.arg(args_for_app.clone().last(true)) .arg(args_for_app.clone().last(true))
) )
.subcommand(Command::new(CMD_FORMAT) .subcommand(Command::new(CMD_FORMAT)
.about("Format a .roc file using standard Roc formatting") .about("Format a .roc file or the .roc files contained in a directory using standard\nRoc formatting")
.arg( .arg(
Arg::new(DIRECTORY_OR_FILES) Arg::new(DIRECTORY_OR_FILES)
.index(1) .index(1)
@ -294,6 +305,7 @@ pub fn build_app() -> Command {
.action(ArgAction::SetTrue) .action(ArgAction::SetTrue)
.required(false), .required(false),
) )
.after_help("If DIRECTORY_OR_FILES is omitted, the .roc files in the current working\ndirectory are formatted.")
) )
.subcommand(Command::new(CMD_VERSION) .subcommand(Command::new(CMD_VERSION)
.about(concatcp!("Print the Roc compilers version, which is currently ", VERSION))) .about(concatcp!("Print the Roc compilers version, which is currently ", VERSION)))
@ -392,6 +404,7 @@ pub fn build_app() -> Command {
.arg(flag_time) .arg(flag_time)
.arg(flag_linker) .arg(flag_linker)
.arg(flag_prebuilt) .arg(flag_prebuilt)
.arg(flag_fuzz)
.arg(roc_file_to_run) .arg(roc_file_to_run)
.arg(args_for_app.trailing_var_arg(true)) .arg(args_for_app.trailing_var_arg(true))
} }
@ -747,6 +760,11 @@ pub fn build(
(cross_compile && !targeting_wasm) (cross_compile && !targeting_wasm)
}; };
let fuzz = matches.get_flag(FLAG_FUZZ);
if fuzz && !matches!(code_gen_backend, CodeGenBackend::Llvm(_)) {
user_error!("Cannot instrument binary for fuzzing while using a dev backend.");
}
let wasm_dev_stack_bytes: Option<u32> = matches let wasm_dev_stack_bytes: Option<u32> = matches
.try_get_one::<u32>(FLAG_WASM_STACK_SIZE_KB) .try_get_one::<u32>(FLAG_WASM_STACK_SIZE_KB)
.ok() .ok()
@ -763,6 +781,7 @@ pub fn build(
opt_level, opt_level,
emit_debug_info, emit_debug_info,
emit_llvm_ir, emit_llvm_ir,
fuzz,
}; };
let load_config = standard_load_config(&triple, build_ordering, threading); let load_config = standard_load_config(&triple, build_ordering, threading);

View file

@ -287,6 +287,7 @@ fn main() -> io::Result<()> {
values.push(os_string.to_owned()); values.push(os_string.to_owned());
} }
} }
None if from_stdin || to_stdout => {}
None => { None => {
let mut os_string_values: Vec<OsString> = Vec::new(); let mut os_string_values: Vec<OsString> = Vec::new();

View file

@ -323,11 +323,12 @@ mod cli_run {
} }
// when you want to run `roc test` to execute `expect`s, perhaps on a library rather than an application. // when you want to run `roc test` to execute `expect`s, perhaps on a library rather than an application.
fn test_roc_expect(dir_name: &str, roc_filename: &str) { // not currently used
let path = file_path_from_root(dir_name, roc_filename); // fn test_roc_expect(dir_name: &str, roc_filename: &str) {
let out = run_roc([CMD_TEST, path.to_str().unwrap()], &[], &[]); // let path = file_path_from_root(dir_name, roc_filename);
assert!(out.status.success()); // let out = run_roc([CMD_TEST, path.to_str().unwrap()], &[], &[]);
} // assert!(out.status.success());
// }
// when you don't need args, stdin or extra_env // when you don't need args, stdin or extra_env
fn test_roc_app_slim( fn test_roc_app_slim(
@ -912,9 +913,9 @@ mod cli_run {
#[cfg_attr(windows, ignore)] #[cfg_attr(windows, ignore)]
fn parse_movies_csv() { fn parse_movies_csv() {
test_roc_app_slim( test_roc_app_slim(
"examples/parser/examples", "examples/parser",
"parse-movies-csv.roc", "parse-movies-csv.roc",
"Parse success!\n", "2 movies were found:\n\nThe movie 'Airplane!' was released in 1980 and stars Robert Hays and Julie Hagerty\nThe movie 'Caddyshack' was released in 1980 and stars Chevy Chase, Rodney Dangerfield, Ted Knight, Michael O'Keefe and Bill Murray\n\nParse success!\n\n",
UseValgrind::No, UseValgrind::No,
) )
} }
@ -924,19 +925,13 @@ mod cli_run {
#[cfg_attr(windows, ignore)] #[cfg_attr(windows, ignore)]
fn parse_letter_counts() { fn parse_letter_counts() {
test_roc_app_slim( test_roc_app_slim(
"examples/parser/examples", "examples/parser",
"letter-counts.roc", "letter-counts.roc",
"I counted 7 letter A's!\n", "I counted 7 letter A's!\n",
UseValgrind::No, UseValgrind::No,
) )
} }
#[test]
#[cfg_attr(windows, ignore)]
fn parse_http() {
test_roc_expect("examples/parser/package", "ParserHttp.roc")
}
#[test] #[test]
#[cfg_attr(windows, ignore)] #[cfg_attr(windows, ignore)]
fn inspect_logging() { fn inspect_logging() {
@ -1333,7 +1328,7 @@ mod cli_run {
&[], &[],
indoc!( indoc!(
r#" r#"
TYPE MISMATCH tests/known_bad/TypeError.roc TYPE MISMATCH in tests/known_bad/TypeError.roc
Something is off with the body of the main definition: Something is off with the body of the main definition:
@ -1362,6 +1357,29 @@ mod cli_run {
); );
} }
#[test]
fn known_type_error_with_long_path() {
check_compile_error(
&known_bad_file("UnusedImportButWithALongFileNameForTesting.roc"),
&[],
indoc!(
r#"
UNUSED IMPORT in ...nown_bad/UnusedImportButWithALongFileNameForTesting.roc
Nothing from Symbol is used in this module.
3 imports [Symbol.{ Ident }]
^^^^^^^^^^^^^^^^
Since Symbol isn't used, you don't need to import it.
0 errors and 1 warning found in <ignored for test> ms."#
),
);
}
#[test] #[test]
fn exposed_not_defined() { fn exposed_not_defined() {
check_compile_error( check_compile_error(
@ -1369,7 +1387,7 @@ mod cli_run {
&[], &[],
indoc!( indoc!(
r#" r#"
MISSING DEFINITION tests/known_bad/ExposedNotDefined.roc MISSING DEFINITION in tests/known_bad/ExposedNotDefined.roc
bar is listed as exposed, but it isn't defined in this module. bar is listed as exposed, but it isn't defined in this module.
@ -1390,7 +1408,7 @@ mod cli_run {
&[], &[],
indoc!( indoc!(
r#" r#"
UNUSED IMPORT tests/known_bad/UnusedImport.roc UNUSED IMPORT in tests/known_bad/UnusedImport.roc
Nothing from Symbol is used in this module. Nothing from Symbol is used in this module.
@ -1413,7 +1431,7 @@ mod cli_run {
&[], &[],
indoc!( indoc!(
r#" r#"
UNKNOWN GENERATES FUNCTION tests/known_bad/UnknownGeneratesWith.roc UNKNOWN GENERATES FUNCTION in tests/known_bad/UnknownGeneratesWith.roc
I don't know how to generate the foobar function. I don't know how to generate the foobar function.

View file

@ -0,0 +1,7 @@
interface UnusedImportButWithALongFileNameForTesting
exposes [plainText, emText]
imports [Symbol.{ Ident }]
plainText = \str -> PlainText str
emText = \str -> EmText str

View file

@ -15,7 +15,7 @@ closure1 = \_ ->
Task.succeed (foo toUnitBorrowed "a long string such that it's malloced") Task.succeed (foo toUnitBorrowed "a long string such that it's malloced")
|> Task.map \_ -> {} |> Task.map \_ -> {}
toUnitBorrowed = \x -> Str.countGraphemes x toUnitBorrowed = \x -> Str.countUtf8Bytes x
foo = \f, x -> f x foo = \f, x -> f x

View file

@ -1173,6 +1173,16 @@ fn lowlevel_spec<'a>(
_ => unreachable!(), _ => unreachable!(),
} }
} }
ListClone => {
let list = env.symbols[&arguments[0]];
let bag = builder.add_get_tuple_field(block, list, LIST_BAG_INDEX)?;
let cell = builder.add_get_tuple_field(block, list, LIST_CELL_INDEX)?;
let _unit = builder.add_update(block, update_mode_var, cell)?;
with_new_heap_cell(builder, block, bag)
}
ListSwap => { ListSwap => {
let list = env.symbols[&arguments[0]]; let list = env.symbols[&arguments[0]];

View file

@ -86,6 +86,7 @@ pub struct CodeGenOptions {
pub opt_level: OptLevel, pub opt_level: OptLevel,
pub emit_debug_info: bool, pub emit_debug_info: bool,
pub emit_llvm_ir: bool, pub emit_llvm_ir: bool,
pub fuzz: bool,
} }
type GenFromMono<'a> = (CodeObject, CodeGenTiming, ExpectMetadata<'a>); type GenFromMono<'a> = (CodeObject, CodeGenTiming, ExpectMetadata<'a>);
@ -103,6 +104,7 @@ pub fn gen_from_mono_module<'a>(
let path = roc_file_path; let path = roc_file_path;
let debug = code_gen_options.emit_debug_info; let debug = code_gen_options.emit_debug_info;
let emit_llvm_ir = code_gen_options.emit_llvm_ir; let emit_llvm_ir = code_gen_options.emit_llvm_ir;
let fuzz = code_gen_options.fuzz;
let opt = code_gen_options.opt_level; let opt = code_gen_options.opt_level;
match code_gen_options.backend { match code_gen_options.backend {
@ -131,6 +133,7 @@ pub fn gen_from_mono_module<'a>(
backend_mode, backend_mode,
debug, debug,
emit_llvm_ir, emit_llvm_ir,
fuzz,
), ),
} }
} }
@ -148,6 +151,7 @@ fn gen_from_mono_module_llvm<'a>(
backend_mode: LlvmBackendMode, backend_mode: LlvmBackendMode,
emit_debug_info: bool, emit_debug_info: bool,
emit_llvm_ir: bool, emit_llvm_ir: bool,
fuzz: bool,
) -> GenFromMono<'a> { ) -> GenFromMono<'a> {
use crate::target::{self, convert_opt_level}; use crate::target::{self, convert_opt_level};
use inkwell::attributes::{Attribute, AttributeLoc}; use inkwell::attributes::{Attribute, AttributeLoc};
@ -284,7 +288,8 @@ fn gen_from_mono_module_llvm<'a>(
// annotate the LLVM IR output with debug info // annotate the LLVM IR output with debug info
// so errors are reported with the line number of the LLVM source // so errors are reported with the line number of the LLVM source
let memory_buffer = if cfg!(feature = "sanitizers") && std::env::var("ROC_SANITIZERS").is_ok() { let gen_sanitizers = cfg!(feature = "sanitizers") && std::env::var("ROC_SANITIZERS").is_ok();
let memory_buffer = if fuzz || gen_sanitizers {
let dir = tempfile::tempdir().unwrap(); let dir = tempfile::tempdir().unwrap();
let dir = dir.into_path(); let dir = dir.into_path();
@ -301,33 +306,27 @@ fn gen_from_mono_module_llvm<'a>(
let mut passes = vec![]; let mut passes = vec![];
let mut extra_args = vec![]; let mut extra_args = vec![];
let mut unrecognized = vec![]; let mut unrecognized = vec![];
for sanitizer in std::env::var("ROC_SANITIZERS") if fuzz {
.unwrap() passes.push("sancov-module");
.split(',') extra_args.extend_from_slice(&[
.map(|x| x.trim()) "-sanitizer-coverage-level=4",
{ "-sanitizer-coverage-inline-8bit-counters",
match sanitizer { "-sanitizer-coverage-pc-table",
"address" => passes.push("asan-module"), "-sanitizer-coverage-trace-compares",
"memory" => passes.push("msan-module"), ]);
"thread" => passes.push("tsan-module"), }
"cargo-fuzz" => { if gen_sanitizers {
passes.push("sancov-module"); for sanitizer in std::env::var("ROC_SANITIZERS")
extra_args.extend_from_slice(&[ .unwrap()
"-sanitizer-coverage-level=3", .split(',')
"-sanitizer-coverage-prune-blocks=0", .map(|x| x.trim())
"-sanitizer-coverage-inline-8bit-counters", {
"-sanitizer-coverage-pc-table", match sanitizer {
]); "address" => passes.push("asan-module"),
"memory" => passes.push("msan-module"),
"thread" => passes.push("tsan-module"),
x => unrecognized.push(x.to_owned()),
} }
"afl.rs" => {
passes.push("sancov-module");
extra_args.extend_from_slice(&[
"-sanitizer-coverage-level=3",
"-sanitizer-coverage-prune-blocks=0",
"-sanitizer-coverage-trace-pc-guard",
]);
}
x => unrecognized.push(x.to_owned()),
} }
} }
if !unrecognized.is_empty() { if !unrecognized.is_empty() {
@ -1291,6 +1290,7 @@ pub fn build_str_test<'a>(
opt_level: OptLevel::Normal, opt_level: OptLevel::Normal,
emit_debug_info: false, emit_debug_info: false,
emit_llvm_ir: false, emit_llvm_ir: false,
fuzz: false,
}; };
let emit_timings = false; let emit_timings = false;

File diff suppressed because it is too large Load diff

View file

@ -962,6 +962,14 @@ pub fn listIsUnique(
return list.isEmpty() or list.isUnique(); return list.isEmpty() or list.isUnique();
} }
pub fn listClone(
list: RocList,
alignment: u32,
element_width: usize,
) callconv(.C) RocList {
return list.makeUnique(alignment, element_width);
}
pub fn listCapacity( pub fn listCapacity(
list: RocList, list: RocList,
) callconv(.C) usize { ) callconv(.C) usize {

View file

@ -75,6 +75,7 @@ comptime {
exportListFn(list.listReplaceInPlace, "replace_in_place"); exportListFn(list.listReplaceInPlace, "replace_in_place");
exportListFn(list.listSwap, "swap"); exportListFn(list.listSwap, "swap");
exportListFn(list.listIsUnique, "is_unique"); exportListFn(list.listIsUnique, "is_unique");
exportListFn(list.listClone, "clone");
exportListFn(list.listCapacity, "capacity"); exportListFn(list.listCapacity, "capacity");
exportListFn(list.listAllocationPtr, "allocation_ptr"); exportListFn(list.listAllocationPtr, "allocation_ptr");
exportListFn(list.listReleaseExcessCapacity, "release_excess_capacity"); exportListFn(list.listReleaseExcessCapacity, "release_excess_capacity");
@ -110,19 +111,6 @@ comptime {
exportNumFn(num.greaterThanU128, "greater_than.u128"); exportNumFn(num.greaterThanU128, "greater_than.u128");
exportNumFn(num.greaterThanOrEqualU128, "greater_than_or_equal.u128"); exportNumFn(num.greaterThanOrEqualU128, "greater_than_or_equal.u128");
exportNumFn(num.compareI128, "compare.i128");
exportNumFn(num.compareU128, "compare.u128");
exportNumFn(num.lessThanI128, "less_than.i128");
exportNumFn(num.lessThanOrEqualI128, "less_than_or_equal.i128");
exportNumFn(num.greaterThanI128, "greater_than.i128");
exportNumFn(num.greaterThanOrEqualI128, "greater_than_or_equal.i128");
exportNumFn(num.lessThanU128, "less_than.u128");
exportNumFn(num.lessThanOrEqualU128, "less_than_or_equal.u128");
exportNumFn(num.greaterThanU128, "greater_than.u128");
exportNumFn(num.greaterThanOrEqualU128, "greater_than_or_equal.u128");
inline for (INTEGERS, 0..) |T, i| { inline for (INTEGERS, 0..) |T, i| {
num.exportPow(T, ROC_BUILTINS ++ "." ++ NUM ++ ".pow_int."); num.exportPow(T, ROC_BUILTINS ++ "." ++ NUM ++ ".pow_int.");
num.exportDivCeil(T, ROC_BUILTINS ++ "." ++ NUM ++ ".div_ceil."); num.exportDivCeil(T, ROC_BUILTINS ++ "." ++ NUM ++ ".div_ceil.");
@ -190,15 +178,12 @@ comptime {
const str = @import("str.zig"); const str = @import("str.zig");
comptime { comptime {
exportStrFn(str.init, "init"); exportStrFn(str.init, "init");
exportStrFn(str.strToScalarsC, "to_scalars");
exportStrFn(str.strSplit, "str_split"); exportStrFn(str.strSplit, "str_split");
exportStrFn(str.countSegments, "count_segments"); exportStrFn(str.countSegments, "count_segments");
exportStrFn(str.countGraphemeClusters, "count_grapheme_clusters");
exportStrFn(str.countUtf8Bytes, "count_utf8_bytes"); exportStrFn(str.countUtf8Bytes, "count_utf8_bytes");
exportStrFn(str.isEmpty, "is_empty"); exportStrFn(str.isEmpty, "is_empty");
exportStrFn(str.getCapacity, "capacity"); exportStrFn(str.getCapacity, "capacity");
exportStrFn(str.startsWith, "starts_with"); exportStrFn(str.startsWith, "starts_with");
exportStrFn(str.startsWithScalar, "starts_with_scalar");
exportStrFn(str.endsWith, "ends_with"); exportStrFn(str.endsWith, "ends_with");
exportStrFn(str.strConcatC, "concat"); exportStrFn(str.strConcatC, "concat");
exportStrFn(str.strJoinWithC, "joinWith"); exportStrFn(str.strJoinWithC, "joinWith");
@ -207,8 +192,6 @@ comptime {
exportStrFn(str.substringUnsafe, "substring_unsafe"); exportStrFn(str.substringUnsafe, "substring_unsafe");
exportStrFn(str.getUnsafe, "get_unsafe"); exportStrFn(str.getUnsafe, "get_unsafe");
exportStrFn(str.reserve, "reserve"); exportStrFn(str.reserve, "reserve");
exportStrFn(str.getScalarUnsafe, "get_scalar_unsafe");
exportStrFn(str.appendScalar, "append_scalar");
exportStrFn(str.strToUtf8C, "to_utf8"); exportStrFn(str.strToUtf8C, "to_utf8");
exportStrFn(str.fromUtf8RangeC, "from_utf8_range"); exportStrFn(str.fromUtf8RangeC, "from_utf8_range");
exportStrFn(str.repeat, "repeat"); exportStrFn(str.repeat, "repeat");
@ -217,7 +200,6 @@ comptime {
exportStrFn(str.strTrimEnd, "trim_end"); exportStrFn(str.strTrimEnd, "trim_end");
exportStrFn(str.strCloneTo, "clone_to"); exportStrFn(str.strCloneTo, "clone_to");
exportStrFn(str.withCapacity, "with_capacity"); exportStrFn(str.withCapacity, "with_capacity");
exportStrFn(str.strGraphemes, "graphemes");
exportStrFn(str.strAllocationPtr, "allocation_ptr"); exportStrFn(str.strAllocationPtr, "allocation_ptr");
exportStrFn(str.strReleaseExcessCapacity, "release_excess_capacity"); exportStrFn(str.strReleaseExcessCapacity, "release_excess_capacity");

View file

@ -1,6 +1,5 @@
const utils = @import("utils.zig"); const utils = @import("utils.zig");
const RocList = @import("list.zig").RocList; const RocList = @import("list.zig").RocList;
const grapheme = @import("helpers/grapheme.zig");
const UpdateMode = utils.UpdateMode; const UpdateMode = utils.UpdateMode;
const std = @import("std"); const std = @import("std");
const mem = std.mem; const mem = std.mem;
@ -552,242 +551,6 @@ pub fn strNumberOfBytes(string: RocStr) callconv(.C) usize {
return string.len(); return string.len();
} }
// Str.toScalars
pub fn strToScalarsC(str: RocStr) callconv(.C) RocList {
return @call(.always_inline, strToScalars, .{str});
}
fn strToScalars(string: RocStr) callconv(.C) RocList {
const len = string.len();
if (len == 0) {
return RocList.empty();
}
var capacity = len;
if (!string.isSmallStr()) {
capacity = string.getCapacity();
}
// For purposes of preallocation, assume the number of code points is the same
// as the number of bytes. This might be longer than necessary, but definitely
// should not require a second allocation.
var answer = RocList.allocate(@alignOf(u32), capacity, @sizeOf(u32));
// `orelse unreachable` is fine here, because we already did an early
// return to verify the string was nonempty.
var answer_elems = answer.elements(u32) orelse unreachable;
var src_index: usize = 0;
var answer_index: usize = 0;
while (src_index < len) {
src_index += writeNextScalar(string, src_index, answer_elems, answer_index);
answer_index += 1;
}
answer.length = answer_index;
return answer;
}
// Given a non-empty RocStr, and a src_index byte index into that string,
// and a destination [*]u32, and an index into that destination,
// Parses the next scalar value out of the string (at the given byte index),
// writes it into the destination, and returns the number of bytes parsed.
inline fn writeNextScalar(non_empty_string: RocStr, src_index: usize, dest: [*]u32, dest_index: usize) usize {
const utf8_byte = non_empty_string.getUnchecked(src_index);
// How UTF-8 bytes work:
// https://docs.teradata.com/r/Teradata-Database-International-Character-Set-Support/June-2017/Client-Character-Set-Options/UTF8-Client-Character-Set-Support/UTF8-Multibyte-Sequences
if (utf8_byte <= 127) {
// It's an ASCII character. Copy it over directly.
dest[dest_index] = @as(u32, @intCast(utf8_byte));
return 1;
} else if (utf8_byte >> 5 == 0b0000_0110) {
// Its three high order bits are 110, so this is a two-byte sequence.
// Example:
// utf-8: 1100 1111 1011 0001
// code pt: 0000 0011 1111 0001 (decimal: 1009)
// Discard the first byte's high order bits of 110.
var code_pt = @as(u32, @intCast(utf8_byte & 0b0001_1111));
// Discard the second byte's high order bits of 10.
code_pt <<= 6;
code_pt |= non_empty_string.getUnchecked(src_index + 1) & 0b0011_1111;
dest[dest_index] = code_pt;
return 2;
} else if (utf8_byte >> 4 == 0b0000_1110) {
// Its four high order bits are 1110, so this is a three-byte sequence.
// Discard the first byte's high order bits of 1110.
var code_pt = @as(u32, @intCast(utf8_byte & 0b0000_1111));
// Discard the second byte's high order bits of 10.
code_pt <<= 6;
code_pt |= non_empty_string.getUnchecked(src_index + 1) & 0b0011_1111;
// Discard the third byte's high order bits of 10 (same as second byte).
code_pt <<= 6;
code_pt |= non_empty_string.getUnchecked(src_index + 2) & 0b0011_1111;
dest[dest_index] = code_pt;
return 3;
} else {
// This must be a four-byte sequence, so the five high order bits should be 11110.
// Discard the first byte's high order bits of 11110.
var code_pt = @as(u32, @intCast(utf8_byte & 0b0000_0111));
// Discard the second byte's high order bits of 10.
code_pt <<= 6;
code_pt |= non_empty_string.getUnchecked(src_index + 1) & 0b0011_1111;
// Discard the third byte's high order bits of 10 (same as second byte).
code_pt <<= 6;
code_pt |= non_empty_string.getUnchecked(src_index + 2) & 0b0011_1111;
// Discard the fourth byte's high order bits of 10 (same as second and third).
code_pt <<= 6;
code_pt |= non_empty_string.getUnchecked(src_index + 3) & 0b0011_1111;
dest[dest_index] = code_pt;
return 4;
}
}
test "strToScalars: empty string" {
const str = RocStr.fromSlice("");
defer RocStr.decref(str);
const expected = RocList.empty();
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: One ASCII char" {
const str = RocStr.fromSlice("R");
defer RocStr.decref(str);
const expected_array = [_]u32{82};
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: Multiple ASCII chars" {
const str = RocStr.fromSlice("Roc!");
defer RocStr.decref(str);
const expected_array = [_]u32{ 82, 111, 99, 33 };
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: One 2-byte UTF-8 character" {
const str = RocStr.fromSlice("é");
defer RocStr.decref(str);
const expected_array = [_]u32{233};
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: Multiple 2-byte UTF-8 characters" {
const str = RocStr.fromSlice("Cäfés");
defer RocStr.decref(str);
const expected_array = [_]u32{ 67, 228, 102, 233, 115 };
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: One 3-byte UTF-8 character" {
const str = RocStr.fromSlice("");
defer RocStr.decref(str);
const expected_array = [_]u32{40527};
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: Multiple 3-byte UTF-8 characters" {
const str = RocStr.fromSlice("鹏很有趣");
defer RocStr.decref(str);
const expected_array = [_]u32{ 40527, 24456, 26377, 36259 };
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: One 4-byte UTF-8 character" {
// from https://design215.com/toolbox/utf8-4byte-characters.php
const str = RocStr.fromSlice("𒀀");
defer RocStr.decref(str);
const expected_array = [_]u32{73728};
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
test "strToScalars: Multiple 4-byte UTF-8 characters" {
// from https://design215.com/toolbox/utf8-4byte-characters.php
const str = RocStr.fromSlice("𒀀𒀁");
defer RocStr.decref(str);
const expected_array = [_]u32{ 73728, 73729 };
const expected = RocList.fromSlice(u32, expected_array[0..expected_array.len]);
defer expected.decref(@sizeOf(u32));
const actual = strToScalars(str);
defer actual.decref(@sizeOf(u32));
try expect(RocList.eql(actual, expected));
}
// Str.fromInt // Str.fromInt
pub fn exportFromInt(comptime T: type, comptime name: []const u8) void { pub fn exportFromInt(comptime T: type, comptime name: []const u8) void {
comptime var f = struct { comptime var f = struct {
@ -1371,125 +1134,6 @@ test "countSegments: overlapping delimiter 2" {
try expectEqual(segments_count, 3); try expectEqual(segments_count, 3);
} }
// Str.countGraphemeClusters
pub fn countGraphemeClusters(string: RocStr) callconv(.C) usize {
if (string.isEmpty()) {
return 0;
}
const bytes_len = string.len();
const bytes_ptr = string.asU8ptr();
var bytes = bytes_ptr[0..bytes_len];
var iter = (unicode.Utf8View.init(bytes) catch unreachable).iterator();
var count: usize = 0;
var grapheme_break_state: ?grapheme.BoundClass = null;
var grapheme_break_state_ptr = &grapheme_break_state;
var opt_last_codepoint: ?u21 = null;
while (iter.nextCodepoint()) |cur_codepoint| {
if (opt_last_codepoint) |last_codepoint| {
var did_break = grapheme.isGraphemeBreak(last_codepoint, cur_codepoint, grapheme_break_state_ptr);
if (did_break) {
count += 1;
grapheme_break_state = null;
}
}
opt_last_codepoint = cur_codepoint;
}
// If there are no breaks, but the str is not empty, then there
// must be a single grapheme
if (bytes_len != 0) {
count += 1;
}
return count;
}
// Str.graphemes
pub fn strGraphemes(roc_str: RocStr) callconv(.C) RocList {
var break_state: ?grapheme.BoundClass = null;
var opt_last_codepoint: ?u21 = null;
var index: usize = 0;
var last_codepoint_len: u8 = 0;
const alloc_ptr = @intFromPtr(roc_str.getAllocationPtr()) >> 1;
const init_fn = if (roc_str.isSmallStr())
&initFromSmallStr
else
&initFromBigStr;
var result = RocList.allocate(@alignOf(RocStr), countGraphemeClusters(roc_str), @sizeOf(RocStr));
const graphemes = result.elements(RocStr) orelse return result;
var slice = roc_str.asSlice();
var iter = (unicode.Utf8View.init(slice) catch unreachable).iterator();
while (iter.nextCodepoint()) |cur_codepoint| {
const cur_codepoint_len = unicode.utf8CodepointSequenceLength(cur_codepoint) catch unreachable;
if (opt_last_codepoint) |last_codepoint| {
var did_break = grapheme.isGraphemeBreak(last_codepoint, cur_codepoint, &break_state);
if (did_break) {
graphemes[index] = init_fn(@constCast(slice.ptr), last_codepoint_len, alloc_ptr);
slice = slice[last_codepoint_len..];
index += 1;
break_state = null;
last_codepoint_len = 0;
}
}
last_codepoint_len += cur_codepoint_len;
opt_last_codepoint = cur_codepoint;
}
// Append last grapheme
graphemes[index] = init_fn(@constCast(slice.ptr), slice.len, alloc_ptr);
if (!roc_str.isSmallStr()) {
// Correct refcount for all of the splits made.
roc_str.incref(index + 1);
}
return result;
}
// these test both countGraphemeClusters() and strGraphemes()
fn graphemesTest(input: []const u8, expected: []const []const u8) !void {
const rocstr = RocStr.fromSlice(input);
defer rocstr.decref();
const count = countGraphemeClusters(rocstr);
try expectEqual(expected.len, count);
const graphemes = strGraphemes(rocstr);
defer graphemes.decref(@sizeOf(u8));
if (input.len == 0) return; // empty string
const elems = graphemes.elements(RocStr) orelse unreachable;
for (expected, 0..) |g, i| {
try std.testing.expectEqualStrings(g, elems[i].asSlice());
}
}
test "graphemes: empty string" {
try graphemesTest("", &.{});
}
test "graphemes: ascii characters" {
try graphemesTest("abcd", &.{ "a", "b", "c", "d" });
}
test "graphemes: utf8 characters" {
try graphemesTest("ãxā", &.{ "ã", "x", "ā" });
}
test "graphemes: emojis" {
try graphemesTest("🤔🤔🤔", &.{ "🤔", "🤔", "🤔" });
}
test "graphemes: emojis and ut8 characters" {
try graphemesTest("🤔å🤔¥🤔ç", &.{ "🤔", "å", "🤔", "¥", "🤔", "ç" });
}
test "graphemes: emojis, ut8, and ascii characters" {
try graphemesTest("6🤔å🤔e¥🤔çpp", &.{ "6", "🤔", "å", "🤔", "e", "¥", "🤔", "ç", "p", "p" });
}
pub fn countUtf8Bytes(string: RocStr) callconv(.C) usize { pub fn countUtf8Bytes(string: RocStr) callconv(.C) usize {
return string.len(); return string.len();
} }
@ -1614,44 +1258,6 @@ pub fn repeat(string: RocStr, count: usize) callconv(.C) RocStr {
return ret_string; return ret_string;
} }
// Str.startsWithScalar
pub fn startsWithScalar(string: RocStr, prefix: u32) callconv(.C) bool {
const len = string.len();
if (len == 0) {
return false;
}
// Write this (non-empty) string's first scalar into `first_scalar`
var first_scalar: [1]u32 = undefined;
_ = writeNextScalar(string, 0, &first_scalar, 0);
// Return whether `first_scalar` equals `prefix`
return @as(*u32, @ptrCast(&first_scalar)).* == prefix;
}
test "startsWithScalar: empty string" {
const whole = RocStr.empty();
const prefix: u32 = 'x';
try expect(!startsWithScalar(whole, prefix));
}
test "startsWithScalar: ascii char" {
const whole = RocStr.fromSlice("foobar");
const prefix: u32 = 'f';
try expect(startsWithScalar(whole, prefix));
}
test "startsWithScalar: emoji" {
const yes = RocStr.fromSlice("💖foobar");
const no = RocStr.fromSlice("foobar");
const prefix: u32 = '💖';
try expect(startsWithScalar(yes, prefix));
try expect(!startsWithScalar(no, prefix));
}
test "startsWith: foo starts with fo" { test "startsWith: foo starts with fo" {
const foo = RocStr.fromSlice("foo"); const foo = RocStr.fromSlice("foo");
const fo = RocStr.fromSlice("fo"); const fo = RocStr.fromSlice("fo");
@ -2761,78 +2367,6 @@ test "capacity: big string" {
try expect(data.getCapacity() >= data_bytes.len); try expect(data.getCapacity() >= data_bytes.len);
} }
pub fn appendScalar(string: RocStr, scalar_u32: u32) callconv(.C) RocStr {
const scalar = @as(u21, @intCast(scalar_u32));
const width = std.unicode.utf8CodepointSequenceLength(scalar) catch unreachable;
var output = string.reallocate(string.len() + width);
var slice = output.asSliceWithCapacityMut();
_ = std.unicode.utf8Encode(scalar, slice[string.len() .. string.len() + width]) catch unreachable;
return output;
}
test "appendScalar: small A" {
const A: []const u8 = "A";
const data_bytes = "hello";
var data = RocStr.init(data_bytes, data_bytes.len);
const actual = appendScalar(data, A[0]);
defer actual.decref();
const expected_bytes = "helloA";
const expected = RocStr.init(expected_bytes, expected_bytes.len);
defer expected.decref();
try expect(actual.eq(expected));
}
test "appendScalar: small 😀" {
const data_bytes = "hello";
var data = RocStr.init(data_bytes, data_bytes.len);
const actual = appendScalar(data, 0x1F600);
defer actual.decref();
const expected_bytes = "hello😀";
const expected = RocStr.init(expected_bytes, expected_bytes.len);
defer expected.decref();
try expect(actual.eq(expected));
}
test "appendScalar: big A" {
const A: []const u8 = "A";
const data_bytes = "a string so large that it must be heap-allocated";
var data = RocStr.init(data_bytes, data_bytes.len);
const actual = appendScalar(data, A[0]);
defer actual.decref();
const expected_bytes = "a string so large that it must be heap-allocatedA";
const expected = RocStr.init(expected_bytes, expected_bytes.len);
defer expected.decref();
try expect(actual.eq(expected));
}
test "appendScalar: big 😀" {
const data_bytes = "a string so large that it must be heap-allocated";
var data = RocStr.init(data_bytes, data_bytes.len);
const actual = appendScalar(data, 0x1F600);
defer actual.decref();
const expected_bytes = "a string so large that it must be heap-allocated😀";
const expected = RocStr.init(expected_bytes, expected_bytes.len);
defer expected.decref();
try expect(actual.eq(expected));
}
pub fn reserve(string: RocStr, spare: usize) callconv(.C) RocStr { pub fn reserve(string: RocStr, spare: usize) callconv(.C) RocStr {
const old_length = string.len(); const old_length = string.len();
if (string.getCapacity() >= old_length + spare) { if (string.getCapacity() >= old_length + spare) {
@ -2849,27 +2383,6 @@ pub fn withCapacity(capacity: usize) callconv(.C) RocStr {
str.setLen(0); str.setLen(0);
return str; return str;
} }
pub fn getScalarUnsafe(string: RocStr, index: usize) callconv(.C) extern struct { bytesParsed: usize, scalar: u32 } {
const slice = string.asSlice();
const bytesParsed = @as(usize, @intCast(std.unicode.utf8ByteSequenceLength(slice[index]) catch unreachable));
const scalar = std.unicode.utf8Decode(slice[index .. index + bytesParsed]) catch unreachable;
return .{ .bytesParsed = bytesParsed, .scalar = @as(u32, @intCast(scalar)) };
}
test "getScalarUnsafe" {
const data_bytes = "A";
var data = RocStr.init(data_bytes, data_bytes.len);
const result = getScalarUnsafe(data, 0);
const expected = try std.unicode.utf8Decode("A");
try expectEqual(result.scalar, @as(u32, @intCast(expected)));
try expectEqual(result.bytesParsed, 1);
}
pub fn strCloneTo( pub fn strCloneTo(
string: RocStr, string: RocStr,
ptr: [*]u8, ptr: [*]u8,

View file

@ -435,7 +435,8 @@ repeatHelp = \value, count, accum ->
## ``` ## ```
reverse : List a -> List a reverse : List a -> List a
reverse = \list -> reverse = \list ->
reverseHelp list 0 (Num.subSaturated (List.len list) 1) end = List.len list |> Num.subSaturated 1
reverseHelp (List.clone list) 0 end
reverseHelp = \list, left, right -> reverseHelp = \list, left, right ->
if left < right then if left < right then
@ -443,6 +444,9 @@ reverseHelp = \list, left, right ->
else else
list list
# Ensures that the list in unique (will re-use if already unique)
clone : List a -> List a
## Join the given lists together into one list. ## Join the given lists together into one list.
## ``` ## ```
## expect List.join [[1], [2, 3], [], [4, 5]] == [1, 2, 3, 4, 5] ## expect List.join [[1], [2, 3], [], [4, 5]] == [1, 2, 3, 4, 5]

View file

@ -48,6 +48,7 @@ interface Num
isLte, isLte,
isGt, isGt,
isGte, isGte,
isApproxEq,
sin, sin,
cos, cos,
tan, tan,
@ -661,6 +662,22 @@ isLte : Num a, Num a -> Bool
## is [defined to be unordered](https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN).) ## is [defined to be unordered](https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN).)
isGte : Num a, Num a -> Bool isGte : Num a, Num a -> Bool
## Returns `Bool.true` if the first number and second number are within a specific threshold
##
## A specific relative and absolute tolerance can be provided to change the threshold
##
## If either argument is [*NaN*](Num.isNaN), returns `Bool.false` no matter what. (*NaN*
## is [defined to be unordered](https://en.wikipedia.org/wiki/NaN#Comparison_with_NaN).)
isApproxEq : Frac a, Frac a, { rtol ? Frac a, atol ? Frac a } -> Bool
isApproxEq = \value, refValue, { rtol ? 0.00001, atol ? 0.00000001 } -> value
<= refValue
&& value
>= refValue
|| Num.absDiff value refValue
<= atol
+ rtol
* Num.abs refValue
## Returns `Bool.true` if the number is `0`, and `Bool.false` otherwise. ## Returns `Bool.true` if the number is `0`, and `Bool.false` otherwise.
isZero : Num a -> Bool isZero : Num a -> Bool

View file

@ -1,90 +1,331 @@
## Roc strings are sequences of text values. This module includes functions for combining strings, ## Strings represent text. For example, `"Hi!"` is a string.
## as well as breaking them up into smaller units—most commonly [extended grapheme clusters](http://www.unicode.org/glossary/#extended_grapheme_cluster)
## (referred to in this module's documentation as "graphemes" rather than "characters" for clarity;
## "characters" can mean very different things in different languages).
## ##
## This module focuses on graphemes (as opposed to, say, Unicode code points or LATIN-1 bytes) ## This guide starts at a high level and works down to the in-memory representation of strings and their [performance characteristics](#performance). For reasons that will be explained later in this guide, some string operations are in the `Str` module while others (notably [capitalization](#capitalization), [code points](#code-points), [graphemes](#graphemes), and sorting) are in separate packages. There's also a list of recommendations for [when to use code points, graphemes, and UTF-8](#when-to-use).
## because graphemes avoid common classes of bugs. Breaking strings up using code points often
## leads to bugs around things like emoji, where multiple code points combine to form to a
## single rendered glyph. Graphemes avoid these bugs by treating multi-code-point things like
## emojis as indivisible units.
## ##
## Because graphemes can have variable length (there's no upper limit on how many code points one ## ## Syntax
## grapheme can represent), it takes linear time to count the number of graphemes in a string,
## and also linear time to find an individual grapheme within a string by its position (or "index")
## among the string's other graphemes. The only way to get constant-time access to these is in a way
## that can result in bugs if the string contains multi-code-point things like emojis, which is why
## this module does not offer those.
## ##
## The most common way to represent strings is using quotation marks:
## ##
## ## Working with Unicode strings in Roc
##
## Unicode can represent text values which span multiple languages, symbols, and emoji.
## Here are some valid Roc strings:
## ``` ## ```
## "Roc!" ## "Hello, World!"
## "鹏"
## "🕊"
## ``` ## ```
## Every Unicode string is a sequence of [extended grapheme clusters](http://www.unicode.org/glossary/#extended_grapheme_cluster).
## An extended grapheme cluster represents what a person reading a string might
## call a "character" - like "A" or "ö" or "👩‍👩‍👦‍👦".
## Because the term "character" means different things in different areas of
## programming, and "extended grapheme cluster" is a mouthful, in Roc we use the
## term "grapheme" as a shorthand for the more precise "extended grapheme cluster."
## ##
## You can get the number of graphemes in a string by calling `Str.countGraphemes` on it: ## Using this syntax, the whole string must go on one line. You can write multiline strings using triple quotes:
##
## ``` ## ```
## Str.countGraphemes "Roc!" ## text =
## Str.countGraphemes "折り紙" ## """
## Str.countGraphemes "🕊" ## In memory, this string will not have any spaces
## at its start. That's because the first line
## starts at the same indentation level as the
## opening quotation mark. Actually, none of these
## lines will be indented.
##
## However, this line will be indented!
## """
## ``` ## ```
## > The `countGraphemes` function walks through the entire string to get its answer,
## > so if you want to check whether a string is empty, you'll get much better performance
## > by calling `Str.isEmpty myStr` instead of `Str.countGraphemes myStr == 0`.
## ##
## ### Escape sequences ## In triple-quoted strings, both the opening and closing `"""` must be at the same indentation level. Lines in the string begin at that indentation level; the spaces that indent the multiline string itself are not considered content.
##
## ### Interpolation
##
## *String interpolation* is syntax for inserting a string into another string.
## ##
## If you put a `\` in a Roc string literal, it begins an *escape sequence*.
## An escape sequence is a convenient way to insert certain strings into other strings.
## For example, suppose you write this Roc string:
## ``` ## ```
## "I took the one less traveled by,\nAnd that has made all the difference." ## name = "Sam"
##
## "Hi, my name is $(name)!"
## ``` ## ```
## The `"\n"` in the middle will insert a line break into this string. There are
## other ways of getting a line break in there, but `"\n"` is the most common.
## ##
## Another way you could insert a newlines is by writing `\u(0A)` instead of `\n`. ## This will evaluate to the string `"Hi, my name is Sam!"`
## That would result in the same string, because the `\u` escape sequence inserts
## [Unicode code points](https://unicode.org/glossary/#code_point) directly into
## the string. The Unicode code point 10 is a newline, and 10 is `0A` in hexadecimal.
## `\u` escape sequences are always followed by a hexadecimal number inside `(` and `)`
## like this.
## ##
## As another example, `"R\u(6F)c"` is the same string as `"Roc"`, because ## You can put any expression you like inside the parentheses, as long as it's all on one line:
## `"\u(6F)"` corresponds to the Unicode code point for lowercase `o`. If you
## want to [spice things up a bit](https://en.wikipedia.org/wiki/Metal_umlaut),
## you can write `"R\u(F6)c"` as an alternative way to get the string `"Röc"\.
## ##
## Roc strings also support these escape sequences:
##
## * `\\` - an actual backslash (writing a single `\` always begins an escape sequence!)
## * `\"` - an actual quotation mark (writing a `"` without a `\` ends the string)
## * `\r` - [carriage return](https://en.wikipedia.org/wiki/Carriage_Return)
## * `\t` - [horizontal tab](https://en.wikipedia.org/wiki/Tab_key#Tab_characters)
## * `\v` - [vertical tab](https://en.wikipedia.org/wiki/Tab_key#Tab_characters)
##
## You can also use escape sequences to insert named strings into other strings, like so:
## ``` ## ```
## name = "Lee" ## colors = ["red", "green", "blue"]
## city = "Roctown" ##
## greeting = "Hello there, \(name)! Welcome to \(city)." ## "The colors are $(colors |> Str.joinWith ", ")!"
## ``` ## ```
## Here, `greeting` will become the string `"Hello there, Lee! Welcome to Roctown."`. ##
## This is known as [string interpolation](https://en.wikipedia.org/wiki/String_interpolation), ## Interpolation can be used in multiline strings, but the part inside the parentheses must still be on one line.
## and you can use it as many times as you like inside a string. The name ##
## between the parentheses must refer to a `Str` value that is currently in ## ### Escapes
## scope, and it must be a name - it can't be an arbitrary expression like a function call. ##
## There are a few special escape sequences in strings:
##
## * `\n` becomes a [newline](https://en.wikipedia.org/wiki/Newline)
## * `\r` becomes a [carriage return](https://en.wikipedia.org/wiki/Carriage_return#Computers)
## * `\t` becomes a [tab](https://en.wikipedia.org/wiki/Tab_key#Tab_characters)
## * `\"` becomes a normal `"` (this lets you write `"` inside a single-line string)
## * `\\` becomes a normal `\` (this lets you write `\` without it being treated as an escape)
## * `\$` becomes a normal `$` (this lets you write `$` followed by `(` without it being treated as [interpolation](#interpolation))
##
## These work in both single-line and multiline strings. We'll also discuss another escape later, for inserting [Unicode code points](#code-points) into a string.
##
## ### Single quote syntax
##
## Try putting `'👩'` into `roc repl`. You should see this:
##
## ```
## » '👩'
##
## 128105 : Int *
## ```
##
## The single-quote `'` syntax lets you represent a Unicode code point (discussed in the next section) in source code, in a way that renders as the actual text it represents rather than as a number literal. This lets you see what it looks like in the source code rather than looking at a number.
##
## At runtime, the single-quoted value will be treated the same as an ordinary number literal—in other words, `'👩'` is syntax sugar for writing `128105`. You can verify this in `roc repl`:
##
## ```
## » '👩' == 128105
##
## Bool.true : Bool
## ```
##
## Double quotes (`"`), on the other hand, are not type-compatible with integers—not only because strings can be empty (`""` is valid, but `''` is not) but also because there may be more than one code point involved in any given string!
##
## There are also some special escape sequences in single-quote strings:
##
## * `\n` becomes a [newline](https://en.wikipedia.org/wiki/Newline)
## * `\r` becomes a [carriage return](https://en.wikipedia.org/wiki/Carriage_return#Computers)
## * `\t` becomes a [tab](https://en.wikipedia.org/wiki/Tab_key#Tab_characters)
## * `\'` becomes a normal `'` (this lets you write `'` inside a single-quote string)
## * `\\` becomes a normal `\` (this lets you write `\` without it being treated as an escape)
##
## Most often this single-quote syntax is used when writing parsers; most Roc programs never use it at all.
##
## ## Unicode
##
## Roc strings represent text using [Unicode](https://unicode.org) This guide will provide only a basic overview of Unicode (the [Unicode glossary](http://www.unicode.org/glossary/) has over 500 entries in it), but it will include the most relevant differences between these concepts:
##
## * Code points
## * Graphemes
## * UTF-8
##
## It will also explain why some operations are included in Roc's builtin [Str](https://www.roc-lang.org/builtins/Str)
## module, and why others are in separate packages like [roc-lang/unicode](https://github.com/roc-lang/unicode).
##
## ### Graphemes
##
## Let's start with the following string:
##
## `"👩‍👩‍👦‍👦"`
##
## Some might call this a "character." After all, in a monospace font, it looks to be about the same width as the letter "A" or the punctuation mark "!"—both of which are commonly called "characters." Unfortunately, the term "character" in programming has changed meanings many times across the years and across programming languages, and today it's become a major source of confusion.
##
## Unicode uses the less ambiguous term [*grapheme*](https://www.unicode.org/glossary/#grapheme), which it defines as a "user-perceived character" (as opposed to one of the several historical ways the term "character" has been used in programming) or, alternatively, "A minimally distinctive unit of writing in the context of a particular writing system."
##
## By Unicode's definition, each of the following is an individual grapheme:
##
## * `a`
## * `鹏`
## * `👩‍👩‍👦‍👦`
##
## Note that although *grapheme* is less ambiguous than *character*, its definition is still open to interpretation. To address this, Unicode has formally specified [text segmentation rules](https://www.unicode.org/reports/tr29/) which define grapheme boundaries in precise technical terms. We won't get into those rules here, but since they can change with new Unicode releases, functions for working with graphemes are in the [roc-lang/unicode](https://github.com/roc-lang/unicode) package rather than in the builtin [`Str`](https://www.roc-lang.org/builtins/Str) module. This allows them to be updated without being blocked on a new release of the Roc language.
##
## ### Code Points
##
## Every Unicode text value can be broken down into [Unicode code points](http://www.unicode.org/glossary/#code_point), which are integers between `0` and `285_212_438` that describe components of the text. In memory, every Roc string is a sequence of these integers stored in a format called UTF-8, which will be discussed [later](#utf8).
##
## The string `"👩‍👩‍👦‍👦"` happens to be made up of these code points:
##
## ```
## [128105, 8205, 128105, 8205, 128102, 8205, 128102]
## ```
##
## From this we can see that:
##
## - One grapheme can be made up of multiple code points. In fact, there is no upper limit on how many code points can go into a single grapheme! (Some programming languages use the term "character" to refer to individual code points; this can be confusing for graphemes like 👩‍👩‍👦‍👦 because it visually looks like "one character" but no single code point can represent it.)
## - Sometimes code points repeat within an individual grapheme. Here, 128105 repeats twice, as does 128102, and there's an 8205 in between each of the other code points.
##
## ### Combining Code Points
##
## The reason every other code point in 👩‍👩‍👦‍👦 is 8205 is that code point 8205 joins together other code points. This emoji, known as ["Family: Woman, Woman, Boy, Boy"](https://emojipedia.org/family-woman-woman-boy-boy), is made by combining several emoji using [zero-width joiners](https://emojipedia.org/zero-width-joiner)—which are represented by code point 8205 in memory, and which have no visual repesentation on their own.
##
## Here are those code points again, this time with comments about what they represent:
##
## ```
## [128105] # "👩"
## [8205] # (joiner)
## [128105] # "👩"
## [8205] # (joiner)
## [128102] # "👦"
## [8205] # (joiner)
## [128102] # "👦"
## ```
##
## One way to read this is "woman emoji joined to woman emoji joined to boy emoji joined to boy emoji." Without the joins, it would be:
##
## ```
## "👩👩👦👦"
## ```
##
## With the joins, however, it is instead:
##
## ```
## "👩‍👩‍👦‍👦"
## ```
##
## Even though 👩‍👩‍👦‍👦 is visually smaller when rendered, it takes up almost twice as much memory as 👩👩👦👦 does! That's because it has all the same code points, plus the zero-width joiners in between them.
##
## ### String equality and normalization
##
## Besides emoji like 👩‍👩‍👦‍👦, another classic example of multiple code points being combined to render as one grapheme has to do with accent marks. Try putting these two strings into `roc repl`:
##
## ```
## "caf\u(e9)"
## "cafe\u(301)"
## ```
##
## The `\u(e9)` syntax is a way of inserting code points into string literals. In this case, it's the same as inserting the hexadecimal number `0xe9` as a code point onto the end of the string `"caf"`. Since Unicode code point `0xe9` happens to be `é`, the string `"caf\u(e9)"` ends up being identical in memory to the string `"café"`.
##
## We can verify this too:
##
## ```
## » "caf\u(e9)" == "café"
##
## Bool.true : Bool
## ```
##
## As it turns out, `"cafe\u(301)"` is another way to represent the same word. The Unicode code point 0x301 represents a ["combining acute accent"](https://unicodeplus.com/U+0301)—which essentially means that it will add an accent mark to whatever came before it. In this case, since `"cafe\u(301)"` has an `e` before the `"\u(301)"`, that `e` ends up with an accent mark on it and becomes `é`.
##
## Although these two strings get rendered identically to one another, they are different in memory because their code points are different! We can also confirm this in `roc repl`:
##
## ```
## » "caf\u(e9)" == "cafe\u(301)"
##
## Bool.false : Bool
## ```
##
## As you can imagine, this can be a source of bugs. Not only are they considered unequal, they also hash differently, meaning `"caf\u(e9)"` and `"cafe\u(301)"` can both be separate entries in the same [`Set`](https://www.roc-lang.org/builtins/Set).
##
## One way to prevent problems like these is to perform [Unicode normalization](https://www.unicode.org/reports/tr15/), a process which converts conceptually equivalent strings (like `"caf\u(e9)"` and `"cafe\u(301)"`) into one canonical in-memory representation. This makes equality checks on them pass, among other benefits.
##
## It would be technically possible for Roc to perform string normalization automatically on every equality check. Unfortunately, although some programs might want to treat `"caf\u(e9)"` and `"cafe\u(301)"` as equivalent, for other programs it might actually be important to be able to tell them apart. If these equality checks always passed, then there would be no way to tell them apart!
##
## As such, normalization must be performed explicitly when desired. Like graphemes, Unicode normalization rules can change with new releases of Unicode. As such, these functions are in separate packages instead of builtins (normalization is planned to be in [roc-lang/unicode](https://github.com/roc-lang/unicode) in the future, but it has not yet been implemented) so that updates to these functions based on new Unicode releases can happen without waiting on new releases of the Roc language.
##
## ### Capitalization
##
## We've already seen two examples of Unicode definitions that can change with new Unicode releases: graphemes and normalization. Another is capitalization; these rules can change with new Unicode releases (most often in the form of additions of new languages, but breaking changes to capitalization rules for existing languages are also possible), and so they are not included in builtin [`Str`](https://www.roc-lang.org/builtins/Str).
##
## This might seem particularly surprising, since capitalization functions are commonly included in standard libraries. However, it turns out that "capitalizing an arbitrary string" is impossible to do correctly without additional information.
##
## For example, what is the capitalized version of this string?
##
## ```
## "i"
## ```
##
## * In English, the correct answer is `"I"`.
## * In Turkish, the correct answer is `"İ"`.
##
## Similarly, the correct lowercased version of the string `"I"` is `"i"` in English and `"ı"` in Turkish.
##
## Turkish is not the only language to use this [dotless i](https://en.wikipedia.org/wiki/Dotless_I), and it's an example of how a function which capitalizes strings cannot give correct answers without the additional information of which language's capitalization rules should be used.
##
## Many languages defer to the operating system's [localization](https://en.wikipedia.org/wiki/Internationalization_and_localization) settings for this information. In that design, calling a program's capitalization function with an input string of `"i"` might give an answer of `"I"` on one machine and `"İ"` on a different machine, even though it was the same program running on both systems. Naturally, this can cause bugs—but more than that, writing tests to prevent bugs like this usually requires extra complexity compared to writing ordinary tests.
##
## In general, Roc programs should give the same answers for the same inputs even when run on different machines. There are exceptions to this (e.g. a program running out of system resources on one machine, while being able to make more progress on a machine that has more resources), but operating system's language localization is not among them.
##
## For these reasons, capitalization functions are not in [`Str`](https://www.roc-lang.org/builtins/Str). There is a planned `roc-lang` package to handle use cases like capitalization and sorting—sorting can also vary by language as well as by things like country—but implementation work has not yet started on this package.
##
## ### UTF-8
##
## Earlier, we discussed how Unicode code points can be described as [`U32`](https://www.roc-lang.org/builtins/Num#U32) integers. However, many common code points are very low integers, and can fit into a `U8` instead of needing an entire `U32` to represent them in memory. UTF-8 takes advantage of this, using a variable-width encoding to represent code points in 1-4 bytes, which saves a lot of memory in the typical case—especially compared to [UTF-16](https://en.wikipedia.org/wiki/UTF-16), which always uses at least 2 bytes to represent each code point, or [UTF-32](https://en.wikipedia.org/wiki/UTF-32), which always uses the maximum 4 bytes.
##
## This guide won't cover all the details of UTF-8, but the basic idea is this:
##
## - If a code point is 127 or lower, UTF-8 stores it in 1 byte.
## - If it's between 128 and 2047, UTF-8 stores it in 2 bytes.
## - If it's between 2048 and 65535, UTF-8 stores it in 3 bytes.
## - If it's higher than that, UTF-8 stores it in 4 bytes.
##
## The specific [UTF-8 encoding](https://en.wikipedia.org/wiki/UTF-8#Encoding) of these bytes involves using 1 to 5 bits of each byte for metadata about multi-byte sequences.
##
## A valuable feature of UTF-8 is that it is backwards-compatible with the [ASCII](https://en.wikipedia.org/wiki/ASCII) encoding that was widely used for many years. ASCII existed before Unicode did, and only used the integers 0 to 127 to represent its equivalent of code points. The Unicode code points 0 to 127 represent the same semantic information as ASCII, (e.g. the number 64 represents the letter "A" in both ASCII and in Unicode), and since UTF-8 represents code points 0 to 127 using one byte, all valid ASCII strings can be successfully parsed as UTF-8 without any need for conversion.
##
## Since many textual computer encodings—including [CSV](https://en.wikipedia.org/wiki/CSV), [XML](https://en.wikipedia.org/wiki/XML), and [JSON](https://en.wikipedia.org/wiki/JSON)—do not use any code points above 127 for their delimiters, it is often possible to write parsers for these formats using only `Str` functions which present UTF-8 as raw `U8` sequences, such as [`Str.walkUtf8`](https://www.roc-lang.org/builtins/Str#walkUtf8) and [`Str.toUtf8`](https://www.roc-lang.org/builtins/Str#toUtf8). In the typical case where they do not to need to parse out individual Unicode code points, they can get everything they need from `Str` UTF-8 functions without needing to depend on other packages.
##
## ### When to use code points, graphemes, and UTF-8
##
## Deciding when to use code points, graphemes, and UTF-8 can be nonobvious to say the least!
##
## The way Roc organizes the `Str` module and supporting packages is designed to help answer this question. Every situation is different, but the following rules of thumb are typical:
##
## * Most often, using `Str` values along with helper functions like [`split`](https://www.roc-lang.org/builtins/Str#split), [`joinWith`](https://www.roc-lang.org/builtins/Str#joinWith), and so on, is the best option.
## * If you are specifically implementing a parser, working in UTF-8 bytes is usually the best option. So functions like [`walkUtf8`](https://www.roc-lang.org/builtins/Str#walkUtf8), [toUtf8](https://www.roc-lang.org/builtins/Str#toUtf8), and so on. (Note that single-quote literals produce number literals, so ASCII-range literals like `'a'` gives an integer literal that works with a UTF-8 `U8`.)
## * If you are implementing a Unicode library like [roc-lang/unicode](https://github.com/roc-lang/unicode), working in terms of code points will be unavoidable. Aside from basic readability considerations like `\u(...)` in string literals, if you have the option to avoid working in terms of code points, it is almost always correct to avoid them.
## * If it seems like a good idea to split a string into "characters" (graphemes), you should definitely stop and reconsider whether this is really the best design. Almost always, doing this is some combination of more error-prone or slower (usually both) than doing something else that does not require taking graphemes into consideration.
##
## For this reason (among others), grapheme functions live in [roc-lang/unicode](https://github.com/roc-lang/unicode) rather than in [`Str`](https://www.roc-lang.org/builtins/Str). They are more niche than they seem, so they should not be reached for all the time!
##
## ## Performance
##
## This section deals with how Roc strings are represented in memory, and their performance characteristics.
##
## A normal heap-allocated roc `Str` is represented on the stack as:
## - A "capacity" unsigned integer, which respresents how many bytes are allocated on the heap to hold the string's contents.
## - A "length" unsigned integer, which rerepresents how many of the "capacity" bytes are actually in use. (A `Str` can have more bytes allocated on the heap than are actually in use.)
## - The memory address of the first byte in the string's actual contents.
##
## Each of these three fields is the same size: 64 bits on a 64-bit system, and 32 bits on a 32-bit system. The actual contents of the string are stored in one contiguous sequence of bytes, encoded as UTF-8, often on the heap but sometimes elsewhere—more on this later. Empty strings do not have heap allocations, so an empty `Str` on a 64-bit system still takes up 24 bytes on the stack (due to its three 64-bit fields).
##
## ### Reference counting and opportunistic mutation
##
## Like lists, dictionaries, and sets, Roc strings are automatically reference-counted and can benefit from opportunistic in-place mutation. The reference count is stored on the heap immediately before the first byte of the string's contents, and it has the same size as a memory address. This means it can count so high that it's impossible to write a Roc program which overflows a reference count, because having that many simultaneous references (each of which is a memory address) would have exhausted the operating system's address space first.
##
## When the string's reference count is 1, functions like [`Str.concat`](https://www.roc-lang.org/builtins/Str#concat) and [`Str.replaceEach`](https://www.roc-lang.org/builtins/Str#replaceEach) mutate the string in-place rather than allocating a new string. This preserves semantic immutability because it is unobservable in terms of the operation's output; if the reference count is 1, it means that memory would have otherwise been deallocated immediately anyway, and it's more efficient to reuse it instead of deallocating it and then immediately making a new allocation.
##
## The contents of statically-known strings (today that means string literals) are stored in the readonly section of the binary, so they do not need heap allocations or reference counts. They are not eligible for in-place mutation, since mutating the readonly section of the binary would cause an operating system [access violation](https://en.wikipedia.org/wiki/Segmentation_fault).
##
## ### Small String Optimization
##
## Roc uses a "small string optimization" when representing certain strings in memory.
##
## If you have a sufficiently long string, then on a 64-bit system it will be represented on the stack using 24 bytes, and on a 32-bit system it will take 12 bytes—plus however many bytes are in the string itself—on the heap. However, if there is a string shorter than either of these stack sizes (so, a string of up to 23 bytes on a 64-bit system, and up to 11 bytes on a 32-bit system), then that string will be stored entirely on the stack rather than having a separate heap allocation at all.
##
## This can be much more memory-efficient! However, `List` does not have this optimization (it has some runtime cost, and in the case of `List` it's not anticipated to come up nearly as often), which means when converting a small string to `List U8` it can result in a heap allocation.
##
## Note that this optimization is based entirely on how many UTF-8 bytes the string takes up in memory. It doesn't matter how many [graphemes](#graphemes), [code points](#code-points) or anything else it has; the only factor that determines whether a particular string is eligible for the small string optimization is the number of UTF-8 bytes it takes up in memory!
##
## ### Seamless Slices
##
## Try putting this into `roc repl`:
##
## ```
## » "foo/bar/baz" |> Str.split "/"
##
## ["foo", "bar", "baz"] : List Str
## ```
##
## All of these strings are small enough that the [small string optimization](#small) will apply, so none of them will be allocated on the heap.
##
## Now let's suppose they were long enough that this optimization no longer applied:
##
## ```
## » "a much, much, much, much/longer/string compared to the last one!" |> Str.split "/"
##
## ["a much, much, much, much", "longer", "string compared to the last one!"] : List Str
## ```
##
## Here, the only strings small enough for the small string optimization are `"/"` and `"longer"`. They will be allocated on the stack.
##
## The first and last strings in the returned list `"a much, much, much, much"` and `"string compared to the last one!"` will not be allocated on the heap either. Instead, they will be *seamless slices*, which means they will share memory with the original input string.
##
## * `"a much, much, much, much"` will share the first 24 bytes of the original string.
## * `"string compared to the last one!"` will share the last 32 bytes of the original string.
##
## All of these strings are semantically immutable, so sharing these bytes is an implementation detail that should only affect performance. By design, there is no way at either compile time or runtime to tell whether a string is a seamless slice. This allows the optimization's behavior to change in the future without affecting Roc programs' semantic behavior.
##
## Seamless slices create additional references to the original string, which make it ineligible for opportunistic mutation (along with the slices themselves; slices are never eligible for mutation), and which also make it take longer before the original string can be deallocated. A case where this might be noticeable in terms of performance would be:
## 1. A function takes a very large string as an argument and returns a much smaller slice into that string.
## 2. The smaller slice is used for a long time in the program, whereas the much larger original string stops being used.
## 3. In this situation, it might have been better for total program memory usage (although not necessarily overall performance) if the original large string could have been deallocated sooner, even at the expense of having to copy the smaller string into a new allocation instead of reusing the bytes with a seamless slice.
##
## If a situation like this comes up, a slice can be turned into a separate string by using [`Str.concat`](https://www.roc-lang.org/builtins/Str#concat) to concatenate the slice onto an empty string (or one created with [`Str.withCapacity`](https://www.roc-lang.org/builtins/Str#withCapacity)).
##
## Currently, the only way to get seamless slices of strings is by calling certain `Str` functions which return them. In general, `Str` functions which accept a string and return a subset of that string tend to do this. [`Str.trim`](https://www.roc-lang.org/builtins/Str#trim) is another example of a function which returns a seamless slice.
interface Str interface Str
exposes [ exposes [
Utf8Problem, Utf8Problem,
@ -94,9 +335,7 @@ interface Str
joinWith, joinWith,
split, split,
repeat, repeat,
countGraphemes,
countUtf8Bytes, countUtf8Bytes,
startsWithScalar,
toUtf8, toUtf8,
fromUtf8, fromUtf8,
fromUtf8Range, fromUtf8Range,
@ -119,7 +358,6 @@ interface Str
toI16, toI16,
toU8, toU8,
toI8, toI8,
toScalars,
replaceEach, replaceEach,
replaceFirst, replaceFirst,
replaceLast, replaceLast,
@ -129,12 +367,8 @@ interface Str
walkUtf8WithIndex, walkUtf8WithIndex,
reserve, reserve,
releaseExcessCapacity, releaseExcessCapacity,
appendScalar,
walkScalars,
walkScalarsUntil,
withCapacity, withCapacity,
withPrefix, withPrefix,
graphemes,
contains, contains,
] ]
imports [ imports [
@ -265,8 +499,7 @@ joinWith : List Str, Str -> Str
## Split a string around a separator. ## Split a string around a separator.
## ##
## Passing `""` for the separator is not useful; ## Passing `""` for the separator is not useful;
## it returns the original string wrapped in a [List]. To split a string ## it returns the original string wrapped in a [List].
## into its individual [graphemes](https://stackoverflow.com/a/27331885/4200103), use `Str.graphemes`
## ``` ## ```
## expect Str.split "1,2,3" "," == ["1","2","3"] ## expect Str.split "1,2,3" "," == ["1","2","3"]
## expect Str.split "1,2,3" "" == ["1,2,3"] ## expect Str.split "1,2,3" "" == ["1,2,3"]
@ -285,78 +518,6 @@ split : Str, Str -> List Str
## ``` ## ```
repeat : Str, Nat -> Str repeat : Str, Nat -> Str
## Counts the number of [extended grapheme clusters](http://www.unicode.org/glossary/#extended_grapheme_cluster)
## in the string.
##
## Note that the number of extended grapheme clusters can be different from the number
## of visual glyphs rendered! Consider the following examples:
## ```
## expect Str.countGraphemes "Roc" == 3
## expect Str.countGraphemes "👩‍👩‍👦‍👦" == 4
## expect Str.countGraphemes "🕊" == 1
## ```
## Note that "👩‍👩‍👦‍👦" takes up 4 graphemes (even though visually it appears as a single
## glyph) because under the hood it's represented using an emoji modifier sequence.
## In contrast, "🕊" only takes up 1 grapheme because under the hood it's represented
## using a single Unicode code point.
countGraphemes : Str -> Nat
## Split a string into its constituent graphemes.
##
## This function breaks a string into its individual [graphemes](https://stackoverflow.com/a/27331885/4200103),
## returning them as a list of strings. This is useful for working with text that
## contains complex characters, such as emojis.
##
## Examples:
## ```
## expect Str.graphemes "Roc" == ["R", "o", "c"]
## expect Str.graphemes "नमस्ते" == ["न", "म", "स्", "ते"]
## expect Str.graphemes "👩‍👩‍👦‍👦" == ["👩‍", "👩‍", "👦‍", "👦"]
## ```
##
## Note that the "👩‍👩‍👦‍👦" example consists of 4 grapheme clusters, although it visually
## appears as a single glyph. This is because it uses an emoji modifier sequence.
graphemes : Str -> List Str
## If the string begins with a [Unicode code point](http://www.unicode.org/glossary/#code_point)
## equal to the given [U32], returns [Bool.true]. Otherwise returns [Bool.false].
##
## If the given string is empty, or if the given [U32] is not a valid
## code point, returns [Bool.false].
## ```
## expect Str.startsWithScalar "鹏 means 'roc'" 40527 # "鹏" is Unicode scalar 40527
## expect !Str.startsWithScalar "9" 9 # the Unicode scalar for "9" is 57, not 9
## expect !Str.startsWithScalar "" 40527
## ```
##
## ## Performance Details
##
## This runs slightly faster than [Str.startsWith], so
## if you want to check whether a string begins with something that's representable
## in a single code point, you can use (for example) `Str.startsWithScalar '鹏'`
## instead of `Str.startsWith "鹏"`. ('鹏' evaluates to the [U32] value `40527`.)
## This will not work for graphemes which take up multiple code points, however;
## `Str.startsWithScalar '👩‍👩‍👦‍👦'` would be a compiler error because 👩‍👩‍👦‍👦 takes up
## multiple code points and cannot be represented as a single [U32].
## You'd need to use `Str.startsWithScalar "🕊"` instead.
startsWithScalar : Str, U32 -> Bool
## Returns a [List] of the [Unicode scalar values](https://unicode.org/glossary/#unicode_scalar_value)
## in the given string.
##
## (Roc strings contain only scalar values, not [surrogate code points](https://unicode.org/glossary/#surrogate_code_point),
## so this is equivalent to returning a list of the string's [code points](https://unicode.org/glossary/#code_point).)
## ```
## expect Str.toScalars "Roc" == [82, 111, 99]
## expect Str.toScalars "鹏" == [40527]
## expect Str.toScalars "சி" == [2970, 3007]
## expect Str.toScalars "🐦" == [128038]
## expect Str.toScalars "👩‍👩‍👦‍👦" == [128105, 8205, 128105, 8205, 128102, 8205, 128102]
## expect Str.toScalars "I ♥ Roc" == [73, 32, 9829, 32, 82, 111, 99]
## expect Str.toScalars "" == []
## ```
toScalars : Str -> List U32
## Returns a [List] of the string's [U8] UTF-8 [code units](https://unicode.org/glossary/#code_unit). ## Returns a [List] of the string's [U8] UTF-8 [code units](https://unicode.org/glossary/#code_unit).
## (To split the string into a [List] of smaller [Str] values instead of [U8] values, ## (To split the string into a [List] of smaller [Str] values instead of [U8] values,
## see [Str.split].) ## see [Str.split].)
@ -907,80 +1068,6 @@ expect (walkUtf8 "鹏" [] List.append) == [233, 185, 143]
## Note: This will also convert seamless slices to regular lists. ## Note: This will also convert seamless slices to regular lists.
releaseExcessCapacity : Str -> Str releaseExcessCapacity : Str -> Str
## is UB when the scalar is invalid
appendScalarUnsafe : Str, U32 -> Str
## Append a [U32] scalar to the given string. If the given scalar is not a valid
## unicode value, it returns [Err InvalidScalar].
## ```
## expect Str.appendScalar "H" 105 == Ok "Hi"
## expect Str.appendScalar "😢" 0xabcdef == Err InvalidScalar
## ```
appendScalar : Str, U32 -> Result Str [InvalidScalar]
appendScalar = \string, scalar ->
if isValidScalar scalar then
Ok (appendScalarUnsafe string scalar)
else
Err InvalidScalar
isValidScalar : U32 -> Bool
isValidScalar = \scalar ->
scalar <= 0xD7FF || (scalar >= 0xE000 && scalar <= 0x10FFFF)
getScalarUnsafe : Str, Nat -> { scalar : U32, bytesParsed : Nat }
## Walks over the unicode [U32] values for the given [Str] and calls a function
## to update state for each.
## ```
## f : List U32, U32 -> List U32
## f = \state, scalar -> List.append state scalar
## expect Str.walkScalars "ABC" [] f == [65, 66, 67]
## ```
walkScalars : Str, state, (state, U32 -> state) -> state
walkScalars = \string, init, step ->
walkScalarsHelp string init step 0 (Str.countUtf8Bytes string)
walkScalarsHelp : Str, state, (state, U32 -> state), Nat, Nat -> state
walkScalarsHelp = \string, state, step, index, length ->
if index < length then
{ scalar, bytesParsed } = getScalarUnsafe string index
newState = step state scalar
walkScalarsHelp string newState step (Num.addWrap index bytesParsed) length
else
state
## Walks over the unicode [U32] values for the given [Str] and calls a function
## to update state for each.
## ```
## f : List U32, U32 -> [Break (List U32), Continue (List U32)]
## f = \state, scalar ->
## check = 66
## if scalar == check then
## Break [check]
## else
## Continue (List.append state scalar)
## expect Str.walkScalarsUntil "ABC" [] f == [66]
## expect Str.walkScalarsUntil "AxC" [] f == [65, 120, 67]
## ```
walkScalarsUntil : Str, state, (state, U32 -> [Break state, Continue state]) -> state
walkScalarsUntil = \string, init, step ->
walkScalarsUntilHelp string init step 0 (Str.countUtf8Bytes string)
walkScalarsUntilHelp : Str, state, (state, U32 -> [Break state, Continue state]), Nat, Nat -> state
walkScalarsUntilHelp = \string, state, step, index, length ->
if index < length then
{ scalar, bytesParsed } = getScalarUnsafe string index
when step state scalar is
Continue newState ->
walkScalarsUntilHelp string newState step (Num.addWrap index bytesParsed) length
Break newState ->
newState
else
state
strToNum : Str -> { berrorcode : U8, aresult : Num * } strToNum : Str -> { berrorcode : U8, aresult : Num * }
strToNumHelp : Str -> Result (Num a) [InvalidNumStr] strToNumHelp : Str -> Result (Num a) [InvalidNumStr]

View file

@ -43,7 +43,7 @@ interface TotallyNotJson
## An opaque type with the `EncoderFormatting` and ## An opaque type with the `EncoderFormatting` and
## `DecoderFormatting` abilities. ## `DecoderFormatting` abilities.
Json := { fieldNameMapping : FieldNameMapping } Json := {}
implements [ implements [
EncoderFormatting { EncoderFormatting {
u8: encodeU8, u8: encodeU8,
@ -89,21 +89,11 @@ Json := { fieldNameMapping : FieldNameMapping }
] ]
## Returns a JSON `Encoder` and `Decoder` ## Returns a JSON `Encoder` and `Decoder`
json = @Json { fieldNameMapping: Default } json = @Json {}
## Returns a JSON `Encoder` and `Decoder` with configuration options ## Returns a JSON `Encoder` and `Decoder` with configuration options
jsonWithOptions = \{ fieldNameMapping ? Default } -> jsonWithOptions = \{} ->
@Json { fieldNameMapping } @Json {}
## Mapping between Roc record fields and JSON object names
FieldNameMapping : [
Default, # no transformation
SnakeCase, # snake_case
PascalCase, # PascalCase
KebabCase, # kabab-case
CamelCase, # camelCase
Custom (Str -> Str), # provide a custom formatting
]
# TODO encode as JSON numbers as base 10 decimal digits # TODO encode as JSON numbers as base 10 decimal digits
# e.g. the REPL `Num.toStr 12e42f64` gives # e.g. the REPL `Num.toStr 12e42f64` gives
@ -171,14 +161,6 @@ encodeBool = \b ->
else else
List.concat bytes (Str.toUtf8 "false") List.concat bytes (Str.toUtf8 "false")
# Test encode boolean
expect
input = [Bool.true, Bool.false]
actual = Encode.toBytes input json
expected = Str.toUtf8 "[true,false]"
actual == expected
encodeString = \str -> encodeString = \str ->
Encode.custom \bytes, @Json {} -> Encode.custom \bytes, @Json {} ->
List.concat bytes (encodeStrBytes str) List.concat bytes (encodeStrBytes str)
@ -248,38 +230,10 @@ escapedByteToJson = \b ->
0x09 -> [0x5c, 'r'] # U+0009 Tab 0x09 -> [0x5c, 'r'] # U+0009 Tab
_ -> [b] _ -> [b]
expect escapedByteToJson '\n' == ['\\', 'n']
expect escapedByteToJson '\\' == ['\\', '\\']
expect escapedByteToJson '"' == ['\\', '"']
# Test encode small string
expect
input = "G'day"
actual = Encode.toBytes input json
expected = Str.toUtf8 "\"G'day\""
actual == expected
# Test encode large string
expect
input = "the quick brown fox jumps over the lazy dog"
actual = Encode.toBytes input json
expected = Str.toUtf8 "\"the quick brown fox jumps over the lazy dog\""
actual == expected
# Test encode with escapes e.g. "\r" encodes to "\\r"
expect
input = "the quick brown fox jumps over the lazy doga\r\nbc\\\"xz"
actual = Encode.toBytes input json
expected = Str.toUtf8 "\"the quick brown fox jumps over the lazy doga\\r\\nbc\\\\\\\"xz\""
actual == expected
encodeList = \lst, encodeElem -> encodeList = \lst, encodeElem ->
Encode.custom \bytes, @Json { fieldNameMapping } -> Encode.custom \bytes, @Json {} ->
writeList = \{ buffer, elemsLeft }, elem -> writeList = \{ buffer, elemsLeft }, elem ->
bufferWithElem = appendWith buffer (encodeElem elem) (@Json { fieldNameMapping }) bufferWithElem = appendWith buffer (encodeElem elem) (@Json {})
bufferWithSuffix = bufferWithSuffix =
if elemsLeft > 1 then if elemsLeft > 1 then
List.append bufferWithElem (Num.toU8 ',') List.append bufferWithElem (Num.toU8 ',')
@ -293,27 +247,16 @@ encodeList = \lst, encodeElem ->
List.append withList (Num.toU8 ']') List.append withList (Num.toU8 ']')
# Test encode list of floats
expect
input : List F64
input = [-1, 0.00001, 1e12, 2.0e-2, 0.0003, 43]
actual = Encode.toBytes input json
expected = Str.toUtf8 "[-1,0.00001,1000000000000,0.02,0.0003,43]"
actual == expected
encodeRecord = \fields -> encodeRecord = \fields ->
Encode.custom \bytes, @Json { fieldNameMapping } -> Encode.custom \bytes, @Json {} ->
writeRecord = \{ buffer, fieldsLeft }, { key, value } -> writeRecord = \{ buffer, fieldsLeft }, { key, value } ->
fieldName = key
fieldName = toObjectNameUsingMap key fieldNameMapping
bufferWithKeyValue = bufferWithKeyValue =
List.append buffer (Num.toU8 '"') List.append buffer (Num.toU8 '"')
|> List.concat (Str.toUtf8 fieldName) |> List.concat (Str.toUtf8 fieldName)
|> List.append (Num.toU8 '"') |> List.append (Num.toU8 '"')
|> List.append (Num.toU8 ':') # Note we need to encode using the json config here |> List.append (Num.toU8 ':') # Note we need to encode using the json config here
|> appendWith value (@Json { fieldNameMapping }) |> appendWith value (@Json {})
bufferWithSuffix = bufferWithSuffix =
if fieldsLeft > 1 then if fieldsLeft > 1 then
@ -328,52 +271,11 @@ encodeRecord = \fields ->
List.append bytesWithRecord (Num.toU8 '}') List.append bytesWithRecord (Num.toU8 '}')
# Test encode for a record with two strings ignoring whitespace
expect
input = { fruitCount: 2, ownerName: "Farmer Joe" }
encoder = jsonWithOptions { fieldNameMapping: PascalCase }
actual = Encode.toBytes input encoder
expected = Str.toUtf8 "{\"FruitCount\":2,\"OwnerName\":\"Farmer Joe\"}"
actual == expected
# Test encode of record with an array of strings and a boolean field
expect
input = { fruitFlavours: ["Apples", "Bananas", "Pears"], isFresh: Bool.true }
encoder = jsonWithOptions { fieldNameMapping: KebabCase }
actual = Encode.toBytes input encoder
expected = Str.toUtf8 "{\"fruit-flavours\":[\"Apples\",\"Bananas\",\"Pears\"],\"is-fresh\":true}"
actual == expected
# Test encode of record with a string and number field
expect
input = { firstSegment: "ab", secondSegment: 10u8 }
encoder = jsonWithOptions { fieldNameMapping: SnakeCase }
actual = Encode.toBytes input encoder
expected = Str.toUtf8 "{\"first_segment\":\"ab\",\"second_segment\":10}"
actual == expected
# Test encode of record of a record
expect
input = { outer: { inner: "a" }, other: { one: "b", two: 10u8 } }
encoder = jsonWithOptions { fieldNameMapping: Custom toYellingCase }
actual = Encode.toBytes input encoder
expected = Str.toUtf8 "{\"OTHER\":{\"ONE\":\"b\",\"TWO\":10},\"OUTER\":{\"INNER\":\"a\"}}"
actual == expected
toYellingCase = \str ->
Str.graphemes str
|> List.map toUppercase
|> Str.joinWith ""
encodeTuple = \elems -> encodeTuple = \elems ->
Encode.custom \bytes, @Json { fieldNameMapping } -> Encode.custom \bytes, @Json {} ->
writeTuple = \{ buffer, elemsLeft }, elemEncoder -> writeTuple = \{ buffer, elemsLeft }, elemEncoder ->
bufferWithElem = bufferWithElem =
appendWith buffer elemEncoder (@Json { fieldNameMapping }) appendWith buffer elemEncoder (@Json {})
bufferWithSuffix = bufferWithSuffix =
if elemsLeft > 1 then if elemsLeft > 1 then
@ -387,20 +289,11 @@ encodeTuple = \elems ->
{ buffer: bytesWithRecord } = List.walk elems { buffer: bytesHead, elemsLeft: List.len elems } writeTuple { buffer: bytesWithRecord } = List.walk elems { buffer: bytesHead, elemsLeft: List.len elems } writeTuple
List.append bytesWithRecord (Num.toU8 ']') List.append bytesWithRecord (Num.toU8 ']')
# Test encode of tuple
expect
input = ("The Answer is", 42)
actual = Encode.toBytes input json
expected = Str.toUtf8 "[\"The Answer is\",42]"
actual == expected
encodeTag = \name, payload -> encodeTag = \name, payload ->
Encode.custom \bytes, @Json { fieldNameMapping } -> Encode.custom \bytes, @Json {} ->
# Idea: encode `A v1 v2` as `{"A": [v1, v2]}` # Idea: encode `A v1 v2` as `{"A": [v1, v2]}`
writePayload = \{ buffer, itemsLeft }, encoder -> writePayload = \{ buffer, itemsLeft }, encoder ->
bufferWithValue = appendWith buffer encoder (@Json { fieldNameMapping }) bufferWithValue = appendWith buffer encoder (@Json {})
bufferWithSuffix = bufferWithSuffix =
if itemsLeft > 1 then if itemsLeft > 1 then
List.append bufferWithValue (Num.toU8 ',') List.append bufferWithValue (Num.toU8 ',')
@ -422,15 +315,6 @@ encodeTag = \name, payload ->
List.append bytesWithPayload (Num.toU8 ']') List.append bytesWithPayload (Num.toU8 ']')
|> List.append (Num.toU8 '}') |> List.append (Num.toU8 '}')
# Test encode of tag
expect
input = TheAnswer "is" 42
encoder = jsonWithOptions { fieldNameMapping: KebabCase }
actual = Encode.toBytes input encoder
expected = Str.toUtf8 "{\"TheAnswer\":[\"is\",42]}"
actual == expected
decodeU8 = Decode.custom \bytes, @Json {} -> decodeU8 = Decode.custom \bytes, @Json {} ->
{ taken, rest } = takeJsonNumber bytes { taken, rest } = takeJsonNumber bytes
@ -1334,7 +1218,7 @@ expect
# JSON OBJECTS ----------------------------------------------------------------- # JSON OBJECTS -----------------------------------------------------------------
decodeRecord = \initialState, stepField, finalizer -> Decode.custom \bytes, @Json { fieldNameMapping } -> decodeRecord = \initialState, stepField, finalizer -> Decode.custom \bytes, @Json {} ->
# Recursively build up record from object field:value pairs # Recursively build up record from object field:value pairs
decodeFields = \recordState, bytesBeforeField -> decodeFields = \recordState, bytesBeforeField ->
@ -1361,8 +1245,7 @@ decodeRecord = \initialState, stepField, finalizer -> Decode.custom \bytes, @Jso
# Decode the json value # Decode the json value
{ val: updatedRecord, rest: bytesAfterValue } <- { val: updatedRecord, rest: bytesAfterValue } <-
( (
fieldName = fieldName = objectName
fromObjectNameUsingMap objectName fieldNameMapping
# Retrieve value decoder for the current field # Retrieve value decoder for the current field
when stepField recordState fieldName is when stepField recordState fieldName is
@ -1375,7 +1258,7 @@ decodeRecord = \initialState, stepField, finalizer -> Decode.custom \bytes, @Jso
Keep valueDecoder -> Keep valueDecoder ->
# Decode the value using the decoder from the recordState # Decode the value using the decoder from the recordState
# Note we need to pass json config options recursively here # Note we need to pass json config options recursively here
Decode.decodeWith valueBytes valueDecoder (@Json { fieldNameMapping }) Decode.decodeWith valueBytes valueDecoder (@Json {})
) )
|> tryDecode |> tryDecode
@ -1444,327 +1327,3 @@ ObjectState : [
AfterClosingBrace Nat, AfterClosingBrace Nat,
InvalidObject, InvalidObject,
] ]
# Test decode of record with two strings ignoring whitespace
expect
input = Str.toUtf8 " {\n\"FruitCount\"\t:2\n, \"OwnerName\": \"Farmer Joe\" } "
decoder = jsonWithOptions { fieldNameMapping: PascalCase }
actual = Decode.fromBytesPartial input decoder
expected = Ok { fruitCount: 2, ownerName: "Farmer Joe" }
actual.result == expected
# Test decode of record with an array of strings and a boolean field
expect
input = Str.toUtf8 "{\"fruit-flavours\": [\"Apples\",\"Bananas\",\"Pears\"], \"is-fresh\": true }"
decoder = jsonWithOptions { fieldNameMapping: KebabCase }
actual = Decode.fromBytesPartial input decoder
expected = Ok { fruitFlavours: ["Apples", "Bananas", "Pears"], isFresh: Bool.true }
actual.result == expected
# Test decode of record with a string and number field
expect
input = Str.toUtf8 "{\"first_segment\":\"ab\",\"second_segment\":10}"
decoder = jsonWithOptions { fieldNameMapping: SnakeCase }
actual = Decode.fromBytesPartial input decoder
expected = Ok { firstSegment: "ab", secondSegment: 10u8 }
actual.result == expected
# Test decode of record of a record
expect
input = Str.toUtf8 "{\"OUTER\":{\"INNER\":\"a\"},\"OTHER\":{\"ONE\":\"b\",\"TWO\":10}}"
decoder = jsonWithOptions { fieldNameMapping: Custom fromYellingCase }
actual = Decode.fromBytesPartial input decoder
expected = Ok { outer: { inner: "a" }, other: { one: "b", two: 10u8 } }
actual.result == expected
fromYellingCase = \str ->
Str.graphemes str
|> List.map toLowercase
|> Str.joinWith ""
expect fromYellingCase "YELLING" == "yelling"
# Complex example from IETF RFC 8259 (2017)
complexExampleJson = Str.toUtf8 "{\"Image\":{\"Animated\":false,\"Height\":600,\"Ids\":[116,943,234,38793],\"Thumbnail\":{\"Height\":125,\"Url\":\"http:\\/\\/www.example.com\\/image\\/481989943\",\"Width\":100},\"Title\":\"View from 15th Floor\",\"Width\":800}}"
complexExampleRecord = {
image: {
width: 800,
height: 600,
title: "View from 15th Floor",
thumbnail: {
url: "http://www.example.com/image/481989943",
height: 125,
width: 100,
},
animated: Bool.false,
ids: [116, 943, 234, 38793],
},
}
# Test decode of Complex Example
expect
input = complexExampleJson
decoder = jsonWithOptions { fieldNameMapping: PascalCase }
actual = Decode.fromBytes input decoder
expected = Ok complexExampleRecord
actual == expected
# Test encode of Complex Example
expect
input = complexExampleRecord
encoder = jsonWithOptions { fieldNameMapping: PascalCase }
actual = Encode.toBytes input encoder
expected = complexExampleJson
actual == expected
fromObjectNameUsingMap : Str, FieldNameMapping -> Str
fromObjectNameUsingMap = \objectName, fieldNameMapping ->
when fieldNameMapping is
Default -> objectName
SnakeCase -> fromSnakeCase objectName
PascalCase -> fromPascalCase objectName
KebabCase -> fromKebabCase objectName
CamelCase -> fromCamelCase objectName
Custom transformation -> transformation objectName
toObjectNameUsingMap : Str, FieldNameMapping -> Str
toObjectNameUsingMap = \fieldName, fieldNameMapping ->
when fieldNameMapping is
Default -> fieldName
SnakeCase -> toSnakeCase fieldName
PascalCase -> toPascalCase fieldName
KebabCase -> toKebabCase fieldName
CamelCase -> toCamelCase fieldName
Custom transformation -> transformation fieldName
# Convert a `snake_case` JSON Object name to a Roc Field name
fromSnakeCase = \str ->
snakeToCamel str
# Convert a `PascalCase` JSON Object name to a Roc Field name
fromPascalCase = \str ->
pascalToCamel str
# Convert a `kabab-case` JSON Object name to a Roc Field name
fromKebabCase = \str ->
kebabToCamel str
# Convert a `camelCase` JSON Object name to a Roc Field name
fromCamelCase = \str ->
# Nothing to change as Roc field names are camelCase by default
str
# Convert a `camelCase` Roc Field name to a `snake_case` JSON Object name
toSnakeCase = \str ->
camelToSnake str
# Convert a `camelCase` Roc Field name to a `PascalCase` JSON Object name
toPascalCase = \str ->
camelToPascal str
# Convert a `camelCase` Roc Field name to a `kabab-case` JSON Object name
toKebabCase = \str ->
camelToKebeb str
# Convert a `camelCase` Roc Field name to a `camelCase` JSON Object name
toCamelCase = \str ->
# Nothing to change as Roc field names are camelCase by default
str
snakeToCamel : Str -> Str
snakeToCamel = \str ->
segments = Str.split str "_"
when segments is
[first, ..] ->
segments
|> List.dropFirst 1
|> List.map uppercaseFirst
|> List.prepend first
|> Str.joinWith ""
_ -> str
expect snakeToCamel "snake_case_string" == "snakeCaseString"
pascalToCamel : Str -> Str
pascalToCamel = \str ->
segments = Str.graphemes str
when segments is
[a, ..] ->
first = toLowercase a
rest = List.dropFirst segments 1
Str.joinWith (List.prepend rest first) ""
_ -> str
expect pascalToCamel "PascalCaseString" == "pascalCaseString"
kebabToCamel : Str -> Str
kebabToCamel = \str ->
segments = Str.split str "-"
when segments is
[first, ..] ->
segments
|> List.dropFirst 1
|> List.map uppercaseFirst
|> List.prepend first
|> Str.joinWith ""
_ -> str
expect kebabToCamel "kebab-case-string" == "kebabCaseString"
camelToPascal : Str -> Str
camelToPascal = \str ->
segments = Str.graphemes str
when segments is
[a, ..] ->
first = toUppercase a
rest = List.dropFirst segments 1
Str.joinWith (List.prepend rest first) ""
_ -> str
expect camelToPascal "someCaseString" == "SomeCaseString"
camelToKebeb : Str -> Str
camelToKebeb = \str ->
rest = Str.graphemes str
taken = List.withCapacity (List.len rest)
camelToKebabHelp { taken, rest }
|> .taken
|> Str.joinWith ""
camelToKebabHelp : { taken : List Str, rest : List Str } -> { taken : List Str, rest : List Str }
camelToKebabHelp = \{ taken, rest } ->
when rest is
[] -> { taken, rest }
[a, ..] if isUpperCase a ->
camelToKebabHelp {
taken: List.concat taken ["-", toLowercase a],
rest: List.dropFirst rest 1,
}
[a, ..] ->
camelToKebabHelp {
taken: List.append taken a,
rest: List.dropFirst rest 1,
}
expect camelToKebeb "someCaseString" == "some-case-string"
camelToSnake : Str -> Str
camelToSnake = \str ->
rest = Str.graphemes str
taken = List.withCapacity (List.len rest)
camelToSnakeHelp { taken, rest }
|> .taken
|> Str.joinWith ""
camelToSnakeHelp : { taken : List Str, rest : List Str } -> { taken : List Str, rest : List Str }
camelToSnakeHelp = \{ taken, rest } ->
when rest is
[] -> { taken, rest }
[a, ..] if isUpperCase a ->
camelToSnakeHelp {
taken: List.concat taken ["_", toLowercase a],
rest: List.dropFirst rest 1,
}
[a, ..] ->
camelToSnakeHelp {
taken: List.append taken a,
rest: List.dropFirst rest 1,
}
expect camelToSnake "someCaseString" == "some_case_string"
uppercaseFirst : Str -> Str
uppercaseFirst = \str ->
segments = Str.graphemes str
when segments is
[a, ..] ->
first = toUppercase a
rest = List.dropFirst segments 1
Str.joinWith (List.prepend rest first) ""
_ -> str
toUppercase : Str -> Str
toUppercase = \str ->
when str is
"a" -> "A"
"b" -> "B"
"c" -> "C"
"d" -> "D"
"e" -> "E"
"f" -> "F"
"g" -> "G"
"h" -> "H"
"i" -> "I"
"j" -> "J"
"k" -> "K"
"l" -> "L"
"m" -> "M"
"n" -> "N"
"o" -> "O"
"p" -> "P"
"q" -> "Q"
"r" -> "R"
"s" -> "S"
"t" -> "T"
"u" -> "U"
"v" -> "V"
"w" -> "W"
"x" -> "X"
"y" -> "Y"
"z" -> "Z"
_ -> str
toLowercase : Str -> Str
toLowercase = \str ->
when str is
"A" -> "a"
"B" -> "b"
"C" -> "c"
"D" -> "d"
"E" -> "e"
"F" -> "f"
"G" -> "g"
"H" -> "h"
"I" -> "i"
"J" -> "j"
"K" -> "k"
"L" -> "l"
"M" -> "m"
"N" -> "n"
"O" -> "o"
"P" -> "p"
"Q" -> "q"
"R" -> "r"
"S" -> "s"
"T" -> "t"
"U" -> "u"
"V" -> "v"
"W" -> "w"
"X" -> "x"
"Y" -> "y"
"Z" -> "z"
_ -> str
isUpperCase : Str -> Bool
isUpperCase = \str ->
when str is
"A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" -> Bool.true
_ -> Bool.false

View file

@ -341,13 +341,10 @@ pub const STR_COUNT_SEGMENTS: &str = "roc_builtins.str.count_segments";
pub const STR_CONCAT: &str = "roc_builtins.str.concat"; pub const STR_CONCAT: &str = "roc_builtins.str.concat";
pub const STR_JOIN_WITH: &str = "roc_builtins.str.joinWith"; pub const STR_JOIN_WITH: &str = "roc_builtins.str.joinWith";
pub const STR_SPLIT: &str = "roc_builtins.str.str_split"; pub const STR_SPLIT: &str = "roc_builtins.str.str_split";
pub const STR_TO_SCALARS: &str = "roc_builtins.str.to_scalars";
pub const STR_COUNT_GRAPEHEME_CLUSTERS: &str = "roc_builtins.str.count_grapheme_clusters";
pub const STR_COUNT_UTF8_BYTES: &str = "roc_builtins.str.count_utf8_bytes"; pub const STR_COUNT_UTF8_BYTES: &str = "roc_builtins.str.count_utf8_bytes";
pub const STR_IS_EMPTY: &str = "roc_builtins.str.is_empty"; pub const STR_IS_EMPTY: &str = "roc_builtins.str.is_empty";
pub const STR_CAPACITY: &str = "roc_builtins.str.capacity"; pub const STR_CAPACITY: &str = "roc_builtins.str.capacity";
pub const STR_STARTS_WITH: &str = "roc_builtins.str.starts_with"; pub const STR_STARTS_WITH: &str = "roc_builtins.str.starts_with";
pub const STR_STARTS_WITH_SCALAR: &str = "roc_builtins.str.starts_with_scalar";
pub const STR_ENDS_WITH: &str = "roc_builtins.str.ends_with"; pub const STR_ENDS_WITH: &str = "roc_builtins.str.ends_with";
pub const STR_NUMBER_OF_BYTES: &str = "roc_builtins.str.number_of_bytes"; pub const STR_NUMBER_OF_BYTES: &str = "roc_builtins.str.number_of_bytes";
pub const STR_FROM_INT: IntrinsicName = int_intrinsic!("roc_builtins.str.from_int"); pub const STR_FROM_INT: IntrinsicName = int_intrinsic!("roc_builtins.str.from_int");
@ -365,11 +362,8 @@ pub const STR_TRIM_START: &str = "roc_builtins.str.trim_start";
pub const STR_TRIM_END: &str = "roc_builtins.str.trim_end"; pub const STR_TRIM_END: &str = "roc_builtins.str.trim_end";
pub const STR_GET_UNSAFE: &str = "roc_builtins.str.get_unsafe"; pub const STR_GET_UNSAFE: &str = "roc_builtins.str.get_unsafe";
pub const STR_RESERVE: &str = "roc_builtins.str.reserve"; pub const STR_RESERVE: &str = "roc_builtins.str.reserve";
pub const STR_APPEND_SCALAR: &str = "roc_builtins.str.append_scalar";
pub const STR_GET_SCALAR_UNSAFE: &str = "roc_builtins.str.get_scalar_unsafe";
pub const STR_CLONE_TO: &str = "roc_builtins.str.clone_to"; pub const STR_CLONE_TO: &str = "roc_builtins.str.clone_to";
pub const STR_WITH_CAPACITY: &str = "roc_builtins.str.with_capacity"; pub const STR_WITH_CAPACITY: &str = "roc_builtins.str.with_capacity";
pub const STR_GRAPHEMES: &str = "roc_builtins.str.graphemes";
pub const STR_ALLOCATION_PTR: &str = "roc_builtins.str.allocation_ptr"; pub const STR_ALLOCATION_PTR: &str = "roc_builtins.str.allocation_ptr";
pub const STR_RELEASE_EXCESS_CAPACITY: &str = "roc_builtins.str.release_excess_capacity"; pub const STR_RELEASE_EXCESS_CAPACITY: &str = "roc_builtins.str.release_excess_capacity";
@ -386,6 +380,7 @@ pub const LIST_CONCAT: &str = "roc_builtins.list.concat";
pub const LIST_REPLACE: &str = "roc_builtins.list.replace"; pub const LIST_REPLACE: &str = "roc_builtins.list.replace";
pub const LIST_REPLACE_IN_PLACE: &str = "roc_builtins.list.replace_in_place"; pub const LIST_REPLACE_IN_PLACE: &str = "roc_builtins.list.replace_in_place";
pub const LIST_IS_UNIQUE: &str = "roc_builtins.list.is_unique"; pub const LIST_IS_UNIQUE: &str = "roc_builtins.list.is_unique";
pub const LIST_CLONE: &str = "roc_builtins.list.clone";
pub const LIST_PREPEND: &str = "roc_builtins.list.prepend"; pub const LIST_PREPEND: &str = "roc_builtins.list.prepend";
pub const LIST_APPEND_UNSAFE: &str = "roc_builtins.list.append_unsafe"; pub const LIST_APPEND_UNSAFE: &str = "roc_builtins.list.append_unsafe";
pub const LIST_RESERVE: &str = "roc_builtins.list.reserve"; pub const LIST_RESERVE: &str = "roc_builtins.list.reserve";

View file

@ -115,10 +115,8 @@ map_symbol_to_lowlevel_and_arity! {
StrJoinWith; STR_JOIN_WITH; 2, StrJoinWith; STR_JOIN_WITH; 2,
StrIsEmpty; STR_IS_EMPTY; 1, StrIsEmpty; STR_IS_EMPTY; 1,
StrStartsWith; STR_STARTS_WITH; 2, StrStartsWith; STR_STARTS_WITH; 2,
StrStartsWithScalar; STR_STARTS_WITH_SCALAR; 2,
StrEndsWith; STR_ENDS_WITH; 2, StrEndsWith; STR_ENDS_WITH; 2,
StrSplit; STR_SPLIT; 2, StrSplit; STR_SPLIT; 2,
StrCountGraphemes; STR_COUNT_GRAPHEMES; 1,
StrCountUtf8Bytes; STR_COUNT_UTF8_BYTES; 1, StrCountUtf8Bytes; STR_COUNT_UTF8_BYTES; 1,
StrFromUtf8Range; STR_FROM_UTF8_RANGE_LOWLEVEL; 3, StrFromUtf8Range; STR_FROM_UTF8_RANGE_LOWLEVEL; 3,
StrToUtf8; STR_TO_UTF8; 1, StrToUtf8; STR_TO_UTF8; 1,
@ -126,22 +124,19 @@ map_symbol_to_lowlevel_and_arity! {
StrTrim; STR_TRIM; 1, StrTrim; STR_TRIM; 1,
StrTrimStart; STR_TRIM_START; 1, StrTrimStart; STR_TRIM_START; 1,
StrTrimEnd; STR_TRIM_END; 1, StrTrimEnd; STR_TRIM_END; 1,
StrToScalars; STR_TO_SCALARS; 1,
StrGetUnsafe; STR_GET_UNSAFE; 2, StrGetUnsafe; STR_GET_UNSAFE; 2,
StrSubstringUnsafe; STR_SUBSTRING_UNSAFE; 3, StrSubstringUnsafe; STR_SUBSTRING_UNSAFE; 3,
StrReserve; STR_RESERVE; 2, StrReserve; STR_RESERVE; 2,
StrAppendScalar; STR_APPEND_SCALAR_UNSAFE; 2,
StrGetScalarUnsafe; STR_GET_SCALAR_UNSAFE; 2,
StrToNum; STR_TO_NUM; 1, StrToNum; STR_TO_NUM; 1,
StrGetCapacity; STR_CAPACITY; 1, StrGetCapacity; STR_CAPACITY; 1,
StrWithCapacity; STR_WITH_CAPACITY; 1, StrWithCapacity; STR_WITH_CAPACITY; 1,
StrGraphemes; STR_GRAPHEMES; 1,
StrReleaseExcessCapacity; STR_RELEASE_EXCESS_CAPACITY; 1, StrReleaseExcessCapacity; STR_RELEASE_EXCESS_CAPACITY; 1,
ListLen; LIST_LEN; 1, ListLen; LIST_LEN; 1,
ListWithCapacity; LIST_WITH_CAPACITY; 1, ListWithCapacity; LIST_WITH_CAPACITY; 1,
ListReserve; LIST_RESERVE; 2, ListReserve; LIST_RESERVE; 2,
ListIsUnique; LIST_IS_UNIQUE; 1, ListIsUnique; LIST_IS_UNIQUE; 1,
ListClone; LIST_CLONE; 1,
ListAppendUnsafe; LIST_APPEND_UNSAFE; 2, ListAppendUnsafe; LIST_APPEND_UNSAFE; 2,
ListPrepend; LIST_PREPEND; 2, ListPrepend; LIST_PREPEND; 2,
ListGetUnsafe; LIST_GET_UNSAFE; 2, ListGetUnsafe; LIST_GET_UNSAFE; 2,

View file

@ -1245,6 +1245,16 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
fabs_freg_freg(buf, FloatWidth::F64, dst, src); fabs_freg_freg(buf, FloatWidth::F64, dst, src);
} }
#[inline(always)]
fn abs_freg32_freg32(
buf: &mut Vec<'_, u8>,
_relocs: &mut Vec<'_, Relocation>,
dst: AArch64FloatReg,
src: AArch64FloatReg,
) {
fabs_freg_freg(buf, FloatWidth::F32, dst, src);
}
#[inline(always)] #[inline(always)]
fn add_reg64_reg64_imm32( fn add_reg64_reg64_imm32(
buf: &mut Vec<'_, u8>, buf: &mut Vec<'_, u8>,

View file

@ -164,6 +164,12 @@ pub trait Assembler<GeneralReg: RegTrait, FloatReg: RegTrait>: Sized + Copy {
dst: FloatReg, dst: FloatReg,
src: FloatReg, src: FloatReg,
); );
fn abs_freg32_freg32(
buf: &mut Vec<'_, u8>,
relocs: &mut Vec<'_, Relocation>,
dst: FloatReg,
src: FloatReg,
);
fn add_reg64_reg64_imm32(buf: &mut Vec<'_, u8>, dst: GeneralReg, src1: GeneralReg, imm32: i32); fn add_reg64_reg64_imm32(buf: &mut Vec<'_, u8>, dst: GeneralReg, src1: GeneralReg, imm32: i32);
fn add_reg64_reg64_reg64( fn add_reg64_reg64_reg64(
@ -1316,6 +1322,11 @@ impl<
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src); let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
ASM::abs_freg64_freg64(&mut self.buf, &mut self.relocs, dst_reg, src_reg); ASM::abs_freg64_freg64(&mut self.buf, &mut self.relocs, dst_reg, src_reg);
} }
LayoutRepr::Builtin(Builtin::Float(FloatWidth::F32)) => {
let dst_reg = self.storage_manager.claim_float_reg(&mut self.buf, dst);
let src_reg = self.storage_manager.load_to_float_reg(&mut self.buf, src);
ASM::abs_freg32_freg32(&mut self.buf, &mut self.relocs, dst_reg, src_reg);
}
x => todo!("NumAbs: layout, {:?}", x), x => todo!("NumAbs: layout, {:?}", x),
} }
} }
@ -2798,6 +2809,55 @@ impl<
self.storage_manager.list_len(&mut self.buf, dst, list); self.storage_manager.list_len(&mut self.buf, dst, list);
} }
fn build_list_clone(
&mut self,
dst: Symbol,
input_list: Symbol,
elem_layout: InLayout<'a>,
ret_layout: InLayout<'a>,
) {
// List alignment argument (u32).
self.load_layout_alignment(ret_layout, Symbol::DEV_TMP);
// Load element_width argument (usize).
self.load_layout_stack_size(elem_layout, Symbol::DEV_TMP2);
// Setup the return location.
let base_offset =
self.storage_manager
.claim_stack_area_layout(self.layout_interner, dst, ret_layout);
let lowlevel_args = [
input_list,
// alignment
Symbol::DEV_TMP,
// element_width
Symbol::DEV_TMP2,
];
let lowlevel_arg_layouts = [ret_layout, Layout::U32, Layout::U64];
self.build_fn_call(
&Symbol::DEV_TMP3,
bitcode::LIST_CLONE.to_string(),
&lowlevel_args,
&lowlevel_arg_layouts,
&ret_layout,
);
self.free_symbol(&Symbol::DEV_TMP);
self.free_symbol(&Symbol::DEV_TMP2);
// Copy from list to the output record.
self.storage_manager.copy_symbol_to_stack_offset(
self.layout_interner,
&mut self.buf,
base_offset,
&Symbol::DEV_TMP3,
&ret_layout,
);
self.free_symbol(&Symbol::DEV_TMP3);
}
fn build_list_with_capacity( fn build_list_with_capacity(
&mut self, &mut self,
dst: &Symbol, dst: &Symbol,

View file

@ -1958,6 +1958,24 @@ impl Assembler<X86_64GeneralReg, X86_64FloatReg> for X86_64Assembler {
andpd_freg64_freg64(buf, dst, src); andpd_freg64_freg64(buf, dst, src);
} }
#[inline(always)]
fn abs_freg32_freg32(
buf: &mut Vec<'_, u8>,
relocs: &mut Vec<'_, Relocation>,
dst: X86_64FloatReg,
src: X86_64FloatReg,
) {
movss_freg32_rip_offset32(buf, dst, 0);
// TODO: make sure this constant only loads once instead of every call to abs
relocs.push(Relocation::LocalData {
offset: buf.len() as u64 - 4,
data: 0x7fffffffu64.to_le_bytes().to_vec(),
});
andps_freg32_freg32(buf, dst, src);
}
#[inline(always)] #[inline(always)]
fn add_reg64_reg64_imm32( fn add_reg64_reg64_imm32(
buf: &mut Vec<'_, u8>, buf: &mut Vec<'_, u8>,
@ -3182,6 +3200,25 @@ fn andpd_freg64_freg64(buf: &mut Vec<'_, u8>, dst: X86_64FloatReg, src: X86_64Fl
} }
} }
#[inline(always)]
fn andps_freg32_freg32(buf: &mut Vec<'_, u8>, dst: X86_64FloatReg, src: X86_64FloatReg) {
let dst_high = dst as u8 > 7;
let dst_mod = dst as u8 % 8;
let src_high = src as u8 > 7;
let src_mod = src as u8 % 8;
if dst_high || src_high {
buf.extend([
0x40 | ((dst_high as u8) << 2) | (src_high as u8),
0x0F,
0x54,
0xC0 | (dst_mod << 3) | (src_mod),
])
} else {
buf.extend([0x0F, 0x54, 0xC0 | (dst_mod << 3) | (src_mod)])
}
}
/// r/m64 AND imm8 (sign-extended). /// r/m64 AND imm8 (sign-extended).
#[inline(always)] #[inline(always)]
fn and_reg64_imm8(buf: &mut Vec<'_, u8>, dst: X86_64GeneralReg, imm: i8) { fn and_reg64_imm8(buf: &mut Vec<'_, u8>, dst: X86_64GeneralReg, imm: i8) {
@ -4486,6 +4523,16 @@ mod tests {
); );
} }
#[test]
fn test_andps_freg32_freg32() {
disassembler_test!(
andps_freg32_freg32,
|reg1, reg2| format!("andps {reg1}, {reg2}"),
ALL_FLOAT_REGS,
ALL_FLOAT_REGS
);
}
#[test] #[test]
fn test_and_reg64_reg64() { fn test_and_reg64_reg64() {
disassembler_test!( disassembler_test!(

View file

@ -1518,6 +1518,15 @@ trait Backend<'a> {
let elem_layout = list_element_layout!(self.interner(), *ret_layout); let elem_layout = list_element_layout!(self.interner(), *ret_layout);
self.build_list_with_capacity(sym, args[0], arg_layouts[0], elem_layout, ret_layout) self.build_list_with_capacity(sym, args[0], arg_layouts[0], elem_layout, ret_layout)
} }
LowLevel::ListClone => {
debug_assert_eq!(
1,
args.len(),
"ListClone: expected to have exactly one argument"
);
let elem_layout = list_element_layout!(self.interner(), *ret_layout);
self.build_list_clone(*sym, args[0], elem_layout, *ret_layout)
}
LowLevel::ListReserve => { LowLevel::ListReserve => {
debug_assert_eq!( debug_assert_eq!(
2, 2,
@ -1595,20 +1604,6 @@ trait Backend<'a> {
arg_layouts, arg_layouts,
ret_layout, ret_layout,
), ),
LowLevel::StrStartsWithScalar => self.build_fn_call(
sym,
bitcode::STR_STARTS_WITH_SCALAR.to_string(),
args,
arg_layouts,
ret_layout,
),
LowLevel::StrAppendScalar => self.build_fn_call(
sym,
bitcode::STR_APPEND_SCALAR.to_string(),
args,
arg_layouts,
ret_layout,
),
LowLevel::StrEndsWith => self.build_fn_call( LowLevel::StrEndsWith => self.build_fn_call(
sym, sym,
bitcode::STR_ENDS_WITH.to_string(), bitcode::STR_ENDS_WITH.to_string(),
@ -1616,13 +1611,6 @@ trait Backend<'a> {
arg_layouts, arg_layouts,
ret_layout, ret_layout,
), ),
LowLevel::StrCountGraphemes => self.build_fn_call(
sym,
bitcode::STR_COUNT_GRAPEHEME_CLUSTERS.to_string(),
args,
arg_layouts,
ret_layout,
),
LowLevel::StrSubstringUnsafe => self.build_fn_call( LowLevel::StrSubstringUnsafe => self.build_fn_call(
sym, sym,
bitcode::STR_SUBSTRING_UNSAFE.to_string(), bitcode::STR_SUBSTRING_UNSAFE.to_string(),
@ -1698,13 +1686,6 @@ trait Backend<'a> {
arg_layouts, arg_layouts,
ret_layout, ret_layout,
), ),
LowLevel::StrToScalars => self.build_fn_call(
sym,
bitcode::STR_TO_SCALARS.to_string(),
args,
arg_layouts,
ret_layout,
),
LowLevel::StrGetUnsafe => self.build_fn_call( LowLevel::StrGetUnsafe => self.build_fn_call(
sym, sym,
bitcode::STR_GET_UNSAFE.to_string(), bitcode::STR_GET_UNSAFE.to_string(),
@ -1712,13 +1693,6 @@ trait Backend<'a> {
arg_layouts, arg_layouts,
ret_layout, ret_layout,
), ),
LowLevel::StrGetScalarUnsafe => self.build_fn_call(
sym,
bitcode::STR_GET_SCALAR_UNSAFE.to_string(),
args,
arg_layouts,
ret_layout,
),
LowLevel::StrToNum => { LowLevel::StrToNum => {
let number_layout = match self.interner().get_repr(*ret_layout) { let number_layout = match self.interner().get_repr(*ret_layout) {
LayoutRepr::Struct(field_layouts) => field_layouts[0], // TODO: why is it sometimes a struct? LayoutRepr::Struct(field_layouts) => field_layouts[0], // TODO: why is it sometimes a struct?
@ -2120,18 +2094,6 @@ trait Backend<'a> {
self.load_literal(sym, BOOL_LAYOUT, LITERAL); self.load_literal(sym, BOOL_LAYOUT, LITERAL);
} }
} }
Symbol::STR_IS_VALID_SCALAR => {
// just call the function
let fn_name = self.lambda_name_to_string(
func_name,
arg_layouts.iter().copied(),
None,
*ret_layout,
);
// Now that the arguments are needed, load them if they are literals.
self.load_literal_symbols(args);
self.build_fn_call(sym, fn_name, args, arg_layouts, ret_layout)
}
_other => { _other => {
// just call the function // just call the function
let fn_name = self.lambda_name_to_string( let fn_name = self.lambda_name_to_string(
@ -2416,6 +2378,14 @@ trait Backend<'a> {
fn build_indirect_inc(&mut self, layout: InLayout<'a>) -> Symbol; fn build_indirect_inc(&mut self, layout: InLayout<'a>) -> Symbol;
fn build_indirect_dec(&mut self, layout: InLayout<'a>) -> Symbol; fn build_indirect_dec(&mut self, layout: InLayout<'a>) -> Symbol;
fn build_list_clone(
&mut self,
dst: Symbol,
input_list: Symbol,
elem_layout: InLayout<'a>,
ret_layout: InLayout<'a>,
);
/// build_list_with_capacity creates and returns a list with the given capacity. /// build_list_with_capacity creates and returns a list with the given capacity.
fn build_list_with_capacity( fn build_list_with_capacity(
&mut self, &mut self,

View file

@ -34,8 +34,8 @@ use crate::llvm::{
BuilderExt, FuncBorrowSpec, RocReturn, BuilderExt, FuncBorrowSpec, RocReturn,
}, },
build_list::{ build_list::{
list_append_unsafe, list_concat, list_drop_at, list_get_unsafe, list_len, list_map, layout_width, list_append_unsafe, list_concat, list_drop_at, list_get_unsafe, list_len,
list_map2, list_map3, list_map4, list_prepend, list_release_excess_capacity, list_map, list_map2, list_map3, list_map4, list_prepend, list_release_excess_capacity,
list_replace_unsafe, list_reserve, list_sort_with, list_sublist, list_swap, list_replace_unsafe, list_reserve, list_sort_with, list_sublist, list_swap,
list_symbol_to_c_abi, list_with_capacity, pass_update_mode, list_symbol_to_c_abi, list_with_capacity, pass_update_mode,
}, },
@ -153,18 +153,6 @@ pub(crate) fn run_low_level<'a, 'ctx>(
} }
} }
} }
StrToScalars => {
// Str.toScalars : Str -> List U32
arguments!(string);
call_str_bitcode_fn(
env,
&[string],
&[],
BitcodeReturns::List,
bitcode::STR_TO_SCALARS,
)
}
StrStartsWith => { StrStartsWith => {
// Str.startsWith : Str, Str -> Bool // Str.startsWith : Str, Str -> Bool
arguments!(string, prefix); arguments!(string, prefix);
@ -177,18 +165,6 @@ pub(crate) fn run_low_level<'a, 'ctx>(
bitcode::STR_STARTS_WITH, bitcode::STR_STARTS_WITH,
) )
} }
StrStartsWithScalar => {
// Str.startsWithScalar : Str, U32 -> Bool
arguments!(string, prefix);
call_str_bitcode_fn(
env,
&[string],
&[prefix],
BitcodeReturns::Basic,
bitcode::STR_STARTS_WITH_SCALAR,
)
}
StrEndsWith => { StrEndsWith => {
// Str.startsWith : Str, Str -> Bool // Str.startsWith : Str, Str -> Bool
arguments!(string, prefix); arguments!(string, prefix);
@ -545,102 +521,6 @@ pub(crate) fn run_low_level<'a, 'ctx>(
); );
BasicValueEnum::IntValue(is_zero) BasicValueEnum::IntValue(is_zero)
} }
StrCountGraphemes => {
// Str.countGraphemes : Str -> Nat
arguments!(string);
call_str_bitcode_fn(
env,
&[string],
&[],
BitcodeReturns::Basic,
bitcode::STR_COUNT_GRAPEHEME_CLUSTERS,
)
}
StrGetScalarUnsafe => {
// Str.getScalarUnsafe : Str, Nat -> { bytesParsed : Nat, scalar : U32 }
arguments!(string, index);
let roc_return_type =
basic_type_from_layout(env, layout_interner, layout_interner.get_repr(layout));
use roc_target::Architecture::*;
use roc_target::OperatingSystem::*;
match env.target_info {
TargetInfo {
operating_system: Windows,
..
} => {
let result = env.builder.new_build_alloca(roc_return_type, "result");
call_void_bitcode_fn(
env,
&[result.into(), string, index],
bitcode::STR_GET_SCALAR_UNSAFE,
);
let cast_result = env.builder.new_build_pointer_cast(
result,
roc_return_type.ptr_type(AddressSpace::default()),
"cast",
);
env.builder
.new_build_load(roc_return_type, cast_result, "load_result")
}
TargetInfo {
architecture: Wasm32,
..
} => {
let result = env.builder.new_build_alloca(roc_return_type, "result");
call_void_bitcode_fn(
env,
&[
result.into(),
pass_string_to_zig_wasm(env, string).into(),
index,
],
bitcode::STR_GET_SCALAR_UNSAFE,
);
let cast_result = env.builder.new_build_pointer_cast(
result,
roc_return_type.ptr_type(AddressSpace::default()),
"cast",
);
env.builder
.new_build_load(roc_return_type, cast_result, "load_result")
}
TargetInfo {
operating_system: Unix,
..
} => {
let result = call_str_bitcode_fn(
env,
&[string],
&[index],
BitcodeReturns::Basic,
bitcode::STR_GET_SCALAR_UNSAFE,
);
// zig will pad the struct to the alignment boundary, or bitpack it on 32-bit
// targets. So we have to cast it to the format that the roc code expects
let alloca = env
.builder
.new_build_alloca(result.get_type(), "to_roc_record");
env.builder.new_build_store(alloca, result);
env.builder
.new_build_load(roc_return_type, alloca, "to_roc_record")
}
TargetInfo {
operating_system: Wasi,
..
} => unimplemented!(),
}
}
StrCountUtf8Bytes => { StrCountUtf8Bytes => {
// Str.countUtf8Bytes : Str -> Nat // Str.countUtf8Bytes : Str -> Nat
arguments!(string); arguments!(string);
@ -695,18 +575,6 @@ pub(crate) fn run_low_level<'a, 'ctx>(
bitcode::STR_RELEASE_EXCESS_CAPACITY, bitcode::STR_RELEASE_EXCESS_CAPACITY,
) )
} }
StrAppendScalar => {
// Str.appendScalar : Str, U32 -> Str
arguments!(string, capacity);
call_str_bitcode_fn(
env,
&[string],
&[capacity],
BitcodeReturns::Str,
bitcode::STR_APPEND_SCALAR,
)
}
StrTrim => { StrTrim => {
// Str.trim : Str -> Str // Str.trim : Str -> Str
arguments!(string); arguments!(string);
@ -749,18 +617,6 @@ pub(crate) fn run_low_level<'a, 'ctx>(
bitcode::STR_WITH_CAPACITY, bitcode::STR_WITH_CAPACITY,
) )
} }
StrGraphemes => {
// Str.graphemes : Str -> List Str
arguments!(string);
call_str_bitcode_fn(
env,
&[string],
&[],
BitcodeReturns::List,
bitcode::STR_GRAPHEMES,
)
}
ListLen => { ListLen => {
// List.len : List * -> Nat // List.len : List * -> Nat
arguments!(list); arguments!(list);
@ -962,6 +818,31 @@ pub(crate) fn run_low_level<'a, 'ctx>(
bitcode::LIST_IS_UNIQUE, bitcode::LIST_IS_UNIQUE,
) )
} }
ListClone => {
// List.clone : List a -> List a
arguments_with_layouts!((list, list_layout));
let element_layout = list_element_layout!(layout_interner, list_layout);
match update_mode {
UpdateMode::Immutable => {
//
call_list_bitcode_fn(
env,
&[list.into_struct_value()],
&[
env.alignment_intvalue(layout_interner, element_layout),
layout_width(env, layout_interner, element_layout),
],
BitcodeReturns::List,
bitcode::LIST_CLONE,
)
}
UpdateMode::InPlace => {
// we statically know the list is unique
list
}
}
}
NumToStr => { NumToStr => {
// Num.toStr : Num a -> Str // Num.toStr : Num a -> Str
arguments_with_layouts!((num, num_layout)); arguments_with_layouts!((num, num_layout));

View file

@ -11,7 +11,7 @@ use roc_mono::layout::{InLayout, LayoutInterner, LayoutRepr, STLayoutInterner};
use crate::llvm::build::{load_roc_value, use_roc_value}; use crate::llvm::build::{load_roc_value, use_roc_value};
use super::{ use super::{
build::{BuilderExt, Env}, build::{store_roc_value, BuilderExt, Env},
convert::basic_type_from_layout, convert::basic_type_from_layout,
scope::Scope, scope::Scope,
}; };
@ -50,19 +50,16 @@ impl<'ctx> RocStruct<'ctx> {
scope: &Scope<'a, 'ctx>, scope: &Scope<'a, 'ctx>,
sorted_fields: &[Symbol], sorted_fields: &[Symbol],
) -> Self { ) -> Self {
let BuildStruct {
struct_type,
struct_val,
} = build_struct_helper(env, layout_interner, scope, sorted_fields);
let passed_by_ref = layout_repr.is_passed_by_reference(layout_interner); let passed_by_ref = layout_repr.is_passed_by_reference(layout_interner);
if passed_by_ref { if passed_by_ref {
let alloca = env.builder.new_build_alloca(struct_type, "struct_alloca"); let struct_alloca =
env.builder.new_build_store(alloca, struct_val); build_struct_alloca_helper(env, layout_interner, scope, sorted_fields);
RocStruct::ByReference(alloca) RocStruct::ByReference(struct_alloca)
} else { } else {
RocStruct::ByValue(struct_val) let struct_value =
build_struct_value_helper(env, layout_interner, scope, sorted_fields);
RocStruct::ByValue(struct_value)
} }
} }
@ -178,17 +175,12 @@ fn get_field_from_value<'ctx>(
.unwrap() .unwrap()
} }
struct BuildStruct<'ctx> { fn build_struct_value_helper<'a, 'ctx>(
struct_type: StructType<'ctx>,
struct_val: StructValue<'ctx>,
}
fn build_struct_helper<'a, 'ctx>(
env: &Env<'a, 'ctx, '_>, env: &Env<'a, 'ctx, '_>,
layout_interner: &STLayoutInterner<'a>, layout_interner: &STLayoutInterner<'a>,
scope: &Scope<'a, 'ctx>, scope: &Scope<'a, 'ctx>,
sorted_fields: &[Symbol], sorted_fields: &[Symbol],
) -> BuildStruct<'ctx> { ) -> StructValue<'ctx> {
let ctx = env.context; let ctx = env.context;
// Determine types // Determine types
@ -227,12 +219,49 @@ fn build_struct_helper<'a, 'ctx>(
// Create the struct_type // Create the struct_type
let struct_type = ctx.struct_type(field_types.into_bump_slice(), false); let struct_type = ctx.struct_type(field_types.into_bump_slice(), false);
let struct_val = struct_from_fields(env, struct_type, field_vals.into_iter().enumerate()); struct_from_fields(env, struct_type, field_vals.into_iter().enumerate())
}
BuildStruct { fn build_struct_alloca_helper<'a, 'ctx>(
struct_type, env: &Env<'a, 'ctx, '_>,
struct_val, layout_interner: &STLayoutInterner<'a>,
scope: &Scope<'a, 'ctx>,
sorted_fields: &[Symbol],
) -> PointerValue<'ctx> {
let ctx = env.context;
// Determine types
let num_fields = sorted_fields.len();
let mut field_types = AVec::with_capacity_in(num_fields, env.arena);
let mut field_expr_repr = AVec::with_capacity_in(num_fields, env.arena);
for symbol in sorted_fields.iter() {
// Zero-sized fields have no runtime representation.
// The layout of the struct expects them to be dropped!
let (field_expr, field_layout) = scope.load_symbol_and_layout(symbol);
if !layout_interner
.get_repr(field_layout)
.is_dropped_because_empty()
{
let field_repr = layout_interner.get_repr(field_layout);
let field_type = basic_type_from_layout(env, layout_interner, field_repr);
field_types.push(field_type);
field_expr_repr.push((field_expr, field_repr));
}
} }
// Create the struct_type
let struct_type = ctx.struct_type(field_types.into_bump_slice(), false);
let alloca = env.builder.new_build_alloca(struct_type, "struct_alloca");
for (i, (field_expr, field_repr)) in field_expr_repr.into_iter().enumerate() {
let dst =
env.builder
.new_build_struct_gep(struct_type, alloca, i as u32, "struct_field_gep");
store_roc_value(env, layout_interner, field_repr, dst, field_expr);
}
alloca
} }
pub fn struct_from_fields<'a, 'ctx, 'env, I>( pub fn struct_from_fields<'a, 'ctx, 'env, I>(

View file

@ -185,7 +185,6 @@ impl<'a> LowLevelCall<'a> {
match self.lowlevel { match self.lowlevel {
// Str // Str
StrConcat => self.load_args_and_call_zig(backend, bitcode::STR_CONCAT), StrConcat => self.load_args_and_call_zig(backend, bitcode::STR_CONCAT),
StrToScalars => self.load_args_and_call_zig(backend, bitcode::STR_TO_SCALARS),
StrGetUnsafe => self.load_args_and_call_zig(backend, bitcode::STR_GET_UNSAFE), StrGetUnsafe => self.load_args_and_call_zig(backend, bitcode::STR_GET_UNSAFE),
StrJoinWith => self.load_args_and_call_zig(backend, bitcode::STR_JOIN_WITH), StrJoinWith => self.load_args_and_call_zig(backend, bitcode::STR_JOIN_WITH),
StrIsEmpty => match backend.storage.get(&self.arguments[0]) { StrIsEmpty => match backend.storage.get(&self.arguments[0]) {
@ -200,14 +199,8 @@ impl<'a> LowLevelCall<'a> {
_ => internal_error!("invalid storage for Str"), _ => internal_error!("invalid storage for Str"),
}, },
StrStartsWith => self.load_args_and_call_zig(backend, bitcode::STR_STARTS_WITH), StrStartsWith => self.load_args_and_call_zig(backend, bitcode::STR_STARTS_WITH),
StrStartsWithScalar => {
self.load_args_and_call_zig(backend, bitcode::STR_STARTS_WITH_SCALAR)
}
StrEndsWith => self.load_args_and_call_zig(backend, bitcode::STR_ENDS_WITH), StrEndsWith => self.load_args_and_call_zig(backend, bitcode::STR_ENDS_WITH),
StrSplit => self.load_args_and_call_zig(backend, bitcode::STR_SPLIT), StrSplit => self.load_args_and_call_zig(backend, bitcode::STR_SPLIT),
StrCountGraphemes => {
self.load_args_and_call_zig(backend, bitcode::STR_COUNT_GRAPEHEME_CLUSTERS)
}
StrCountUtf8Bytes => { StrCountUtf8Bytes => {
self.load_args_and_call_zig(backend, bitcode::STR_COUNT_UTF8_BYTES) self.load_args_and_call_zig(backend, bitcode::STR_COUNT_UTF8_BYTES)
} }
@ -263,16 +256,11 @@ impl<'a> LowLevelCall<'a> {
self.load_args_and_call_zig(backend, bitcode::STR_RELEASE_EXCESS_CAPACITY) self.load_args_and_call_zig(backend, bitcode::STR_RELEASE_EXCESS_CAPACITY)
} }
StrRepeat => self.load_args_and_call_zig(backend, bitcode::STR_REPEAT), StrRepeat => self.load_args_and_call_zig(backend, bitcode::STR_REPEAT),
StrAppendScalar => self.load_args_and_call_zig(backend, bitcode::STR_APPEND_SCALAR),
StrTrim => self.load_args_and_call_zig(backend, bitcode::STR_TRIM), StrTrim => self.load_args_and_call_zig(backend, bitcode::STR_TRIM),
StrGetScalarUnsafe => {
self.load_args_and_call_zig(backend, bitcode::STR_GET_SCALAR_UNSAFE)
}
StrSubstringUnsafe => { StrSubstringUnsafe => {
self.load_args_and_call_zig(backend, bitcode::STR_SUBSTRING_UNSAFE) self.load_args_and_call_zig(backend, bitcode::STR_SUBSTRING_UNSAFE)
} }
StrWithCapacity => self.load_args_and_call_zig(backend, bitcode::STR_WITH_CAPACITY), StrWithCapacity => self.load_args_and_call_zig(backend, bitcode::STR_WITH_CAPACITY),
StrGraphemes => self.load_args_and_call_zig(backend, bitcode::STR_GRAPHEMES),
// List // List
ListLen => match backend.storage.get(&self.arguments[0]) { ListLen => match backend.storage.get(&self.arguments[0]) {
@ -299,6 +287,28 @@ impl<'a> LowLevelCall<'a> {
ListIsUnique => self.load_args_and_call_zig(backend, bitcode::LIST_IS_UNIQUE), ListIsUnique => self.load_args_and_call_zig(backend, bitcode::LIST_IS_UNIQUE),
ListClone => {
let input_list: Symbol = self.arguments[0];
let elem_layout = unwrap_list_elem_layout(self.ret_layout_raw);
let elem_layout = backend.layout_interner.get_repr(elem_layout);
let (elem_width, elem_align) =
elem_layout.stack_size_and_alignment(backend.layout_interner);
// Zig arguments Wasm types
// (return pointer) i32
// input_list: &RocList i32
// alignment: u32 i32
// element_width: usize i32
backend
.storage
.load_symbols(&mut backend.code_builder, &[self.ret_symbol, input_list]);
backend.code_builder.i32_const(elem_align as i32);
backend.code_builder.i32_const(elem_width as i32);
backend.call_host_fn_after_loading_args(bitcode::LIST_CLONE);
}
ListMap | ListMap2 | ListMap3 | ListMap4 | ListSortWith => { ListMap | ListMap2 | ListMap3 | ListMap4 | ListSortWith => {
internal_error!("HigherOrder lowlevels should not be handled here") internal_error!("HigherOrder lowlevels should not be handled here")
} }

View file

@ -29,11 +29,8 @@ roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" } roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" } roc_target = { path = "../roc_target" }
roc_error_macros = { path = "../../error_macros" } roc_error_macros = { path = "../../error_macros" }
bumpalo.workspace = true
[target.'cfg(not(windows))'.build-dependencies]
roc_load_internal = { path = "../load_internal" } roc_load_internal = { path = "../load_internal" }
bumpalo.workspace = true
[dev-dependencies] [dev-dependencies]
roc_constrain = { path = "../constrain" } roc_constrain = { path = "../constrain" }

View file

@ -1,6 +1,5 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
#[cfg(not(windows))]
use bumpalo::Bump; use bumpalo::Bump;
use roc_error_macros::internal_error; use roc_error_macros::internal_error;
use roc_module::symbol::ModuleId; use roc_module::symbol::ModuleId;
@ -47,19 +46,11 @@ fn write_subs_for_module(module_id: ModuleId, filename: &str) {
output_path.extend([filename]); output_path.extend([filename]);
output_path.set_extension("dat"); output_path.set_extension("dat");
#[cfg(not(windows))]
if SKIP_SUBS_CACHE { if SKIP_SUBS_CACHE {
write_types_for_module_dummy(&output_path) write_types_for_module_dummy(&output_path)
} else { } else {
write_types_for_module_real(module_id, filename, &output_path) write_types_for_module_real(module_id, filename, &output_path)
} }
#[cfg(windows)]
{
let _ = SKIP_SUBS_CACHE;
let _ = module_id;
write_types_for_module_dummy(&output_path)
}
} }
fn write_types_for_module_dummy(output_path: &Path) { fn write_types_for_module_dummy(output_path: &Path) {
@ -67,7 +58,6 @@ fn write_types_for_module_dummy(output_path: &Path) {
std::fs::write(output_path, []).unwrap(); std::fs::write(output_path, []).unwrap();
} }
#[cfg(not(windows))]
fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path: &Path) { fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path: &Path) {
use roc_can::module::TypeState; use roc_can::module::TypeState;
use roc_load_internal::file::{LoadingProblem, Threading}; use roc_load_internal::file::{LoadingProblem, Threading};

View file

@ -247,7 +247,7 @@ fn read_cached_types() -> MutMap<ModuleId, TypeState> {
// Wasm seems to re-order definitions between build time and runtime, but only in release mode. // Wasm seems to re-order definitions between build time and runtime, but only in release mode.
// That is very strange, but we can solve it separately // That is very strange, but we can solve it separately
if !cfg!(target_family = "wasm") && !cfg!(windows) && !SKIP_SUBS_CACHE { if !cfg!(target_family = "wasm") && !SKIP_SUBS_CACHE {
output.insert(ModuleId::BOOL, deserialize_help(mod_bool)); output.insert(ModuleId::BOOL, deserialize_help(mod_bool));
output.insert(ModuleId::RESULT, deserialize_help(mod_result)); output.insert(ModuleId::RESULT, deserialize_help(mod_result));

File diff suppressed because it is too large Load diff

View file

@ -2174,6 +2174,38 @@ fn report_unused_imported_modules(
} }
} }
///Generates an errorfor modules that are imported from packages that don't exist
///TODO. This is temporary. Remove this once module params is implemented
fn check_for_missing_package_shorthand_in_cache<'a>(
header: &ModuleHeader,
shorthands: &Arc<Mutex<MutMap<&'a str, ShorthandPath>>>,
) -> Result<(), LoadingProblem<'a>> {
header.package_qualified_imported_modules
.iter()
.find_map(|pqim| match pqim {
PackageQualified::Unqualified(_) => None,
PackageQualified::Qualified(shorthand, _) => {
if!(shorthands.lock().iter().any(|(short,_)|short==shorthand)){
let module_path=header.module_path.to_str().unwrap_or("");
Some(LoadingProblem::FormattedReport(
match header.header_type {
HeaderType::Hosted { ..} |
HeaderType::Builtin {..} |
HeaderType::Interface {..} =>
{
let mod_type= header.header_type.to_string();
format!("The package shorthand '{shorthand}' that you are using in the 'imports' section of the header of module '{module_path}' doesn't exist.\nCheck that package shorthand is correct or reference the package in an 'app' or 'package' header.\nThis module is an {mod_type}, because of a bug in the compiler we are unable to directly typecheck {mod_type} modules with package imports so this error may not be correct. Please start checking at an app, package or platform file that imports this file.")
},
_=>
format!("The package shorthand '{shorthand}' that you are using in the 'imports' section of the header of module '{module_path}' doesn't exist.\nCheck that package shorthand is correct or reference the package in an 'app' or 'package' header.")
}))
} else {
None
}
}
}).map_or(Ok(()),Err)
}
fn extend_header_with_builtin(header: &mut ModuleHeader, module: ModuleId) { fn extend_header_with_builtin(header: &mut ModuleHeader, module: ModuleId) {
header header
.package_qualified_imported_modules .package_qualified_imported_modules
@ -2257,7 +2289,9 @@ fn update<'a>(
#[cfg(target_family = "wasm")] #[cfg(target_family = "wasm")]
{ {
panic!("Specifying packages via URLs is curently unsupported in wasm."); panic!(
"Specifying packages via URLs is currently unsupported in wasm."
);
} }
} else { } else {
// This wasn't a URL, so it must be a filesystem path. // This wasn't a URL, so it must be a filesystem path.
@ -2387,6 +2421,7 @@ fn update<'a>(
} }
} }
check_for_missing_package_shorthand_in_cache(&header, &state.arc_shorthands)?;
// store an ID to name mapping, so we know the file to read when fetching dependencies' headers // store an ID to name mapping, so we know the file to read when fetching dependencies' headers
for (name, id) in header.deps_by_name.iter() { for (name, id) in header.deps_by_name.iter() {
state.module_cache.module_names.insert(*id, name.clone()); state.module_cache.module_names.insert(*id, name.clone());
@ -3936,6 +3971,11 @@ fn parse_header<'a>(
} else { } else {
&[] &[]
}; };
let imports = if let Some(imports) = header.imports {
unspace(arena, imports.item.items)
} else {
&[]
};
let mut provides = bumpalo::collections::Vec::new_in(arena); let mut provides = bumpalo::collections::Vec::new_in(arena);
@ -3955,11 +3995,7 @@ fn parse_header<'a>(
is_root_module, is_root_module,
opt_shorthand, opt_shorthand,
packages, packages,
imports: if let Some(imports) = header.imports { imports,
unspace(arena, imports.item.items)
} else {
&[]
},
header_type: HeaderType::App { header_type: HeaderType::App {
provides: provides.into_bump_slice(), provides: provides.into_bump_slice(),
output_name: header.name.value, output_name: header.name.value,
@ -4143,7 +4179,7 @@ fn load_packages<'a>(
#[cfg(target_family = "wasm")] #[cfg(target_family = "wasm")]
{ {
panic!("Specifying packages via URLs is curently unsupported in wasm."); panic!("Specifying packages via URLs is currently unsupported in wasm.");
} }
} else { } else {
cwd.join(src) cwd.join(src)

View file

@ -0,0 +1,22 @@
fn report_missing_package_shorthand2<'a>(
packages: &[Loc<PackageEntry>],
imports: &[Loc<ImportsEntry>],
) -> Option<LoadingProblem<'a>> {
imports.iter().find_map(|i| match i.value {
ImportsEntry::Module(_, _) | ImportsEntry::IngestedFile(_, _) => None,
ImportsEntry::Package(shorthand, name, _) => {
let name=name.as_str();
if packages
.iter()
.find(|p| p.value.shorthand == shorthand)
.is_none()
{
Some(
LoadingProblem::FormattedReport(
format!("The package shorthand '{shorthand}' that you are importing the module '{name}' from in '{shorthand}.{name}', doesn't exist in this module.\nImport it in the \"packages\" section of the header.")))
} else {
None
}
}
})
}

View file

@ -641,7 +641,7 @@ fn parse_problem() {
report, report,
indoc!( indoc!(
" "
UNFINISHED LIST tmp/parse_problem/Main UNFINISHED LIST in tmp/parse_problem/Main
I am partway through started parsing a list, but I got stuck here: I am partway through started parsing a list, but I got stuck here:
@ -847,7 +847,7 @@ fn opaque_wrapped_unwrapped_outside_defining_module() {
err, err,
indoc!( indoc!(
r" r"
OPAQUE TYPE DECLARED OUTSIDE SCOPE ...rapped_outside_defining_module/Main OPAQUE TYPE DECLARED OUTSIDE SCOPE in ...apped_outside_defining_module/Main
The unwrapped opaque type Age referenced here: The unwrapped opaque type Age referenced here:
@ -861,7 +861,7 @@ fn opaque_wrapped_unwrapped_outside_defining_module() {
Note: Opaque types can only be wrapped and unwrapped in the module they are defined in! Note: Opaque types can only be wrapped and unwrapped in the module they are defined in!
OPAQUE TYPE DECLARED OUTSIDE SCOPE ...rapped_outside_defining_module/Main OPAQUE TYPE DECLARED OUTSIDE SCOPE in ...apped_outside_defining_module/Main
The unwrapped opaque type Age referenced here: The unwrapped opaque type Age referenced here:
@ -875,7 +875,7 @@ fn opaque_wrapped_unwrapped_outside_defining_module() {
Note: Opaque types can only be wrapped and unwrapped in the module they are defined in! Note: Opaque types can only be wrapped and unwrapped in the module they are defined in!
UNUSED IMPORT tmp/opaque_wrapped_unwrapped_outside_defining_module/Main UNUSED IMPORT in tmp/opaque_wrapped_unwrapped_outside_defining_module/Main
Nothing from Age is used in this module. Nothing from Age is used in this module.
@ -930,7 +930,7 @@ fn issue_2863_module_type_does_not_exist() {
report, report,
indoc!( indoc!(
" "
UNRECOGNIZED NAME tmp/issue_2863_module_type_does_not_exist/Main UNRECOGNIZED NAME in tmp/issue_2863_module_type_does_not_exist/Main
Nothing is named `DoesNotExist` in this scope. Nothing is named `DoesNotExist` in this scope.
@ -1006,7 +1006,7 @@ fn module_doesnt_match_file_path() {
err, err,
indoc!( indoc!(
r" r"
WEIRD MODULE NAME tmp/module_doesnt_match_file_path/Age WEIRD MODULE NAME in tmp/module_doesnt_match_file_path/Age
This module name does not correspond with the file path it is defined This module name does not correspond with the file path it is defined
in: in:
@ -1039,7 +1039,7 @@ fn module_cyclic_import_itself() {
err, err,
indoc!( indoc!(
r" r"
IMPORT CYCLE tmp/module_cyclic_import_itself/Age IMPORT CYCLE in tmp/module_cyclic_import_itself/Age
I can't compile Age because it depends on itself through the following I can't compile Age because it depends on itself through the following
chain of module imports: chain of module imports:
@ -1058,7 +1058,6 @@ fn module_cyclic_import_itself() {
err err
); );
} }
#[test] #[test]
fn module_cyclic_import_transitive() { fn module_cyclic_import_transitive() {
let modules = vec![ let modules = vec![
@ -1085,7 +1084,7 @@ fn module_cyclic_import_transitive() {
err, err,
indoc!( indoc!(
r" r"
IMPORT CYCLE tmp/module_cyclic_import_transitive/Age.roc IMPORT CYCLE in tmp/module_cyclic_import_transitive/Age.roc
I can't compile Age because it depends on itself through the following I can't compile Age because it depends on itself through the following
chain of module imports: chain of module imports:
@ -1133,7 +1132,7 @@ fn nested_module_has_incorrect_name() {
err, err,
indoc!( indoc!(
r" r"
INCORRECT MODULE NAME tmp/nested_module_has_incorrect_name/Dep/Foo.roc INCORRECT MODULE NAME in tmp/nested_module_has_incorrect_name/Dep/Foo.roc
This module has a different name than I expected: This module has a different name than I expected:
@ -1148,3 +1147,55 @@ fn nested_module_has_incorrect_name() {
err err
); );
} }
#[test]
fn module_interface_with_qualified_import() {
let modules = vec![(
"A",
indoc!(
r"
interface A exposes [] imports [b.T]
"
),
)];
let err = multiple_modules("module_interface_with_qualified_import", modules).unwrap_err();
assert_eq!(
err,
indoc!(
r#"
The package shorthand 'b' that you are using in the 'imports' section of the header of module 'tmp/module_interface_with_qualified_import/A' doesn't exist.
Check that package shorthand is correct or reference the package in an 'app' or 'package' header.
This module is an interface, because of a bug in the compiler we are unable to directly typecheck interface modules with package imports so this error may not be correct. Please start checking at an app, package or platform file that imports this file."#
),
"\n{}",
err
);
}
#[test]
fn app_missing_package_import() {
let modules = vec![(
"Main",
indoc!(
r#"
app "example"
packages { pack: "./package/main.roc" }
imports [notpack.Mod]
provides [] to pack
main = ""
"#
),
)];
let err = multiple_modules("app_missing_package_import", modules).unwrap_err();
assert_eq!(
err,
indoc!(
r#"
The package shorthand 'notpack' that you are using in the 'imports' section of the header of module 'tmp/app_missing_package_import/Main' doesn't exist.
Check that package shorthand is correct or reference the package in an 'app' or 'package' header."#
),
"\n{}",
err
);
}

View file

@ -9,10 +9,8 @@ pub enum LowLevel {
StrJoinWith, StrJoinWith,
StrIsEmpty, StrIsEmpty,
StrStartsWith, StrStartsWith,
StrStartsWithScalar,
StrEndsWith, StrEndsWith,
StrSplit, StrSplit,
StrCountGraphemes,
StrCountUtf8Bytes, StrCountUtf8Bytes,
StrFromInt, StrFromInt,
StrFromUtf8Range, StrFromUtf8Range,
@ -23,15 +21,11 @@ pub enum LowLevel {
StrTrimStart, StrTrimStart,
StrTrimEnd, StrTrimEnd,
StrToNum, StrToNum,
StrToScalars,
StrGetUnsafe, StrGetUnsafe,
StrSubstringUnsafe, StrSubstringUnsafe,
StrReserve, StrReserve,
StrAppendScalar,
StrGetScalarUnsafe,
StrGetCapacity, StrGetCapacity,
StrWithCapacity, StrWithCapacity,
StrGraphemes,
StrReleaseExcessCapacity, StrReleaseExcessCapacity,
ListLen, ListLen,
ListWithCapacity, ListWithCapacity,
@ -50,8 +44,9 @@ pub enum LowLevel {
ListSublist, ListSublist,
ListDropAt, ListDropAt,
ListSwap, ListSwap,
ListIsUnique,
ListGetCapacity, ListGetCapacity,
ListIsUnique,
ListClone,
NumAdd, NumAdd,
NumAddWrap, NumAddWrap,
NumAddChecked, NumAddChecked,
@ -263,10 +258,8 @@ map_symbol_to_lowlevel! {
StrJoinWith <= STR_JOIN_WITH; StrJoinWith <= STR_JOIN_WITH;
StrIsEmpty <= STR_IS_EMPTY; StrIsEmpty <= STR_IS_EMPTY;
StrStartsWith <= STR_STARTS_WITH; StrStartsWith <= STR_STARTS_WITH;
StrStartsWithScalar <= STR_STARTS_WITH_SCALAR;
StrEndsWith <= STR_ENDS_WITH; StrEndsWith <= STR_ENDS_WITH;
StrSplit <= STR_SPLIT; StrSplit <= STR_SPLIT;
StrCountGraphemes <= STR_COUNT_GRAPHEMES;
StrCountUtf8Bytes <= STR_COUNT_UTF8_BYTES; StrCountUtf8Bytes <= STR_COUNT_UTF8_BYTES;
StrFromUtf8Range <= STR_FROM_UTF8_RANGE_LOWLEVEL; StrFromUtf8Range <= STR_FROM_UTF8_RANGE_LOWLEVEL;
StrToUtf8 <= STR_TO_UTF8; StrToUtf8 <= STR_TO_UTF8;
@ -274,16 +267,12 @@ map_symbol_to_lowlevel! {
StrTrim <= STR_TRIM; StrTrim <= STR_TRIM;
StrTrimStart <= STR_TRIM_START; StrTrimStart <= STR_TRIM_START;
StrTrimEnd <= STR_TRIM_END; StrTrimEnd <= STR_TRIM_END;
StrToScalars <= STR_TO_SCALARS;
StrGetUnsafe <= STR_GET_UNSAFE; StrGetUnsafe <= STR_GET_UNSAFE;
StrSubstringUnsafe <= STR_SUBSTRING_UNSAFE; StrSubstringUnsafe <= STR_SUBSTRING_UNSAFE;
StrReserve <= STR_RESERVE; StrReserve <= STR_RESERVE;
StrAppendScalar <= STR_APPEND_SCALAR_UNSAFE;
StrGetScalarUnsafe <= STR_GET_SCALAR_UNSAFE;
StrToNum <= STR_TO_NUM; StrToNum <= STR_TO_NUM;
StrGetCapacity <= STR_CAPACITY; StrGetCapacity <= STR_CAPACITY;
StrWithCapacity <= STR_WITH_CAPACITY; StrWithCapacity <= STR_WITH_CAPACITY;
StrGraphemes <= STR_GRAPHEMES;
StrReleaseExcessCapacity <= STR_RELEASE_EXCESS_CAPACITY; StrReleaseExcessCapacity <= STR_RELEASE_EXCESS_CAPACITY;
ListLen <= LIST_LEN; ListLen <= LIST_LEN;
ListGetCapacity <= LIST_CAPACITY; ListGetCapacity <= LIST_CAPACITY;
@ -291,6 +280,7 @@ map_symbol_to_lowlevel! {
ListReserve <= LIST_RESERVE; ListReserve <= LIST_RESERVE;
ListReleaseExcessCapacity <= LIST_RELEASE_EXCESS_CAPACITY; ListReleaseExcessCapacity <= LIST_RELEASE_EXCESS_CAPACITY;
ListIsUnique <= LIST_IS_UNIQUE; ListIsUnique <= LIST_IS_UNIQUE;
ListClone <= LIST_CLONE;
ListAppendUnsafe <= LIST_APPEND_UNSAFE; ListAppendUnsafe <= LIST_APPEND_UNSAFE;
ListPrepend <= LIST_PREPEND; ListPrepend <= LIST_PREPEND;
ListGetUnsafe <= LIST_GET_UNSAFE, DICT_LIST_GET_UNSAFE; ListGetUnsafe <= LIST_GET_UNSAFE, DICT_LIST_GET_UNSAFE;

View file

@ -1274,6 +1274,7 @@ define_builtins! {
162 NUM_PI: "pi" 162 NUM_PI: "pi"
163 NUM_TAU: "tau" 163 NUM_TAU: "tau"
164 NUM_BITWISE_NOT: "bitwiseNot" 164 NUM_BITWISE_NOT: "bitwiseNot"
165 NUM_IS_APPROX_EQ: "isApproxEq"
} }
4 BOOL: "Bool" => { 4 BOOL: "Bool" => {
0 BOOL_BOOL: "Bool" exposed_type=true // the Bool.Bool type alias 0 BOOL_BOOL: "Bool" exposed_type=true // the Bool.Bool type alias
@ -1297,14 +1298,14 @@ define_builtins! {
3 STR_CONCAT: "concat" 3 STR_CONCAT: "concat"
4 STR_JOIN_WITH: "joinWith" 4 STR_JOIN_WITH: "joinWith"
5 STR_SPLIT: "split" 5 STR_SPLIT: "split"
6 STR_COUNT_GRAPHEMES: "countGraphemes" 6 STR_WITH_PREFIX: "withPrefix"
7 STR_STARTS_WITH: "startsWith" 7 STR_STARTS_WITH: "startsWith"
8 STR_ENDS_WITH: "endsWith" 8 STR_ENDS_WITH: "endsWith"
9 STR_FROM_UTF8: "fromUtf8" 9 STR_FROM_UTF8: "fromUtf8"
10 STR_UT8_PROBLEM: "Utf8Problem" // the Utf8Problem type alias 10 STR_UT8_PROBLEM: "Utf8Problem" // the Utf8Problem type alias
11 STR_UT8_BYTE_PROBLEM: "Utf8ByteProblem" // the Utf8ByteProblem type alias 11 STR_UT8_BYTE_PROBLEM: "Utf8ByteProblem" // the Utf8ByteProblem type alias
12 STR_TO_UTF8: "toUtf8" 12 STR_TO_UTF8: "toUtf8"
13 STR_STARTS_WITH_SCALAR: "startsWithScalar" 13 STR_WALK_UTF8: "walkUtf8"
14 STR_ALIAS_ANALYSIS_STATIC: "#aliasAnalysisStatic" // string with the static lifetime 14 STR_ALIAS_ANALYSIS_STATIC: "#aliasAnalysisStatic" // string with the static lifetime
15 STR_FROM_UTF8_RANGE: "fromUtf8Range" 15 STR_FROM_UTF8_RANGE: "fromUtf8Range"
16 STR_REPEAT: "repeat" 16 STR_REPEAT: "repeat"
@ -1325,7 +1326,7 @@ define_builtins! {
31 STR_TO_I16: "toI16" 31 STR_TO_I16: "toI16"
32 STR_TO_U8: "toU8" 32 STR_TO_U8: "toU8"
33 STR_TO_I8: "toI8" 33 STR_TO_I8: "toI8"
34 STR_TO_SCALARS: "toScalars" 34 STR_CONTAINS: "contains"
35 STR_GET_UNSAFE: "getUnsafe" 35 STR_GET_UNSAFE: "getUnsafe"
36 STR_COUNT_UTF8_BYTES: "countUtf8Bytes" 36 STR_COUNT_UTF8_BYTES: "countUtf8Bytes"
37 STR_SUBSTRING_UNSAFE: "substringUnsafe" 37 STR_SUBSTRING_UNSAFE: "substringUnsafe"
@ -1333,24 +1334,14 @@ define_builtins! {
39 STR_SPLIT_LAST: "splitLast" 39 STR_SPLIT_LAST: "splitLast"
40 STR_WALK_UTF8_WITH_INDEX: "walkUtf8WithIndex" 40 STR_WALK_UTF8_WITH_INDEX: "walkUtf8WithIndex"
41 STR_RESERVE: "reserve" 41 STR_RESERVE: "reserve"
42 STR_APPEND_SCALAR_UNSAFE: "appendScalarUnsafe" 42 STR_TO_NUM: "strToNum"
43 STR_APPEND_SCALAR: "appendScalar" 43 STR_FROM_UTF8_RANGE_LOWLEVEL: "fromUtf8RangeLowlevel"
44 STR_GET_SCALAR_UNSAFE: "getScalarUnsafe" 44 STR_CAPACITY: "capacity"
45 STR_WALK_SCALARS: "walkScalars" 45 STR_REPLACE_EACH: "replaceEach"
46 STR_WALK_SCALARS_UNTIL: "walkScalarsUntil" 46 STR_REPLACE_FIRST: "replaceFirst"
47 STR_TO_NUM: "strToNum" 47 STR_REPLACE_LAST: "replaceLast"
48 STR_FROM_UTF8_RANGE_LOWLEVEL: "fromUtf8RangeLowlevel" 48 STR_WITH_CAPACITY: "withCapacity"
49 STR_CAPACITY: "capacity" 49 STR_RELEASE_EXCESS_CAPACITY: "releaseExcessCapacity"
50 STR_REPLACE_EACH: "replaceEach"
51 STR_REPLACE_FIRST: "replaceFirst"
52 STR_REPLACE_LAST: "replaceLast"
53 STR_WITH_CAPACITY: "withCapacity"
54 STR_WITH_PREFIX: "withPrefix"
55 STR_GRAPHEMES: "graphemes"
56 STR_IS_VALID_SCALAR: "isValidScalar"
57 STR_RELEASE_EXCESS_CAPACITY: "releaseExcessCapacity"
58 STR_WALK_UTF8: "walkUtf8"
59 STR_CONTAINS: "contains"
} }
6 LIST: "List" => { 6 LIST: "List" => {
0 LIST_LIST: "List" exposed_apply_type=true // the List.List type alias 0 LIST_LIST: "List" exposed_apply_type=true // the List.List type alias
@ -1440,6 +1431,7 @@ define_builtins! {
84 LIST_APPEND_IF_OK: "appendIfOk" 84 LIST_APPEND_IF_OK: "appendIfOk"
85 LIST_PREPEND_IF_OK: "prependIfOk" 85 LIST_PREPEND_IF_OK: "prependIfOk"
86 LIST_WALK_WITH_INDEX_UNTIL: "walkWithIndexUntil" 86 LIST_WALK_WITH_INDEX_UNTIL: "walkWithIndexUntil"
87 LIST_CLONE: "clone"
} }
7 RESULT: "Result" => { 7 RESULT: "Result" => {
0 RESULT_RESULT: "Result" exposed_type=true // the Result.Result type alias 0 RESULT_RESULT: "Result" exposed_type=true // the Result.Result type alias

View file

@ -1533,17 +1533,14 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC {
match lowlevel { match lowlevel {
Unreachable => RC::Uknown, Unreachable => RC::Uknown,
ListLen | StrIsEmpty | StrToScalars | StrCountGraphemes | StrGraphemes ListLen | StrIsEmpty | StrCountUtf8Bytes | StrGetCapacity | ListGetCapacity
| StrCountUtf8Bytes | StrGetCapacity | ListGetCapacity => RC::NoRc, | ListWithCapacity | StrWithCapacity => RC::NoRc,
ListWithCapacity | StrWithCapacity => RC::NoRc,
ListReplaceUnsafe => RC::Rc, ListReplaceUnsafe => RC::Rc,
StrGetUnsafe | ListGetUnsafe => RC::NoRc, StrGetUnsafe | ListGetUnsafe => RC::NoRc,
ListConcat => RC::Rc, ListConcat => RC::Rc,
StrConcat => RC::Rc, StrConcat => RC::Rc,
StrSubstringUnsafe => RC::Rc, StrSubstringUnsafe => RC::Rc,
StrReserve => RC::Rc, StrReserve => RC::Rc,
StrAppendScalar => RC::Rc,
StrGetScalarUnsafe => RC::NoRc,
StrTrim => RC::Rc, StrTrim => RC::Rc,
StrTrimStart => RC::Rc, StrTrimStart => RC::Rc,
StrTrimEnd => RC::Rc, StrTrimEnd => RC::Rc,
@ -1603,7 +1600,6 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC {
I128OfDec => RC::NoRc, I128OfDec => RC::NoRc,
DictPseudoSeed => RC::NoRc, DictPseudoSeed => RC::NoRc,
StrStartsWith | StrEndsWith => RC::NoRc, StrStartsWith | StrEndsWith => RC::NoRc,
StrStartsWithScalar => RC::NoRc,
StrFromUtf8Range => RC::Rc, StrFromUtf8Range => RC::Rc,
StrToUtf8 => RC::Rc, StrToUtf8 => RC::Rc,
StrRepeat => RC::NoRc, StrRepeat => RC::NoRc,
@ -1611,6 +1607,7 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC {
Hash => RC::NoRc, Hash => RC::NoRc,
ListIsUnique => RC::Rc, ListIsUnique => RC::Rc,
ListClone => RC::Rc,
BoxExpr | UnboxExpr => { BoxExpr | UnboxExpr => {
unreachable!("These lowlevel operations are turned into mono Expr's") unreachable!("These lowlevel operations are turned into mono Expr's")

View file

@ -1283,8 +1283,7 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
match op { match op {
Unreachable => arena.alloc_slice_copy(&[irrelevant]), Unreachable => arena.alloc_slice_copy(&[irrelevant]),
DictPseudoSeed => arena.alloc_slice_copy(&[irrelevant]), DictPseudoSeed => arena.alloc_slice_copy(&[irrelevant]),
ListLen | StrIsEmpty | StrToScalars | StrCountGraphemes | StrGraphemes ListLen | StrIsEmpty | StrCountUtf8Bytes | StrGetCapacity | ListGetCapacity => {
| StrCountUtf8Bytes | StrGetCapacity | ListGetCapacity => {
arena.alloc_slice_copy(&[borrowed]) arena.alloc_slice_copy(&[borrowed])
} }
ListWithCapacity | StrWithCapacity => arena.alloc_slice_copy(&[irrelevant]), ListWithCapacity | StrWithCapacity => arena.alloc_slice_copy(&[irrelevant]),
@ -1294,8 +1293,6 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
StrConcat => arena.alloc_slice_copy(&[owned, borrowed]), StrConcat => arena.alloc_slice_copy(&[owned, borrowed]),
StrSubstringUnsafe => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]), StrSubstringUnsafe => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]),
StrReserve => arena.alloc_slice_copy(&[owned, irrelevant]), StrReserve => arena.alloc_slice_copy(&[owned, irrelevant]),
StrAppendScalar => arena.alloc_slice_copy(&[owned, irrelevant]),
StrGetScalarUnsafe => arena.alloc_slice_copy(&[borrowed, irrelevant]),
StrTrim => arena.alloc_slice_copy(&[owned]), StrTrim => arena.alloc_slice_copy(&[owned]),
StrTrimStart => arena.alloc_slice_copy(&[owned]), StrTrimStart => arena.alloc_slice_copy(&[owned]),
StrTrimEnd => arena.alloc_slice_copy(&[owned]), StrTrimEnd => arena.alloc_slice_copy(&[owned]),
@ -1308,7 +1305,6 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
ListMap3 => arena.alloc_slice_copy(&[owned, owned, owned, function, closure_data]), ListMap3 => arena.alloc_slice_copy(&[owned, owned, owned, function, closure_data]),
ListMap4 => arena.alloc_slice_copy(&[owned, owned, owned, owned, function, closure_data]), ListMap4 => arena.alloc_slice_copy(&[owned, owned, owned, owned, function, closure_data]),
ListSortWith => arena.alloc_slice_copy(&[owned, function, closure_data]), ListSortWith => arena.alloc_slice_copy(&[owned, function, closure_data]),
ListAppendUnsafe => arena.alloc_slice_copy(&[owned, owned]), ListAppendUnsafe => arena.alloc_slice_copy(&[owned, owned]),
ListReserve => arena.alloc_slice_copy(&[owned, irrelevant]), ListReserve => arena.alloc_slice_copy(&[owned, irrelevant]),
ListSublist => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]), ListSublist => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]),
@ -1358,7 +1354,6 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
NumBytesToU64 => arena.alloc_slice_copy(&[borrowed, irrelevant]), NumBytesToU64 => arena.alloc_slice_copy(&[borrowed, irrelevant]),
NumBytesToU128 => arena.alloc_slice_copy(&[borrowed, irrelevant]), NumBytesToU128 => arena.alloc_slice_copy(&[borrowed, irrelevant]),
StrStartsWith | StrEndsWith => arena.alloc_slice_copy(&[borrowed, borrowed]), StrStartsWith | StrEndsWith => arena.alloc_slice_copy(&[borrowed, borrowed]),
StrStartsWithScalar => arena.alloc_slice_copy(&[borrowed, irrelevant]),
StrFromUtf8Range => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]), StrFromUtf8Range => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]),
StrToUtf8 => arena.alloc_slice_copy(&[owned]), StrToUtf8 => arena.alloc_slice_copy(&[owned]),
StrRepeat => arena.alloc_slice_copy(&[borrowed, irrelevant]), StrRepeat => arena.alloc_slice_copy(&[borrowed, irrelevant]),
@ -1366,6 +1361,7 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
Hash => arena.alloc_slice_copy(&[borrowed, irrelevant]), Hash => arena.alloc_slice_copy(&[borrowed, irrelevant]),
ListIsUnique => arena.alloc_slice_copy(&[borrowed]), ListIsUnique => arena.alloc_slice_copy(&[borrowed]),
ListClone => arena.alloc_slice_copy(&[owned]),
BoxExpr | UnboxExpr => { BoxExpr | UnboxExpr => {
unreachable!("These lowlevel operations are turned into mono Expr's") unreachable!("These lowlevel operations are turned into mono Expr's")

View file

@ -61,10 +61,8 @@ enum FirstOrder {
StrJoinWith, StrJoinWith,
StrIsEmpty, StrIsEmpty,
StrStartsWith, StrStartsWith,
StrStartsWithScalar,
StrEndsWith, StrEndsWith,
StrSplit, StrSplit,
StrCountGraphemes,
StrFromInt, StrFromInt,
StrFromUtf8, StrFromUtf8,
StrFromUtf8Range, StrFromUtf8Range,

View file

@ -23,6 +23,16 @@ impl<'a> HeaderType<'a> {
HeaderType::Platform { .. } | HeaderType::Package { .. } => &[], HeaderType::Platform { .. } | HeaderType::Package { .. } => &[],
} }
} }
pub fn to_string(&'a self) -> &str {
match self {
HeaderType::App { .. } => "app",
HeaderType::Hosted { .. } => "hosted",
HeaderType::Builtin { .. } => "builtin",
HeaderType::Package { .. } => "package",
HeaderType::Platform { .. } => "platform",
HeaderType::Interface { .. } => "interface",
}
}
} }
#[derive(Debug)] #[derive(Debug)]

View file

@ -33,7 +33,7 @@ fn multi_branch_capturing() {
f = \t, s -> f = \t, s ->
if t if t
then \{} -> 15nat then \{} -> 15nat
else \{} -> Str.countGraphemes s else \{} -> Str.countUtf8Bytes s
main = ((f Bool.true "abc") {}, (f Bool.false "abc") {}) main = ((f Bool.true "abc") {}, (f Bool.false "abc") {})
"# "#

View file

@ -3158,7 +3158,7 @@ fn list_find() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findFirst ["a", "bc", "def", "g"] (\s -> Str.countGraphemes s > 1) is when List.findFirst ["a", "bc", "def", "g"] (\s -> Str.countUtf8Bytes s > 1) is
Ok v -> v Ok v -> v
Err _ -> "not found" Err _ -> "not found"
"# "#
@ -3170,7 +3170,7 @@ fn list_find() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findLast ["a", "bc", "def", "g"] (\s -> Str.countGraphemes s > 1) is when List.findLast ["a", "bc", "def", "g"] (\s -> Str.countUtf8Bytes s > 1) is
Ok v -> v Ok v -> v
Err _ -> "not found" Err _ -> "not found"
"# "#
@ -3186,7 +3186,7 @@ fn list_find_not_found() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findFirst ["a", "bc", "def", "g"] (\s -> Str.countGraphemes s > 5) is when List.findFirst ["a", "bc", "def", "g"] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> "not found" Err _ -> "not found"
"# "#
@ -3198,7 +3198,7 @@ fn list_find_not_found() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findLast ["a", "bc", "def", "g"] (\s -> Str.countGraphemes s > 5) is when List.findLast ["a", "bc", "def", "g"] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> "not found" Err _ -> "not found"
"# "#
@ -3214,7 +3214,7 @@ fn list_find_empty_typed_list() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findFirst [] (\s -> Str.countGraphemes s > 5) is when List.findFirst [] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> "not found" Err _ -> "not found"
"# "#
@ -3226,7 +3226,7 @@ fn list_find_empty_typed_list() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findLast [] (\s -> Str.countGraphemes s > 5) is when List.findLast [] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> "not found" Err _ -> "not found"
"# "#
@ -3270,7 +3270,7 @@ fn list_find_index() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findFirstIndex ["a", "bc", "def", "g"] (\s -> Str.countGraphemes s > 1) is when List.findFirstIndex ["a", "bc", "def", "g"] (\s -> Str.countUtf8Bytes s > 1) is
Ok v -> v Ok v -> v
Err _ -> 999 Err _ -> 999
"# "#
@ -3282,7 +3282,7 @@ fn list_find_index() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findLastIndex ["a", "bc", "def", "g"] (\s -> Str.countGraphemes s > 1) is when List.findLastIndex ["a", "bc", "def", "g"] (\s -> Str.countUtf8Bytes s > 1) is
Ok v -> v Ok v -> v
Err _ -> 999 Err _ -> 999
"# "#
@ -3298,7 +3298,7 @@ fn list_find_index_not_found() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findFirstIndex ["a", "bc", "def", "g"] (\s -> Str.countGraphemes s > 5) is when List.findFirstIndex ["a", "bc", "def", "g"] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> 999 Err _ -> 999
"# "#
@ -3310,7 +3310,7 @@ fn list_find_index_not_found() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r#" r#"
when List.findLastIndex ["a", "bc", "def"] (\s -> Str.countGraphemes s > 5) is when List.findLastIndex ["a", "bc", "def"] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> 999 Err _ -> 999
"# "#
@ -3326,7 +3326,7 @@ fn list_find_index_empty_typed_list() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r" r"
when List.findFirstIndex [] (\s -> Str.countGraphemes s > 5) is when List.findFirstIndex [] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> 999 Err _ -> 999
" "
@ -3338,7 +3338,7 @@ fn list_find_index_empty_typed_list() {
assert_evals_to!( assert_evals_to!(
indoc!( indoc!(
r" r"
when List.findLastIndex [] (\s -> Str.countGraphemes s > 5) is when List.findLastIndex [] (\s -> Str.countUtf8Bytes s > 5) is
Ok v -> v Ok v -> v
Err _ -> 999 Err _ -> 999
" "

View file

@ -531,11 +531,18 @@ fn f64_abs() {
assert_evals_to!("Num.abs -4.7f64", 4.7, f64); assert_evals_to!("Num.abs -4.7f64", 4.7, f64);
assert_evals_to!("Num.abs 5.8f64", 5.8, f64); assert_evals_to!("Num.abs 5.8f64", 5.8, f64);
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] assert_evals_to!("Num.abs Num.maxF64", f64::MAX, f64);
{ assert_evals_to!("Num.abs Num.minF64", f64::MAX, f64);
assert_evals_to!("Num.abs Num.maxF64", f64::MAX, f64); }
assert_evals_to!("Num.abs Num.minF64", f64::MAX, f64);
} #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))]
fn f32_abs() {
assert_evals_to!("Num.abs -4.7f32", 4.7, f32);
assert_evals_to!("Num.abs 5.8f32", 5.8, f32);
assert_evals_to!("Num.abs Num.maxF32", f32::MAX, f32);
assert_evals_to!("Num.abs Num.minF32", f32::MAX, f32);
} }
#[test] #[test]
@ -1484,6 +1491,29 @@ fn gte_f64() {
assert_evals_to!("0.0f64 >= 0.0", true, bool); assert_evals_to!("0.0f64 >= 0.0", true, bool);
} }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn gen_is_approx_eq() {
assert_evals_to!("Num.isApproxEq 1e10f64 1.00001e10f64 {}", true, bool);
assert_evals_to!("Num.isApproxEq 1e-7f64 1e-8f64 {}", false, bool);
assert_evals_to!("Num.isApproxEq 1e-8f32 1e-9f32 {}", true, bool);
assert_evals_to!("Num.isApproxEq 1e10f64 1.0001e10f64 {}", false, bool);
assert_evals_to!("Num.isApproxEq 1.0f32 1.0 {}", true, bool);
assert_evals_to!("Num.isApproxEq (1f64 / 0.0) (1f64 / 0.0) {}", true, bool);
assert_evals_to!("Num.isApproxEq (0f64 / 0.0) (0f64 / 0.0) {}", false, bool);
assert_evals_to!("Num.isApproxEq 1e-8f64 0f64 {}", true, bool);
assert_evals_to!("Num.isApproxEq 1e-7f64 0f64 {}", false, bool);
assert_evals_to!("Num.isApproxEq 1e-100f64 0f64 { atol: 0f64 }", false, bool);
assert_evals_to!("Num.isApproxEq 1e-7f64 0f64 { atol: 0f64 }", false, bool);
assert_evals_to!("Num.isApproxEq 1e-10f64 1e-20f64 {}", true, bool);
assert_evals_to!("Num.isApproxEq 1e-10f64 0f64 {}", true, bool);
assert_evals_to!(
"Num.isApproxEq 1e-10f64 0.999999e-10f64 { atol: 0f64 }",
true,
bool
);
}
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn gen_order_of_arithmetic_ops() { fn gen_order_of_arithmetic_ops() {

View file

@ -67,7 +67,7 @@ fn str_split_empty_delimiter() {
r#" r#"
when List.first (Str.split "JJJ" "") is when List.first (Str.split "JJJ" "") is
Ok str -> Ok str ->
Str.countGraphemes str Str.countUtf8Bytes str
_ -> _ ->
1729 1729
@ -97,7 +97,7 @@ fn str_split_bigger_delimiter_small_str() {
r#" r#"
when List.first (Str.split "JJJ" "JJJJ there") is when List.first (Str.split "JJJ" "JJJJ there") is
Ok str -> Ok str ->
Str.countGraphemes str Str.countUtf8Bytes str
_ -> _ ->
1729 1729
@ -528,21 +528,6 @@ fn str_starts_with() {
assert_evals_to!(r#"Str.startsWith "" "hello world""#, false, bool); assert_evals_to!(r#"Str.startsWith "" "hello world""#, false, bool);
} }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_starts_with_scalar() {
assert_evals_to!(
&format!(r#"Str.startsWithScalar "foobar" {}"#, 'f' as u32),
true,
bool
);
assert_evals_to!(
&format!(r#"Str.startsWithScalar "zoobar" {}"#, 'f' as u32),
false,
bool
);
}
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_ends_with() { fn str_ends_with() {
@ -551,28 +536,6 @@ fn str_ends_with() {
assert_evals_to!(r#"Str.endsWith "" "hello world""#, false, bool); assert_evals_to!(r#"Str.endsWith "" "hello world""#, false, bool);
} }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_count_graphemes_small_str() {
assert_evals_to!(r#"Str.countGraphemes "å🤔""#, 2, usize);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_count_graphemes_three_js() {
assert_evals_to!(r#"Str.countGraphemes "JJJ""#, 3, usize);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_count_graphemes_big_str() {
assert_evals_to!(
r#"Str.countGraphemes "6🤔å🤔e¥🤔çppkd🙃1jdal🦯asdfa∆ltråø˚waia8918.,🏅jjc""#,
45,
usize
);
}
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_starts_with_same_big_str() { fn str_starts_with_same_big_str() {
@ -1625,103 +1588,6 @@ fn issue_2811() {
); );
} }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn to_scalar_1_byte() {
assert_evals_to!(
indoc!(
r#"
Str.toScalars "R"
"#
),
RocList::from_slice(&[82u32]),
RocList<u32>
);
assert_evals_to!(
indoc!(
r#"
Str.toScalars "Roc!"
"#
),
RocList::from_slice(&[82u32, 111, 99, 33]),
RocList<u32>
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn to_scalar_2_byte() {
assert_evals_to!(
indoc!(
r#"
Str.toScalars "é"
"#
),
RocList::from_slice(&[233u32]),
RocList<u32>
);
assert_evals_to!(
indoc!(
r#"
Str.toScalars "Cäfés"
"#
),
RocList::from_slice(&[67u32, 228, 102, 233, 115]),
RocList<u32>
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn to_scalar_3_byte() {
assert_evals_to!(
indoc!(
r#"
Str.toScalars ""
"#
),
RocList::from_slice(&[40527u32]),
RocList<u32>
);
assert_evals_to!(
indoc!(
r#"
Str.toScalars "鹏很有趣"
"#
),
RocList::from_slice(&[40527u32, 24456, 26377, 36259]),
RocList<u32>
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn to_scalar_4_byte() {
// from https://design215.com/toolbox/utf8-4byte-characters.php
assert_evals_to!(
indoc!(
r#"
Str.toScalars "𒀀"
"#
),
RocList::from_slice(&[73728u32]),
RocList<u32>
);
assert_evals_to!(
indoc!(
r#"
Str.toScalars "𒀀𒀁"
"#
),
RocList::from_slice(&[73728u32, 73729u32]),
RocList<u32>
);
}
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_split_first_one_char() { fn str_split_first_one_char() {
@ -1909,34 +1775,6 @@ fn str_walk_utf8_with_index() {
); );
} }
#[test]
#[cfg(feature = "gen-llvm")]
fn str_append_scalar() {
assert_evals_to!(
indoc!(
r#"
Str.appendScalar "abcd" 'A'
"#
),
RocStr::from("abcdA"),
RocStr
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_walk_scalars() {
assert_evals_to!(
indoc!(
r#"
Str.walkScalars "abcd" [] List.append
"#
),
RocList::from_slice(&['a', 'b', 'c', 'd']),
RocList<char>
);
}
#[test] #[test]
#[cfg(feature = "gen-llvm-wasm")] #[cfg(feature = "gen-llvm-wasm")]
fn llvm_wasm_str_layout() { fn llvm_wasm_str_layout() {

View file

@ -27,27 +27,6 @@ fn str_split_empty_delimiter() {
); );
} }
// This test produces an app that exposes nothing to the host!
#[test]
#[ignore]
fn str_split_empty_delimiter_broken() {
assert_evals_to!(
indoc!(
r#"
when List.first (Str.split "JJJ" "") is
Ok str ->
Str.countGraphemes str
_ ->
-1
"#
),
3,
usize
);
}
#[test] #[test]
fn str_split_bigger_delimiter_small_str() { fn str_split_bigger_delimiter_small_str() {
assert_evals_to!( assert_evals_to!(
@ -61,27 +40,6 @@ fn str_split_bigger_delimiter_small_str() {
); );
} }
// This test produces an app that exposes nothing to the host!
#[test]
#[ignore]
fn str_split_bigger_delimiter_small_str_broken() {
assert_evals_to!(
indoc!(
r#"
when List.first (Str.split "JJJ" "JJJJ there") is
Ok str ->
Str.countGraphemes str
_ ->
-1
"#
),
3,
usize
);
}
#[test] #[test]
fn str_split_str_concat_repeated() { fn str_split_str_concat_repeated() {
assert_evals_to!( assert_evals_to!(
@ -414,20 +372,6 @@ fn str_starts_with() {
assert_evals_to!(r#"Str.startsWith "" "hello world""#, false, bool); assert_evals_to!(r#"Str.startsWith "" "hello world""#, false, bool);
} }
#[test]
fn str_starts_with_scalar() {
assert_evals_to!(
&format!(r#"Str.startsWithScalar "foobar" {}"#, 'f' as u32),
true,
bool
);
assert_evals_to!(
&format!(r#"Str.startsWithScalar "zoobar" {}"#, 'f' as u32),
false,
bool
);
}
#[test] #[test]
fn str_ends_with() { fn str_ends_with() {
assert_evals_to!(r#"Str.endsWith "hello world" "world""#, true, bool); assert_evals_to!(r#"Str.endsWith "hello world" "world""#, true, bool);
@ -435,25 +379,6 @@ fn str_ends_with() {
assert_evals_to!(r#"Str.endsWith "" "hello world""#, false, bool); assert_evals_to!(r#"Str.endsWith "" "hello world""#, false, bool);
} }
#[test]
fn str_count_graphemes_small_str() {
assert_evals_to!(r#"Str.countGraphemes "å🤔""#, 2, usize);
}
#[test]
fn str_count_graphemes_three_js() {
assert_evals_to!(r#"Str.countGraphemes "JJJ""#, 3, usize);
}
#[test]
fn str_count_graphemes_big_str() {
assert_evals_to!(
r#"Str.countGraphemes "6🤔å🤔e¥🤔çppkd🙃1jdal🦯asdfa∆ltråø˚waia8918.,🏅jjc""#,
45,
usize
);
}
#[test] #[test]
fn str_starts_with_same_big_str() { fn str_starts_with_same_big_str() {
assert_evals_to!( assert_evals_to!(
@ -1314,16 +1239,3 @@ fn str_to_dec() {
RocDec RocDec
); );
} }
#[test]
fn str_walk_scalars() {
assert_evals_to!(
indoc!(
r#"
Str.walkScalars "abcd" [] List.append
"#
),
RocList::from_slice(&['a', 'b', 'c', 'd']),
RocList<char>
);
}

View file

@ -2,92 +2,92 @@ procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23; ret Bool.23;
procedure List.101 (List.484, List.485, List.486): procedure List.102 (List.486, List.487, List.488):
let List.587 : U64 = 0i64; let List.589 : U64 = 0i64;
let List.588 : U64 = CallByName List.6 List.484; let List.590 : U64 = CallByName List.6 List.486;
let List.586 : [C U64, C U64] = CallByName List.80 List.484 List.485 List.486 List.587 List.588; let List.588 : [C U64, C U64] = CallByName List.80 List.486 List.487 List.488 List.589 List.590;
ret List.586; ret List.588;
procedure List.26 (List.197, List.198, List.199): procedure List.26 (List.199, List.200, List.201):
let List.580 : [C U64, C U64] = CallByName List.101 List.197 List.198 List.199; let List.582 : [C U64, C U64] = CallByName List.102 List.199 List.200 List.201;
let List.583 : U8 = 1i64; let List.585 : U8 = 1i64;
let List.584 : U8 = GetTagId List.580; let List.586 : U8 = GetTagId List.582;
let List.585 : Int1 = lowlevel Eq List.583 List.584; let List.587 : Int1 = lowlevel Eq List.585 List.586;
if List.585 then if List.587 then
let List.200 : U64 = UnionAtIndex (Id 1) (Index 0) List.580; let List.202 : U64 = UnionAtIndex (Id 1) (Index 0) List.582;
ret List.200; ret List.202;
else else
let List.201 : U64 = UnionAtIndex (Id 0) (Index 0) List.580; let List.203 : U64 = UnionAtIndex (Id 0) (Index 0) List.582;
ret List.201; ret List.203;
procedure List.38 (List.340, List.341): procedure List.38 (List.342, List.343):
let List.581 : U64 = CallByName List.6 List.342;
let List.344 : U64 = CallByName Num.77 List.581 List.343;
let List.571 : List U8 = CallByName List.43 List.342 List.344;
ret List.571;
procedure List.43 (List.340, List.341):
let List.579 : U64 = CallByName List.6 List.340; let List.579 : U64 = CallByName List.6 List.340;
let List.342 : U64 = CallByName Num.77 List.579 List.341; let List.578 : U64 = CallByName Num.77 List.579 List.341;
let List.569 : List U8 = CallByName List.43 List.340 List.342; let List.573 : {U64, U64} = Struct {List.341, List.578};
ret List.569; let List.572 : List U8 = CallByName List.49 List.340 List.573;
procedure List.43 (List.338, List.339):
let List.577 : U64 = CallByName List.6 List.338;
let List.576 : U64 = CallByName Num.77 List.577 List.339;
let List.571 : {U64, U64} = Struct {List.339, List.576};
let List.570 : List U8 = CallByName List.49 List.338 List.571;
ret List.570;
procedure List.49 (List.416, List.417):
let List.573 : U64 = StructAtIndex 1 List.417;
let List.574 : U64 = StructAtIndex 0 List.417;
let List.572 : List U8 = CallByName List.72 List.416 List.573 List.574;
ret List.572; ret List.572;
procedure List.49 (List.418, List.419):
let List.575 : U64 = StructAtIndex 1 List.419;
let List.576 : U64 = StructAtIndex 0 List.419;
let List.574 : List U8 = CallByName List.72 List.418 List.575 List.576;
ret List.574;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.578 : U64 = lowlevel ListLen #Attr.2; let List.580 : U64 = lowlevel ListLen #Attr.2;
ret List.578; ret List.580;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.601 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.603 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.601; ret List.603;
procedure List.72 (#Attr.2, #Attr.3, #Attr.4): procedure List.72 (#Attr.2, #Attr.3, #Attr.4):
let List.575 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; let List.577 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4;
ret List.575; ret List.577;
procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4):
joinpoint List.589 List.487 List.488 List.489 List.490 List.491: joinpoint List.591 List.489 List.490 List.491 List.492 List.493:
let List.591 : Int1 = CallByName Num.22 List.490 List.491; let List.593 : Int1 = CallByName Num.22 List.492 List.493;
if List.591 then if List.593 then
let List.600 : U8 = CallByName List.66 List.487 List.490; let List.602 : U8 = CallByName List.66 List.489 List.492;
let List.592 : [C U64, C U64] = CallByName Test.4 List.488 List.600; let List.594 : [C U64, C U64] = CallByName Test.4 List.490 List.602;
let List.597 : U8 = 1i64; let List.599 : U8 = 1i64;
let List.598 : U8 = GetTagId List.592; let List.600 : U8 = GetTagId List.594;
let List.599 : Int1 = lowlevel Eq List.597 List.598; let List.601 : Int1 = lowlevel Eq List.599 List.600;
if List.599 then if List.601 then
let List.492 : U64 = UnionAtIndex (Id 1) (Index 0) List.592; let List.494 : U64 = UnionAtIndex (Id 1) (Index 0) List.594;
let List.595 : U64 = 1i64; let List.597 : U64 = 1i64;
let List.594 : U64 = CallByName Num.51 List.490 List.595; let List.596 : U64 = CallByName Num.51 List.492 List.597;
jump List.589 List.487 List.492 List.489 List.594 List.491; jump List.591 List.489 List.494 List.491 List.596 List.493;
else else
dec List.487; dec List.489;
let List.493 : U64 = UnionAtIndex (Id 0) (Index 0) List.592; let List.495 : U64 = UnionAtIndex (Id 0) (Index 0) List.594;
let List.596 : [C U64, C U64] = TagId(0) List.493; let List.598 : [C U64, C U64] = TagId(0) List.495;
ret List.596; ret List.598;
else else
dec List.487; dec List.489;
let List.590 : [C U64, C U64] = TagId(1) List.488; let List.592 : [C U64, C U64] = TagId(1) List.490;
ret List.590; ret List.592;
in in
jump List.589 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; jump List.591 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.294 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.294; ret Num.300;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.293 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Num.77 (#Attr.2, #Attr.3): procedure Num.77 (#Attr.2, #Attr.3):
let Num.292 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; let Num.298 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Test.1 (Test.2): procedure Test.1 (Test.2):
let Test.13 : U64 = 0i64; let Test.13 : U64 = 0i64;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.4 (Test.27): procedure Test.4 (Test.27):
let Test.39 : [<rnu>C [<rnu><null>, C *self *self] *self, <null>] = TagId(0) ; let Test.39 : [<rnu>C [<rnu><null>, C *self *self] *self, <null>] = TagId(0) ;

View file

@ -1,7 +1,7 @@
procedure List.5 (#Attr.2, #Attr.3): procedure List.5 (#Attr.2, #Attr.3):
let List.569 : List {} = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; let List.571 : List {} = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3;
decref #Attr.2; decref #Attr.2;
ret List.569; ret List.571;
procedure Test.2 (Test.3): procedure Test.2 (Test.3):
let Test.7 : {} = Struct {}; let Test.7 : {} = Struct {};

View file

@ -1,7 +1,7 @@
procedure List.5 (#Attr.2, #Attr.3): procedure List.5 (#Attr.2, #Attr.3):
let List.569 : List [] = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; let List.571 : List [] = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3;
decref #Attr.2; decref #Attr.2;
ret List.569; ret List.571;
procedure Test.2 (Test.3): procedure Test.2 (Test.3):
let Test.7 : {} = Struct {}; let Test.7 : {} = Struct {};

View file

@ -1,39 +1,39 @@
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : [<r>C {}, C *self {{}, []}] = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : [<r>C {}, C *self {{}, []}] = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): procedure List.90 (#Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : [] = CallByName List.66 List.159 List.162; let List.580 : [] = CallByName List.66 List.161 List.164;
let List.164 : [<r>C {}, C *self {{}, []}] = CallByName Test.29 List.160 List.578 List.161; let List.166 : [<r>C {}, C *self {{}, []}] = CallByName Test.29 List.162 List.580 List.163;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; jump List.574 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.292 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.10 (Test.69, #Attr.12): procedure Test.10 (Test.69, #Attr.12):
let Test.72 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12; let Test.72 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12;

View file

@ -2,53 +2,53 @@ procedure Bool.1 ():
let Bool.24 : Int1 = false; let Bool.24 : Int1 = false;
ret Bool.24; ret Bool.24;
procedure List.2 (List.105, List.106): procedure List.2 (List.106, List.107):
let List.583 : U64 = CallByName List.6 List.105; let List.585 : U64 = CallByName List.6 List.106;
let List.579 : Int1 = CallByName Num.22 List.106 List.583; let List.581 : Int1 = CallByName Num.22 List.107 List.585;
if List.579 then if List.581 then
let List.581 : Str = CallByName List.66 List.105 List.106; let List.583 : Str = CallByName List.66 List.106 List.107;
inc List.581; inc List.583;
dec List.105; dec List.106;
let List.580 : [C {}, C Str] = TagId(1) List.581; let List.582 : [C {}, C Str] = TagId(1) List.583;
ret List.580; ret List.582;
else else
dec List.105; dec List.106;
let List.578 : {} = Struct {}; let List.580 : {} = Struct {};
let List.577 : [C {}, C Str] = TagId(0) List.578; let List.579 : [C {}, C Str] = TagId(0) List.580;
ret List.577; ret List.579;
procedure List.5 (#Attr.2, #Attr.3): procedure List.5 (#Attr.2, #Attr.3):
let List.585 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.10 #Attr.3; let List.587 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.10 #Attr.3;
decref #Attr.2; decref #Attr.2;
ret List.585; ret List.587;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.584 : U64 = lowlevel ListLen #Attr.2; let List.586 : U64 = lowlevel ListLen #Attr.2;
ret List.584; ret List.586;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.582 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.584 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.582; ret List.584;
procedure List.9 (List.331): procedure List.9 (List.333):
let List.576 : U64 = 0i64; let List.578 : U64 = 0i64;
let List.569 : [C {}, C Str] = CallByName List.2 List.331 List.576; let List.571 : [C {}, C Str] = CallByName List.2 List.333 List.578;
let List.573 : U8 = 1i64; let List.575 : U8 = 1i64;
let List.574 : U8 = GetTagId List.569; let List.576 : U8 = GetTagId List.571;
let List.575 : Int1 = lowlevel Eq List.573 List.574; let List.577 : Int1 = lowlevel Eq List.575 List.576;
if List.575 then if List.577 then
let List.332 : Str = UnionAtIndex (Id 1) (Index 0) List.569; let List.334 : Str = UnionAtIndex (Id 1) (Index 0) List.571;
let List.570 : [C {}, C Str] = TagId(1) List.332; let List.572 : [C {}, C Str] = TagId(1) List.334;
ret List.570; ret List.572;
else else
dec List.569; dec List.571;
let List.572 : {} = Struct {}; let List.574 : {} = Struct {};
let List.571 : [C {}, C Str] = TagId(0) List.572; let List.573 : [C {}, C Str] = TagId(0) List.574;
ret List.571; ret List.573;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.291 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Result.5 (Result.12, Result.13): procedure Result.5 (Result.12, Result.13):
let Result.39 : U8 = 1i64; let Result.39 : U8 = 1i64;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.292 : I128 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.298 : I128 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Test.0 (): procedure Test.0 ():
let Test.6 : I128 = 18446744073709551616i64; let Test.6 : I128 = 18446744073709551616i64;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : U128 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : U128 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.2 : U128 = 170141183460469231731687303715884105728u128; let Test.2 : U128 = 170141183460469231731687303715884105728u128;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.2 : U64 = 9999999999999999999i64; let Test.2 : U64 = 9999999999999999999i64;

View file

@ -1,6 +1,6 @@
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.569 : U64 = lowlevel ListLen #Attr.2; let List.571 : U64 = lowlevel ListLen #Attr.2;
ret List.569; ret List.571;
procedure Test.1 (Test.5): procedure Test.1 (Test.5):
let Test.2 : I64 = 41i64; let Test.2 : I64 = 41i64;

View file

@ -2,46 +2,46 @@ procedure Bool.2 ():
let Bool.23 : Int1 = true; let Bool.23 : Int1 = true;
ret Bool.23; ret Bool.23;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : [<rnw><null>, C *self Int1, C *self Int1] = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : [<rnw><null>, C *self Int1, C *self Int1] = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : Int1 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : Int1 = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7): procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : Int1 = CallByName List.66 List.159 List.162; let List.580 : Int1 = CallByName List.66 List.161 List.164;
let List.164 : [<rnw><null>, C *self Int1, C *self Int1] = CallByName Test.6 List.160 List.578 List.161; let List.166 : [<rnw><null>, C *self Int1, C *self Int1] = CallByName Test.6 List.162 List.580 List.163;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7; jump List.574 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.292 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.294 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.253 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.294; ret Str.253;
procedure Test.1 (Test.5): procedure Test.1 (Test.5):
ret Test.5; ret Test.5;

View file

@ -42,8 +42,8 @@ procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.1 (): procedure Test.1 ():
let Test.4 : Str = ""; let Test.4 : Str = "";

View file

@ -38,8 +38,8 @@ procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.3 : Str = ""; let Test.3 : Str = "";

View file

@ -26,12 +26,12 @@ procedure Dict.45 ():
ret Dict.738; ret Dict.738;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.569 : U64 = lowlevel ListLen #Attr.2; let List.571 : U64 = lowlevel ListLen #Attr.2;
ret List.569; ret List.571;
procedure Num.20 (#Attr.2, #Attr.3): procedure Num.20 (#Attr.2, #Attr.3):
let Num.291 : U8 = lowlevel NumSub #Attr.2 #Attr.3; let Num.297 : U8 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.3 : {} = Struct {}; let Test.3 : {} = Struct {};

View file

@ -2,31 +2,31 @@ procedure Bool.1 ():
let Bool.23 : Int1 = false; let Bool.23 : Int1 = false;
ret Bool.23; ret Bool.23;
procedure List.2 (List.105, List.106): procedure List.2 (List.106, List.107):
let List.575 : U64 = CallByName List.6 List.105; let List.577 : U64 = CallByName List.6 List.106;
let List.571 : Int1 = CallByName Num.22 List.106 List.575; let List.573 : Int1 = CallByName Num.22 List.107 List.577;
if List.571 then if List.573 then
let List.573 : {} = CallByName List.66 List.105 List.106; let List.575 : {} = CallByName List.66 List.106 List.107;
dec List.105; dec List.106;
let List.572 : [C {}, C {}] = TagId(1) List.573; let List.574 : [C {}, C {}] = TagId(1) List.575;
ret List.572; ret List.574;
else else
dec List.105; dec List.106;
let List.570 : {} = Struct {}; let List.572 : {} = Struct {};
let List.569 : [C {}, C {}] = TagId(0) List.570; let List.571 : [C {}, C {}] = TagId(0) List.572;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.576 : U64 = lowlevel ListLen #Attr.2; let List.578 : U64 = lowlevel ListLen #Attr.2;
ret List.576; ret List.578;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.574 : {} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.576 : {} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.574; ret List.576;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.291 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.2 (Test.5): procedure Test.2 (Test.5):
dec Test.5; dec Test.5;

View file

@ -1,16 +1,16 @@
procedure List.4 (List.121, List.122): procedure List.4 (List.122, List.123):
let List.572 : U64 = 1i64; let List.574 : U64 = 1i64;
let List.570 : List U8 = CallByName List.70 List.121 List.572; let List.572 : List U8 = CallByName List.70 List.122 List.574;
let List.569 : List U8 = CallByName List.71 List.570 List.122; let List.571 : List U8 = CallByName List.71 List.572 List.123;
ret List.569; ret List.571;
procedure List.70 (#Attr.2, #Attr.3): procedure List.70 (#Attr.2, #Attr.3):
let List.573 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; let List.575 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3;
ret List.573; ret List.575;
procedure List.71 (#Attr.2, #Attr.3): procedure List.71 (#Attr.2, #Attr.3):
let List.571 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; let List.573 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
ret List.571; ret List.573;
procedure Test.23 (Test.24, Test.35, Test.22): procedure Test.23 (Test.24, Test.35, Test.22):
let Test.37 : List U8 = CallByName List.4 Test.24 Test.22; let Test.37 : List U8 = CallByName List.4 Test.24 Test.22;

View file

@ -2,7 +2,7 @@ procedure Encode.23 (Encode.98):
ret Encode.98; ret Encode.98;
procedure Encode.24 (Encode.99, Encode.107, Encode.101): procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.111 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; let Encode.111 : List U8 = CallByName TotallyNotJson.150 Encode.99 Encode.101 Encode.107;
ret Encode.111; ret Encode.111;
procedure Encode.26 (Encode.105, Encode.106): procedure Encode.26 (Encode.105, Encode.106):
@ -11,343 +11,343 @@ procedure Encode.26 (Encode.105, Encode.106):
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108; ret Encode.108;
procedure List.101 (List.484, List.485, List.486): procedure List.102 (List.486, List.487, List.488):
let List.612 : U64 = 0i64; let List.614 : U64 = 0i64;
let List.613 : U64 = CallByName List.6 List.484; let List.615 : U64 = CallByName List.6 List.486;
let List.611 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.484 List.485 List.486 List.612 List.613; let List.613 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.614 List.615;
ret List.611; ret List.613;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.583 : U64 = 0i64; let List.585 : U64 = 0i64;
let List.584 : U64 = CallByName List.6 List.156; let List.586 : U64 = CallByName List.6 List.158;
let List.582 : List U8 = CallByName List.89 List.156 List.157 List.158 List.583 List.584; let List.584 : List U8 = CallByName List.90 List.158 List.159 List.160 List.585 List.586;
ret List.582; ret List.584;
procedure List.26 (List.197, List.198, List.199): procedure List.26 (List.199, List.200, List.201):
let List.605 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.101 List.197 List.198 List.199; let List.607 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201;
let List.608 : U8 = 1i64; let List.610 : U8 = 1i64;
let List.609 : U8 = GetTagId List.605; let List.611 : U8 = GetTagId List.607;
let List.610 : Int1 = lowlevel Eq List.608 List.609; let List.612 : Int1 = lowlevel Eq List.610 List.611;
if List.610 then if List.612 then
let List.200 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.605; let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.607;
ret List.200; ret List.202;
else else
let List.201 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.605; let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.607;
ret List.201; ret List.203;
procedure List.49 (List.416, List.417): procedure List.49 (List.418, List.419):
let List.596 : U64 = StructAtIndex 1 List.417; let List.598 : U64 = StructAtIndex 1 List.419;
let List.597 : U64 = StructAtIndex 0 List.417; let List.599 : U64 = StructAtIndex 0 List.419;
let List.595 : List U8 = CallByName List.72 List.416 List.596 List.597; let List.597 : List U8 = CallByName List.72 List.418 List.598 List.599;
ret List.595; ret List.597;
procedure List.52 (List.431, List.432): procedure List.52 (List.433, List.434):
let List.433 : U64 = CallByName List.6 List.431; let List.435 : U64 = CallByName List.6 List.433;
joinpoint List.603 List.434: joinpoint List.605 List.436:
let List.601 : U64 = 0i64; let List.603 : U64 = 0i64;
let List.600 : {U64, U64} = Struct {List.434, List.601}; let List.602 : {U64, U64} = Struct {List.436, List.603};
inc List.431; inc List.433;
let List.435 : List U8 = CallByName List.49 List.431 List.600; let List.437 : List U8 = CallByName List.49 List.433 List.602;
let List.599 : U64 = CallByName Num.75 List.433 List.434; let List.601 : U64 = CallByName Num.75 List.435 List.436;
let List.594 : {U64, U64} = Struct {List.599, List.434}; let List.596 : {U64, U64} = Struct {List.601, List.436};
let List.436 : List U8 = CallByName List.49 List.431 List.594; let List.438 : List U8 = CallByName List.49 List.433 List.596;
let List.593 : {List U8, List U8} = Struct {List.435, List.436}; let List.595 : {List U8, List U8} = Struct {List.437, List.438};
ret List.593; ret List.595;
in in
let List.604 : Int1 = CallByName Num.24 List.433 List.432; let List.606 : Int1 = CallByName Num.24 List.435 List.434;
if List.604 then if List.606 then
jump List.603 List.432; jump List.605 List.434;
else else
jump List.603 List.433; jump List.605 List.435;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.581 : U64 = lowlevel ListLen #Attr.2; let List.583 : U64 = lowlevel ListLen #Attr.2;
ret List.581; ret List.583;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.592 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.594 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.592; ret List.594;
procedure List.68 (#Attr.2): procedure List.68 (#Attr.2):
let List.579 : List U8 = lowlevel ListWithCapacity #Attr.2; let List.581 : List U8 = lowlevel ListWithCapacity #Attr.2;
ret List.579; ret List.581;
procedure List.72 (#Attr.2, #Attr.3, #Attr.4): procedure List.72 (#Attr.2, #Attr.3, #Attr.4):
let List.598 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; let List.600 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4;
ret List.598; ret List.600;
procedure List.8 (#Attr.2, #Attr.3): procedure List.8 (#Attr.2, #Attr.3):
let List.577 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; let List.579 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3;
ret List.577; ret List.579;
procedure List.80 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4):
joinpoint List.614 List.487 List.488 List.489 List.490 List.491: joinpoint List.616 List.489 List.490 List.491 List.492 List.493:
let List.616 : Int1 = CallByName Num.22 List.490 List.491; let List.618 : Int1 = CallByName Num.22 List.492 List.493;
if List.616 then if List.618 then
let List.625 : U8 = CallByName List.66 List.487 List.490; let List.627 : U8 = CallByName List.66 List.489 List.492;
let List.617 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.488 List.625; let List.619 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.627;
let List.622 : U8 = 1i64; let List.624 : U8 = 1i64;
let List.623 : U8 = GetTagId List.617; let List.625 : U8 = GetTagId List.619;
let List.624 : Int1 = lowlevel Eq List.622 List.623; let List.626 : Int1 = lowlevel Eq List.624 List.625;
if List.624 then if List.626 then
let List.492 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.617; let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.619;
let List.620 : U64 = 1i64; let List.622 : U64 = 1i64;
let List.619 : U64 = CallByName Num.51 List.490 List.620; let List.621 : U64 = CallByName Num.51 List.492 List.622;
jump List.614 List.487 List.492 List.489 List.619 List.491; jump List.616 List.489 List.494 List.491 List.621 List.493;
else else
dec List.487; dec List.489;
let List.493 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.617; let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.619;
let List.621 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.493; let List.623 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495;
ret List.621; ret List.623;
else else
dec List.487; dec List.489;
let List.615 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.488; let List.617 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490;
ret List.615; ret List.617;
in in
jump List.614 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; jump List.616 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure List.89 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): procedure List.90 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12):
joinpoint List.585 List.159 List.160 List.161 List.162 List.163: joinpoint List.587 List.161 List.162 List.163 List.164 List.165:
let List.587 : Int1 = CallByName Num.22 List.162 List.163; let List.589 : Int1 = CallByName Num.22 List.164 List.165;
if List.587 then if List.589 then
let List.591 : U8 = CallByName List.66 List.159 List.162; let List.593 : U8 = CallByName List.66 List.161 List.164;
let List.164 : List U8 = CallByName TotallyNotJson.215 List.160 List.591; let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.593;
let List.590 : U64 = 1i64; let List.592 : U64 = 1i64;
let List.589 : U64 = CallByName Num.51 List.162 List.590; let List.591 : U64 = CallByName Num.51 List.164 List.592;
jump List.585 List.159 List.164 List.161 List.589 List.163; jump List.587 List.161 List.166 List.163 List.591 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.585 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; jump List.587 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12;
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.292 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.298 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.292;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.294 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.294;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.298; ret Num.298;
procedure Num.24 (#Attr.2, #Attr.3): procedure Num.21 (#Attr.2, #Attr.3):
let Num.300 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; let Num.300 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.300; ret Num.300;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.304 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.304;
procedure Num.24 (#Attr.2, #Attr.3):
let Num.306 : Int1 = lowlevel NumGt #Attr.2 #Attr.3;
ret Num.306;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.296 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.302 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.296; ret Num.302;
procedure Num.75 (#Attr.2, #Attr.3): procedure Num.75 (#Attr.2, #Attr.3):
let Num.299 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; let Num.305 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3;
ret Num.299; ret Num.305;
procedure Num.94 (#Attr.2, #Attr.3): procedure Num.94 (#Attr.2, #Attr.3):
let Num.293 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; let Num.299 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Str.12 (#Attr.2): procedure Str.12 (#Attr.2):
let Str.302 : List U8 = lowlevel StrToUtf8 #Attr.2; let Str.261 : List U8 = lowlevel StrToUtf8 #Attr.2;
ret Str.302; ret Str.261;
procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): procedure Str.43 (#Attr.2, #Attr.3, #Attr.4):
let Str.301 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4;
ret Str.301; ret Str.260;
procedure Str.9 (Str.80): procedure Str.9 (Str.68):
let Str.299 : U64 = 0i64; let Str.258 : U64 = 0i64;
let Str.300 : U64 = CallByName List.6 Str.80; let Str.259 : U64 = CallByName List.6 Str.68;
let Str.81 : {U64, Str, Int1, U8} = CallByName Str.48 Str.80 Str.299 Str.300; let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259;
let Str.296 : Int1 = StructAtIndex 2 Str.81; let Str.255 : Int1 = StructAtIndex 2 Str.69;
if Str.296 then if Str.255 then
let Str.298 : Str = StructAtIndex 1 Str.81; let Str.257 : Str = StructAtIndex 1 Str.69;
let Str.297 : [C {U64, U8}, C Str] = TagId(1) Str.298; let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257;
ret Str.297; ret Str.256;
else else
let Str.294 : U8 = StructAtIndex 3 Str.81; let Str.253 : U8 = StructAtIndex 3 Str.69;
let Str.295 : U64 = StructAtIndex 0 Str.81; let Str.254 : U64 = StructAtIndex 0 Str.69;
let #Derived_gen.13 : Str = StructAtIndex 1 Str.81; let #Derived_gen.13 : Str = StructAtIndex 1 Str.69;
dec #Derived_gen.13; dec #Derived_gen.13;
let Str.293 : {U64, U8} = Struct {Str.295, Str.294}; let Str.252 : {U64, U8} = Struct {Str.254, Str.253};
let Str.292 : [C {U64, U8}, C Str] = TagId(0) Str.293; let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252;
ret Str.292; ret Str.251;
procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1175, TotallyNotJson.181): procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.973, TotallyNotJson.149):
let TotallyNotJson.1178 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181; let TotallyNotJson.976 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149;
let TotallyNotJson.1177 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1178; let TotallyNotJson.975 : List U8 = CallByName List.8 TotallyNotJson.151 TotallyNotJson.976;
ret TotallyNotJson.1177; ret TotallyNotJson.975;
procedure TotallyNotJson.189 (TotallyNotJson.1226, TotallyNotJson.192): procedure TotallyNotJson.157 (TotallyNotJson.1024, TotallyNotJson.160):
let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1226; let TotallyNotJson.158 : U64 = StructAtIndex 0 TotallyNotJson.1024;
let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1226; let TotallyNotJson.159 : Int1 = StructAtIndex 1 TotallyNotJson.1024;
switch TotallyNotJson.192: switch TotallyNotJson.160:
case 34: case 34:
let TotallyNotJson.1229 : Int1 = false; let TotallyNotJson.1027 : Int1 = false;
let TotallyNotJson.1228 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1229}; let TotallyNotJson.1026 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1027};
let TotallyNotJson.1227 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1228; let TotallyNotJson.1025 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1026;
ret TotallyNotJson.1227; ret TotallyNotJson.1025;
case 92: case 92:
let TotallyNotJson.1232 : Int1 = false; let TotallyNotJson.1030 : Int1 = false;
let TotallyNotJson.1231 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1232}; let TotallyNotJson.1029 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1030};
let TotallyNotJson.1230 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1231; let TotallyNotJson.1028 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1029;
ret TotallyNotJson.1230; ret TotallyNotJson.1028;
case 47: case 47:
let TotallyNotJson.1235 : Int1 = false; let TotallyNotJson.1033 : Int1 = false;
let TotallyNotJson.1234 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1235}; let TotallyNotJson.1032 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1033};
let TotallyNotJson.1233 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1234; let TotallyNotJson.1031 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1032;
ret TotallyNotJson.1233; ret TotallyNotJson.1031;
case 8: case 8:
let TotallyNotJson.1238 : Int1 = false; let TotallyNotJson.1036 : Int1 = false;
let TotallyNotJson.1237 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1238}; let TotallyNotJson.1035 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1036};
let TotallyNotJson.1236 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1237; let TotallyNotJson.1034 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1035;
ret TotallyNotJson.1236; ret TotallyNotJson.1034;
case 12: case 12:
let TotallyNotJson.1241 : Int1 = false; let TotallyNotJson.1039 : Int1 = false;
let TotallyNotJson.1240 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1241}; let TotallyNotJson.1038 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1039};
let TotallyNotJson.1239 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1240; let TotallyNotJson.1037 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1038;
ret TotallyNotJson.1239; ret TotallyNotJson.1037;
case 10: case 10:
let TotallyNotJson.1244 : Int1 = false; let TotallyNotJson.1042 : Int1 = false;
let TotallyNotJson.1243 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1244}; let TotallyNotJson.1041 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1042};
let TotallyNotJson.1242 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1243; let TotallyNotJson.1040 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1041;
ret TotallyNotJson.1242; ret TotallyNotJson.1040;
case 13: case 13:
let TotallyNotJson.1247 : Int1 = false; let TotallyNotJson.1045 : Int1 = false;
let TotallyNotJson.1246 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1247}; let TotallyNotJson.1044 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1045};
let TotallyNotJson.1245 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1246; let TotallyNotJson.1043 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1044;
ret TotallyNotJson.1245; ret TotallyNotJson.1043;
case 9: case 9:
let TotallyNotJson.1250 : Int1 = false; let TotallyNotJson.1048 : Int1 = false;
let TotallyNotJson.1249 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1250}; let TotallyNotJson.1047 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1048};
let TotallyNotJson.1248 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1249; let TotallyNotJson.1046 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1047;
ret TotallyNotJson.1248; ret TotallyNotJson.1046;
default: default:
let TotallyNotJson.1254 : U64 = 1i64; let TotallyNotJson.1052 : U64 = 1i64;
let TotallyNotJson.1253 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1254; let TotallyNotJson.1051 : U64 = CallByName Num.19 TotallyNotJson.158 TotallyNotJson.1052;
let TotallyNotJson.1252 : {U64, Int1} = Struct {TotallyNotJson.1253, TotallyNotJson.191}; let TotallyNotJson.1050 : {U64, Int1} = Struct {TotallyNotJson.1051, TotallyNotJson.159};
let TotallyNotJson.1251 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1252; let TotallyNotJson.1049 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1050;
ret TotallyNotJson.1251; ret TotallyNotJson.1049;
procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217): procedure TotallyNotJson.183 (TotallyNotJson.184, TotallyNotJson.185):
let TotallyNotJson.1197 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217; let TotallyNotJson.995 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.185;
let TotallyNotJson.1196 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1197; let TotallyNotJson.994 : List U8 = CallByName List.8 TotallyNotJson.184 TotallyNotJson.995;
ret TotallyNotJson.1196; ret TotallyNotJson.994;
procedure TotallyNotJson.25 (TotallyNotJson.181): procedure TotallyNotJson.25 (TotallyNotJson.149):
let TotallyNotJson.1173 : Str = CallByName Encode.23 TotallyNotJson.181; let TotallyNotJson.971 : Str = CallByName Encode.23 TotallyNotJson.149;
ret TotallyNotJson.1173; ret TotallyNotJson.971;
procedure TotallyNotJson.26 (TotallyNotJson.184): procedure TotallyNotJson.26 (TotallyNotJson.152):
let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184; let TotallyNotJson.153 : List U8 = CallByName Str.12 TotallyNotJson.152;
let TotallyNotJson.1255 : U64 = 0i64; let TotallyNotJson.1053 : U64 = 0i64;
let TotallyNotJson.1256 : Int1 = true; let TotallyNotJson.1054 : Int1 = true;
let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1255, TotallyNotJson.1256}; let TotallyNotJson.154 : {U64, Int1} = Struct {TotallyNotJson.1053, TotallyNotJson.1054};
let TotallyNotJson.1225 : {} = Struct {}; let TotallyNotJson.1023 : {} = Struct {};
inc TotallyNotJson.185; inc TotallyNotJson.153;
let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1225; let TotallyNotJson.155 : {U64, Int1} = CallByName List.26 TotallyNotJson.153 TotallyNotJson.154 TotallyNotJson.1023;
let TotallyNotJson.1179 : Int1 = StructAtIndex 1 TotallyNotJson.187; let TotallyNotJson.977 : Int1 = StructAtIndex 1 TotallyNotJson.155;
let TotallyNotJson.1223 : Int1 = true; let TotallyNotJson.1021 : Int1 = true;
let TotallyNotJson.1224 : Int1 = lowlevel Eq TotallyNotJson.1223 TotallyNotJson.1179; let TotallyNotJson.1022 : Int1 = lowlevel Eq TotallyNotJson.1021 TotallyNotJson.977;
if TotallyNotJson.1224 then if TotallyNotJson.1022 then
let TotallyNotJson.1189 : U64 = CallByName List.6 TotallyNotJson.185; let TotallyNotJson.987 : U64 = CallByName List.6 TotallyNotJson.153;
let TotallyNotJson.1190 : U64 = 2i64; let TotallyNotJson.988 : U64 = 2i64;
let TotallyNotJson.1188 : U64 = CallByName Num.19 TotallyNotJson.1189 TotallyNotJson.1190; let TotallyNotJson.986 : U64 = CallByName Num.19 TotallyNotJson.987 TotallyNotJson.988;
let TotallyNotJson.1185 : List U8 = CallByName List.68 TotallyNotJson.1188; let TotallyNotJson.983 : List U8 = CallByName List.68 TotallyNotJson.986;
let TotallyNotJson.1187 : U8 = 34i64; let TotallyNotJson.985 : U8 = 34i64;
let TotallyNotJson.1186 : List U8 = Array [TotallyNotJson.1187]; let TotallyNotJson.984 : List U8 = Array [TotallyNotJson.985];
let TotallyNotJson.1184 : List U8 = CallByName List.8 TotallyNotJson.1185 TotallyNotJson.1186; let TotallyNotJson.982 : List U8 = CallByName List.8 TotallyNotJson.983 TotallyNotJson.984;
let TotallyNotJson.1181 : List U8 = CallByName List.8 TotallyNotJson.1184 TotallyNotJson.185; let TotallyNotJson.979 : List U8 = CallByName List.8 TotallyNotJson.982 TotallyNotJson.153;
let TotallyNotJson.1183 : U8 = 34i64; let TotallyNotJson.981 : U8 = 34i64;
let TotallyNotJson.1182 : List U8 = Array [TotallyNotJson.1183]; let TotallyNotJson.980 : List U8 = Array [TotallyNotJson.981];
let TotallyNotJson.1180 : List U8 = CallByName List.8 TotallyNotJson.1181 TotallyNotJson.1182; let TotallyNotJson.978 : List U8 = CallByName List.8 TotallyNotJson.979 TotallyNotJson.980;
ret TotallyNotJson.1180; ret TotallyNotJson.978;
else else
inc TotallyNotJson.185; inc TotallyNotJson.153;
let TotallyNotJson.1222 : U64 = StructAtIndex 0 TotallyNotJson.187; let TotallyNotJson.1020 : U64 = StructAtIndex 0 TotallyNotJson.155;
let TotallyNotJson.1221 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1222; let TotallyNotJson.1019 : {List U8, List U8} = CallByName List.52 TotallyNotJson.153 TotallyNotJson.1020;
let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1221; let TotallyNotJson.179 : List U8 = StructAtIndex 0 TotallyNotJson.1019;
let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1221; let TotallyNotJson.181 : List U8 = StructAtIndex 1 TotallyNotJson.1019;
let TotallyNotJson.1219 : U64 = CallByName List.6 TotallyNotJson.185; let TotallyNotJson.1017 : U64 = CallByName List.6 TotallyNotJson.153;
dec TotallyNotJson.185; dec TotallyNotJson.153;
let TotallyNotJson.1220 : U64 = 120i64; let TotallyNotJson.1018 : U64 = 120i64;
let TotallyNotJson.1217 : U64 = CallByName Num.21 TotallyNotJson.1219 TotallyNotJson.1220; let TotallyNotJson.1015 : U64 = CallByName Num.21 TotallyNotJson.1017 TotallyNotJson.1018;
let TotallyNotJson.1218 : U64 = 100i64; let TotallyNotJson.1016 : U64 = 100i64;
let TotallyNotJson.1216 : U64 = CallByName Num.94 TotallyNotJson.1217 TotallyNotJson.1218; let TotallyNotJson.1014 : U64 = CallByName Num.94 TotallyNotJson.1015 TotallyNotJson.1016;
let TotallyNotJson.1213 : List U8 = CallByName List.68 TotallyNotJson.1216; let TotallyNotJson.1011 : List U8 = CallByName List.68 TotallyNotJson.1014;
let TotallyNotJson.1215 : U8 = 34i64; let TotallyNotJson.1013 : U8 = 34i64;
let TotallyNotJson.1214 : List U8 = Array [TotallyNotJson.1215]; let TotallyNotJson.1012 : List U8 = Array [TotallyNotJson.1013];
let TotallyNotJson.1212 : List U8 = CallByName List.8 TotallyNotJson.1213 TotallyNotJson.1214; let TotallyNotJson.1010 : List U8 = CallByName List.8 TotallyNotJson.1011 TotallyNotJson.1012;
let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1212 TotallyNotJson.211; let TotallyNotJson.182 : List U8 = CallByName List.8 TotallyNotJson.1010 TotallyNotJson.179;
let TotallyNotJson.1195 : {} = Struct {}; let TotallyNotJson.993 : {} = Struct {};
let TotallyNotJson.1192 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1195; let TotallyNotJson.990 : List U8 = CallByName List.18 TotallyNotJson.181 TotallyNotJson.182 TotallyNotJson.993;
let TotallyNotJson.1194 : U8 = 34i64; let TotallyNotJson.992 : U8 = 34i64;
let TotallyNotJson.1193 : List U8 = Array [TotallyNotJson.1194]; let TotallyNotJson.991 : List U8 = Array [TotallyNotJson.992];
let TotallyNotJson.1191 : List U8 = CallByName List.8 TotallyNotJson.1192 TotallyNotJson.1193; let TotallyNotJson.989 : List U8 = CallByName List.8 TotallyNotJson.990 TotallyNotJson.991;
ret TotallyNotJson.1191; ret TotallyNotJson.989;
procedure TotallyNotJson.27 (TotallyNotJson.218): procedure TotallyNotJson.27 (TotallyNotJson.186):
switch TotallyNotJson.218: switch TotallyNotJson.186:
case 34: case 34:
let TotallyNotJson.1198 : List U8 = Array [92i64, 34i64]; let TotallyNotJson.996 : List U8 = Array [92i64, 34i64];
ret TotallyNotJson.1198; ret TotallyNotJson.996;
case 92: case 92:
let TotallyNotJson.1199 : List U8 = Array [92i64, 92i64]; let TotallyNotJson.997 : List U8 = Array [92i64, 92i64];
ret TotallyNotJson.1199; ret TotallyNotJson.997;
case 47: case 47:
let TotallyNotJson.1200 : List U8 = Array [92i64, 47i64]; let TotallyNotJson.998 : List U8 = Array [92i64, 47i64];
ret TotallyNotJson.1200; ret TotallyNotJson.998;
case 8: case 8:
let TotallyNotJson.1202 : U8 = 98i64; let TotallyNotJson.1000 : U8 = 98i64;
let TotallyNotJson.1201 : List U8 = Array [92i64, TotallyNotJson.1202]; let TotallyNotJson.999 : List U8 = Array [92i64, TotallyNotJson.1000];
ret TotallyNotJson.1201; ret TotallyNotJson.999;
case 12: case 12:
let TotallyNotJson.1204 : U8 = 102i64; let TotallyNotJson.1002 : U8 = 102i64;
let TotallyNotJson.1203 : List U8 = Array [92i64, TotallyNotJson.1204]; let TotallyNotJson.1001 : List U8 = Array [92i64, TotallyNotJson.1002];
ret TotallyNotJson.1203; ret TotallyNotJson.1001;
case 10: case 10:
let TotallyNotJson.1206 : U8 = 110i64; let TotallyNotJson.1004 : U8 = 110i64;
let TotallyNotJson.1205 : List U8 = Array [92i64, TotallyNotJson.1206]; let TotallyNotJson.1003 : List U8 = Array [92i64, TotallyNotJson.1004];
ret TotallyNotJson.1205; ret TotallyNotJson.1003;
case 13: case 13:
let TotallyNotJson.1208 : U8 = 114i64; let TotallyNotJson.1006 : U8 = 114i64;
let TotallyNotJson.1207 : List U8 = Array [92i64, TotallyNotJson.1208]; let TotallyNotJson.1005 : List U8 = Array [92i64, TotallyNotJson.1006];
ret TotallyNotJson.1207; ret TotallyNotJson.1005;
case 9: case 9:
let TotallyNotJson.1210 : U8 = 114i64; let TotallyNotJson.1008 : U8 = 114i64;
let TotallyNotJson.1209 : List U8 = Array [92i64, TotallyNotJson.1210]; let TotallyNotJson.1007 : List U8 = Array [92i64, TotallyNotJson.1008];
ret TotallyNotJson.1209; ret TotallyNotJson.1007;
default: default:
let TotallyNotJson.1211 : List U8 = Array [TotallyNotJson.218]; let TotallyNotJson.1009 : List U8 = Array [TotallyNotJson.186];
ret TotallyNotJson.1211; ret TotallyNotJson.1009;
procedure TotallyNotJson.8 (): procedure TotallyNotJson.8 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ; let TotallyNotJson.970 : {} = Struct {};
ret TotallyNotJson.1172; ret TotallyNotJson.970;
procedure Test.0 (): procedure Test.0 ():
let Test.9 : Str = "abc"; let Test.9 : Str = "abc";
let Test.10 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.8; let Test.10 : {} = CallByName TotallyNotJson.8;
let Test.8 : List U8 = CallByName Encode.26 Test.9 Test.10; let Test.8 : List U8 = CallByName Encode.26 Test.9 Test.10;
let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8; let Test.1 : [C {U64, U8}, C Str] = CallByName Str.9 Test.8;
let Test.5 : U8 = 1i64; let Test.5 : U8 = 1i64;

View file

@ -10,7 +10,7 @@ procedure #Derived.3 (#Derived.4, #Derived.5, #Derived.1):
let #Derived_gen.7 : Str = "A"; let #Derived_gen.7 : Str = "A";
let #Derived_gen.9 : Str = CallByName TotallyNotJson.25 #Derived.1; let #Derived_gen.9 : Str = CallByName TotallyNotJson.25 #Derived.1;
let #Derived_gen.8 : List Str = Array [#Derived_gen.9]; let #Derived_gen.8 : List Str = Array [#Derived_gen.9];
let #Derived_gen.6 : {Str, List Str} = CallByName TotallyNotJson.32 #Derived_gen.7 #Derived_gen.8; let #Derived_gen.6 : {Str, List Str} = CallByName TotallyNotJson.31 #Derived_gen.7 #Derived_gen.8;
jump #Derived_gen.5 #Derived_gen.6; jump #Derived_gen.5 #Derived_gen.6;
procedure Encode.23 (Encode.98): procedure Encode.23 (Encode.98):
@ -27,11 +27,11 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101):
ret Encode.111; ret Encode.111;
procedure Encode.24 (Encode.99, Encode.107, Encode.101): procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.113 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; let Encode.113 : List U8 = CallByName TotallyNotJson.228 Encode.99 Encode.101 Encode.107;
ret Encode.113; ret Encode.113;
procedure Encode.24 (Encode.99, Encode.107, Encode.101): procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.116 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; let Encode.116 : List U8 = CallByName TotallyNotJson.150 Encode.99 Encode.101 Encode.107;
ret Encode.116; ret Encode.116;
procedure Encode.26 (Encode.105, Encode.106): procedure Encode.26 (Encode.105, Encode.106):
@ -40,452 +40,454 @@ procedure Encode.26 (Encode.105, Encode.106):
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108; ret Encode.108;
procedure List.101 (List.484, List.485, List.486): procedure List.102 (List.486, List.487, List.488):
let List.653 : U64 = 0i64; let List.655 : U64 = 0i64;
let List.654 : U64 = CallByName List.6 List.484; let List.656 : U64 = CallByName List.6 List.486;
let List.652 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.484 List.485 List.486 List.653 List.654; let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.655 List.656;
ret List.652; ret List.654;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.597 : U64 = 0i64; let List.599 : U64 = 0i64;
let List.598 : U64 = CallByName List.6 List.156; let List.600 : U64 = CallByName List.6 List.158;
let List.596 : {List U8, U64} = CallByName List.89 List.156 List.157 List.158 List.597 List.598; let List.598 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.599 List.600;
ret List.596; ret List.598;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.609 : U64 = 0i64; let List.611 : U64 = 0i64;
let List.610 : U64 = CallByName List.6 List.156; let List.612 : U64 = CallByName List.6 List.158;
let List.608 : List U8 = CallByName List.89 List.156 List.157 List.158 List.609 List.610; let List.610 : List U8 = CallByName List.90 List.158 List.159 List.160 List.611 List.612;
ret List.608; ret List.610;
procedure List.26 (List.197, List.198, List.199): procedure List.26 (List.199, List.200, List.201):
let List.646 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.101 List.197 List.198 List.199; let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201;
let List.649 : U8 = 1i64; let List.651 : U8 = 1i64;
let List.650 : U8 = GetTagId List.646; let List.652 : U8 = GetTagId List.648;
let List.651 : Int1 = lowlevel Eq List.649 List.650; let List.653 : Int1 = lowlevel Eq List.651 List.652;
if List.651 then if List.653 then
let List.200 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.646; let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.648;
ret List.200; ret List.202;
else else
let List.201 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.646; let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.648;
ret List.201; ret List.203;
procedure List.4 (List.121, List.122): procedure List.4 (List.122, List.123):
let List.595 : U64 = 1i64; let List.597 : U64 = 1i64;
let List.594 : List U8 = CallByName List.70 List.121 List.595; let List.596 : List U8 = CallByName List.70 List.122 List.597;
let List.593 : List U8 = CallByName List.71 List.594 List.122; let List.595 : List U8 = CallByName List.71 List.596 List.123;
ret List.593; ret List.595;
procedure List.49 (List.416, List.417): procedure List.49 (List.418, List.419):
let List.637 : U64 = StructAtIndex 1 List.417; let List.639 : U64 = StructAtIndex 1 List.419;
let List.638 : U64 = StructAtIndex 0 List.417; let List.640 : U64 = StructAtIndex 0 List.419;
let List.636 : List U8 = CallByName List.72 List.416 List.637 List.638; let List.638 : List U8 = CallByName List.72 List.418 List.639 List.640;
ret List.636; ret List.638;
procedure List.52 (List.431, List.432): procedure List.52 (List.433, List.434):
let List.433 : U64 = CallByName List.6 List.431; let List.435 : U64 = CallByName List.6 List.433;
joinpoint List.644 List.434: joinpoint List.646 List.436:
let List.642 : U64 = 0i64; let List.644 : U64 = 0i64;
let List.641 : {U64, U64} = Struct {List.434, List.642}; let List.643 : {U64, U64} = Struct {List.436, List.644};
inc List.431; inc List.433;
let List.435 : List U8 = CallByName List.49 List.431 List.641; let List.437 : List U8 = CallByName List.49 List.433 List.643;
let List.640 : U64 = CallByName Num.75 List.433 List.434; let List.642 : U64 = CallByName Num.75 List.435 List.436;
let List.635 : {U64, U64} = Struct {List.640, List.434}; let List.637 : {U64, U64} = Struct {List.642, List.436};
let List.436 : List U8 = CallByName List.49 List.431 List.635; let List.438 : List U8 = CallByName List.49 List.433 List.637;
let List.634 : {List U8, List U8} = Struct {List.435, List.436}; let List.636 : {List U8, List U8} = Struct {List.437, List.438};
ret List.634; ret List.636;
in in
let List.645 : Int1 = CallByName Num.24 List.433 List.432; let List.647 : Int1 = CallByName Num.24 List.435 List.434;
if List.645 then if List.647 then
jump List.644 List.432; jump List.646 List.434;
else else
jump List.644 List.433; jump List.646 List.435;
procedure List.6 (#Attr.2):
let List.620 : U64 = lowlevel ListLen #Attr.2;
ret List.620;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.622 : U64 = lowlevel ListLen #Attr.2; let List.622 : U64 = lowlevel ListLen #Attr.2;
ret List.622; ret List.622;
procedure List.66 (#Attr.2, #Attr.3): procedure List.6 (#Attr.2):
let List.606 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.624 : U64 = lowlevel ListLen #Attr.2;
ret List.606; ret List.624;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.618 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.608 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.618; ret List.608;
procedure List.66 (#Attr.2, #Attr.3):
let List.620 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.620;
procedure List.68 (#Attr.2): procedure List.68 (#Attr.2):
let List.633 : List U8 = lowlevel ListWithCapacity #Attr.2; let List.635 : List U8 = lowlevel ListWithCapacity #Attr.2;
ret List.633; ret List.635;
procedure List.70 (#Attr.2, #Attr.3): procedure List.70 (#Attr.2, #Attr.3):
let List.574 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3;
ret List.574; ret List.576;
procedure List.71 (#Attr.2, #Attr.3): procedure List.71 (#Attr.2, #Attr.3):
let List.572 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
ret List.572; ret List.574;
procedure List.72 (#Attr.2, #Attr.3, #Attr.4): procedure List.72 (#Attr.2, #Attr.3, #Attr.4):
let List.639 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; let List.641 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4;
ret List.639; ret List.641;
procedure List.8 (#Attr.2, #Attr.3): procedure List.8 (#Attr.2, #Attr.3):
let List.631 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3;
ret List.631; ret List.633;
procedure List.80 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): procedure List.80 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30):
joinpoint List.655 List.487 List.488 List.489 List.490 List.491: joinpoint List.657 List.489 List.490 List.491 List.492 List.493:
let List.657 : Int1 = CallByName Num.22 List.490 List.491; let List.659 : Int1 = CallByName Num.22 List.492 List.493;
if List.657 then if List.659 then
let List.666 : U8 = CallByName List.66 List.487 List.490; let List.668 : U8 = CallByName List.66 List.489 List.492;
let List.658 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.488 List.666; let List.660 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.668;
let List.663 : U8 = 1i64; let List.665 : U8 = 1i64;
let List.664 : U8 = GetTagId List.658; let List.666 : U8 = GetTagId List.660;
let List.665 : Int1 = lowlevel Eq List.663 List.664; let List.667 : Int1 = lowlevel Eq List.665 List.666;
if List.665 then if List.667 then
let List.492 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.658; let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.660;
let List.661 : U64 = 1i64; let List.663 : U64 = 1i64;
let List.660 : U64 = CallByName Num.51 List.490 List.661; let List.662 : U64 = CallByName Num.51 List.492 List.663;
jump List.655 List.487 List.492 List.489 List.660 List.491; jump List.657 List.489 List.494 List.491 List.662 List.493;
else else
dec List.487; dec List.489;
let List.493 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.658; let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.660;
let List.662 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.493; let List.664 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495;
ret List.662; ret List.664;
else else
dec List.487; dec List.489;
let List.656 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.488; let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490;
ret List.656; ret List.658;
in in
jump List.655 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; jump List.657 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30;
procedure List.89 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): procedure List.90 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17):
joinpoint List.611 List.159 List.160 List.161 List.162 List.163: joinpoint List.613 List.161 List.162 List.163 List.164 List.165:
let List.613 : Int1 = CallByName Num.22 List.162 List.163; let List.615 : Int1 = CallByName Num.22 List.164 List.165;
if List.613 then if List.615 then
let List.617 : U8 = CallByName List.66 List.159 List.162; let List.619 : U8 = CallByName List.66 List.161 List.164;
let List.164 : List U8 = CallByName TotallyNotJson.215 List.160 List.617; let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619;
let List.616 : U64 = 1i64; let List.618 : U64 = 1i64;
let List.615 : U64 = CallByName Num.51 List.162 List.616; let List.617 : U64 = CallByName Num.51 List.164 List.618;
jump List.611 List.159 List.164 List.161 List.615 List.163; jump List.613 List.161 List.166 List.163 List.617 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.611 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; jump List.613 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17;
procedure List.89 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22):
joinpoint List.599 List.159 List.160 List.161 List.162 List.163: joinpoint List.601 List.161 List.162 List.163 List.164 List.165:
let List.601 : Int1 = CallByName Num.22 List.162 List.163; let List.603 : Int1 = CallByName Num.22 List.164 List.165;
if List.601 then if List.603 then
let List.605 : Str = CallByName List.66 List.159 List.162; let List.607 : Str = CallByName List.66 List.161 List.164;
inc List.605; inc List.607;
let List.164 : {List U8, U64} = CallByName TotallyNotJson.267 List.160 List.605 List.161; let List.166 : {List U8, U64} = CallByName TotallyNotJson.230 List.162 List.607;
let List.604 : U64 = 1i64; let List.606 : U64 = 1i64;
let List.603 : U64 = CallByName Num.51 List.162 List.604; let List.605 : U64 = CallByName Num.51 List.164 List.606;
jump List.599 List.159 List.164 List.161 List.603 List.163; jump List.601 List.161 List.166 List.163 List.605 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.599 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; jump List.601 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22;
procedure Num.127 (#Attr.2): procedure Num.127 (#Attr.2):
let Num.298 : U8 = lowlevel NumIntCast #Attr.2; let Num.304 : U8 = lowlevel NumIntCast #Attr.2;
ret Num.298;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.302 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.302;
procedure Num.20 (#Attr.2, #Attr.3):
let Num.299 : U64 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.299;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.304 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.304; ret Num.304;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.310 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.308 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.308;
procedure Num.20 (#Attr.2, #Attr.3):
let Num.305 : U64 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.305;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.310 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.310; ret Num.310;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.316 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.316;
procedure Num.24 (#Attr.2, #Attr.3): procedure Num.24 (#Attr.2, #Attr.3):
let Num.312 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; let Num.318 : Int1 = lowlevel NumGt #Attr.2 #Attr.3;
ret Num.312; ret Num.318;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.307 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.313 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.307; ret Num.313;
procedure Num.75 (#Attr.2, #Attr.3): procedure Num.75 (#Attr.2, #Attr.3):
let Num.311 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; let Num.317 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3;
ret Num.311; ret Num.317;
procedure Num.94 (#Attr.2, #Attr.3): procedure Num.94 (#Attr.2, #Attr.3):
let Num.303 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; let Num.309 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3;
ret Num.303; ret Num.309;
procedure Str.12 (#Attr.2): procedure Str.12 (#Attr.2):
let Str.303 : List U8 = lowlevel StrToUtf8 #Attr.2; let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2;
ret Str.303; ret Str.262;
procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): procedure Str.43 (#Attr.2, #Attr.3, #Attr.4):
let Str.301 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4;
ret Str.301; ret Str.260;
procedure Str.9 (Str.80): procedure Str.9 (Str.68):
let Str.299 : U64 = 0i64; let Str.258 : U64 = 0i64;
let Str.300 : U64 = CallByName List.6 Str.80; let Str.259 : U64 = CallByName List.6 Str.68;
let Str.81 : {U64, Str, Int1, U8} = CallByName Str.48 Str.80 Str.299 Str.300; let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259;
let Str.296 : Int1 = StructAtIndex 2 Str.81; let Str.255 : Int1 = StructAtIndex 2 Str.69;
if Str.296 then if Str.255 then
let Str.298 : Str = StructAtIndex 1 Str.81; let Str.257 : Str = StructAtIndex 1 Str.69;
let Str.297 : [C {U64, U8}, C Str] = TagId(1) Str.298; let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257;
ret Str.297; ret Str.256;
else else
let Str.294 : U8 = StructAtIndex 3 Str.81; let Str.253 : U8 = StructAtIndex 3 Str.69;
let Str.295 : U64 = StructAtIndex 0 Str.81; let Str.254 : U64 = StructAtIndex 0 Str.69;
let #Derived_gen.34 : Str = StructAtIndex 1 Str.81; let #Derived_gen.34 : Str = StructAtIndex 1 Str.69;
dec #Derived_gen.34; dec #Derived_gen.34;
let Str.293 : {U64, U8} = Struct {Str.295, Str.294}; let Str.252 : {U64, U8} = Struct {Str.254, Str.253};
let Str.292 : [C {U64, U8}, C Str] = TagId(0) Str.293; let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252;
ret Str.292; ret Str.251;
procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1216, TotallyNotJson.181): procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149):
let TotallyNotJson.1219 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181; let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149;
let TotallyNotJson.1218 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1219; let TotallyNotJson.1016 : List U8 = CallByName List.8 TotallyNotJson.151 TotallyNotJson.1017;
ret TotallyNotJson.1218; ret TotallyNotJson.1016;
procedure TotallyNotJson.189 (TotallyNotJson.1267, TotallyNotJson.192): procedure TotallyNotJson.157 (TotallyNotJson.1065, TotallyNotJson.160):
let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1267; let TotallyNotJson.158 : U64 = StructAtIndex 0 TotallyNotJson.1065;
let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1267; let TotallyNotJson.159 : Int1 = StructAtIndex 1 TotallyNotJson.1065;
switch TotallyNotJson.192: switch TotallyNotJson.160:
case 34: case 34:
let TotallyNotJson.1270 : Int1 = false; let TotallyNotJson.1068 : Int1 = false;
let TotallyNotJson.1269 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1270}; let TotallyNotJson.1067 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1068};
let TotallyNotJson.1268 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1269; let TotallyNotJson.1066 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1067;
ret TotallyNotJson.1268; ret TotallyNotJson.1066;
case 92: case 92:
let TotallyNotJson.1273 : Int1 = false; let TotallyNotJson.1071 : Int1 = false;
let TotallyNotJson.1272 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1273}; let TotallyNotJson.1070 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1071};
let TotallyNotJson.1271 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1272; let TotallyNotJson.1069 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1070;
ret TotallyNotJson.1271; ret TotallyNotJson.1069;
case 47: case 47:
let TotallyNotJson.1276 : Int1 = false; let TotallyNotJson.1074 : Int1 = false;
let TotallyNotJson.1275 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1276}; let TotallyNotJson.1073 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1074};
let TotallyNotJson.1274 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1275; let TotallyNotJson.1072 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1073;
ret TotallyNotJson.1274; ret TotallyNotJson.1072;
case 8: case 8:
let TotallyNotJson.1279 : Int1 = false; let TotallyNotJson.1077 : Int1 = false;
let TotallyNotJson.1278 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1279}; let TotallyNotJson.1076 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1077};
let TotallyNotJson.1277 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1278; let TotallyNotJson.1075 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1076;
ret TotallyNotJson.1277; ret TotallyNotJson.1075;
case 12: case 12:
let TotallyNotJson.1282 : Int1 = false; let TotallyNotJson.1080 : Int1 = false;
let TotallyNotJson.1281 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1282}; let TotallyNotJson.1079 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1080};
let TotallyNotJson.1280 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1281; let TotallyNotJson.1078 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1079;
ret TotallyNotJson.1280; ret TotallyNotJson.1078;
case 10: case 10:
let TotallyNotJson.1285 : Int1 = false; let TotallyNotJson.1083 : Int1 = false;
let TotallyNotJson.1284 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1285}; let TotallyNotJson.1082 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1083};
let TotallyNotJson.1283 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1284; let TotallyNotJson.1081 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1082;
ret TotallyNotJson.1283; ret TotallyNotJson.1081;
case 13: case 13:
let TotallyNotJson.1288 : Int1 = false; let TotallyNotJson.1086 : Int1 = false;
let TotallyNotJson.1287 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1288}; let TotallyNotJson.1085 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1086};
let TotallyNotJson.1286 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1287; let TotallyNotJson.1084 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1085;
ret TotallyNotJson.1286; ret TotallyNotJson.1084;
case 9: case 9:
let TotallyNotJson.1291 : Int1 = false; let TotallyNotJson.1089 : Int1 = false;
let TotallyNotJson.1290 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1291}; let TotallyNotJson.1088 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1089};
let TotallyNotJson.1289 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1290; let TotallyNotJson.1087 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1088;
ret TotallyNotJson.1289; ret TotallyNotJson.1087;
default: default:
let TotallyNotJson.1295 : U64 = 1i64; let TotallyNotJson.1093 : U64 = 1i64;
let TotallyNotJson.1294 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1295; let TotallyNotJson.1092 : U64 = CallByName Num.19 TotallyNotJson.158 TotallyNotJson.1093;
let TotallyNotJson.1293 : {U64, Int1} = Struct {TotallyNotJson.1294, TotallyNotJson.191}; let TotallyNotJson.1091 : {U64, Int1} = Struct {TotallyNotJson.1092, TotallyNotJson.159};
let TotallyNotJson.1292 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1293; let TotallyNotJson.1090 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1091;
ret TotallyNotJson.1292; ret TotallyNotJson.1090;
procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217): procedure TotallyNotJson.183 (TotallyNotJson.184, TotallyNotJson.185):
let TotallyNotJson.1238 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217; let TotallyNotJson.1036 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.185;
let TotallyNotJson.1237 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1238; let TotallyNotJson.1035 : List U8 = CallByName List.8 TotallyNotJson.184 TotallyNotJson.1036;
ret TotallyNotJson.1237; ret TotallyNotJson.1035;
procedure TotallyNotJson.25 (TotallyNotJson.181): procedure TotallyNotJson.228 (TotallyNotJson.229, TotallyNotJson.973, #Attr.12):
let TotallyNotJson.1214 : Str = CallByName Encode.23 TotallyNotJson.181; let TotallyNotJson.227 : List Str = StructAtIndex 1 #Attr.12;
ret TotallyNotJson.1214; let TotallyNotJson.226 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1011 : I64 = 123i64;
let TotallyNotJson.1010 : U8 = CallByName Num.127 TotallyNotJson.1011;
let TotallyNotJson.1007 : List U8 = CallByName List.4 TotallyNotJson.229 TotallyNotJson.1010;
let TotallyNotJson.1009 : I64 = 34i64;
let TotallyNotJson.1008 : U8 = CallByName Num.127 TotallyNotJson.1009;
let TotallyNotJson.1005 : List U8 = CallByName List.4 TotallyNotJson.1007 TotallyNotJson.1008;
let TotallyNotJson.1006 : List U8 = CallByName Str.12 TotallyNotJson.226;
let TotallyNotJson.1002 : List U8 = CallByName List.8 TotallyNotJson.1005 TotallyNotJson.1006;
let TotallyNotJson.1004 : I64 = 34i64;
let TotallyNotJson.1003 : U8 = CallByName Num.127 TotallyNotJson.1004;
let TotallyNotJson.999 : List U8 = CallByName List.4 TotallyNotJson.1002 TotallyNotJson.1003;
let TotallyNotJson.1001 : I64 = 58i64;
let TotallyNotJson.1000 : U8 = CallByName Num.127 TotallyNotJson.1001;
let TotallyNotJson.996 : List U8 = CallByName List.4 TotallyNotJson.999 TotallyNotJson.1000;
let TotallyNotJson.998 : I64 = 91i64;
let TotallyNotJson.997 : U8 = CallByName Num.127 TotallyNotJson.998;
let TotallyNotJson.231 : List U8 = CallByName List.4 TotallyNotJson.996 TotallyNotJson.997;
let TotallyNotJson.995 : U64 = CallByName List.6 TotallyNotJson.227;
let TotallyNotJson.983 : {List U8, U64} = Struct {TotallyNotJson.231, TotallyNotJson.995};
let TotallyNotJson.984 : {} = Struct {};
let TotallyNotJson.982 : {List U8, U64} = CallByName List.18 TotallyNotJson.227 TotallyNotJson.983 TotallyNotJson.984;
let TotallyNotJson.233 : List U8 = StructAtIndex 0 TotallyNotJson.982;
let TotallyNotJson.981 : I64 = 93i64;
let TotallyNotJson.980 : U8 = CallByName Num.127 TotallyNotJson.981;
let TotallyNotJson.977 : List U8 = CallByName List.4 TotallyNotJson.233 TotallyNotJson.980;
let TotallyNotJson.979 : I64 = 125i64;
let TotallyNotJson.978 : U8 = CallByName Num.127 TotallyNotJson.979;
let TotallyNotJson.976 : List U8 = CallByName List.4 TotallyNotJson.977 TotallyNotJson.978;
ret TotallyNotJson.976;
procedure TotallyNotJson.26 (TotallyNotJson.184): procedure TotallyNotJson.230 (TotallyNotJson.975, TotallyNotJson.236):
let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184; let TotallyNotJson.234 : List U8 = StructAtIndex 0 TotallyNotJson.975;
let TotallyNotJson.1296 : U64 = 0i64; let TotallyNotJson.235 : U64 = StructAtIndex 1 TotallyNotJson.975;
let TotallyNotJson.1297 : Int1 = true; let TotallyNotJson.994 : {} = Struct {};
let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1296, TotallyNotJson.1297}; let TotallyNotJson.237 : List U8 = CallByName Encode.24 TotallyNotJson.234 TotallyNotJson.236 TotallyNotJson.994;
let TotallyNotJson.1266 : {} = Struct {}; joinpoint TotallyNotJson.989 TotallyNotJson.238:
inc TotallyNotJson.185; let TotallyNotJson.987 : U64 = 1i64;
let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1266; let TotallyNotJson.986 : U64 = CallByName Num.20 TotallyNotJson.235 TotallyNotJson.987;
let TotallyNotJson.1220 : Int1 = StructAtIndex 1 TotallyNotJson.187; let TotallyNotJson.985 : {List U8, U64} = Struct {TotallyNotJson.238, TotallyNotJson.986};
let TotallyNotJson.1264 : Int1 = true; ret TotallyNotJson.985;
let TotallyNotJson.1265 : Int1 = lowlevel Eq TotallyNotJson.1264 TotallyNotJson.1220;
if TotallyNotJson.1265 then
let TotallyNotJson.1230 : U64 = CallByName List.6 TotallyNotJson.185;
let TotallyNotJson.1231 : U64 = 2i64;
let TotallyNotJson.1229 : U64 = CallByName Num.19 TotallyNotJson.1230 TotallyNotJson.1231;
let TotallyNotJson.1226 : List U8 = CallByName List.68 TotallyNotJson.1229;
let TotallyNotJson.1228 : U8 = 34i64;
let TotallyNotJson.1227 : List U8 = Array [TotallyNotJson.1228];
let TotallyNotJson.1225 : List U8 = CallByName List.8 TotallyNotJson.1226 TotallyNotJson.1227;
let TotallyNotJson.1222 : List U8 = CallByName List.8 TotallyNotJson.1225 TotallyNotJson.185;
let TotallyNotJson.1224 : U8 = 34i64;
let TotallyNotJson.1223 : List U8 = Array [TotallyNotJson.1224];
let TotallyNotJson.1221 : List U8 = CallByName List.8 TotallyNotJson.1222 TotallyNotJson.1223;
ret TotallyNotJson.1221;
else
inc TotallyNotJson.185;
let TotallyNotJson.1263 : U64 = StructAtIndex 0 TotallyNotJson.187;
let TotallyNotJson.1262 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1263;
let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1262;
let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1262;
let TotallyNotJson.1260 : U64 = CallByName List.6 TotallyNotJson.185;
dec TotallyNotJson.185;
let TotallyNotJson.1261 : U64 = 120i64;
let TotallyNotJson.1258 : U64 = CallByName Num.21 TotallyNotJson.1260 TotallyNotJson.1261;
let TotallyNotJson.1259 : U64 = 100i64;
let TotallyNotJson.1257 : U64 = CallByName Num.94 TotallyNotJson.1258 TotallyNotJson.1259;
let TotallyNotJson.1254 : List U8 = CallByName List.68 TotallyNotJson.1257;
let TotallyNotJson.1256 : U8 = 34i64;
let TotallyNotJson.1255 : List U8 = Array [TotallyNotJson.1256];
let TotallyNotJson.1253 : List U8 = CallByName List.8 TotallyNotJson.1254 TotallyNotJson.1255;
let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1253 TotallyNotJson.211;
let TotallyNotJson.1236 : {} = Struct {};
let TotallyNotJson.1233 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1236;
let TotallyNotJson.1235 : U8 = 34i64;
let TotallyNotJson.1234 : List U8 = Array [TotallyNotJson.1235];
let TotallyNotJson.1232 : List U8 = CallByName List.8 TotallyNotJson.1233 TotallyNotJson.1234;
ret TotallyNotJson.1232;
procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12):
let TotallyNotJson.263 : List Str = StructAtIndex 1 #Attr.12;
let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1213 : I64 = 123i64;
let TotallyNotJson.1212 : U8 = CallByName Num.127 TotallyNotJson.1213;
let TotallyNotJson.1209 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1212;
let TotallyNotJson.1211 : I64 = 34i64;
let TotallyNotJson.1210 : U8 = CallByName Num.127 TotallyNotJson.1211;
let TotallyNotJson.1207 : List U8 = CallByName List.4 TotallyNotJson.1209 TotallyNotJson.1210;
let TotallyNotJson.1208 : List U8 = CallByName Str.12 TotallyNotJson.262;
let TotallyNotJson.1204 : List U8 = CallByName List.8 TotallyNotJson.1207 TotallyNotJson.1208;
let TotallyNotJson.1206 : I64 = 34i64;
let TotallyNotJson.1205 : U8 = CallByName Num.127 TotallyNotJson.1206;
let TotallyNotJson.1201 : List U8 = CallByName List.4 TotallyNotJson.1204 TotallyNotJson.1205;
let TotallyNotJson.1203 : I64 = 58i64;
let TotallyNotJson.1202 : U8 = CallByName Num.127 TotallyNotJson.1203;
let TotallyNotJson.1198 : List U8 = CallByName List.4 TotallyNotJson.1201 TotallyNotJson.1202;
let TotallyNotJson.1200 : I64 = 91i64;
let TotallyNotJson.1199 : U8 = CallByName Num.127 TotallyNotJson.1200;
let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1198 TotallyNotJson.1199;
let TotallyNotJson.1197 : U64 = CallByName List.6 TotallyNotJson.263;
let TotallyNotJson.1185 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1197};
let TotallyNotJson.1184 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1185 TotallyNotJson.1175;
let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1184;
let TotallyNotJson.1183 : I64 = 93i64;
let TotallyNotJson.1182 : U8 = CallByName Num.127 TotallyNotJson.1183;
let TotallyNotJson.1179 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1182;
let TotallyNotJson.1181 : I64 = 125i64;
let TotallyNotJson.1180 : U8 = CallByName Num.127 TotallyNotJson.1181;
let TotallyNotJson.1178 : List U8 = CallByName List.4 TotallyNotJson.1179 TotallyNotJson.1180;
ret TotallyNotJson.1178;
procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266):
let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177;
let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177;
let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266;
joinpoint TotallyNotJson.1191 TotallyNotJson.275:
let TotallyNotJson.1189 : U64 = 1i64;
let TotallyNotJson.1188 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1189;
let TotallyNotJson.1187 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1188};
ret TotallyNotJson.1187;
in in
let TotallyNotJson.1195 : U64 = 1i64; let TotallyNotJson.993 : U64 = 1i64;
let TotallyNotJson.1192 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1195; let TotallyNotJson.990 : Int1 = CallByName Num.24 TotallyNotJson.235 TotallyNotJson.993;
if TotallyNotJson.1192 then if TotallyNotJson.990 then
let TotallyNotJson.1194 : I64 = 44i64; let TotallyNotJson.992 : I64 = 44i64;
let TotallyNotJson.1193 : U8 = CallByName Num.127 TotallyNotJson.1194; let TotallyNotJson.991 : U8 = CallByName Num.127 TotallyNotJson.992;
let TotallyNotJson.1190 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1193; let TotallyNotJson.988 : List U8 = CallByName List.4 TotallyNotJson.237 TotallyNotJson.991;
jump TotallyNotJson.1191 TotallyNotJson.1190; jump TotallyNotJson.989 TotallyNotJson.988;
else else
jump TotallyNotJson.1191 TotallyNotJson.274; jump TotallyNotJson.989 TotallyNotJson.237;
procedure TotallyNotJson.27 (TotallyNotJson.218): procedure TotallyNotJson.25 (TotallyNotJson.149):
switch TotallyNotJson.218: let TotallyNotJson.1012 : Str = CallByName Encode.23 TotallyNotJson.149;
ret TotallyNotJson.1012;
procedure TotallyNotJson.26 (TotallyNotJson.152):
let TotallyNotJson.153 : List U8 = CallByName Str.12 TotallyNotJson.152;
let TotallyNotJson.1094 : U64 = 0i64;
let TotallyNotJson.1095 : Int1 = true;
let TotallyNotJson.154 : {U64, Int1} = Struct {TotallyNotJson.1094, TotallyNotJson.1095};
let TotallyNotJson.1064 : {} = Struct {};
inc TotallyNotJson.153;
let TotallyNotJson.155 : {U64, Int1} = CallByName List.26 TotallyNotJson.153 TotallyNotJson.154 TotallyNotJson.1064;
let TotallyNotJson.1018 : Int1 = StructAtIndex 1 TotallyNotJson.155;
let TotallyNotJson.1062 : Int1 = true;
let TotallyNotJson.1063 : Int1 = lowlevel Eq TotallyNotJson.1062 TotallyNotJson.1018;
if TotallyNotJson.1063 then
let TotallyNotJson.1028 : U64 = CallByName List.6 TotallyNotJson.153;
let TotallyNotJson.1029 : U64 = 2i64;
let TotallyNotJson.1027 : U64 = CallByName Num.19 TotallyNotJson.1028 TotallyNotJson.1029;
let TotallyNotJson.1024 : List U8 = CallByName List.68 TotallyNotJson.1027;
let TotallyNotJson.1026 : U8 = 34i64;
let TotallyNotJson.1025 : List U8 = Array [TotallyNotJson.1026];
let TotallyNotJson.1023 : List U8 = CallByName List.8 TotallyNotJson.1024 TotallyNotJson.1025;
let TotallyNotJson.1020 : List U8 = CallByName List.8 TotallyNotJson.1023 TotallyNotJson.153;
let TotallyNotJson.1022 : U8 = 34i64;
let TotallyNotJson.1021 : List U8 = Array [TotallyNotJson.1022];
let TotallyNotJson.1019 : List U8 = CallByName List.8 TotallyNotJson.1020 TotallyNotJson.1021;
ret TotallyNotJson.1019;
else
inc TotallyNotJson.153;
let TotallyNotJson.1061 : U64 = StructAtIndex 0 TotallyNotJson.155;
let TotallyNotJson.1060 : {List U8, List U8} = CallByName List.52 TotallyNotJson.153 TotallyNotJson.1061;
let TotallyNotJson.179 : List U8 = StructAtIndex 0 TotallyNotJson.1060;
let TotallyNotJson.181 : List U8 = StructAtIndex 1 TotallyNotJson.1060;
let TotallyNotJson.1058 : U64 = CallByName List.6 TotallyNotJson.153;
dec TotallyNotJson.153;
let TotallyNotJson.1059 : U64 = 120i64;
let TotallyNotJson.1056 : U64 = CallByName Num.21 TotallyNotJson.1058 TotallyNotJson.1059;
let TotallyNotJson.1057 : U64 = 100i64;
let TotallyNotJson.1055 : U64 = CallByName Num.94 TotallyNotJson.1056 TotallyNotJson.1057;
let TotallyNotJson.1052 : List U8 = CallByName List.68 TotallyNotJson.1055;
let TotallyNotJson.1054 : U8 = 34i64;
let TotallyNotJson.1053 : List U8 = Array [TotallyNotJson.1054];
let TotallyNotJson.1051 : List U8 = CallByName List.8 TotallyNotJson.1052 TotallyNotJson.1053;
let TotallyNotJson.182 : List U8 = CallByName List.8 TotallyNotJson.1051 TotallyNotJson.179;
let TotallyNotJson.1034 : {} = Struct {};
let TotallyNotJson.1031 : List U8 = CallByName List.18 TotallyNotJson.181 TotallyNotJson.182 TotallyNotJson.1034;
let TotallyNotJson.1033 : U8 = 34i64;
let TotallyNotJson.1032 : List U8 = Array [TotallyNotJson.1033];
let TotallyNotJson.1030 : List U8 = CallByName List.8 TotallyNotJson.1031 TotallyNotJson.1032;
ret TotallyNotJson.1030;
procedure TotallyNotJson.27 (TotallyNotJson.186):
switch TotallyNotJson.186:
case 34: case 34:
let TotallyNotJson.1239 : List U8 = Array [92i64, 34i64]; let TotallyNotJson.1037 : List U8 = Array [92i64, 34i64];
ret TotallyNotJson.1239; ret TotallyNotJson.1037;
case 92: case 92:
let TotallyNotJson.1240 : List U8 = Array [92i64, 92i64]; let TotallyNotJson.1038 : List U8 = Array [92i64, 92i64];
ret TotallyNotJson.1240; ret TotallyNotJson.1038;
case 47: case 47:
let TotallyNotJson.1241 : List U8 = Array [92i64, 47i64]; let TotallyNotJson.1039 : List U8 = Array [92i64, 47i64];
ret TotallyNotJson.1241; ret TotallyNotJson.1039;
case 8: case 8:
let TotallyNotJson.1243 : U8 = 98i64; let TotallyNotJson.1041 : U8 = 98i64;
let TotallyNotJson.1242 : List U8 = Array [92i64, TotallyNotJson.1243]; let TotallyNotJson.1040 : List U8 = Array [92i64, TotallyNotJson.1041];
ret TotallyNotJson.1242; ret TotallyNotJson.1040;
case 12: case 12:
let TotallyNotJson.1245 : U8 = 102i64; let TotallyNotJson.1043 : U8 = 102i64;
let TotallyNotJson.1244 : List U8 = Array [92i64, TotallyNotJson.1245]; let TotallyNotJson.1042 : List U8 = Array [92i64, TotallyNotJson.1043];
ret TotallyNotJson.1244; ret TotallyNotJson.1042;
case 10: case 10:
let TotallyNotJson.1247 : U8 = 110i64; let TotallyNotJson.1045 : U8 = 110i64;
let TotallyNotJson.1246 : List U8 = Array [92i64, TotallyNotJson.1247]; let TotallyNotJson.1044 : List U8 = Array [92i64, TotallyNotJson.1045];
ret TotallyNotJson.1246; ret TotallyNotJson.1044;
case 13: case 13:
let TotallyNotJson.1249 : U8 = 114i64; let TotallyNotJson.1047 : U8 = 114i64;
let TotallyNotJson.1248 : List U8 = Array [92i64, TotallyNotJson.1249]; let TotallyNotJson.1046 : List U8 = Array [92i64, TotallyNotJson.1047];
ret TotallyNotJson.1248; ret TotallyNotJson.1046;
case 9: case 9:
let TotallyNotJson.1251 : U8 = 114i64; let TotallyNotJson.1049 : U8 = 114i64;
let TotallyNotJson.1250 : List U8 = Array [92i64, TotallyNotJson.1251]; let TotallyNotJson.1048 : List U8 = Array [92i64, TotallyNotJson.1049];
ret TotallyNotJson.1250; ret TotallyNotJson.1048;
default: default:
let TotallyNotJson.1252 : List U8 = Array [TotallyNotJson.218]; let TotallyNotJson.1050 : List U8 = Array [TotallyNotJson.186];
ret TotallyNotJson.1252; ret TotallyNotJson.1050;
procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263): procedure TotallyNotJson.31 (TotallyNotJson.226, TotallyNotJson.227):
let TotallyNotJson.1174 : {Str, List Str} = Struct {TotallyNotJson.262, TotallyNotJson.263}; let TotallyNotJson.972 : {Str, List Str} = Struct {TotallyNotJson.226, TotallyNotJson.227};
let TotallyNotJson.1173 : {Str, List Str} = CallByName Encode.23 TotallyNotJson.1174; let TotallyNotJson.971 : {Str, List Str} = CallByName Encode.23 TotallyNotJson.972;
ret TotallyNotJson.1173; ret TotallyNotJson.971;
procedure TotallyNotJson.8 (): procedure TotallyNotJson.8 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ; let TotallyNotJson.970 : {} = Struct {};
ret TotallyNotJson.1172; ret TotallyNotJson.970;
procedure Test.0 (): procedure Test.0 ():
let Test.12 : Str = "foo"; let Test.12 : Str = "foo";
let Test.11 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.8; let Test.11 : {} = CallByName TotallyNotJson.8;
let Test.10 : List U8 = CallByName Encode.26 Test.12 Test.11; let Test.10 : List U8 = CallByName Encode.26 Test.12 Test.11;
let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10; let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10;
let Test.7 : U8 = 1i64; let Test.7 : U8 = 1i64;

View file

@ -13,7 +13,7 @@ procedure #Derived.4 (#Derived.5, #Derived.6, #Derived.1):
let #Derived_gen.9 : Str = CallByName TotallyNotJson.25 #Derived.2; let #Derived_gen.9 : Str = CallByName TotallyNotJson.25 #Derived.2;
let #Derived_gen.10 : Str = CallByName TotallyNotJson.25 #Derived.3; let #Derived_gen.10 : Str = CallByName TotallyNotJson.25 #Derived.3;
let #Derived_gen.8 : List Str = Array [#Derived_gen.9, #Derived_gen.10]; let #Derived_gen.8 : List Str = Array [#Derived_gen.9, #Derived_gen.10];
let #Derived_gen.6 : {Str, List Str} = CallByName TotallyNotJson.32 #Derived_gen.7 #Derived_gen.8; let #Derived_gen.6 : {Str, List Str} = CallByName TotallyNotJson.31 #Derived_gen.7 #Derived_gen.8;
jump #Derived_gen.5 #Derived_gen.6; jump #Derived_gen.5 #Derived_gen.6;
procedure Encode.23 (Encode.98): procedure Encode.23 (Encode.98):
@ -30,11 +30,11 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101):
ret Encode.111; ret Encode.111;
procedure Encode.24 (Encode.99, Encode.107, Encode.101): procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.113 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; let Encode.113 : List U8 = CallByName TotallyNotJson.228 Encode.99 Encode.101 Encode.107;
ret Encode.113; ret Encode.113;
procedure Encode.24 (Encode.99, Encode.107, Encode.101): procedure Encode.24 (Encode.99, Encode.107, Encode.101):
let Encode.117 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; let Encode.117 : List U8 = CallByName TotallyNotJson.150 Encode.99 Encode.101 Encode.107;
ret Encode.117; ret Encode.117;
procedure Encode.26 (Encode.105, Encode.106): procedure Encode.26 (Encode.105, Encode.106):
@ -43,454 +43,456 @@ procedure Encode.26 (Encode.105, Encode.106):
let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106;
ret Encode.108; ret Encode.108;
procedure List.101 (List.484, List.485, List.486): procedure List.102 (List.486, List.487, List.488):
let List.653 : U64 = 0i64; let List.655 : U64 = 0i64;
let List.654 : U64 = CallByName List.6 List.484; let List.656 : U64 = CallByName List.6 List.486;
let List.652 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.484 List.485 List.486 List.653 List.654; let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.655 List.656;
ret List.652; ret List.654;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.597 : U64 = 0i64; let List.599 : U64 = 0i64;
let List.598 : U64 = CallByName List.6 List.156; let List.600 : U64 = CallByName List.6 List.158;
let List.596 : {List U8, U64} = CallByName List.89 List.156 List.157 List.158 List.597 List.598; let List.598 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.599 List.600;
ret List.596; ret List.598;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.609 : U64 = 0i64; let List.611 : U64 = 0i64;
let List.610 : U64 = CallByName List.6 List.156; let List.612 : U64 = CallByName List.6 List.158;
let List.608 : List U8 = CallByName List.89 List.156 List.157 List.158 List.609 List.610; let List.610 : List U8 = CallByName List.90 List.158 List.159 List.160 List.611 List.612;
ret List.608; ret List.610;
procedure List.26 (List.197, List.198, List.199): procedure List.26 (List.199, List.200, List.201):
let List.646 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.101 List.197 List.198 List.199; let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201;
let List.649 : U8 = 1i64; let List.651 : U8 = 1i64;
let List.650 : U8 = GetTagId List.646; let List.652 : U8 = GetTagId List.648;
let List.651 : Int1 = lowlevel Eq List.649 List.650; let List.653 : Int1 = lowlevel Eq List.651 List.652;
if List.651 then if List.653 then
let List.200 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.646; let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.648;
ret List.200; ret List.202;
else else
let List.201 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.646; let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.648;
ret List.201; ret List.203;
procedure List.4 (List.121, List.122): procedure List.4 (List.122, List.123):
let List.595 : U64 = 1i64; let List.597 : U64 = 1i64;
let List.594 : List U8 = CallByName List.70 List.121 List.595; let List.596 : List U8 = CallByName List.70 List.122 List.597;
let List.593 : List U8 = CallByName List.71 List.594 List.122; let List.595 : List U8 = CallByName List.71 List.596 List.123;
ret List.593; ret List.595;
procedure List.49 (List.416, List.417): procedure List.49 (List.418, List.419):
let List.637 : U64 = StructAtIndex 1 List.417; let List.639 : U64 = StructAtIndex 1 List.419;
let List.638 : U64 = StructAtIndex 0 List.417; let List.640 : U64 = StructAtIndex 0 List.419;
let List.636 : List U8 = CallByName List.72 List.416 List.637 List.638; let List.638 : List U8 = CallByName List.72 List.418 List.639 List.640;
ret List.636; ret List.638;
procedure List.52 (List.431, List.432): procedure List.52 (List.433, List.434):
let List.433 : U64 = CallByName List.6 List.431; let List.435 : U64 = CallByName List.6 List.433;
joinpoint List.644 List.434: joinpoint List.646 List.436:
let List.642 : U64 = 0i64; let List.644 : U64 = 0i64;
let List.641 : {U64, U64} = Struct {List.434, List.642}; let List.643 : {U64, U64} = Struct {List.436, List.644};
inc List.431; inc List.433;
let List.435 : List U8 = CallByName List.49 List.431 List.641; let List.437 : List U8 = CallByName List.49 List.433 List.643;
let List.640 : U64 = CallByName Num.75 List.433 List.434; let List.642 : U64 = CallByName Num.75 List.435 List.436;
let List.635 : {U64, U64} = Struct {List.640, List.434}; let List.637 : {U64, U64} = Struct {List.642, List.436};
let List.436 : List U8 = CallByName List.49 List.431 List.635; let List.438 : List U8 = CallByName List.49 List.433 List.637;
let List.634 : {List U8, List U8} = Struct {List.435, List.436}; let List.636 : {List U8, List U8} = Struct {List.437, List.438};
ret List.634; ret List.636;
in in
let List.645 : Int1 = CallByName Num.24 List.433 List.432; let List.647 : Int1 = CallByName Num.24 List.435 List.434;
if List.645 then if List.647 then
jump List.644 List.432; jump List.646 List.434;
else else
jump List.644 List.433; jump List.646 List.435;
procedure List.6 (#Attr.2):
let List.620 : U64 = lowlevel ListLen #Attr.2;
ret List.620;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.622 : U64 = lowlevel ListLen #Attr.2; let List.622 : U64 = lowlevel ListLen #Attr.2;
ret List.622; ret List.622;
procedure List.66 (#Attr.2, #Attr.3): procedure List.6 (#Attr.2):
let List.606 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.624 : U64 = lowlevel ListLen #Attr.2;
ret List.606; ret List.624;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.618 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.608 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.618; ret List.608;
procedure List.66 (#Attr.2, #Attr.3):
let List.620 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.620;
procedure List.68 (#Attr.2): procedure List.68 (#Attr.2):
let List.633 : List U8 = lowlevel ListWithCapacity #Attr.2; let List.635 : List U8 = lowlevel ListWithCapacity #Attr.2;
ret List.633; ret List.635;
procedure List.70 (#Attr.2, #Attr.3): procedure List.70 (#Attr.2, #Attr.3):
let List.574 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3;
ret List.574; ret List.576;
procedure List.71 (#Attr.2, #Attr.3): procedure List.71 (#Attr.2, #Attr.3):
let List.572 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
ret List.572; ret List.574;
procedure List.72 (#Attr.2, #Attr.3, #Attr.4): procedure List.72 (#Attr.2, #Attr.3, #Attr.4):
let List.639 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; let List.641 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4;
ret List.639; ret List.641;
procedure List.8 (#Attr.2, #Attr.3): procedure List.8 (#Attr.2, #Attr.3):
let List.631 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3;
ret List.631; ret List.633;
procedure List.80 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): procedure List.80 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23):
joinpoint List.655 List.487 List.488 List.489 List.490 List.491: joinpoint List.657 List.489 List.490 List.491 List.492 List.493:
let List.657 : Int1 = CallByName Num.22 List.490 List.491; let List.659 : Int1 = CallByName Num.22 List.492 List.493;
if List.657 then if List.659 then
let List.666 : U8 = CallByName List.66 List.487 List.490; let List.668 : U8 = CallByName List.66 List.489 List.492;
let List.658 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.488 List.666; let List.660 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.668;
let List.663 : U8 = 1i64; let List.665 : U8 = 1i64;
let List.664 : U8 = GetTagId List.658; let List.666 : U8 = GetTagId List.660;
let List.665 : Int1 = lowlevel Eq List.663 List.664; let List.667 : Int1 = lowlevel Eq List.665 List.666;
if List.665 then if List.667 then
let List.492 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.658; let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.660;
let List.661 : U64 = 1i64; let List.663 : U64 = 1i64;
let List.660 : U64 = CallByName Num.51 List.490 List.661; let List.662 : U64 = CallByName Num.51 List.492 List.663;
jump List.655 List.487 List.492 List.489 List.660 List.491; jump List.657 List.489 List.494 List.491 List.662 List.493;
else else
dec List.487; dec List.489;
let List.493 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.658; let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.660;
let List.662 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.493; let List.664 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495;
ret List.662; ret List.664;
else else
dec List.487; dec List.489;
let List.656 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.488; let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490;
ret List.656; ret List.658;
in in
jump List.655 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; jump List.657 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23;
procedure List.89 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18):
joinpoint List.611 List.159 List.160 List.161 List.162 List.163: joinpoint List.601 List.161 List.162 List.163 List.164 List.165:
let List.613 : Int1 = CallByName Num.22 List.162 List.163; let List.603 : Int1 = CallByName Num.22 List.164 List.165;
if List.613 then if List.603 then
let List.617 : U8 = CallByName List.66 List.159 List.162; let List.607 : Str = CallByName List.66 List.161 List.164;
let List.164 : List U8 = CallByName TotallyNotJson.215 List.160 List.617; inc List.607;
let List.616 : U64 = 1i64; let List.166 : {List U8, U64} = CallByName TotallyNotJson.230 List.162 List.607;
let List.615 : U64 = CallByName Num.51 List.162 List.616; let List.606 : U64 = 1i64;
jump List.611 List.159 List.164 List.161 List.615 List.163; let List.605 : U64 = CallByName Num.51 List.164 List.606;
jump List.601 List.161 List.166 List.163 List.605 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.611 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; jump List.601 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18;
procedure List.89 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28):
joinpoint List.599 List.159 List.160 List.161 List.162 List.163: joinpoint List.613 List.161 List.162 List.163 List.164 List.165:
let List.601 : Int1 = CallByName Num.22 List.162 List.163; let List.615 : Int1 = CallByName Num.22 List.164 List.165;
if List.601 then if List.615 then
let List.605 : Str = CallByName List.66 List.159 List.162; let List.619 : U8 = CallByName List.66 List.161 List.164;
inc List.605; let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619;
let List.164 : {List U8, U64} = CallByName TotallyNotJson.267 List.160 List.605 List.161; let List.618 : U64 = 1i64;
let List.604 : U64 = 1i64; let List.617 : U64 = CallByName Num.51 List.164 List.618;
let List.603 : U64 = CallByName Num.51 List.162 List.604; jump List.613 List.161 List.166 List.163 List.617 List.165;
jump List.599 List.159 List.164 List.161 List.603 List.163;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.599 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; jump List.613 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28;
procedure Num.127 (#Attr.2): procedure Num.127 (#Attr.2):
let Num.298 : U8 = lowlevel NumIntCast #Attr.2; let Num.304 : U8 = lowlevel NumIntCast #Attr.2;
ret Num.298;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.302 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.302;
procedure Num.20 (#Attr.2, #Attr.3):
let Num.299 : U64 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.299;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.304 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.304; ret Num.304;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.310 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.308 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.308;
procedure Num.20 (#Attr.2, #Attr.3):
let Num.305 : U64 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.305;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.310 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.310; ret Num.310;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.316 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.316;
procedure Num.24 (#Attr.2, #Attr.3): procedure Num.24 (#Attr.2, #Attr.3):
let Num.312 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; let Num.318 : Int1 = lowlevel NumGt #Attr.2 #Attr.3;
ret Num.312; ret Num.318;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.307 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.313 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.307; ret Num.313;
procedure Num.75 (#Attr.2, #Attr.3): procedure Num.75 (#Attr.2, #Attr.3):
let Num.311 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; let Num.317 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3;
ret Num.311; ret Num.317;
procedure Num.94 (#Attr.2, #Attr.3): procedure Num.94 (#Attr.2, #Attr.3):
let Num.303 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; let Num.309 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3;
ret Num.303; ret Num.309;
procedure Str.12 (#Attr.2): procedure Str.12 (#Attr.2):
let Str.303 : List U8 = lowlevel StrToUtf8 #Attr.2; let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2;
ret Str.303; ret Str.262;
procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): procedure Str.43 (#Attr.2, #Attr.3, #Attr.4):
let Str.301 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4;
ret Str.301; ret Str.260;
procedure Str.9 (Str.80): procedure Str.9 (Str.68):
let Str.299 : U64 = 0i64; let Str.258 : U64 = 0i64;
let Str.300 : U64 = CallByName List.6 Str.80; let Str.259 : U64 = CallByName List.6 Str.68;
let Str.81 : {U64, Str, Int1, U8} = CallByName Str.48 Str.80 Str.299 Str.300; let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259;
let Str.296 : Int1 = StructAtIndex 2 Str.81; let Str.255 : Int1 = StructAtIndex 2 Str.69;
if Str.296 then if Str.255 then
let Str.298 : Str = StructAtIndex 1 Str.81; let Str.257 : Str = StructAtIndex 1 Str.69;
let Str.297 : [C {U64, U8}, C Str] = TagId(1) Str.298; let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257;
ret Str.297; ret Str.256;
else else
let Str.294 : U8 = StructAtIndex 3 Str.81; let Str.253 : U8 = StructAtIndex 3 Str.69;
let Str.295 : U64 = StructAtIndex 0 Str.81; let Str.254 : U64 = StructAtIndex 0 Str.69;
let #Derived_gen.35 : Str = StructAtIndex 1 Str.81; let #Derived_gen.35 : Str = StructAtIndex 1 Str.69;
dec #Derived_gen.35; dec #Derived_gen.35;
let Str.293 : {U64, U8} = Struct {Str.295, Str.294}; let Str.252 : {U64, U8} = Struct {Str.254, Str.253};
let Str.292 : [C {U64, U8}, C Str] = TagId(0) Str.293; let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252;
ret Str.292; ret Str.251;
procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1216, TotallyNotJson.181): procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149):
let TotallyNotJson.1219 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181; let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149;
let TotallyNotJson.1218 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1219; let TotallyNotJson.1016 : List U8 = CallByName List.8 TotallyNotJson.151 TotallyNotJson.1017;
ret TotallyNotJson.1218; ret TotallyNotJson.1016;
procedure TotallyNotJson.189 (TotallyNotJson.1267, TotallyNotJson.192): procedure TotallyNotJson.157 (TotallyNotJson.1065, TotallyNotJson.160):
let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1267; let TotallyNotJson.158 : U64 = StructAtIndex 0 TotallyNotJson.1065;
let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1267; let TotallyNotJson.159 : Int1 = StructAtIndex 1 TotallyNotJson.1065;
switch TotallyNotJson.192: switch TotallyNotJson.160:
case 34: case 34:
let TotallyNotJson.1270 : Int1 = false; let TotallyNotJson.1068 : Int1 = false;
let TotallyNotJson.1269 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1270}; let TotallyNotJson.1067 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1068};
let TotallyNotJson.1268 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1269; let TotallyNotJson.1066 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1067;
ret TotallyNotJson.1268; ret TotallyNotJson.1066;
case 92: case 92:
let TotallyNotJson.1273 : Int1 = false; let TotallyNotJson.1071 : Int1 = false;
let TotallyNotJson.1272 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1273}; let TotallyNotJson.1070 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1071};
let TotallyNotJson.1271 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1272; let TotallyNotJson.1069 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1070;
ret TotallyNotJson.1271; ret TotallyNotJson.1069;
case 47: case 47:
let TotallyNotJson.1276 : Int1 = false; let TotallyNotJson.1074 : Int1 = false;
let TotallyNotJson.1275 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1276}; let TotallyNotJson.1073 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1074};
let TotallyNotJson.1274 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1275; let TotallyNotJson.1072 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1073;
ret TotallyNotJson.1274; ret TotallyNotJson.1072;
case 8: case 8:
let TotallyNotJson.1279 : Int1 = false; let TotallyNotJson.1077 : Int1 = false;
let TotallyNotJson.1278 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1279}; let TotallyNotJson.1076 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1077};
let TotallyNotJson.1277 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1278; let TotallyNotJson.1075 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1076;
ret TotallyNotJson.1277; ret TotallyNotJson.1075;
case 12: case 12:
let TotallyNotJson.1282 : Int1 = false; let TotallyNotJson.1080 : Int1 = false;
let TotallyNotJson.1281 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1282}; let TotallyNotJson.1079 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1080};
let TotallyNotJson.1280 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1281; let TotallyNotJson.1078 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1079;
ret TotallyNotJson.1280; ret TotallyNotJson.1078;
case 10: case 10:
let TotallyNotJson.1285 : Int1 = false; let TotallyNotJson.1083 : Int1 = false;
let TotallyNotJson.1284 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1285}; let TotallyNotJson.1082 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1083};
let TotallyNotJson.1283 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1284; let TotallyNotJson.1081 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1082;
ret TotallyNotJson.1283; ret TotallyNotJson.1081;
case 13: case 13:
let TotallyNotJson.1288 : Int1 = false; let TotallyNotJson.1086 : Int1 = false;
let TotallyNotJson.1287 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1288}; let TotallyNotJson.1085 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1086};
let TotallyNotJson.1286 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1287; let TotallyNotJson.1084 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1085;
ret TotallyNotJson.1286; ret TotallyNotJson.1084;
case 9: case 9:
let TotallyNotJson.1291 : Int1 = false; let TotallyNotJson.1089 : Int1 = false;
let TotallyNotJson.1290 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1291}; let TotallyNotJson.1088 : {U64, Int1} = Struct {TotallyNotJson.158, TotallyNotJson.1089};
let TotallyNotJson.1289 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1290; let TotallyNotJson.1087 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1088;
ret TotallyNotJson.1289; ret TotallyNotJson.1087;
default: default:
let TotallyNotJson.1295 : U64 = 1i64; let TotallyNotJson.1093 : U64 = 1i64;
let TotallyNotJson.1294 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1295; let TotallyNotJson.1092 : U64 = CallByName Num.19 TotallyNotJson.158 TotallyNotJson.1093;
let TotallyNotJson.1293 : {U64, Int1} = Struct {TotallyNotJson.1294, TotallyNotJson.191}; let TotallyNotJson.1091 : {U64, Int1} = Struct {TotallyNotJson.1092, TotallyNotJson.159};
let TotallyNotJson.1292 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1293; let TotallyNotJson.1090 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1091;
ret TotallyNotJson.1292; ret TotallyNotJson.1090;
procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217): procedure TotallyNotJson.183 (TotallyNotJson.184, TotallyNotJson.185):
let TotallyNotJson.1238 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217; let TotallyNotJson.1036 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.185;
let TotallyNotJson.1237 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1238; let TotallyNotJson.1035 : List U8 = CallByName List.8 TotallyNotJson.184 TotallyNotJson.1036;
ret TotallyNotJson.1237; ret TotallyNotJson.1035;
procedure TotallyNotJson.25 (TotallyNotJson.181): procedure TotallyNotJson.228 (TotallyNotJson.229, TotallyNotJson.973, #Attr.12):
let TotallyNotJson.1298 : Str = CallByName Encode.23 TotallyNotJson.181; let TotallyNotJson.227 : List Str = StructAtIndex 1 #Attr.12;
ret TotallyNotJson.1298; let TotallyNotJson.226 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1011 : I64 = 123i64;
let TotallyNotJson.1010 : U8 = CallByName Num.127 TotallyNotJson.1011;
let TotallyNotJson.1007 : List U8 = CallByName List.4 TotallyNotJson.229 TotallyNotJson.1010;
let TotallyNotJson.1009 : I64 = 34i64;
let TotallyNotJson.1008 : U8 = CallByName Num.127 TotallyNotJson.1009;
let TotallyNotJson.1005 : List U8 = CallByName List.4 TotallyNotJson.1007 TotallyNotJson.1008;
let TotallyNotJson.1006 : List U8 = CallByName Str.12 TotallyNotJson.226;
let TotallyNotJson.1002 : List U8 = CallByName List.8 TotallyNotJson.1005 TotallyNotJson.1006;
let TotallyNotJson.1004 : I64 = 34i64;
let TotallyNotJson.1003 : U8 = CallByName Num.127 TotallyNotJson.1004;
let TotallyNotJson.999 : List U8 = CallByName List.4 TotallyNotJson.1002 TotallyNotJson.1003;
let TotallyNotJson.1001 : I64 = 58i64;
let TotallyNotJson.1000 : U8 = CallByName Num.127 TotallyNotJson.1001;
let TotallyNotJson.996 : List U8 = CallByName List.4 TotallyNotJson.999 TotallyNotJson.1000;
let TotallyNotJson.998 : I64 = 91i64;
let TotallyNotJson.997 : U8 = CallByName Num.127 TotallyNotJson.998;
let TotallyNotJson.231 : List U8 = CallByName List.4 TotallyNotJson.996 TotallyNotJson.997;
let TotallyNotJson.995 : U64 = CallByName List.6 TotallyNotJson.227;
let TotallyNotJson.983 : {List U8, U64} = Struct {TotallyNotJson.231, TotallyNotJson.995};
let TotallyNotJson.984 : {} = Struct {};
let TotallyNotJson.982 : {List U8, U64} = CallByName List.18 TotallyNotJson.227 TotallyNotJson.983 TotallyNotJson.984;
let TotallyNotJson.233 : List U8 = StructAtIndex 0 TotallyNotJson.982;
let TotallyNotJson.981 : I64 = 93i64;
let TotallyNotJson.980 : U8 = CallByName Num.127 TotallyNotJson.981;
let TotallyNotJson.977 : List U8 = CallByName List.4 TotallyNotJson.233 TotallyNotJson.980;
let TotallyNotJson.979 : I64 = 125i64;
let TotallyNotJson.978 : U8 = CallByName Num.127 TotallyNotJson.979;
let TotallyNotJson.976 : List U8 = CallByName List.4 TotallyNotJson.977 TotallyNotJson.978;
ret TotallyNotJson.976;
procedure TotallyNotJson.26 (TotallyNotJson.184): procedure TotallyNotJson.230 (TotallyNotJson.975, TotallyNotJson.236):
let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184; let TotallyNotJson.234 : List U8 = StructAtIndex 0 TotallyNotJson.975;
let TotallyNotJson.1296 : U64 = 0i64; let TotallyNotJson.235 : U64 = StructAtIndex 1 TotallyNotJson.975;
let TotallyNotJson.1297 : Int1 = true; let TotallyNotJson.994 : {} = Struct {};
let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1296, TotallyNotJson.1297}; let TotallyNotJson.237 : List U8 = CallByName Encode.24 TotallyNotJson.234 TotallyNotJson.236 TotallyNotJson.994;
let TotallyNotJson.1266 : {} = Struct {}; joinpoint TotallyNotJson.989 TotallyNotJson.238:
inc TotallyNotJson.185; let TotallyNotJson.987 : U64 = 1i64;
let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1266; let TotallyNotJson.986 : U64 = CallByName Num.20 TotallyNotJson.235 TotallyNotJson.987;
let TotallyNotJson.1220 : Int1 = StructAtIndex 1 TotallyNotJson.187; let TotallyNotJson.985 : {List U8, U64} = Struct {TotallyNotJson.238, TotallyNotJson.986};
let TotallyNotJson.1264 : Int1 = true; ret TotallyNotJson.985;
let TotallyNotJson.1265 : Int1 = lowlevel Eq TotallyNotJson.1264 TotallyNotJson.1220;
if TotallyNotJson.1265 then
let TotallyNotJson.1230 : U64 = CallByName List.6 TotallyNotJson.185;
let TotallyNotJson.1231 : U64 = 2i64;
let TotallyNotJson.1229 : U64 = CallByName Num.19 TotallyNotJson.1230 TotallyNotJson.1231;
let TotallyNotJson.1226 : List U8 = CallByName List.68 TotallyNotJson.1229;
let TotallyNotJson.1228 : U8 = 34i64;
let TotallyNotJson.1227 : List U8 = Array [TotallyNotJson.1228];
let TotallyNotJson.1225 : List U8 = CallByName List.8 TotallyNotJson.1226 TotallyNotJson.1227;
let TotallyNotJson.1222 : List U8 = CallByName List.8 TotallyNotJson.1225 TotallyNotJson.185;
let TotallyNotJson.1224 : U8 = 34i64;
let TotallyNotJson.1223 : List U8 = Array [TotallyNotJson.1224];
let TotallyNotJson.1221 : List U8 = CallByName List.8 TotallyNotJson.1222 TotallyNotJson.1223;
ret TotallyNotJson.1221;
else
inc TotallyNotJson.185;
let TotallyNotJson.1263 : U64 = StructAtIndex 0 TotallyNotJson.187;
let TotallyNotJson.1262 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1263;
let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1262;
let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1262;
let TotallyNotJson.1260 : U64 = CallByName List.6 TotallyNotJson.185;
dec TotallyNotJson.185;
let TotallyNotJson.1261 : U64 = 120i64;
let TotallyNotJson.1258 : U64 = CallByName Num.21 TotallyNotJson.1260 TotallyNotJson.1261;
let TotallyNotJson.1259 : U64 = 100i64;
let TotallyNotJson.1257 : U64 = CallByName Num.94 TotallyNotJson.1258 TotallyNotJson.1259;
let TotallyNotJson.1254 : List U8 = CallByName List.68 TotallyNotJson.1257;
let TotallyNotJson.1256 : U8 = 34i64;
let TotallyNotJson.1255 : List U8 = Array [TotallyNotJson.1256];
let TotallyNotJson.1253 : List U8 = CallByName List.8 TotallyNotJson.1254 TotallyNotJson.1255;
let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1253 TotallyNotJson.211;
let TotallyNotJson.1236 : {} = Struct {};
let TotallyNotJson.1233 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1236;
let TotallyNotJson.1235 : U8 = 34i64;
let TotallyNotJson.1234 : List U8 = Array [TotallyNotJson.1235];
let TotallyNotJson.1232 : List U8 = CallByName List.8 TotallyNotJson.1233 TotallyNotJson.1234;
ret TotallyNotJson.1232;
procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12):
let TotallyNotJson.263 : List Str = StructAtIndex 1 #Attr.12;
let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12;
let TotallyNotJson.1213 : I64 = 123i64;
let TotallyNotJson.1212 : U8 = CallByName Num.127 TotallyNotJson.1213;
let TotallyNotJson.1209 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1212;
let TotallyNotJson.1211 : I64 = 34i64;
let TotallyNotJson.1210 : U8 = CallByName Num.127 TotallyNotJson.1211;
let TotallyNotJson.1207 : List U8 = CallByName List.4 TotallyNotJson.1209 TotallyNotJson.1210;
let TotallyNotJson.1208 : List U8 = CallByName Str.12 TotallyNotJson.262;
let TotallyNotJson.1204 : List U8 = CallByName List.8 TotallyNotJson.1207 TotallyNotJson.1208;
let TotallyNotJson.1206 : I64 = 34i64;
let TotallyNotJson.1205 : U8 = CallByName Num.127 TotallyNotJson.1206;
let TotallyNotJson.1201 : List U8 = CallByName List.4 TotallyNotJson.1204 TotallyNotJson.1205;
let TotallyNotJson.1203 : I64 = 58i64;
let TotallyNotJson.1202 : U8 = CallByName Num.127 TotallyNotJson.1203;
let TotallyNotJson.1198 : List U8 = CallByName List.4 TotallyNotJson.1201 TotallyNotJson.1202;
let TotallyNotJson.1200 : I64 = 91i64;
let TotallyNotJson.1199 : U8 = CallByName Num.127 TotallyNotJson.1200;
let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1198 TotallyNotJson.1199;
let TotallyNotJson.1197 : U64 = CallByName List.6 TotallyNotJson.263;
let TotallyNotJson.1185 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1197};
let TotallyNotJson.1184 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1185 TotallyNotJson.1175;
let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1184;
let TotallyNotJson.1183 : I64 = 93i64;
let TotallyNotJson.1182 : U8 = CallByName Num.127 TotallyNotJson.1183;
let TotallyNotJson.1179 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1182;
let TotallyNotJson.1181 : I64 = 125i64;
let TotallyNotJson.1180 : U8 = CallByName Num.127 TotallyNotJson.1181;
let TotallyNotJson.1178 : List U8 = CallByName List.4 TotallyNotJson.1179 TotallyNotJson.1180;
ret TotallyNotJson.1178;
procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266):
let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177;
let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177;
let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266;
joinpoint TotallyNotJson.1191 TotallyNotJson.275:
let TotallyNotJson.1189 : U64 = 1i64;
let TotallyNotJson.1188 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1189;
let TotallyNotJson.1187 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1188};
ret TotallyNotJson.1187;
in in
let TotallyNotJson.1195 : U64 = 1i64; let TotallyNotJson.993 : U64 = 1i64;
let TotallyNotJson.1192 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1195; let TotallyNotJson.990 : Int1 = CallByName Num.24 TotallyNotJson.235 TotallyNotJson.993;
if TotallyNotJson.1192 then if TotallyNotJson.990 then
let TotallyNotJson.1194 : I64 = 44i64; let TotallyNotJson.992 : I64 = 44i64;
let TotallyNotJson.1193 : U8 = CallByName Num.127 TotallyNotJson.1194; let TotallyNotJson.991 : U8 = CallByName Num.127 TotallyNotJson.992;
let TotallyNotJson.1190 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1193; let TotallyNotJson.988 : List U8 = CallByName List.4 TotallyNotJson.237 TotallyNotJson.991;
jump TotallyNotJson.1191 TotallyNotJson.1190; jump TotallyNotJson.989 TotallyNotJson.988;
else else
jump TotallyNotJson.1191 TotallyNotJson.274; jump TotallyNotJson.989 TotallyNotJson.237;
procedure TotallyNotJson.27 (TotallyNotJson.218): procedure TotallyNotJson.25 (TotallyNotJson.149):
switch TotallyNotJson.218: let TotallyNotJson.1096 : Str = CallByName Encode.23 TotallyNotJson.149;
ret TotallyNotJson.1096;
procedure TotallyNotJson.26 (TotallyNotJson.152):
let TotallyNotJson.153 : List U8 = CallByName Str.12 TotallyNotJson.152;
let TotallyNotJson.1094 : U64 = 0i64;
let TotallyNotJson.1095 : Int1 = true;
let TotallyNotJson.154 : {U64, Int1} = Struct {TotallyNotJson.1094, TotallyNotJson.1095};
let TotallyNotJson.1064 : {} = Struct {};
inc TotallyNotJson.153;
let TotallyNotJson.155 : {U64, Int1} = CallByName List.26 TotallyNotJson.153 TotallyNotJson.154 TotallyNotJson.1064;
let TotallyNotJson.1018 : Int1 = StructAtIndex 1 TotallyNotJson.155;
let TotallyNotJson.1062 : Int1 = true;
let TotallyNotJson.1063 : Int1 = lowlevel Eq TotallyNotJson.1062 TotallyNotJson.1018;
if TotallyNotJson.1063 then
let TotallyNotJson.1028 : U64 = CallByName List.6 TotallyNotJson.153;
let TotallyNotJson.1029 : U64 = 2i64;
let TotallyNotJson.1027 : U64 = CallByName Num.19 TotallyNotJson.1028 TotallyNotJson.1029;
let TotallyNotJson.1024 : List U8 = CallByName List.68 TotallyNotJson.1027;
let TotallyNotJson.1026 : U8 = 34i64;
let TotallyNotJson.1025 : List U8 = Array [TotallyNotJson.1026];
let TotallyNotJson.1023 : List U8 = CallByName List.8 TotallyNotJson.1024 TotallyNotJson.1025;
let TotallyNotJson.1020 : List U8 = CallByName List.8 TotallyNotJson.1023 TotallyNotJson.153;
let TotallyNotJson.1022 : U8 = 34i64;
let TotallyNotJson.1021 : List U8 = Array [TotallyNotJson.1022];
let TotallyNotJson.1019 : List U8 = CallByName List.8 TotallyNotJson.1020 TotallyNotJson.1021;
ret TotallyNotJson.1019;
else
inc TotallyNotJson.153;
let TotallyNotJson.1061 : U64 = StructAtIndex 0 TotallyNotJson.155;
let TotallyNotJson.1060 : {List U8, List U8} = CallByName List.52 TotallyNotJson.153 TotallyNotJson.1061;
let TotallyNotJson.179 : List U8 = StructAtIndex 0 TotallyNotJson.1060;
let TotallyNotJson.181 : List U8 = StructAtIndex 1 TotallyNotJson.1060;
let TotallyNotJson.1058 : U64 = CallByName List.6 TotallyNotJson.153;
dec TotallyNotJson.153;
let TotallyNotJson.1059 : U64 = 120i64;
let TotallyNotJson.1056 : U64 = CallByName Num.21 TotallyNotJson.1058 TotallyNotJson.1059;
let TotallyNotJson.1057 : U64 = 100i64;
let TotallyNotJson.1055 : U64 = CallByName Num.94 TotallyNotJson.1056 TotallyNotJson.1057;
let TotallyNotJson.1052 : List U8 = CallByName List.68 TotallyNotJson.1055;
let TotallyNotJson.1054 : U8 = 34i64;
let TotallyNotJson.1053 : List U8 = Array [TotallyNotJson.1054];
let TotallyNotJson.1051 : List U8 = CallByName List.8 TotallyNotJson.1052 TotallyNotJson.1053;
let TotallyNotJson.182 : List U8 = CallByName List.8 TotallyNotJson.1051 TotallyNotJson.179;
let TotallyNotJson.1034 : {} = Struct {};
let TotallyNotJson.1031 : List U8 = CallByName List.18 TotallyNotJson.181 TotallyNotJson.182 TotallyNotJson.1034;
let TotallyNotJson.1033 : U8 = 34i64;
let TotallyNotJson.1032 : List U8 = Array [TotallyNotJson.1033];
let TotallyNotJson.1030 : List U8 = CallByName List.8 TotallyNotJson.1031 TotallyNotJson.1032;
ret TotallyNotJson.1030;
procedure TotallyNotJson.27 (TotallyNotJson.186):
switch TotallyNotJson.186:
case 34: case 34:
let TotallyNotJson.1239 : List U8 = Array [92i64, 34i64]; let TotallyNotJson.1037 : List U8 = Array [92i64, 34i64];
ret TotallyNotJson.1239; ret TotallyNotJson.1037;
case 92: case 92:
let TotallyNotJson.1240 : List U8 = Array [92i64, 92i64]; let TotallyNotJson.1038 : List U8 = Array [92i64, 92i64];
ret TotallyNotJson.1240; ret TotallyNotJson.1038;
case 47: case 47:
let TotallyNotJson.1241 : List U8 = Array [92i64, 47i64]; let TotallyNotJson.1039 : List U8 = Array [92i64, 47i64];
ret TotallyNotJson.1241; ret TotallyNotJson.1039;
case 8: case 8:
let TotallyNotJson.1243 : U8 = 98i64; let TotallyNotJson.1041 : U8 = 98i64;
let TotallyNotJson.1242 : List U8 = Array [92i64, TotallyNotJson.1243]; let TotallyNotJson.1040 : List U8 = Array [92i64, TotallyNotJson.1041];
ret TotallyNotJson.1242; ret TotallyNotJson.1040;
case 12: case 12:
let TotallyNotJson.1245 : U8 = 102i64; let TotallyNotJson.1043 : U8 = 102i64;
let TotallyNotJson.1244 : List U8 = Array [92i64, TotallyNotJson.1245]; let TotallyNotJson.1042 : List U8 = Array [92i64, TotallyNotJson.1043];
ret TotallyNotJson.1244; ret TotallyNotJson.1042;
case 10: case 10:
let TotallyNotJson.1247 : U8 = 110i64; let TotallyNotJson.1045 : U8 = 110i64;
let TotallyNotJson.1246 : List U8 = Array [92i64, TotallyNotJson.1247]; let TotallyNotJson.1044 : List U8 = Array [92i64, TotallyNotJson.1045];
ret TotallyNotJson.1246; ret TotallyNotJson.1044;
case 13: case 13:
let TotallyNotJson.1249 : U8 = 114i64; let TotallyNotJson.1047 : U8 = 114i64;
let TotallyNotJson.1248 : List U8 = Array [92i64, TotallyNotJson.1249]; let TotallyNotJson.1046 : List U8 = Array [92i64, TotallyNotJson.1047];
ret TotallyNotJson.1248; ret TotallyNotJson.1046;
case 9: case 9:
let TotallyNotJson.1251 : U8 = 114i64; let TotallyNotJson.1049 : U8 = 114i64;
let TotallyNotJson.1250 : List U8 = Array [92i64, TotallyNotJson.1251]; let TotallyNotJson.1048 : List U8 = Array [92i64, TotallyNotJson.1049];
ret TotallyNotJson.1250; ret TotallyNotJson.1048;
default: default:
let TotallyNotJson.1252 : List U8 = Array [TotallyNotJson.218]; let TotallyNotJson.1050 : List U8 = Array [TotallyNotJson.186];
ret TotallyNotJson.1252; ret TotallyNotJson.1050;
procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263): procedure TotallyNotJson.31 (TotallyNotJson.226, TotallyNotJson.227):
let TotallyNotJson.1174 : {Str, List Str} = Struct {TotallyNotJson.262, TotallyNotJson.263}; let TotallyNotJson.972 : {Str, List Str} = Struct {TotallyNotJson.226, TotallyNotJson.227};
let TotallyNotJson.1173 : {Str, List Str} = CallByName Encode.23 TotallyNotJson.1174; let TotallyNotJson.971 : {Str, List Str} = CallByName Encode.23 TotallyNotJson.972;
ret TotallyNotJson.1173; ret TotallyNotJson.971;
procedure TotallyNotJson.8 (): procedure TotallyNotJson.8 ():
let TotallyNotJson.1172 : [C , C [], C , C , C , C ] = TagId(2) ; let TotallyNotJson.970 : {} = Struct {};
ret TotallyNotJson.1172; ret TotallyNotJson.970;
procedure Test.0 (): procedure Test.0 ():
let Test.13 : Str = "foo"; let Test.13 : Str = "foo";
let Test.12 : Str = "foo"; let Test.12 : Str = "foo";
let Test.1 : {Str, Str} = Struct {Test.12, Test.13}; let Test.1 : {Str, Str} = Struct {Test.12, Test.13};
let Test.11 : [C , C [], C , C , C , C ] = CallByName TotallyNotJson.8; let Test.11 : {} = CallByName TotallyNotJson.8;
let Test.10 : List U8 = CallByName Encode.26 Test.1 Test.11; let Test.10 : List U8 = CallByName Encode.26 Test.1 Test.11;
let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10; let Test.2 : [C {U64, U8}, C Str] = CallByName Str.9 Test.10;
let Test.7 : U8 = 1i64; let Test.7 : U8 = 1i64;

View file

@ -1,10 +1,10 @@
procedure Num.20 (#Attr.2, #Attr.3): procedure Num.20 (#Attr.2, #Attr.3):
let Num.292 : I64 = lowlevel NumSub #Attr.2 #Attr.3; let Num.298 : I64 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.21 (#Attr.2, #Attr.3): procedure Num.21 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumMul #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.1 (#Derived_gen.0, #Derived_gen.1): procedure Test.1 (#Derived_gen.0, #Derived_gen.1):
joinpoint Test.7 Test.2 Test.3: joinpoint Test.7 Test.2 Test.3:

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.1 (Test.8): procedure Test.1 (Test.8):
let Test.3 : I64 = 10i64; let Test.3 : I64 = 10i64;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.292 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.298 : U8 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Test.1 (Test.9): procedure Test.1 (Test.9):
let Test.4 : U8 = 10i64; let Test.4 : U8 = 10i64;

View file

@ -3,8 +3,8 @@ procedure Bool.1 ():
ret Bool.23; ret Bool.23;
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.3 (Test.4): procedure Test.3 (Test.4):
ret Test.4; ret Test.4;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.293 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.299 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Test.2 (Test.3): procedure Test.2 (Test.3):
switch Test.3: switch Test.3:

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.292 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.298 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Test.2 (Test.3, Test.1): procedure Test.2 (Test.3, Test.1):
let Test.18 : Int1 = false; let Test.18 : Int1 = false;

View file

@ -287,7 +287,7 @@ procedure Dict.65 (Dict.405, Dict.406, Dict.407):
let Dict.854 : {U64, U32} = CallByName Dict.66 Dict.405 Dict.410 Dict.409; let Dict.854 : {U64, U32} = CallByName Dict.66 Dict.405 Dict.410 Dict.409;
ret Dict.854; ret Dict.854;
procedure Dict.66 (#Derived_gen.32, #Derived_gen.33, #Derived_gen.34): procedure Dict.66 (#Derived_gen.37, #Derived_gen.38, #Derived_gen.39):
joinpoint Dict.855 Dict.411 Dict.412 Dict.413: joinpoint Dict.855 Dict.411 Dict.412 Dict.413:
let Dict.863 : U64 = CallByName Num.137 Dict.412; let Dict.863 : U64 = CallByName Num.137 Dict.412;
let Dict.414 : {U32, U32} = CallByName Dict.22 Dict.411 Dict.863; let Dict.414 : {U32, U32} = CallByName Dict.22 Dict.411 Dict.863;
@ -303,9 +303,9 @@ procedure Dict.66 (#Derived_gen.32, #Derived_gen.33, #Derived_gen.34):
let Dict.856 : {U64, U32} = Struct {Dict.412, Dict.413}; let Dict.856 : {U64, U32} = Struct {Dict.412, Dict.413};
ret Dict.856; ret Dict.856;
in in
jump Dict.855 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34; jump Dict.855 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39;
procedure Dict.67 (#Derived_gen.43, #Derived_gen.44, #Derived_gen.45): procedure Dict.67 (#Derived_gen.48, #Derived_gen.49, #Derived_gen.50):
joinpoint Dict.756 Dict.415 Dict.416 Dict.417: joinpoint Dict.756 Dict.415 Dict.416 Dict.417:
let Dict.770 : U64 = CallByName Num.137 Dict.417; let Dict.770 : U64 = CallByName Num.137 Dict.417;
let Dict.418 : {U32, U32} = CallByName Dict.22 Dict.415 Dict.770; let Dict.418 : {U32, U32} = CallByName Dict.22 Dict.415 Dict.770;
@ -327,7 +327,7 @@ procedure Dict.67 (#Derived_gen.43, #Derived_gen.44, #Derived_gen.45):
let Dict.757 : List {U32, U32} = CallByName List.3 Dict.415 Dict.758 Dict.416; let Dict.757 : List {U32, U32} = CallByName List.3 Dict.415 Dict.758 Dict.416;
ret Dict.757; ret Dict.757;
in in
jump Dict.756 #Derived_gen.43 #Derived_gen.44 #Derived_gen.45; jump Dict.756 #Derived_gen.48 #Derived_gen.49 #Derived_gen.50;
procedure Dict.68 (Dict.420, Dict.421): procedure Dict.68 (Dict.420, Dict.421):
let Dict.752 : U64 = 1i64; let Dict.752 : U64 = 1i64;
@ -510,7 +510,7 @@ procedure Dict.82 (Dict.705, Dict.481):
let Dict.929 : {U64, U64, U64} = CallByName Dict.83 Dict.479 Dict.479 Dict.479 Dict.481 Dict.931 Dict.482; let Dict.929 : {U64, U64, U64} = CallByName Dict.83 Dict.479 Dict.479 Dict.479 Dict.481 Dict.931 Dict.482;
jump Dict.930 Dict.929; jump Dict.930 Dict.929;
procedure Dict.83 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31): procedure Dict.83 (#Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36):
joinpoint Dict.932 Dict.487 Dict.488 Dict.489 Dict.490 Dict.491 Dict.492: joinpoint Dict.932 Dict.487 Dict.488 Dict.489 Dict.490 Dict.491 Dict.492:
inc 6 Dict.490; inc 6 Dict.490;
let Dict.1039 : U64 = CallByName Dict.91 Dict.490 Dict.491; let Dict.1039 : U64 = CallByName Dict.91 Dict.490 Dict.491;
@ -572,9 +572,9 @@ procedure Dict.83 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_g
let Dict.933 : {U64, U64, U64} = Struct {Dict.934, Dict.935, Dict.499}; let Dict.933 : {U64, U64, U64} = Struct {Dict.934, Dict.935, Dict.499};
ret Dict.933; ret Dict.933;
in in
jump Dict.932 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31; jump Dict.932 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36;
procedure Dict.84 (#Derived_gen.59, #Derived_gen.60, #Derived_gen.61, #Derived_gen.62): procedure Dict.84 (#Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54):
joinpoint Dict.985 Dict.500 Dict.501 Dict.502 Dict.503: joinpoint Dict.985 Dict.500 Dict.501 Dict.502 Dict.503:
inc 2 Dict.501; inc 2 Dict.501;
let Dict.1005 : U64 = CallByName Dict.91 Dict.501 Dict.502; let Dict.1005 : U64 = CallByName Dict.91 Dict.501 Dict.502;
@ -606,7 +606,7 @@ procedure Dict.84 (#Derived_gen.59, #Derived_gen.60, #Derived_gen.61, #Derived_g
else else
jump Dict.985 Dict.504 Dict.501 Dict.506 Dict.505; jump Dict.985 Dict.504 Dict.501 Dict.506 Dict.505;
in in
jump Dict.985 #Derived_gen.59 #Derived_gen.60 #Derived_gen.61 #Derived_gen.62; jump Dict.985 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54;
procedure Dict.85 (): procedure Dict.85 ():
let Dict.921 : U64 = 11562461410679940143i64; let Dict.921 : U64 = 11562461410679940143i64;
@ -890,315 +890,315 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.11 (List.135, List.136): procedure List.11 (List.136, List.137):
let List.631 : List {U32, U32} = CallByName List.68 List.136; let List.633 : List {U32, U32} = CallByName List.68 List.137;
let List.630 : List {U32, U32} = CallByName List.87 List.135 List.136 List.631; let List.632 : List {U32, U32} = CallByName List.88 List.136 List.137 List.633;
ret List.630;
procedure List.18 (List.156, List.157, List.158):
let List.570 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156;
let List.569 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName List.89 List.156 List.157 List.158 List.570 List.571;
ret List.569;
procedure List.18 (List.156, List.157, List.158):
let List.634 : U64 = 0i64;
let List.635 : U64 = CallByName List.6 List.156;
let List.633 : {Str, Int1} = CallByName List.89 List.156 List.157 List.158 List.634 List.635;
ret List.633;
procedure List.3 (List.113, List.114, List.115):
let List.595 : {List {U32, U32}, {U32, U32}} = CallByName List.64 List.113 List.114 List.115;
let List.594 : List {U32, U32} = StructAtIndex 0 List.595;
ret List.594;
procedure List.3 (List.113, List.114, List.115):
let List.597 : {List {Str, I64}, {Str, I64}} = CallByName List.64 List.113 List.114 List.115;
let List.596 : List {Str, I64} = StructAtIndex 0 List.597;
let #Derived_gen.71 : {Str, I64} = StructAtIndex 1 List.597;
dec #Derived_gen.71;
ret List.596;
procedure List.4 (List.121, List.122):
let List.606 : U64 = 1i64;
let List.604 : List {Str, I64} = CallByName List.70 List.121 List.606;
let List.603 : List {Str, I64} = CallByName List.71 List.604 List.122;
ret List.603;
procedure List.6 (#Attr.2):
let List.585 : U64 = lowlevel ListLen #Attr.2;
ret List.585;
procedure List.6 (#Attr.2):
let List.632 : U64 = lowlevel ListLen #Attr.2;
ret List.632; ret List.632;
procedure List.18 (List.158, List.159, List.160):
let List.572 : U64 = 0i64;
let List.573 : U64 = CallByName List.6 List.158;
let List.571 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.571;
procedure List.18 (List.158, List.159, List.160):
let List.636 : U64 = 0i64;
let List.637 : U64 = CallByName List.6 List.158;
let List.635 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.636 List.637;
ret List.635;
procedure List.3 (List.114, List.115, List.116):
let List.597 : {List {U32, U32}, {U32, U32}} = CallByName List.64 List.114 List.115 List.116;
let List.596 : List {U32, U32} = StructAtIndex 0 List.597;
ret List.596;
procedure List.3 (List.114, List.115, List.116):
let List.599 : {List {Str, I64}, {Str, I64}} = CallByName List.64 List.114 List.115 List.116;
let List.598 : List {Str, I64} = StructAtIndex 0 List.599;
let #Derived_gen.71 : {Str, I64} = StructAtIndex 1 List.599;
dec #Derived_gen.71;
ret List.598;
procedure List.4 (List.122, List.123):
let List.608 : U64 = 1i64;
let List.606 : List {Str, I64} = CallByName List.70 List.122 List.608;
let List.605 : List {Str, I64} = CallByName List.71 List.606 List.123;
ret List.605;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.644 : U64 = lowlevel ListLen #Attr.2; let List.587 : U64 = lowlevel ListLen #Attr.2;
ret List.644; ret List.587;
procedure List.64 (List.110, List.111, List.112): procedure List.6 (#Attr.2):
let List.593 : U64 = CallByName List.6 List.110; let List.634 : U64 = lowlevel ListLen #Attr.2;
let List.590 : Int1 = CallByName Num.22 List.111 List.593; ret List.634;
if List.590 then
let List.591 : {List {U32, U32}, {U32, U32}} = CallByName List.67 List.110 List.111 List.112; procedure List.6 (#Attr.2):
let List.646 : U64 = lowlevel ListLen #Attr.2;
ret List.646;
procedure List.64 (List.111, List.112, List.113):
let List.595 : U64 = CallByName List.6 List.111;
let List.592 : Int1 = CallByName Num.22 List.112 List.595;
if List.592 then
let List.593 : {List {U32, U32}, {U32, U32}} = CallByName List.67 List.111 List.112 List.113;
ret List.593;
else
let List.591 : {List {U32, U32}, {U32, U32}} = Struct {List.111, List.113};
ret List.591; ret List.591;
else
let List.589 : {List {U32, U32}, {U32, U32}} = Struct {List.110, List.112};
ret List.589;
procedure List.64 (List.110, List.111, List.112): procedure List.64 (List.111, List.112, List.113):
let List.602 : U64 = CallByName List.6 List.110; let List.604 : U64 = CallByName List.6 List.111;
let List.599 : Int1 = CallByName Num.22 List.111 List.602; let List.601 : Int1 = CallByName Num.22 List.112 List.604;
if List.599 then if List.601 then
let List.600 : {List {Str, I64}, {Str, I64}} = CallByName List.67 List.110 List.111 List.112; let List.602 : {List {Str, I64}, {Str, I64}} = CallByName List.67 List.111 List.112 List.113;
ret List.600; ret List.602;
else else
let List.598 : {List {Str, I64}, {Str, I64}} = Struct {List.110, List.112}; let List.600 : {List {Str, I64}, {Str, I64}} = Struct {List.111, List.113};
ret List.598; ret List.600;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.643 : {Str, I64} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.645 : {Str, I64} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.643; ret List.645;
procedure List.67 (#Attr.2, #Attr.3, #Attr.4): procedure List.67 (#Attr.2, #Attr.3, #Attr.4):
let List.592 : {List {U32, U32}, {U32, U32}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; let List.594 : {List {U32, U32}, {U32, U32}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4;
ret List.592; ret List.594;
procedure List.67 (#Attr.2, #Attr.3, #Attr.4): procedure List.67 (#Attr.2, #Attr.3, #Attr.4):
let List.601 : {List {Str, I64}, {Str, I64}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; let List.603 : {List {Str, I64}, {Str, I64}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4;
ret List.601; ret List.603;
procedure List.68 (#Attr.2): procedure List.68 (#Attr.2):
let List.629 : List {U32, U32} = lowlevel ListWithCapacity #Attr.2; let List.631 : List {U32, U32} = lowlevel ListWithCapacity #Attr.2;
ret List.629; ret List.631;
procedure List.70 (#Attr.2, #Attr.3): procedure List.70 (#Attr.2, #Attr.3):
let List.607 : List {Str, I64} = lowlevel ListReserve #Attr.2 #Attr.3; let List.609 : List {Str, I64} = lowlevel ListReserve #Attr.2 #Attr.3;
ret List.609;
procedure List.71 (#Attr.2, #Attr.3):
let List.607 : List {Str, I64} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
ret List.607; ret List.607;
procedure List.71 (#Attr.2, #Attr.3): procedure List.71 (#Attr.2, #Attr.3):
let List.605 : List {Str, I64} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; let List.628 : List {U32, U32} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
ret List.605; ret List.628;
procedure List.71 (#Attr.2, #Attr.3): procedure List.83 (List.167, List.168, List.169):
let List.626 : List {U32, U32} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; let List.611 : U64 = 0i64;
ret List.626; let List.612 : U64 = CallByName List.6 List.167;
let List.610 : List {U32, U32} = CallByName List.91 List.167 List.168 List.169 List.611 List.612;
ret List.610;
procedure List.83 (List.165, List.166, List.167): procedure List.88 (#Derived_gen.58, #Derived_gen.59, #Derived_gen.60):
let List.609 : U64 = 0i64; joinpoint List.622 List.138 List.139 List.140:
let List.610 : U64 = CallByName List.6 List.165; let List.630 : U64 = 0i64;
let List.608 : List {U32, U32} = CallByName List.90 List.165 List.166 List.167 List.609 List.610; let List.624 : Int1 = CallByName Num.24 List.139 List.630;
ret List.608; if List.624 then
let List.629 : U64 = 1i64;
procedure List.87 (#Derived_gen.46, #Derived_gen.47, #Derived_gen.48): let List.626 : U64 = CallByName Num.75 List.139 List.629;
joinpoint List.620 List.137 List.138 List.139: let List.627 : List {U32, U32} = CallByName List.71 List.140 List.138;
let List.628 : U64 = 0i64; jump List.622 List.138 List.626 List.627;
let List.622 : Int1 = CallByName Num.24 List.138 List.628;
if List.622 then
let List.627 : U64 = 1i64;
let List.624 : U64 = CallByName Num.75 List.138 List.627;
let List.625 : List {U32, U32} = CallByName List.71 List.139 List.137;
jump List.620 List.137 List.624 List.625;
else else
ret List.139; ret List.140;
in in
jump List.620 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48; jump List.622 #Derived_gen.58 #Derived_gen.59 #Derived_gen.60;
procedure List.89 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21): procedure List.90 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.638 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.640 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.640 then
let List.578 : {Str, I64} = CallByName List.66 List.159 List.162; let List.644 : {Str, I64} = CallByName List.66 List.161 List.164;
inc List.578; inc List.644;
let List.164 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.153 List.160 List.578; let List.166 : {Str, Int1} = CallByName Dict.182 List.162 List.644 List.163;
let List.577 : U64 = 1i64; let List.643 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.642 : U64 = CallByName Num.51 List.164 List.643;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.638 List.161 List.166 List.163 List.642 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21; jump List.638 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21;
procedure List.89 (#Derived_gen.54, #Derived_gen.55, #Derived_gen.56, #Derived_gen.57, #Derived_gen.58): procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30):
joinpoint List.636 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.638 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.638 then if List.576 then
let List.642 : {Str, I64} = CallByName List.66 List.159 List.162; let List.580 : {Str, I64} = CallByName List.66 List.161 List.164;
inc List.642; inc List.580;
let List.164 : {Str, Int1} = CallByName Dict.182 List.160 List.642 List.161; let List.166 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.153 List.162 List.580;
let List.641 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.640 : U64 = CallByName Num.51 List.162 List.641; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.636 List.159 List.164 List.161 List.640 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.636 #Derived_gen.54 #Derived_gen.55 #Derived_gen.56 #Derived_gen.57 #Derived_gen.58; jump List.574 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30;
procedure List.90 (#Derived_gen.49, #Derived_gen.50, #Derived_gen.51, #Derived_gen.52, #Derived_gen.53): procedure List.91 (#Derived_gen.61, #Derived_gen.62, #Derived_gen.63, #Derived_gen.64, #Derived_gen.65):
joinpoint List.611 List.168 List.169 List.170 List.171 List.172: joinpoint List.613 List.170 List.171 List.172 List.173 List.174:
let List.613 : Int1 = CallByName Num.22 List.171 List.172; let List.615 : Int1 = CallByName Num.22 List.173 List.174;
if List.613 then if List.615 then
let List.617 : {Str, I64} = CallByName List.66 List.168 List.171; let List.619 : {Str, I64} = CallByName List.66 List.170 List.173;
inc List.617; inc List.619;
let List.173 : List {U32, U32} = CallByName Dict.399 List.169 List.617 List.171 List.170; let List.175 : List {U32, U32} = CallByName Dict.399 List.171 List.619 List.173 List.172;
let List.616 : U64 = 1i64; let List.618 : U64 = 1i64;
let List.615 : U64 = CallByName Num.51 List.171 List.616; let List.617 : U64 = CallByName Num.51 List.173 List.618;
jump List.611 List.168 List.173 List.170 List.615 List.172; jump List.613 List.170 List.175 List.172 List.617 List.174;
else else
dec List.168; dec List.170;
ret List.169; ret List.171;
in in
jump List.611 #Derived_gen.49 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53; jump List.613 #Derived_gen.61 #Derived_gen.62 #Derived_gen.63 #Derived_gen.64 #Derived_gen.65;
procedure Num.131 (#Attr.2): procedure Num.131 (#Attr.2):
let Num.310 : U32 = lowlevel NumIntCast #Attr.2; let Num.316 : U32 = lowlevel NumIntCast #Attr.2;
ret Num.310; ret Num.316;
procedure Num.133 (#Attr.2): procedure Num.133 (#Attr.2):
let Num.365 : U64 = lowlevel NumIntCast #Attr.2; let Num.371 : U64 = lowlevel NumIntCast #Attr.2;
ret Num.365; ret Num.371;
procedure Num.133 (#Attr.2): procedure Num.133 (#Attr.2):
let Num.366 : U64 = lowlevel NumIntCast #Attr.2; let Num.372 : U64 = lowlevel NumIntCast #Attr.2;
ret Num.366; ret Num.372;
procedure Num.133 (#Attr.2): procedure Num.133 (#Attr.2):
let Num.381 : U64 = lowlevel NumIntCast #Attr.2; let Num.387 : U64 = lowlevel NumIntCast #Attr.2;
ret Num.381;
procedure Num.135 (#Attr.2):
let Num.387 : U128 = lowlevel NumIntCast #Attr.2;
ret Num.387; ret Num.387;
procedure Num.137 (#Attr.2): procedure Num.135 (#Attr.2):
let Num.301 : U64 = lowlevel NumIntCast #Attr.2; let Num.393 : U128 = lowlevel NumIntCast #Attr.2;
ret Num.301; ret Num.393;
procedure Num.137 (#Attr.2): procedure Num.137 (#Attr.2):
let Num.307 : U64 = lowlevel NumIntCast #Attr.2; let Num.307 : U64 = lowlevel NumIntCast #Attr.2;
ret Num.307; ret Num.307;
procedure Num.139 (#Attr.2): procedure Num.137 (#Attr.2):
let Num.334 : Float32 = lowlevel NumToFloatCast #Attr.2; let Num.313 : U64 = lowlevel NumIntCast #Attr.2;
ret Num.334; ret Num.313;
procedure Num.159 (Num.240, Num.241): procedure Num.139 (#Attr.2):
let Num.336 : Int1 = CallByName Num.22 Num.240 Num.241; let Num.340 : Float32 = lowlevel NumToFloatCast #Attr.2;
if Num.336 then ret Num.340;
ret Num.240;
procedure Num.159 (Num.245, Num.246):
let Num.342 : Int1 = CallByName Num.22 Num.245 Num.246;
if Num.342 then
ret Num.245;
else else
ret Num.241; ret Num.246;
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : U32 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : U32 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Num.20 (#Attr.2, #Attr.3): procedure Num.20 (#Attr.2, #Attr.3):
let Num.311 : U64 = lowlevel NumSub #Attr.2 #Attr.3; let Num.317 : U64 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.311; ret Num.317;
procedure Num.20 (#Attr.2, #Attr.3): procedure Num.20 (#Attr.2, #Attr.3):
let Num.314 : U8 = lowlevel NumSub #Attr.2 #Attr.3; let Num.320 : U8 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.314;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.327 : Float32 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.327;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.385 : U128 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.385;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.331 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.331;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.460 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.460;
procedure Num.23 (#Attr.2, #Attr.3):
let Num.453 : Int1 = lowlevel NumLte #Attr.2 #Attr.3;
ret Num.453;
procedure Num.24 (#Attr.2, #Attr.3):
let Num.315 : Int1 = lowlevel NumGt #Attr.2 #Attr.3;
ret Num.315;
procedure Num.24 (#Attr.2, #Attr.3):
let Num.456 : Int1 = lowlevel NumGt #Attr.2 #Attr.3;
ret Num.456;
procedure Num.25 (#Attr.2, #Attr.3):
let Num.457 : Int1 = lowlevel NumGte #Attr.2 #Attr.3;
ret Num.457;
procedure Num.50 (#Attr.2):
let Num.333 : U64 = lowlevel NumFloor #Attr.2;
ret Num.333;
procedure Num.51 (#Attr.2, #Attr.3):
let Num.459 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.459;
procedure Num.69 (#Attr.2, #Attr.3):
let Num.319 : U32 = lowlevel NumBitwiseAnd #Attr.2 #Attr.3;
ret Num.319;
procedure Num.70 (#Attr.2, #Attr.3):
let Num.363 : U64 = lowlevel NumBitwiseXor #Attr.2 #Attr.3;
ret Num.363;
procedure Num.71 (#Attr.2, #Attr.3):
let Num.318 : U32 = lowlevel NumBitwiseOr #Attr.2 #Attr.3;
ret Num.318;
procedure Num.71 (#Attr.2, #Attr.3):
let Num.401 : U64 = lowlevel NumBitwiseOr #Attr.2 #Attr.3;
ret Num.401;
procedure Num.72 (#Attr.2, #Attr.3):
let Num.292 : U32 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3;
ret Num.292;
procedure Num.72 (#Attr.2, #Attr.3):
let Num.416 : U64 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3;
ret Num.416;
procedure Num.74 (#Attr.2, #Attr.3):
let Num.382 : U128 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3;
ret Num.382;
procedure Num.74 (#Attr.2, #Attr.3):
let Num.384 : U64 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3;
ret Num.384;
procedure Num.75 (#Attr.2, #Attr.3):
let Num.320 : U32 = lowlevel NumSubWrap #Attr.2 #Attr.3;
ret Num.320; ret Num.320;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.333 : Float32 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.333;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.391 : U128 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.391;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.337 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.337;
procedure Num.22 (#Attr.2, #Attr.3):
let Num.466 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.466;
procedure Num.23 (#Attr.2, #Attr.3):
let Num.459 : Int1 = lowlevel NumLte #Attr.2 #Attr.3;
ret Num.459;
procedure Num.24 (#Attr.2, #Attr.3):
let Num.321 : Int1 = lowlevel NumGt #Attr.2 #Attr.3;
ret Num.321;
procedure Num.24 (#Attr.2, #Attr.3):
let Num.462 : Int1 = lowlevel NumGt #Attr.2 #Attr.3;
ret Num.462;
procedure Num.25 (#Attr.2, #Attr.3):
let Num.463 : Int1 = lowlevel NumGte #Attr.2 #Attr.3;
ret Num.463;
procedure Num.50 (#Attr.2):
let Num.339 : U64 = lowlevel NumFloor #Attr.2;
ret Num.339;
procedure Num.51 (#Attr.2, #Attr.3):
let Num.465 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.465;
procedure Num.69 (#Attr.2, #Attr.3):
let Num.325 : U32 = lowlevel NumBitwiseAnd #Attr.2 #Attr.3;
ret Num.325;
procedure Num.70 (#Attr.2, #Attr.3):
let Num.369 : U64 = lowlevel NumBitwiseXor #Attr.2 #Attr.3;
ret Num.369;
procedure Num.71 (#Attr.2, #Attr.3):
let Num.324 : U32 = lowlevel NumBitwiseOr #Attr.2 #Attr.3;
ret Num.324;
procedure Num.71 (#Attr.2, #Attr.3):
let Num.407 : U64 = lowlevel NumBitwiseOr #Attr.2 #Attr.3;
ret Num.407;
procedure Num.72 (#Attr.2, #Attr.3):
let Num.298 : U32 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3;
ret Num.298;
procedure Num.72 (#Attr.2, #Attr.3):
let Num.422 : U64 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3;
ret Num.422;
procedure Num.74 (#Attr.2, #Attr.3):
let Num.388 : U128 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3;
ret Num.388;
procedure Num.74 (#Attr.2, #Attr.3):
let Num.390 : U64 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3;
ret Num.390;
procedure Num.75 (#Attr.2, #Attr.3): procedure Num.75 (#Attr.2, #Attr.3):
let Num.450 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; let Num.326 : U32 = lowlevel NumSubWrap #Attr.2 #Attr.3;
ret Num.450; ret Num.326;
procedure Num.75 (#Attr.2, #Attr.3):
let Num.456 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3;
ret Num.456;
procedure Num.96 (#Attr.2): procedure Num.96 (#Attr.2):
let Num.330 : Str = lowlevel NumToStr #Attr.2; let Num.336 : Str = lowlevel NumToStr #Attr.2;
ret Num.330; ret Num.336;
procedure Num.96 (#Attr.2): procedure Num.96 (#Attr.2):
let Num.458 : Str = lowlevel NumToStr #Attr.2; let Num.464 : Str = lowlevel NumToStr #Attr.2;
ret Num.458; ret Num.464;
procedure Str.12 (#Attr.2): procedure Str.12 (#Attr.2):
let Str.294 : List U8 = lowlevel StrToUtf8 #Attr.2; let Str.253 : List U8 = lowlevel StrToUtf8 #Attr.2;
ret Str.294; ret Str.253;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.295 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.254 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.295; ret Str.254;
procedure Test.0 (): procedure Test.0 ():
let Test.8 : Str = "a"; let Test.8 : Str = "a";

View file

@ -125,50 +125,50 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : {Str, Int1} = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : I64 = CallByName List.66 List.159 List.162; let List.580 : I64 = CallByName List.66 List.161 List.164;
let List.164 : {Str, Int1} = CallByName Inspect.161 List.160 List.578 List.161; let List.166 : {Str, Int1} = CallByName Inspect.161 List.162 List.580 List.163;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; jump List.574 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.293 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.299 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.292 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.298 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.96 (#Attr.2): procedure Num.96 (#Attr.2):
let Num.291 : Str = lowlevel NumToStr #Attr.2; let Num.297 : Str = lowlevel NumToStr #Attr.2;
ret Num.291; ret Num.297;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.2 : List I64 = Array [1i64, 2i64, 3i64]; let Test.2 : List I64 = Array [1i64, 2i64, 3i64];

View file

@ -200,77 +200,77 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : {Str, Int1} = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.582 : U64 = 0i64; let List.584 : U64 = 0i64;
let List.583 : U64 = CallByName List.6 List.156; let List.585 : U64 = CallByName List.6 List.158;
let List.581 : {Str, Int1} = CallByName List.89 List.156 List.157 List.158 List.582 List.583; let List.583 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.584 List.585;
ret List.583;
procedure List.6 (#Attr.2):
let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.582;
procedure List.6 (#Attr.2):
let List.594 : U64 = lowlevel ListLen #Attr.2;
ret List.594;
procedure List.66 (#Attr.2, #Attr.3):
let List.581 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.581; ret List.581;
procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2;
ret List.580;
procedure List.6 (#Attr.2):
let List.592 : U64 = lowlevel ListLen #Attr.2;
ret List.592;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.593 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.593;
procedure List.66 (#Attr.2, #Attr.3): procedure List.90 (#Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36):
let List.591 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; joinpoint List.586 List.161 List.162 List.163 List.164 List.165:
ret List.591; let List.588 : Int1 = CallByName Num.22 List.164 List.165;
if List.588 then
procedure List.89 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26): let List.592 : {Str, Str} = CallByName List.66 List.161 List.164;
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: inc List.592;
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.592;
if List.574 then let List.591 : U64 = 1i64;
let List.578 : {Str, Str} = CallByName List.66 List.159 List.162; let List.590 : U64 = CallByName Num.51 List.164 List.591;
inc List.578; jump List.586 List.161 List.166 List.163 List.590 List.165;
let List.164 : {Str, Int1} = CallByName Inspect.234 List.160 List.578;
let List.577 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577;
jump List.572 List.159 List.164 List.161 List.576 List.163;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; jump List.586 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36;
procedure List.89 (#Derived_gen.43, #Derived_gen.44, #Derived_gen.45, #Derived_gen.46, #Derived_gen.47): procedure List.90 (#Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_gen.40, #Derived_gen.41):
joinpoint List.584 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.586 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.586 then if List.576 then
let List.590 : {Str, Str} = CallByName List.66 List.159 List.162; let List.580 : {Str, Str} = CallByName List.66 List.161 List.164;
inc List.590; inc List.580;
let List.164 : {Str, Int1} = CallByName Inspect.234 List.160 List.590; let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580;
let List.589 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.588 : U64 = CallByName Num.51 List.162 List.589; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.584 List.159 List.164 List.161 List.588 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.584 #Derived_gen.43 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47; jump List.574 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.294 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.294; ret Num.300;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.293 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.293 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.293; ret Str.252;
procedure Test.0 (): procedure Test.0 ():
let Test.4 : Str = "bar"; let Test.4 : Str = "bar";

View file

@ -150,55 +150,55 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : {Str, Int1} = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : {[C I64, C Decimal], Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : {[C I64, C Decimal], Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): procedure List.90 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : {[C I64, C Decimal], Str} = CallByName List.66 List.159 List.162; let List.580 : {[C I64, C Decimal], Str} = CallByName List.66 List.161 List.164;
inc List.578; inc List.580;
let List.164 : {Str, Int1} = CallByName Inspect.234 List.160 List.578; let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; jump List.574 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.294 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.294; ret Num.300;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.293 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Num.96 (#Attr.2): procedure Num.96 (#Attr.2):
let Num.291 : Str = lowlevel NumToStr #Attr.2; let Num.297 : Str = lowlevel NumToStr #Attr.2;
ret Num.291; ret Num.297;
procedure Num.96 (#Attr.2): procedure Num.96 (#Attr.2):
let Num.292 : Str = lowlevel NumToStr #Attr.2; let Num.298 : Str = lowlevel NumToStr #Attr.2;
ret Num.292; ret Num.298;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.3 : Decimal = 3dec; let Test.3 : Decimal = 3dec;

View file

@ -127,47 +127,47 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : {Str, Int1} = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16): procedure List.90 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : {Str, Str} = CallByName List.66 List.159 List.162; let List.580 : {Str, Str} = CallByName List.66 List.161 List.164;
inc List.578; inc List.580;
let List.164 : {Str, Int1} = CallByName Inspect.234 List.160 List.578; let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16; jump List.574 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.292 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.3 : Str = "foo"; let Test.3 : Str = "foo";

View file

@ -134,47 +134,47 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : {Str, Int1} = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20): procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : {Str, Str} = CallByName List.66 List.159 List.162; let List.580 : {Str, Str} = CallByName List.66 List.161 List.164;
inc List.578; inc List.580;
let List.164 : {Str, Int1} = CallByName Inspect.234 List.160 List.578; let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20; jump List.574 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.292 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.3 : Str = "foo"; let Test.3 : Str = "foo";

View file

@ -38,8 +38,8 @@ procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.2 : Str = "abc"; let Test.2 : Str = "abc";

View file

@ -122,54 +122,54 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.1 (List.104): procedure List.1 (List.105):
let List.582 : U64 = CallByName List.6 List.104; let List.584 : U64 = CallByName List.6 List.105;
dec List.104; dec List.105;
let List.583 : U64 = 0i64; let List.585 : U64 = 0i64;
let List.581 : Int1 = CallByName Bool.11 List.582 List.583; let List.583 : Int1 = CallByName Bool.11 List.584 List.585;
ret List.581; ret List.583;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : Str = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : Str = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : Str = CallByName List.66 List.159 List.162; let List.580 : Str = CallByName List.66 List.161 List.164;
inc List.578; inc List.580;
let List.164 : Str = CallByName Inspect.211 List.160 List.578; let List.166 : Str = CallByName Inspect.211 List.162 List.580;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; jump List.574 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.292 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.4 : Str = "foo"; let Test.4 : Str = "foo";

View file

@ -125,54 +125,54 @@ procedure Inspect.61 (Inspect.304, Inspect.300):
procedure Inspect.62 (Inspect.306): procedure Inspect.62 (Inspect.306):
ret Inspect.306; ret Inspect.306;
procedure List.1 (List.104): procedure List.1 (List.105):
let List.582 : U64 = CallByName List.6 List.104; let List.584 : U64 = CallByName List.6 List.105;
dec List.104; dec List.105;
let List.583 : U64 = 0i64; let List.585 : U64 = 0i64;
let List.581 : Int1 = CallByName Bool.11 List.582 List.583; let List.583 : Int1 = CallByName Bool.11 List.584 List.585;
ret List.581; ret List.583;
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : Str = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : Str = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): procedure List.90 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : Str = CallByName List.66 List.159 List.162; let List.580 : Str = CallByName List.66 List.161 List.164;
inc List.578; inc List.580;
let List.164 : Str = CallByName Inspect.211 List.160 List.578; let List.166 : Str = CallByName Inspect.211 List.162 List.580;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; jump List.574 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.292 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Str.3 (#Attr.2, #Attr.3): procedure Str.3 (#Attr.2, #Attr.3):
let Str.292 : Str = lowlevel StrConcat #Attr.2 #Attr.3; let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3;
ret Str.292; ret Str.251;
procedure Test.0 (): procedure Test.0 ():
let Test.5 : Str = "foo"; let Test.5 : Str = "foo";

View file

@ -1,10 +1,10 @@
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.569 : U64 = lowlevel ListLen #Attr.2; let List.571 : U64 = lowlevel ListLen #Attr.2;
ret List.569; ret List.571;
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.293 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.299 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Test.0 (): procedure Test.0 ():
let Test.1 : List I64 = Array [1i64, 2i64]; let Test.1 : List I64 = Array [1i64, 2i64];

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.2 : I64 = 1i64; let Test.2 : I64 = 1i64;

View file

@ -1,6 +1,6 @@
procedure Num.45 (#Attr.2): procedure Num.45 (#Attr.2):
let Num.291 : I64 = lowlevel NumRound #Attr.2; let Num.297 : I64 = lowlevel NumRound #Attr.2;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.2 : Decimal = 3.6dec; let Test.2 : Decimal = 3.6dec;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.1 : I64 = 3i64; let Test.1 : I64 = 3i64;

View file

@ -1,22 +1,22 @@
procedure Num.30 (#Attr.2): procedure Num.30 (#Attr.2):
let Num.298 : I64 = 0i64; let Num.304 : I64 = 0i64;
let Num.297 : Int1 = lowlevel Eq #Attr.2 Num.298; let Num.303 : Int1 = lowlevel Eq #Attr.2 Num.304;
ret Num.297; ret Num.303;
procedure Num.39 (#Attr.2, #Attr.3): procedure Num.39 (#Attr.2, #Attr.3):
let Num.293 : I64 = lowlevel NumDivTruncUnchecked #Attr.2 #Attr.3; let Num.299 : I64 = lowlevel NumDivTruncUnchecked #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Num.40 (Num.262, Num.263): procedure Num.40 (Num.267, Num.268):
let Num.294 : Int1 = CallByName Num.30 Num.263; let Num.300 : Int1 = CallByName Num.30 Num.268;
if Num.294 then if Num.300 then
let Num.296 : {} = Struct {}; let Num.302 : {} = Struct {};
let Num.295 : [C {}, C I64] = TagId(0) Num.296; let Num.301 : [C {}, C I64] = TagId(0) Num.302;
ret Num.295; ret Num.301;
else else
let Num.292 : I64 = CallByName Num.39 Num.262 Num.263; let Num.298 : I64 = CallByName Num.39 Num.267 Num.268;
let Num.291 : [C {}, C I64] = TagId(1) Num.292; let Num.297 : [C {}, C I64] = TagId(1) Num.298;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.8 : I64 = 1000i64; let Test.8 : I64 = 1000i64;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.0 (): procedure Test.0 ():
let Test.10 : I64 = 41i64; let Test.10 : I64 = 41i64;

View file

@ -6,69 +6,69 @@ procedure Bool.2 ():
let Bool.23 : Int1 = true; let Bool.23 : Int1 = true;
ret Bool.23; ret Bool.23;
procedure List.2 (List.105, List.106): procedure List.2 (List.106, List.107):
let List.583 : U64 = CallByName List.6 List.105; let List.585 : U64 = CallByName List.6 List.106;
let List.579 : Int1 = CallByName Num.22 List.106 List.583; let List.581 : Int1 = CallByName Num.22 List.107 List.585;
if List.579 then if List.581 then
let List.581 : I64 = CallByName List.66 List.105 List.106; let List.583 : I64 = CallByName List.66 List.106 List.107;
dec List.105; dec List.106;
let List.580 : [C {}, C I64] = TagId(1) List.581; let List.582 : [C {}, C I64] = TagId(1) List.583;
ret List.580; ret List.582;
else else
dec List.105; dec List.106;
let List.578 : {} = Struct {}; let List.580 : {} = Struct {};
let List.577 : [C {}, C I64] = TagId(0) List.578; let List.579 : [C {}, C I64] = TagId(0) List.580;
ret List.577; ret List.579;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.584 : U64 = lowlevel ListLen #Attr.2; let List.586 : U64 = lowlevel ListLen #Attr.2;
ret List.584; ret List.586;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.582 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.584 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.582; ret List.584;
procedure List.9 (List.331): procedure List.9 (List.333):
let List.576 : U64 = 0i64; let List.578 : U64 = 0i64;
let List.569 : [C {}, C I64] = CallByName List.2 List.331 List.576; let List.571 : [C {}, C I64] = CallByName List.2 List.333 List.578;
let List.573 : U8 = 1i64; let List.575 : U8 = 1i64;
let List.574 : U8 = GetTagId List.569; let List.576 : U8 = GetTagId List.571;
let List.575 : Int1 = lowlevel Eq List.573 List.574; let List.577 : Int1 = lowlevel Eq List.575 List.576;
if List.575 then if List.577 then
let List.332 : I64 = UnionAtIndex (Id 1) (Index 0) List.569; let List.334 : I64 = UnionAtIndex (Id 1) (Index 0) List.571;
let List.570 : [C Int1, C I64] = TagId(1) List.332; let List.572 : [C Int1, C I64] = TagId(1) List.334;
ret List.570; ret List.572;
else else
let List.572 : Int1 = true; let List.574 : Int1 = true;
let List.571 : [C Int1, C I64] = TagId(0) List.572; let List.573 : [C Int1, C I64] = TagId(0) List.574;
ret List.571; ret List.573;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.291 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Str.27 (Str.100): procedure Str.27 (Str.88):
let Str.292 : [C Int1, C I64] = CallByName Str.73 Str.100; let Str.251 : [C Int1, C I64] = CallByName Str.61 Str.88;
ret Str.292; ret Str.251;
procedure Str.47 (#Attr.2): procedure Str.42 (#Attr.2):
let Str.300 : {I64, U8} = lowlevel StrToNum #Attr.2; let Str.259 : {I64, U8} = lowlevel StrToNum #Attr.2;
ret Str.300; ret Str.259;
procedure Str.73 (Str.236): procedure Str.61 (Str.195):
let Str.237 : {I64, U8} = CallByName Str.47 Str.236; let Str.196 : {I64, U8} = CallByName Str.42 Str.195;
dec Str.236; dec Str.195;
let Str.298 : U8 = StructAtIndex 1 Str.237; let Str.257 : U8 = StructAtIndex 1 Str.196;
let Str.299 : U8 = 0i64; let Str.258 : U8 = 0i64;
let Str.295 : Int1 = CallByName Bool.11 Str.298 Str.299; let Str.254 : Int1 = CallByName Bool.11 Str.257 Str.258;
if Str.295 then if Str.254 then
let Str.297 : I64 = StructAtIndex 0 Str.237; let Str.256 : I64 = StructAtIndex 0 Str.196;
let Str.296 : [C Int1, C I64] = TagId(1) Str.297; let Str.255 : [C Int1, C I64] = TagId(1) Str.256;
ret Str.296; ret Str.255;
else else
let Str.294 : Int1 = false; let Str.253 : Int1 = false;
let Str.293 : [C Int1, C I64] = TagId(0) Str.294; let Str.252 : [C Int1, C I64] = TagId(0) Str.253;
ret Str.293; ret Str.252;
procedure Test.0 (): procedure Test.0 ():
let Test.3 : Int1 = CallByName Bool.2; let Test.3 : Int1 = CallByName Bool.2;

File diff suppressed because it is too large Load diff

View file

@ -6,92 +6,92 @@ procedure Bool.2 ():
let Bool.24 : Int1 = true; let Bool.24 : Int1 = true;
ret Bool.24; ret Bool.24;
procedure List.101 (List.484, List.485, List.486): procedure List.102 (List.486, List.487, List.488):
let List.583 : U64 = 0i64; let List.585 : U64 = 0i64;
let List.584 : U64 = CallByName List.6 List.484; let List.586 : U64 = CallByName List.6 List.486;
let List.582 : [C {}, C {}] = CallByName List.80 List.484 List.485 List.486 List.583 List.584; let List.584 : [C {}, C {}] = CallByName List.80 List.486 List.487 List.488 List.585 List.586;
ret List.582; ret List.584;
procedure List.23 (#Attr.2, #Attr.3, #Attr.4): procedure List.23 (#Attr.2, #Attr.3, #Attr.4):
let List.604 : List {[<r>C I64, C List *self], [<r>C I64, C List *self]} = lowlevel ListMap2 { xs: `#Attr.#arg1`, ys: `#Attr.#arg2` } #Attr.2 #Attr.3 Test.15 #Attr.4; let List.606 : List {[<r>C I64, C List *self], [<r>C I64, C List *self]} = lowlevel ListMap2 { xs: `#Attr.#arg1`, ys: `#Attr.#arg2` } #Attr.2 #Attr.3 Test.15 #Attr.4;
decref #Attr.3; decref #Attr.3;
decref #Attr.2; decref #Attr.2;
ret List.604; ret List.606;
procedure List.232 (List.571, List.233, List.231): procedure List.234 (List.573, List.235, List.233):
let List.601 : Int1 = CallByName Test.1 List.233; let List.603 : Int1 = CallByName Test.1 List.235;
if List.601 then if List.603 then
let List.603 : {} = Struct {}; let List.605 : {} = Struct {};
let List.602 : [C {}, C {}] = TagId(1) List.603; let List.604 : [C {}, C {}] = TagId(1) List.605;
ret List.602; ret List.604;
else else
let List.600 : {} = Struct {}; let List.602 : {} = Struct {};
let List.599 : [C {}, C {}] = TagId(0) List.600; let List.601 : [C {}, C {}] = TagId(0) List.602;
ret List.599; ret List.601;
procedure List.56 (List.230, List.231): procedure List.56 (List.232, List.233):
let List.580 : {} = Struct {}; let List.582 : {} = Struct {};
let List.572 : [C {}, C {}] = CallByName List.101 List.230 List.580 List.231; let List.574 : [C {}, C {}] = CallByName List.102 List.232 List.582 List.233;
let List.577 : U8 = 1i64; let List.579 : U8 = 1i64;
let List.578 : U8 = GetTagId List.572; let List.580 : U8 = GetTagId List.574;
let List.579 : Int1 = lowlevel Eq List.577 List.578; let List.581 : Int1 = lowlevel Eq List.579 List.580;
if List.579 then if List.581 then
let List.573 : Int1 = CallByName Bool.2; let List.575 : Int1 = CallByName Bool.2;
ret List.573; ret List.575;
else else
let List.574 : Int1 = CallByName Bool.1; let List.576 : Int1 = CallByName Bool.1;
ret List.574; ret List.576;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.570 : U64 = lowlevel ListLen #Attr.2; let List.572 : U64 = lowlevel ListLen #Attr.2;
ret List.570; ret List.572;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.598 : U64 = lowlevel ListLen #Attr.2; let List.600 : U64 = lowlevel ListLen #Attr.2;
ret List.598; ret List.600;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.597 : {[<r>C I64, C List *self], [<r>C I64, C List *self]} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.599 : {[<r>C I64, C List *self], [<r>C I64, C List *self]} = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.597; ret List.599;
procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5): procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5):
joinpoint List.585 List.487 List.488 List.489 List.490 List.491: joinpoint List.587 List.489 List.490 List.491 List.492 List.493:
let List.587 : Int1 = CallByName Num.22 List.490 List.491; let List.589 : Int1 = CallByName Num.22 List.492 List.493;
if List.587 then if List.589 then
let List.596 : {[<r>C I64, C List *self], [<r>C I64, C List *self]} = CallByName List.66 List.487 List.490; let List.598 : {[<r>C I64, C List *self], [<r>C I64, C List *self]} = CallByName List.66 List.489 List.492;
inc List.596; inc List.598;
let List.588 : [C {}, C {}] = CallByName List.232 List.488 List.596 List.489; let List.590 : [C {}, C {}] = CallByName List.234 List.490 List.598 List.491;
let List.593 : U8 = 1i64; let List.595 : U8 = 1i64;
let List.594 : U8 = GetTagId List.588; let List.596 : U8 = GetTagId List.590;
let List.595 : Int1 = lowlevel Eq List.593 List.594; let List.597 : Int1 = lowlevel Eq List.595 List.596;
if List.595 then if List.597 then
let List.492 : {} = UnionAtIndex (Id 1) (Index 0) List.588; let List.494 : {} = UnionAtIndex (Id 1) (Index 0) List.590;
let List.591 : U64 = 1i64; let List.593 : U64 = 1i64;
let List.590 : U64 = CallByName Num.51 List.490 List.591; let List.592 : U64 = CallByName Num.51 List.492 List.593;
jump List.585 List.487 List.492 List.489 List.590 List.491; jump List.587 List.489 List.494 List.491 List.592 List.493;
else else
dec List.487; dec List.489;
let List.493 : {} = UnionAtIndex (Id 0) (Index 0) List.588; let List.495 : {} = UnionAtIndex (Id 0) (Index 0) List.590;
let List.592 : [C {}, C {}] = TagId(0) List.493; let List.594 : [C {}, C {}] = TagId(0) List.495;
ret List.592; ret List.594;
else else
dec List.487; dec List.489;
let List.586 : [C {}, C {}] = TagId(1) List.488; let List.588 : [C {}, C {}] = TagId(1) List.490;
ret List.586; ret List.588;
in in
jump List.585 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; jump List.587 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.291 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.294 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.294; ret Num.300;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.293 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Test.1 (#Derived_gen.0): procedure Test.1 (#Derived_gen.0):
joinpoint Test.26 Test.6: joinpoint Test.26 Test.6:

View file

@ -1,6 +1,6 @@
procedure Num.20 (#Attr.2, #Attr.3): procedure Num.20 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumSub #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumSub #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.1 (#Derived_gen.0, #Derived_gen.1): procedure Test.1 (#Derived_gen.0, #Derived_gen.1):
joinpoint Test.12 Test.2 Test.3: joinpoint Test.12 Test.2 Test.3:

View file

@ -1,10 +1,10 @@
procedure Num.96 (#Attr.2): procedure Num.96 (#Attr.2):
let Num.291 : Str = lowlevel NumToStr #Attr.2; let Num.297 : Str = lowlevel NumToStr #Attr.2;
ret Num.291; ret Num.297;
procedure Num.96 (#Attr.2): procedure Num.96 (#Attr.2):
let Num.292 : Str = lowlevel NumToStr #Attr.2; let Num.298 : Str = lowlevel NumToStr #Attr.2;
ret Num.292; ret Num.298;
procedure Test.1 (Test.4): procedure Test.1 (Test.4):
let Test.13 : [C U8, C U64] = TagId(1) Test.4; let Test.13 : [C U8, C U64] = TagId(1) Test.4;

View file

@ -7,12 +7,12 @@ procedure Bool.2 ():
ret Bool.24; ret Bool.24;
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Num.21 (#Attr.2, #Attr.3): procedure Num.21 (#Attr.2, #Attr.3):
let Num.292 : U64 = lowlevel NumMul #Attr.2 #Attr.3; let Num.298 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Test.0 (Test.8): procedure Test.0 (Test.8):
let Test.20 : Int1 = CallByName Bool.2; let Test.20 : Int1 = CallByName Bool.2;

View file

@ -1,40 +1,40 @@
procedure List.18 (List.156, List.157, List.158): procedure List.18 (List.158, List.159, List.160):
let List.570 : U64 = 0i64; let List.572 : U64 = 0i64;
let List.571 : U64 = CallByName List.6 List.156; let List.573 : U64 = CallByName List.6 List.158;
let List.569 : [<rnu><null>, C {[<rnu>C *self, <null>], *self}] = CallByName List.89 List.156 List.157 List.158 List.570 List.571; let List.571 : [<rnu><null>, C {[<rnu>C *self, <null>], *self}] = CallByName List.90 List.158 List.159 List.160 List.572 List.573;
ret List.569; ret List.571;
procedure List.6 (#Attr.2): procedure List.6 (#Attr.2):
let List.580 : U64 = lowlevel ListLen #Attr.2; let List.582 : U64 = lowlevel ListLen #Attr.2;
ret List.580; ret List.582;
procedure List.66 (#Attr.2, #Attr.3): procedure List.66 (#Attr.2, #Attr.3):
let List.579 : [<rnu>C *self, <null>] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; let List.581 : [<rnu>C *self, <null>] = lowlevel ListGetUnsafe #Attr.2 #Attr.3;
ret List.579; ret List.581;
procedure List.89 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4):
joinpoint List.572 List.159 List.160 List.161 List.162 List.163: joinpoint List.574 List.161 List.162 List.163 List.164 List.165:
let List.574 : Int1 = CallByName Num.22 List.162 List.163; let List.576 : Int1 = CallByName Num.22 List.164 List.165;
if List.574 then if List.576 then
let List.578 : [<rnu>C *self, <null>] = CallByName List.66 List.159 List.162; let List.580 : [<rnu>C *self, <null>] = CallByName List.66 List.161 List.164;
inc List.578; inc List.580;
let List.164 : [<rnu><null>, C {[<rnu>C *self, <null>], *self}] = CallByName Test.7 List.160 List.578; let List.166 : [<rnu><null>, C {[<rnu>C *self, <null>], *self}] = CallByName Test.7 List.162 List.580;
let List.577 : U64 = 1i64; let List.579 : U64 = 1i64;
let List.576 : U64 = CallByName Num.51 List.162 List.577; let List.578 : U64 = CallByName Num.51 List.164 List.579;
jump List.572 List.159 List.164 List.161 List.576 List.163; jump List.574 List.161 List.166 List.163 List.578 List.165;
else else
dec List.159; dec List.161;
ret List.160; ret List.162;
in in
jump List.572 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; jump List.574 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4;
procedure Num.22 (#Attr.2, #Attr.3): procedure Num.22 (#Attr.2, #Attr.3):
let Num.292 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3;
ret Num.292; ret Num.298;
procedure Num.51 (#Attr.2, #Attr.3): procedure Num.51 (#Attr.2, #Attr.3):
let Num.291 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.7 (Test.11, Test.12): procedure Test.7 (Test.11, Test.12):
let Test.17 : {[<rnu>C *self, <null>], [<rnu><null>, C {[<rnu>C *self, <null>], *self}]} = Struct {Test.12, Test.11}; let Test.17 : {[<rnu>C *self, <null>], [<rnu><null>, C {[<rnu>C *self, <null>], *self}]} = Struct {Test.12, Test.11};

View file

@ -1,11 +1,11 @@
procedure Num.31 (Num.234): procedure Num.31 (Num.239):
let Num.292 : I64 = 2i64; let Num.298 : I64 = 2i64;
let Num.291 : Int1 = CallByName Num.86 Num.234 Num.292; let Num.297 : Int1 = CallByName Num.86 Num.239 Num.298;
ret Num.291; ret Num.297;
procedure Num.86 (#Attr.2, #Attr.3): procedure Num.86 (#Attr.2, #Attr.3):
let Num.293 : Int1 = lowlevel NumIsMultipleOf #Attr.2 #Attr.3; let Num.299 : Int1 = lowlevel NumIsMultipleOf #Attr.2 #Attr.3;
ret Num.293; ret Num.299;
procedure Test.2 (#Derived_gen.0, #Derived_gen.1): procedure Test.2 (#Derived_gen.0, #Derived_gen.1):
let #Derived_gen.3 : [<rnu><null>, C I64 *self] = NullPointer; let #Derived_gen.3 : [<rnu><null>, C I64 *self] = NullPointer;

View file

@ -1,6 +1,6 @@
procedure Num.19 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3):
let Num.291 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.291; ret Num.297;
procedure Test.10 (Test.11): procedure Test.10 (Test.11):
let Test.28 : I64 = 1i64; let Test.28 : I64 = 1i64;

View file

@ -1,16 +1,16 @@
procedure List.4 (List.121, List.122): procedure List.4 (List.122, List.123):
let List.572 : U64 = 1i64; let List.574 : U64 = 1i64;
let List.570 : List I64 = CallByName List.70 List.121 List.572; let List.572 : List I64 = CallByName List.70 List.122 List.574;
let List.569 : List I64 = CallByName List.71 List.570 List.122; let List.571 : List I64 = CallByName List.71 List.572 List.123;
ret List.569; ret List.571;
procedure List.70 (#Attr.2, #Attr.3): procedure List.70 (#Attr.2, #Attr.3):
let List.573 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3; let List.575 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3;
ret List.573; ret List.575;
procedure List.71 (#Attr.2, #Attr.3): procedure List.71 (#Attr.2, #Attr.3):
let List.571 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; let List.573 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
ret List.571; ret List.573;
procedure Test.0 (): procedure Test.0 ():
let Test.2 : List I64 = Array [1i64]; let Test.2 : List I64 = Array [1i64];

View file

@ -1,16 +1,16 @@
procedure List.4 (List.121, List.122): procedure List.4 (List.122, List.123):
let List.572 : U64 = 1i64; let List.574 : U64 = 1i64;
let List.570 : List I64 = CallByName List.70 List.121 List.572; let List.572 : List I64 = CallByName List.70 List.122 List.574;
let List.569 : List I64 = CallByName List.71 List.570 List.122; let List.571 : List I64 = CallByName List.71 List.572 List.123;
ret List.569; ret List.571;
procedure List.70 (#Attr.2, #Attr.3): procedure List.70 (#Attr.2, #Attr.3):
let List.573 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3; let List.575 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3;
ret List.573; ret List.575;
procedure List.71 (#Attr.2, #Attr.3): procedure List.71 (#Attr.2, #Attr.3):
let List.571 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; let List.573 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3;
ret List.571; ret List.573;
procedure Test.1 (Test.2): procedure Test.1 (Test.2):
let Test.6 : I64 = 42i64; let Test.6 : I64 = 42i64;

Some files were not shown because too many files have changed in this diff Show more