From 7b6a9a5b55a35a2134e09469a1c78c7691e98e98 Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Sun, 19 Jun 2022 19:18:29 +0200 Subject: [PATCH] Fix eval attributes --- boa_engine/src/builtins/eval/mod.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/boa_engine/src/builtins/eval/mod.rs b/boa_engine/src/builtins/eval/mod.rs index 54c04594e00..2fc58a692dd 100644 --- a/boa_engine/src/builtins/eval/mod.rs +++ b/boa_engine/src/builtins/eval/mod.rs @@ -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, }; @@ -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 { 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()) }