File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ Value CallExpression::execute(Interpreter& interpreter) const
83
83
Object* new_object = nullptr ;
84
84
if (is_new_expression ()) {
85
85
new_object = interpreter.heap ().allocate <Object>();
86
+ auto prototype = function->get (" prototype" );
87
+ if (prototype.has_value () && prototype.value ().is_object ())
88
+ new_object->set_prototype (prototype.value ().as_object ());
86
89
call_frame.this_value = new_object;
87
90
} else {
88
91
if (m_callee->is_member_expression ()) {
Original file line number Diff line number Diff line change 24
24
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
25
*/
26
26
27
+ #include < AK/FlyString.h>
28
+ #include < LibJS/Heap/Heap.h>
27
29
#include < LibJS/Runtime/Function.h>
28
30
#include < LibJS/Runtime/Value.h>
29
31
30
32
namespace JS {
31
33
32
34
Function::Function ()
33
35
{
36
+ put (" prototype" , heap ().allocate <Object>());
34
37
}
35
38
36
39
Function::~Function ()
You can’t perform that action at this time.
0 commit comments