mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
Drop smallvec
This commit is contained in:
parent
6294e77159
commit
1556cf1fc9
7 changed files with 16 additions and 30 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -117,7 +117,6 @@ dependencies = [
|
||||||
"maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -149,11 +148,6 @@ dependencies = [
|
||||||
"typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "smallvec"
|
|
||||||
version = "0.6.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.10.0"
|
version = "1.10.0"
|
||||||
|
@ -212,7 +206,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
"checksum sized-chunks 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2eb3fe454976eefb479f78f9b394d34d661b647c6326a3a6e66f68bb12c26"
|
"checksum sized-chunks 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2eb3fe454976eefb479f78f9b394d34d661b647c6326a3a6e66f68bb12c26"
|
||||||
"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"
|
|
||||||
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
||||||
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||||
|
|
|
@ -9,7 +9,6 @@ log = "0.4"
|
||||||
petgraph = { version = "0.4.5", optional = true }
|
petgraph = { version = "0.4.5", optional = true }
|
||||||
combine = "3.8.1"
|
combine = "3.8.1"
|
||||||
im-rc = "13.0.0"
|
im-rc = "13.0.0"
|
||||||
smallvec = "0.6.9"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pretty_assertions = "0.5.1"
|
pretty_assertions = "0.5.1"
|
||||||
|
|
|
@ -4,7 +4,6 @@ use expr::Operator::*;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use im_rc::hashmap::HashMap;
|
use im_rc::hashmap::HashMap;
|
||||||
use smallvec::SmallVec;
|
|
||||||
use self::Evaluated::*;
|
use self::Evaluated::*;
|
||||||
use self::Problem::*;
|
use self::Problem::*;
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ pub enum Evaluated {
|
||||||
Str(String),
|
Str(String),
|
||||||
InterpolatedStr(Vec<(String, Ident)>, String),
|
InterpolatedStr(Vec<(String, Ident)>, String),
|
||||||
Char(char),
|
Char(char),
|
||||||
Closure(SmallVec<[Pattern; 2]>, Box<Expr>, Scope),
|
Closure(Vec<Pattern>, Box<Expr>, Scope),
|
||||||
|
|
||||||
// Sum Types
|
// Sum Types
|
||||||
ApplyVariant(String, Option<Vec<Evaluated>>),
|
ApplyVariant(String, Option<Vec<Evaluated>>),
|
||||||
|
@ -198,7 +197,7 @@ fn eval_apply(evaluated: Evaluated, args: Vec<Expr>, vars: &Scope) -> Evaluated
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn eval_closure(args: Vec<Evaluated>, arg_patterns: SmallVec<[Pattern; 2]>, vars: &Scope)
|
fn eval_closure(args: Vec<Evaluated>, arg_patterns: Vec<Pattern>, vars: &Scope)
|
||||||
-> Result<Scope, Problem>
|
-> Result<Scope, Problem>
|
||||||
{
|
{
|
||||||
if arg_patterns.len() == args.len() {
|
if arg_patterns.len() == args.len() {
|
||||||
|
@ -313,7 +312,7 @@ fn eval_operator(left_expr: &Evaluated, op: Operator, right_expr: &Evaluated) ->
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn eval_case (evaluated: Evaluated, branches: SmallVec<[(Pattern, Box<Expr>); 2]>, vars: &Scope) -> Evaluated {
|
fn eval_case (evaluated: Evaluated, branches: Vec<(Pattern, Box<Expr>)>, vars: &Scope) -> Evaluated {
|
||||||
for (pattern, definition) in branches {
|
for (pattern, definition) in branches {
|
||||||
let mut branch_vars = vars.clone();
|
let mut branch_vars = vars.clone();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
use smallvec::SmallVec;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub enum Expr {
|
pub enum Expr {
|
||||||
// Literals
|
// Literals
|
||||||
|
@ -17,7 +15,7 @@ pub enum Expr {
|
||||||
CallByName(Ident, Vec<Expr>),
|
CallByName(Ident, Vec<Expr>),
|
||||||
Apply(Box<Expr>, Vec<Expr>),
|
Apply(Box<Expr>, Vec<Expr>),
|
||||||
Operator(Box<Expr>, Operator, Box<Expr>),
|
Operator(Box<Expr>, Operator, Box<Expr>),
|
||||||
Closure(SmallVec<[Pattern; 2]>, Box<Expr>),
|
Closure(Vec<Pattern>, Box<Expr>),
|
||||||
|
|
||||||
// Sum Types
|
// Sum Types
|
||||||
ApplyVariant(String, Option<Vec<Expr>>),
|
ApplyVariant(String, Option<Vec<Expr>>),
|
||||||
|
@ -27,7 +25,7 @@ pub enum Expr {
|
||||||
|
|
||||||
// Conditionals
|
// Conditionals
|
||||||
If(Box<Expr>, Box<Expr>, Box<Expr>),
|
If(Box<Expr>, Box<Expr>, Box<Expr>),
|
||||||
Case(Box<Expr>, SmallVec<[(Pattern, Box<Expr>); 2]>),
|
Case(Box<Expr>, Vec<(Pattern, Box<Expr>)>),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Ident = String;
|
pub type Ident = String;
|
||||||
|
|
|
@ -12,5 +12,4 @@ extern crate dogged;
|
||||||
|
|
||||||
extern crate im_rc;
|
extern crate im_rc;
|
||||||
|
|
||||||
extern crate smallvec;
|
|
||||||
#[macro_use] extern crate combine;
|
#[macro_use] extern crate combine;
|
||||||
|
|
|
@ -3,7 +3,6 @@ use expr::{Expr, Pattern, Ident};
|
||||||
|
|
||||||
use std::char;
|
use std::char;
|
||||||
use parse_state::{IndentablePosition};
|
use parse_state::{IndentablePosition};
|
||||||
use smallvec::SmallVec;
|
|
||||||
|
|
||||||
use combine::parser::char::{char, string, spaces, digit, hex_digit, HexDigit, alpha_num};
|
use combine::parser::char::{char, string, spaces, digit, hex_digit, HexDigit, alpha_num};
|
||||||
use combine::parser::repeat::{many, count_min_max, sep_by1, skip_many, skip_many1};
|
use combine::parser::repeat::{many, count_min_max, sep_by1, skip_many, skip_many1};
|
||||||
|
@ -218,7 +217,7 @@ where I: Stream<Item = char, Position = IndentablePosition>,
|
||||||
attempt(string("case").skip(indented_whitespaces1(min_indent)))
|
attempt(string("case").skip(indented_whitespaces1(min_indent)))
|
||||||
.with(expr_body(min_indent))
|
.with(expr_body(min_indent))
|
||||||
.and(
|
.and(
|
||||||
many::<SmallVec<_>, _>(
|
many::<Vec<_>, _>(
|
||||||
attempt(
|
attempt(
|
||||||
skip_many(indented_whitespaces1(min_indent))
|
skip_many(indented_whitespaces1(min_indent))
|
||||||
.with(string("when").skip(indented_whitespaces1(min_indent)))
|
.with(string("when").skip(indented_whitespaces1(min_indent)))
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#[macro_use] extern crate pretty_assertions;
|
#[macro_use] extern crate pretty_assertions;
|
||||||
#[macro_use] extern crate smallvec;
|
|
||||||
extern crate combine;
|
extern crate combine;
|
||||||
|
|
||||||
extern crate roc;
|
extern crate roc;
|
||||||
|
@ -567,7 +566,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Int(1)),
|
Box::new(Int(1)),
|
||||||
smallvec![( Identifier("x".to_string()), Box::new(Int(2)) )]
|
vec![( Identifier("x".to_string()), Box::new(Int(2)) )]
|
||||||
),
|
),
|
||||||
""
|
""
|
||||||
))
|
))
|
||||||
|
@ -581,7 +580,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Int(1)),
|
Box::new(Int(1)),
|
||||||
smallvec![
|
vec![
|
||||||
( Identifier("x".to_string()), Box::new(Int(2)) ),
|
( Identifier("x".to_string()), Box::new(Int(2)) ),
|
||||||
( Identifier("y".to_string()), Box::new(Int(3)) )
|
( Identifier("y".to_string()), Box::new(Int(3)) )
|
||||||
]
|
]
|
||||||
|
@ -598,7 +597,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Var("a".to_string())),
|
Box::new(Var("a".to_string())),
|
||||||
smallvec![
|
vec![
|
||||||
( Identifier("b".to_string()), Box::new(Int(1)) ),
|
( Identifier("b".to_string()), Box::new(Int(1)) ),
|
||||||
( Identifier("c".to_string()), Box::new(Int(2)) ),
|
( Identifier("c".to_string()), Box::new(Int(2)) ),
|
||||||
]
|
]
|
||||||
|
@ -617,7 +616,7 @@ mod test_parse {
|
||||||
Identifier("a".to_string()),
|
Identifier("a".to_string()),
|
||||||
Box::new(Case(
|
Box::new(Case(
|
||||||
Box::new(Var("x".to_string())),
|
Box::new(Var("x".to_string())),
|
||||||
smallvec![
|
vec![
|
||||||
( Identifier("b".to_string()), Box::new(Int(1)) ),
|
( Identifier("b".to_string()), Box::new(Int(1)) ),
|
||||||
( Identifier("c".to_string()), Box::new(Int(2)) ),
|
( Identifier("c".to_string()), Box::new(Int(2)) ),
|
||||||
]
|
]
|
||||||
|
@ -636,7 +635,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Var("a".to_string())),
|
Box::new(Var("a".to_string())),
|
||||||
smallvec![
|
vec![
|
||||||
( Identifier("b".to_string()), Box::new(Int(1)) ),
|
( Identifier("b".to_string()), Box::new(Int(1)) ),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
@ -652,7 +651,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Int(1)),
|
Box::new(Int(1)),
|
||||||
smallvec![
|
vec![
|
||||||
( Integer(2), Box::new(Int(3)) ),
|
( Integer(2), Box::new(Int(3)) ),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
@ -668,7 +667,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Int(1)),
|
Box::new(Int(1)),
|
||||||
smallvec![
|
vec![
|
||||||
( Variant("Foo".to_string(), None), Box::new(Int(3)) ),
|
( Variant("Foo".to_string(), None), Box::new(Int(3)) ),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
@ -684,7 +683,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Int(1)),
|
Box::new(Int(1)),
|
||||||
smallvec![
|
vec![
|
||||||
( Variant("Foo".to_string(), Some(vec![Identifier("x".to_string())])), Box::new(Int(3)) ),
|
( Variant("Foo".to_string(), Some(vec![Identifier("x".to_string())])), Box::new(Int(3)) ),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
@ -700,7 +699,7 @@ mod test_parse {
|
||||||
Ok((
|
Ok((
|
||||||
Case(
|
Case(
|
||||||
Box::new(Int(0)),
|
Box::new(Int(0)),
|
||||||
smallvec![
|
vec![
|
||||||
( Integer(2), Box::new(CallByName("foo".to_string(), vec![Int(9)])) ),
|
( Integer(2), Box::new(CallByName("foo".to_string(), vec![Int(9)])) ),
|
||||||
( Integer(1), Box::new(CallByName("bar".to_string(), vec![Int(8)])) ),
|
( Integer(1), Box::new(CallByName("bar".to_string(), vec![Int(8)])) ),
|
||||||
]
|
]
|
||||||
|
@ -1107,7 +1106,7 @@ mod test_parse {
|
||||||
Assign(
|
Assign(
|
||||||
Identifier("f".to_string()),
|
Identifier("f".to_string()),
|
||||||
Box::new(Closure(
|
Box::new(Closure(
|
||||||
smallvec![Identifier("x".to_string())],
|
vec![Identifier("x".to_string())],
|
||||||
Box::new(CallByName("c".to_string(), vec![Int(1)]))
|
Box::new(CallByName("c".to_string(), vec![Int(1)]))
|
||||||
)),
|
)),
|
||||||
Box::new(Var("f".to_string()))
|
Box::new(Var("f".to_string()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue