Skip to content

Commit

Permalink
Fix fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad committed Sep 22, 2024
1 parent accfd60 commit e628428
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/fuzz/fuzz_targets/parser-idempotency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
mod common;

use crate::common::FuzzData;
use boa_interner::ToInternedString;
use boa_ast::scope::Scope;
use boa_interner::ToInternedString;
use boa_parser::{Parser, Source};
use libfuzzer_sys::{fuzz_target, Corpus};
use std::{error::Error, io::Cursor};
Expand All @@ -20,7 +20,7 @@ fn do_fuzz(mut data: FuzzData) -> Result<(), Box<dyn Error>> {
let before = data.interner.len();
// For a variety of reasons, we may not actually produce valid code here (e.g., nameless function).
// Fail fast and only make the next checks if we were valid.
if let Ok(first) = parser.parse_script(&mut data.interner, &scope) {
if let Ok(first) = parser.parse_script(&scope, &mut data.interner) {
let after_first = data.interner.len();
let first_interned = first.to_interned_string(&data.interner);

Expand All @@ -38,7 +38,7 @@ fn do_fuzz(mut data: FuzzData) -> Result<(), Box<dyn Error>> {

// Now, we most assuredly should produce valid code. It has already gone through a first pass.
let second = parser
.parse_script(&mut data.interner, &second_scope)
.parse_script(&second_scope, &mut data.interner)
.expect("Could not parse the first-pass interned copy.");
let second_interned = second.to_interned_string(&data.interner);
let after_second = data.interner.len();
Expand Down

0 comments on commit e628428

Please sign in to comment.