Skip to content

Deno crash when specifying sourceURL comment during async code evaluation. #24782

@garethj2

Description

@garethj2

Version: Deno 1.45.4

Run this code and Deno will crash...

const AsyncFunction = Object.getPrototypeOf(async function () {
	// empty
}).constructor

const func = new AsyncFunction(
	`return doesNotExist();
    //# sourceURL=empty.eval`
)

func.call({})

...with this output...

Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 1.45.4
Args: ["deno", "run", "crash.ts"]

thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_core-0.299.0/error.rs:1245:36:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To resolve, simply remove the sourceURL line. Now it'll fail as expected.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctlydeno_coreChanges in "deno_core" crate are needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions