-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Grant Wuerker
committed
May 14, 2024
1 parent
4a18de0
commit 048e43b
Showing
21 changed files
with
1,267 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use fe_driver2::DriverDataBase; | ||
|
||
#[test] | ||
fn check_std_lib() { | ||
let mut driver = DriverDataBase::default(); | ||
let std_ingot = library2::std_lib_input_ingot(&mut driver); | ||
driver.run_on_ingot(std_ingot); | ||
|
||
let diags = driver.format_diags(); | ||
if !diags.is_empty() { | ||
panic!("{diags}") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "fe-library2" | ||
version = "0.23.0" | ||
authors = ["The Fe Developers <[email protected]>"] | ||
edition = "2021" | ||
license = "Apache-2.0" | ||
repository = "https://github.com/ethereum/fe" | ||
|
||
[dependencies] | ||
include_dir = "0.7.2" | ||
common = { path = "../common2", package = "fe-common2" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("cargo:rerun-if-changed=./std"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use std::collections::BTreeSet; | ||
|
||
pub use ::include_dir; | ||
use common::{ | ||
input::{IngotKind, Version}, | ||
InputDb, InputFile, InputIngot, | ||
}; | ||
use include_dir::{include_dir, Dir}; | ||
|
||
pub const STD: Dir = include_dir!("$CARGO_MANIFEST_DIR/std"); | ||
|
||
fn std_src_input_files(db: &mut dyn InputDb, ingot: InputIngot) -> BTreeSet<InputFile> { | ||
static_dir_files(&STD) | ||
.into_iter() | ||
.map(|(path, content)| InputFile::new(db, ingot, path.into(), content.into())) | ||
.collect() | ||
} | ||
|
||
pub fn std_lib_input_ingot(db: &mut dyn InputDb) -> InputIngot { | ||
let ingot = InputIngot::new( | ||
db, | ||
"/", | ||
IngotKind::Std, | ||
Version::new(0, 0, 0), | ||
BTreeSet::default(), | ||
); | ||
|
||
let input_files = std_src_input_files(db, ingot); | ||
let root_file = input_files | ||
.iter() | ||
.find(|file| file.path(db).ends_with("lib.fe")) | ||
.unwrap() | ||
.to_owned(); | ||
|
||
ingot.set_root_file(db, root_file); | ||
ingot.set_files(db, input_files); | ||
|
||
ingot | ||
} | ||
|
||
pub fn static_dir_files(dir: &'static Dir) -> Vec<(&'static str, &'static str)> { | ||
fn add_files(dir: &'static Dir, accum: &mut Vec<(&'static str, &'static str)>) { | ||
accum.extend(dir.files().map(|file| { | ||
( | ||
file.path().to_str().unwrap(), | ||
file.contents_utf8().expect("non-utf8 static file"), | ||
) | ||
})); | ||
|
||
for sub_dir in dir.dirs() { | ||
add_files(sub_dir, accum) | ||
} | ||
} | ||
|
||
let mut files = vec![]; | ||
add_files(dir, &mut files); | ||
files | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub type isize = i256 | ||
pub type usize = u256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
extern { | ||
fn __u8_u16_extend(_ x: u8) -> u16 | ||
fn __u8_u32_extend(_ x: u8) -> u32 | ||
fn __u8_u64_extend(_ x: u8) -> u64 | ||
fn __u8_u128_extend(_ x: u8) -> u128 | ||
fn __u8_u256_extend(_ x: u8) -> u256 | ||
fn __u16_u32_extend(_ x: u16) -> u32 | ||
fn __u16_u64_extend(_ x: u16) -> u64 | ||
fn __u16_u128_extend(_ x: u16) -> u128 | ||
fn __u16_u256_extend(_ x: u16) -> u256 | ||
fn __u32_u64_extend(_ x: u32) -> u64 | ||
fn __u32_u128_extend(_ x: u32) -> u128 | ||
fn __u32_u256_extend(_ x: u32) -> u256 | ||
fn __u64_u128_extend(_ x: u64) -> u128 | ||
fn __u64_u256_extend(_ x: u64) -> u256 | ||
fn __u128_u256_extend(_ x: u128) -> u256 | ||
fn __i8_i16_extend(_ x: i8) -> i16 | ||
fn __i8_i32_extend(_ x: i8) -> i32 | ||
fn __i8_i64_extend(_ x: i8) -> i64 | ||
fn __i8_i128_extend(_ x: i8) -> i128 | ||
fn __i8_i256_extend(_ x: i8) -> i256 | ||
fn __i16_i32_extend(_ x: i16) -> i32 | ||
fn __i16_i64_extend(_ x: i16) -> i64 | ||
fn __i16_i128_extend(_ x: i16) -> i128 | ||
fn __i16_i256_extend(_ x: i16) -> i256 | ||
fn __i32_i64_extend(_ x: i32) -> i64 | ||
fn __i32_i128_extend(_ x: i32) -> i128 | ||
fn __i32_i256_extend(_ x: i32) -> i256 | ||
fn __i64_i128_extend(_ x: i64) -> i128 | ||
fn __i64_i256_extend(_ x: i64) -> i256 | ||
fn __i128_i256_extend(_ x: i128) -> i256 | ||
} | ||
|
||
pub trait Extend<Out> { | ||
fn extend(self) -> Out | ||
} | ||
|
||
impl Extend<u16> for u8 { | ||
fn extend(self) -> u16 { __u8_u16_extend(self) } | ||
} | ||
|
||
impl Extend<u32> for u8 { | ||
fn extend(self) -> u32 { __u8_u32_extend(self) } | ||
} | ||
|
||
impl Extend<u64> for u8 { | ||
fn extend(self) -> u64 { __u8_u64_extend(self) } | ||
} | ||
|
||
impl Extend<u128> for u8 { | ||
fn extend(self) -> u128 { __u8_u128_extend(self) } | ||
} | ||
|
||
impl Extend<u256> for u8 { | ||
fn extend(self) -> u256 { __u8_u256_extend(self) } | ||
} | ||
|
||
impl Extend<u32> for u16 { | ||
fn extend(self) -> u32 { __u16_u32_extend(self) } | ||
} | ||
|
||
impl Extend<u64> for u16 { | ||
fn extend(self) -> u64 { __u16_u64_extend(self) } | ||
} | ||
|
||
impl Extend<u128> for u16 { | ||
fn extend(self) -> u128 { __u16_u128_extend(self) } | ||
} | ||
|
||
impl Extend<u256> for u16 { | ||
fn extend(self) -> u256 { __u16_u256_extend(self) } | ||
} | ||
|
||
impl Extend<u64> for u32 { | ||
fn extend(self) -> u64 { __u32_u64_extend(self) } | ||
} | ||
|
||
impl Extend<u128> for u32 { | ||
fn extend(self) -> u128 { __u32_u128_extend(self) } | ||
} | ||
|
||
impl Extend<u256> for u32 { | ||
fn extend(self) -> u256 { __u32_u256_extend(self) } | ||
} | ||
|
||
impl Extend<u128> for u64 { | ||
fn extend(self) -> u128 { __u64_u128_extend(self) } | ||
} | ||
|
||
impl Extend<u256> for u64 { | ||
fn extend(self) -> u256 { __u64_u256_extend(self) } | ||
} | ||
|
||
impl Extend<u256> for u128 { | ||
fn extend(self) -> u256 { __u128_u256_extend(self) } | ||
} | ||
|
||
impl Extend<i16> for i8 { | ||
fn extend(self) -> i16 { __i8_i16_extend(self) } | ||
} | ||
|
||
impl Extend<i32> for i8 { | ||
fn extend(self) -> i32 { __i8_i32_extend(self) } | ||
} | ||
|
||
impl Extend<i64> for i8 { | ||
fn extend(self) -> i64 { __i8_i64_extend(self) } | ||
} | ||
|
||
impl Extend<i128> for i8 { | ||
fn extend(self) -> i128 { __i8_i128_extend(self) } | ||
} | ||
|
||
impl Extend<i256> for i8 { | ||
fn extend(self) -> i256 { __i8_i256_extend(self) } | ||
} | ||
|
||
impl Extend<i32> for i16 { | ||
fn extend(self) -> i32 { __i16_i32_extend(self) } | ||
} | ||
|
||
impl Extend<i64> for i16 { | ||
fn extend(self) -> i64 { __i16_i64_extend(self) } | ||
} | ||
|
||
impl Extend<i128> for i16 { | ||
fn extend(self) -> i128 { __i16_i128_extend(self) } | ||
} | ||
|
||
impl Extend<i256> for i16 { | ||
fn extend(self) -> i256 { __i16_i256_extend(self) } | ||
} | ||
|
||
impl Extend<i64> for i32 { | ||
fn extend(self) -> i64 { __i32_i64_extend(self) } | ||
} | ||
|
||
impl Extend<i128> for i32 { | ||
fn extend(self) -> i128 { __i32_i128_extend(self) } | ||
} | ||
|
||
impl Extend<i256> for i32 { | ||
fn extend(self) -> i256 { __i32_i256_extend(self) } | ||
} | ||
|
||
impl Extend<i128> for i64 { | ||
fn extend(self) -> i128 { __i64_i128_extend(self) } | ||
} | ||
|
||
impl Extend<i256> for i64 { | ||
fn extend(self) -> i256 { __i64_i256_extend(self) } | ||
} | ||
|
||
impl Extend<i256> for i128 { | ||
fn extend(self) -> i256 { __i128_i256_extend(self) } | ||
} |
Empty file.
Oops, something went wrong.