mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:57:44 +00:00
LibJS: Correct behaviour of direct vs. indirect eval
eval only has direct access to the local scope when accessed through the name eval. This includes locals named eval, because of course it does.
This commit is contained in:
parent
5d24b5f4be
commit
2822da8c8f
10 changed files with 121 additions and 20 deletions
|
@ -36,6 +36,8 @@ public:
|
|||
// Not included in JS_ENUMERATE_NATIVE_OBJECTS due to missing distinct constructor
|
||||
GeneratorObjectPrototype* generator_object_prototype() { return m_generator_object_prototype; }
|
||||
|
||||
Function* eval_function() const { return m_eval_function; }
|
||||
|
||||
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \
|
||||
ConstructorName* snake_name##_constructor() { return m_##snake_name##_constructor; } \
|
||||
Object* snake_name##_prototype() { return m_##snake_name##_prototype; }
|
||||
|
@ -95,6 +97,8 @@ private:
|
|||
Object* m_##snake_name##_prototype { nullptr };
|
||||
JS_ENUMERATE_ITERATOR_PROTOTYPES
|
||||
#undef __JS_ENUMERATE
|
||||
|
||||
Function* m_eval_function;
|
||||
};
|
||||
|
||||
template<typename ConstructorType>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue