mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +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
|
@ -10,7 +10,7 @@ use roc_repl_ui::colors::{CYAN, END_COL};
|
|||
use roc_repl_ui::repl_state::{ReplAction, ReplState};
|
||||
use roc_repl_ui::{format_output, is_incomplete, CONT_PROMPT, PROMPT, SHORT_INSTRUCTIONS, TIPS};
|
||||
use roc_reporting::report::{ANSI_STYLE_CODES, DEFAULT_PALETTE};
|
||||
use roc_target::TargetInfo;
|
||||
use roc_target::Target;
|
||||
use rustyline::highlight::{Highlighter, PromptInfo};
|
||||
use rustyline::validate::{self, ValidationContext, ValidationResult, Validator};
|
||||
use rustyline_derive::{Completer, Helper, Hinter};
|
||||
|
@ -46,8 +46,7 @@ pub fn main() -> i32 {
|
|||
let mut editor = Editor::<ReplHelper>::new();
|
||||
let repl_helper = ReplHelper::default();
|
||||
editor.set_helper(Some(repl_helper));
|
||||
let target = Triple::host();
|
||||
let target_info = TargetInfo::from(&target);
|
||||
let target = Triple::host().into();
|
||||
let mut arena = Bump::new();
|
||||
|
||||
loop {
|
||||
|
@ -63,9 +62,9 @@ pub fn main() -> i32 {
|
|||
.state;
|
||||
|
||||
arena.reset();
|
||||
match repl_state.step(&arena, line, target_info, DEFAULT_PALETTE) {
|
||||
match repl_state.step(&arena, line, target, DEFAULT_PALETTE) {
|
||||
ReplAction::Eval { opt_mono, problems } => {
|
||||
let output = evaluate(opt_mono, problems, &target);
|
||||
let output = evaluate(opt_mono, problems, target);
|
||||
// If there was no output, don't print a blank line!
|
||||
// (This happens for something like a type annotation.)
|
||||
if !output.is_empty() {
|
||||
|
@ -104,7 +103,7 @@ pub fn main() -> i32 {
|
|||
pub fn evaluate(
|
||||
opt_mono: Option<MonomorphizedModule<'_>>,
|
||||
problems: Problems,
|
||||
target: &Triple,
|
||||
target: Target,
|
||||
) -> String {
|
||||
let opt_output = opt_mono.and_then(|mono| eval_llvm(mono, target, OptLevel::Normal));
|
||||
format_output(ANSI_STYLE_CODES, opt_output, problems)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue