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

[Merged by Bors] - Fix eval attributes #2130

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions boa_engine/src/builtins/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval

use crate::{
builtins::{function::Function, BuiltIn, JsArgs},
object::{JsObject, ObjectData},
builtins::{BuiltIn, JsArgs},
object::FunctionBuilder,
property::Attribute,
Context, JsValue,
};
Expand All @@ -24,20 +24,18 @@ pub(crate) struct Eval;
impl BuiltIn for Eval {
const NAME: &'static str = "eval";

const ATTRIBUTE: Attribute = Attribute::READONLY
const ATTRIBUTE: Attribute = Attribute::CONFIGURABLE
.union(Attribute::NON_ENUMERABLE)
.union(Attribute::PERMANENT);
.union(Attribute::WRITABLE);

fn init(context: &mut Context) -> Option<JsValue> {
let _timer = Profiler::global().start_event(Self::NAME, "init");

let object = JsObject::from_proto_and_data(
context.intrinsics().constructors().function().prototype(),
ObjectData::function(Function::Native {
function: Self::eval,
constructor: false,
}),
);
let object = FunctionBuilder::native(context, Self::eval)
.name("eval")
.length(1)
.constructor(false)
.build();

Some(object.into())
}
Expand Down