Skip to content

Commit

Permalink
Fixes #17914: rudderc is way too slow - Tests fail
Browse files Browse the repository at this point in the history
  • Loading branch information
peckpeck committed Jul 6, 2020
1 parent 6df6b4b commit 0b72154
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rudder-lang/src/parser/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ pub enum PErrorKind<I> {
}

// This is the same thing as a closure (Fn() -> I) but I couldn't manage to cope with lifetime
#[derive(Debug)]
pub struct Context<I> {
pub extractor: fn(I, I) -> I,
pub text: I,
pub token: I,
}
#[derive(Debug)]
pub struct PError<I> {
pub context: Option<Context<I>>,
pub kind: PErrorKind<I>,
Expand Down
2 changes: 1 addition & 1 deletion rudder-lang/src/parser/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn map_err(err: PError<PInput>) -> (&str, PErrorKind<&str>) {
PErrorKind::Unparsed(i) => PErrorKind::Unparsed(i.fragment),
};
match err.context {
Some(context) => (context.fragment, kind),
Some(context) => ((context.extractor)(context.text,context.token).fragment, kind),
None => ("", kind),
}
}
Expand Down

0 comments on commit 0b72154

Please sign in to comment.