mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Use roc_target over target_lexicon
Tailors a target class for our needs. Replaces tons of uses across the entire compiler. This is a base for later adding new targets like thumb.
This commit is contained in:
parent
185262510c
commit
6dc5bfb1b7
72 changed files with 1008 additions and 1371 deletions
|
@ -16,7 +16,7 @@ use roc_repl_ui::{
|
|||
repl_state::{ReplAction, ReplState},
|
||||
TIPS,
|
||||
};
|
||||
use roc_target::TargetInfo;
|
||||
use roc_target::Target;
|
||||
use roc_types::pretty_print::{name_and_print_var, DebugPrint};
|
||||
|
||||
use crate::{js_create_app, js_get_result_and_memory, js_run_app};
|
||||
|
@ -189,12 +189,12 @@ pub async fn entrypoint_from_js(src: String) -> String {
|
|||
let arena = &Bump::new();
|
||||
|
||||
// Compile the app
|
||||
let target_info = TargetInfo::default_wasm32();
|
||||
let target = Target::Wasm32;
|
||||
|
||||
// Advance the REPL state machine
|
||||
let action = REPL_STATE.with(|repl_state_cell| {
|
||||
let mut repl_state = repl_state_cell.borrow_mut();
|
||||
repl_state.step(arena, &src, target_info, DEFAULT_PALETTE_HTML)
|
||||
repl_state.step(arena, &src, target, DEFAULT_PALETTE_HTML)
|
||||
});
|
||||
|
||||
// Perform the action the state machine asked for, and return the appropriate output string
|
||||
|
@ -206,7 +206,7 @@ pub async fn entrypoint_from_js(src: String) -> String {
|
|||
ReplAction::Nothing => String::new(),
|
||||
ReplAction::Eval { opt_mono, problems } => {
|
||||
let opt_output = match opt_mono {
|
||||
Some(mono) => eval_wasm(arena, target_info, mono).await,
|
||||
Some(mono) => eval_wasm(arena, target, mono).await,
|
||||
None => None,
|
||||
};
|
||||
|
||||
|
@ -217,7 +217,7 @@ pub async fn entrypoint_from_js(src: String) -> String {
|
|||
|
||||
async fn eval_wasm<'a>(
|
||||
arena: &'a Bump,
|
||||
target_info: TargetInfo,
|
||||
target: Target,
|
||||
mono: MonomorphizedModule<'a>,
|
||||
) -> Option<ReplOutput> {
|
||||
let MonomorphizedModule {
|
||||
|
@ -311,7 +311,7 @@ async fn eval_wasm<'a>(
|
|||
&subs,
|
||||
&interns,
|
||||
layout_interner.into_global().fork(),
|
||||
target_info,
|
||||
target,
|
||||
);
|
||||
|
||||
// Transform the Expr to a string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue