Jelajahi Sumber

LibJS: Reorder the global eval function call detection conditions a bit

This just makes it clearer, since the actual check is off-screen, making
the reader wonder what that check is for.
Ali Mohammad Pur 3 tahun lalu
induk
melakukan
4f7e14e0aa
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      Userland/Libraries/LibJS/AST.cpp

+ 1 - 1
Userland/Libraries/LibJS/AST.cpp

@@ -251,7 +251,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj
 
     auto& function = callee.as_function();
 
-    if (is<Identifier>(*m_callee) && static_cast<Identifier const&>(*m_callee).string() == vm.names.eval.as_string() && &function == global_object.eval_function()) {
+    if (&function == global_object.eval_function() && is<Identifier>(*m_callee) && static_cast<Identifier const&>(*m_callee).string() == vm.names.eval.as_string()) {
         auto script_value = arg_list.size() == 0 ? js_undefined() : arg_list[0];
         return perform_eval(script_value, global_object, vm.in_strict_mode() ? CallerMode::Strict : CallerMode::NonStrict, EvalMode::Direct);
     }