Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefining a function panics with binding already exists #669

Closed
dvtkrlbs opened this issue Aug 30, 2020 · 0 comments · Fixed by #1010
Closed

Redefining a function panics with binding already exists #669

dvtkrlbs opened this issue Aug 30, 2020 · 0 comments · Fixed by #1010
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics execution Issues or PRs related to code execution
Milestone

Comments

@dvtkrlbs
Copy link

dvtkrlbs commented Aug 30, 2020

Redefining a function in repl panics with binding already exists error

To Reproduce
Steps to reproduce the issue, or JavaScript code that causes this failure.
cargo run
function x() {} enter
function x() { return 3; } enter panics

Expected behavior
It should override the previous binding

Backtrace

thread 'main' panicked at 'Binding already exists!', boa/src/environment/global_environment_record.rs:108:13
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1076
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:217
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:526
  11: std::panicking::begin_panic
  12: <boa::environment::global_environment_record::GlobalEnvironmentRecord as boa::environment::environment_record_trait::EnvironmentRecordTrait>::create_mutable_binding
             at boa/src/environment/global_environment_record.rs:108
  13: boa::environment::lexical_environment::LexicalEnvironment::create_mutable_binding
             at /Users/dvtkrlbs/.cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.8.2/src/raw/mod.rs:1822
  14: boa::exec::declaration::<impl boa::exec::Executable for boa::syntax::ast::node::declaration::FunctionDecl>::run
             at boa/src/exec/declaration/mod.rs:24
  15: <boa::syntax::ast::node::Node as boa::exec::Executable>::run
             at boa/src/exec/mod.rs:389
  16: boa::exec::statement_list::<impl boa::exec::Executable for boa::syntax::ast::node::statement_list::StatementList>::run
             at boa/src/exec/statement_list.rs:15
  17: boa::forward_val
             at boa/src/lib.rs:89
  18: boa::main
             at boa_cli/src/main.rs:190
  19: std::rt::lang_start::{{closure}}
             at /Users/dvtkrlbs/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:67
  20: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:52
  21: std::panicking::try::do_call
             at src/libstd/panicking.rs:348
  22: std::panicking::try
             at src/libstd/panicking.rs:325
  23: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  24: std::rt::lang_start_internal
             at src/libstd/rt.rs:51
  25: std::rt::lang_start
             at /Users/dvtkrlbs/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:67
  26: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@dvtkrlbs dvtkrlbs added the bug Something isn't working label Aug 30, 2020
@Razican Razican added builtins PRs and Issues related to builtins/intrinsics execution Issues or PRs related to code execution labels Sep 2, 2020
@Razican Razican added this to the v0.11.0 milestone Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics execution Issues or PRs related to code execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants