Quellcode durchsuchen

LibJS: Add some more items to CommonPropertyNames that I missed

Andreas Kling vor 4 Jahren
Ursprung
Commit
a1029738fd

+ 15 - 5
Libraries/LibJS/Runtime/CommonPropertyNames.h

@@ -71,17 +71,24 @@ namespace JS {
     P(ceil)                                  \
     P(ceil)                                  \
     P(charAt)                                \
     P(charAt)                                \
     P(charCodeAt)                            \
     P(charCodeAt)                            \
+    P(clear)                                 \
     P(clz32)                                 \
     P(clz32)                                 \
     P(concat)                                \
     P(concat)                                \
+    P(configurable)                          \
     P(console)                               \
     P(console)                               \
     P(construct)                             \
     P(construct)                             \
     P(constructor)                           \
     P(constructor)                           \
     P(cos)                                   \
     P(cos)                                   \
+    P(count)                                 \
+    P(countReset)                            \
+    P(debug)                                 \
     P(defineProperty)                        \
     P(defineProperty)                        \
     P(deleteProperty)                        \
     P(deleteProperty)                        \
     P(description)                           \
     P(description)                           \
     P(done)                                  \
     P(done)                                  \
     P(entries)                               \
     P(entries)                               \
+    P(enumerable)                            \
+    P(error)                                 \
     P(every)                                 \
     P(every)                                 \
     P(exp)                                   \
     P(exp)                                   \
     P(expm1)                                 \
     P(expm1)                                 \
@@ -120,6 +127,7 @@ namespace JS {
     P(hasOwnProperty)                        \
     P(hasOwnProperty)                        \
     P(includes)                              \
     P(includes)                              \
     P(indexOf)                               \
     P(indexOf)                               \
+    P(info)                                  \
     P(is)                                    \
     P(is)                                    \
     P(isArray)                               \
     P(isArray)                               \
     P(isExtensible)                          \
     P(isExtensible)                          \
@@ -132,12 +140,14 @@ namespace JS {
     P(keys)                                  \
     P(keys)                                  \
     P(lastIndexOf)                           \
     P(lastIndexOf)                           \
     P(length)                                \
     P(length)                                \
+    P(log)                                   \
     P(log1p)                                 \
     P(log1p)                                 \
     P(map)                                   \
     P(map)                                   \
     P(max)                                   \
     P(max)                                   \
     P(message)                               \
     P(message)                               \
     P(min)                                   \
     P(min)                                   \
     P(name)                                  \
     P(name)                                  \
+    P(next)                                  \
     P(now)                                   \
     P(now)                                   \
     P(of)                                    \
     P(of)                                    \
     P(ownKeys)                               \
     P(ownKeys)                               \
@@ -167,6 +177,7 @@ namespace JS {
     P(splice)                                \
     P(splice)                                \
     P(sqrt)                                  \
     P(sqrt)                                  \
     P(startsWith)                            \
     P(startsWith)                            \
+    P(stringify)                             \
     P(substring)                             \
     P(substring)                             \
     P(tan)                                   \
     P(tan)                                   \
     P(toDateString)                          \
     P(toDateString)                          \
@@ -179,6 +190,7 @@ namespace JS {
     P(toString)                              \
     P(toString)                              \
     P(toTimeString)                          \
     P(toTimeString)                          \
     P(toUpperCase)                           \
     P(toUpperCase)                           \
+    P(trace)                                 \
     P(trim)                                  \
     P(trim)                                  \
     P(trimEnd)                               \
     P(trimEnd)                               \
     P(trimStart)                             \
     P(trimStart)                             \
@@ -187,11 +199,9 @@ namespace JS {
     P(unshift)                               \
     P(unshift)                               \
     P(value)                                 \
     P(value)                                 \
     P(valueOf)                               \
     P(valueOf)                               \
-    P(enumerable)                            \
-    P(configurable)                          \
-    P(writable)                              \
-    P(next)                                  \
-    P(values)
+    P(values)                                \
+    P(warn)                                  \
+    P(writable)
 
 
 struct CommonPropertyNames {
 struct CommonPropertyNames {
     FlyString for_ { "for" };
     FlyString for_ { "for" };

+ 10 - 9
Libraries/LibJS/Runtime/ConsoleObject.cpp

@@ -41,16 +41,17 @@ ConsoleObject::ConsoleObject(GlobalObject& global_object)
 
 
 void ConsoleObject::initialize(GlobalObject& global_object)
 void ConsoleObject::initialize(GlobalObject& global_object)
 {
 {
+    auto& vm = this->vm();
     Object::initialize(global_object);
     Object::initialize(global_object);
-    define_native_function("log", log);
-    define_native_function("debug", debug);
-    define_native_function("info", info);
-    define_native_function("warn", warn);
-    define_native_function("error", error);
-    define_native_function("trace", trace);
-    define_native_function("count", count);
-    define_native_function("countReset", count_reset);
-    define_native_function("clear", clear);
+    define_native_function(vm.names.log, log);
+    define_native_function(vm.names.debug, debug);
+    define_native_function(vm.names.info, info);
+    define_native_function(vm.names.warn, warn);
+    define_native_function(vm.names.error, error);
+    define_native_function(vm.names.trace, trace);
+    define_native_function(vm.names.count, count);
+    define_native_function(vm.names.countReset, count_reset);
+    define_native_function(vm.names.clear, clear);
 }
 }
 
 
 ConsoleObject::~ConsoleObject()
 ConsoleObject::~ConsoleObject()

+ 4 - 4
Libraries/LibJS/Runtime/JSONObject.cpp

@@ -44,12 +44,12 @@ JSONObject::JSONObject(GlobalObject& global_object)
 
 
 void JSONObject::initialize(GlobalObject& global_object)
 void JSONObject::initialize(GlobalObject& global_object)
 {
 {
+    auto& vm = this->vm();
     Object::initialize(global_object);
     Object::initialize(global_object);
     u8 attr = Attribute::Writable | Attribute::Configurable;
     u8 attr = Attribute::Writable | Attribute::Configurable;
-    define_native_function("stringify", stringify, 3, attr);
-    define_native_function("parse", parse, 2, attr);
-
-    define_property(global_object.vm().well_known_symbol_to_string_tag(), js_string(global_object.heap(), "JSON"), Attribute::Configurable);
+    define_native_function(vm.names.stringify, stringify, 3, attr);
+    define_native_function(vm.names.parse, parse, 2, attr);
+    define_property(vm.well_known_symbol_to_string_tag(), js_string(global_object.heap(), "JSON"), Attribute::Configurable);
 }
 }
 
 
 JSONObject::~JSONObject()
 JSONObject::~JSONObject()

+ 2 - 2
Libraries/LibJS/Runtime/NumberPrototype.cpp

@@ -50,9 +50,9 @@ NumberPrototype::NumberPrototype(GlobalObject& global_object)
 
 
 void NumberPrototype::initialize(GlobalObject& object)
 void NumberPrototype::initialize(GlobalObject& object)
 {
 {
+    auto& vm = this->vm();
     Object::initialize(object);
     Object::initialize(object);
-
-    define_native_function("toString", to_string, 1, Attribute::Configurable | Attribute::Writable);
+    define_native_function(vm.names.toString, to_string, 1, Attribute::Configurable | Attribute::Writable);
 }
 }
 
 
 NumberPrototype::~NumberPrototype()
 NumberPrototype::~NumberPrototype()