diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-20 13:55:34 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-20 15:45:07 +0200 |
commit | e4add199153bd32a7a4ccbe32751c799aaacaea9 (patch) | |
tree | 5d326c1635f94eadf6d53861be17186a21865085 /Libraries/LibJS/Runtime/MathObject.h | |
parent | 4aa98052caa728da0de4c3960d312d8cf92f1be7 (diff) | |
download | serenity-e4add199153bd32a7a4ccbe32751c799aaacaea9.zip |
LibJS: Pass GlobalObject& to native functions and property accessors
More work towards supporting multiple global objects. Native C++ code
now get a GlobalObject& and don't have to ask the Interpreter for it.
I've added macros for declaring and defining native callbacks since
this was pretty tedious and this makes it easier next time we want to
change any of these signatures.
Diffstat (limited to 'Libraries/LibJS/Runtime/MathObject.h')
-rw-r--r-- | Libraries/LibJS/Runtime/MathObject.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Libraries/LibJS/Runtime/MathObject.h b/Libraries/LibJS/Runtime/MathObject.h index 1cd550ca7d..d1da19a672 100644 --- a/Libraries/LibJS/Runtime/MathObject.h +++ b/Libraries/LibJS/Runtime/MathObject.h @@ -38,23 +38,23 @@ public: private: virtual const char* class_name() const override { return "MathObject"; } - static Value abs(Interpreter&); - static Value random(Interpreter&); - static Value sqrt(Interpreter&); - static Value floor(Interpreter&); - static Value ceil(Interpreter&); - static Value round(Interpreter&); - static Value max(Interpreter&); - static Value min(Interpreter&); - static Value trunc(Interpreter&); - static Value sin(Interpreter&); - static Value cos(Interpreter&); - static Value tan(Interpreter&); - static Value pow(Interpreter&); - static Value exp(Interpreter&); - static Value expm1(Interpreter&); - static Value sign(Interpreter&); - static Value clz32(Interpreter&); + JS_DECLARE_NATIVE_FUNCTION(abs); + JS_DECLARE_NATIVE_FUNCTION(random); + JS_DECLARE_NATIVE_FUNCTION(sqrt); + JS_DECLARE_NATIVE_FUNCTION(floor); + JS_DECLARE_NATIVE_FUNCTION(ceil); + JS_DECLARE_NATIVE_FUNCTION(round); + JS_DECLARE_NATIVE_FUNCTION(max); + JS_DECLARE_NATIVE_FUNCTION(min); + JS_DECLARE_NATIVE_FUNCTION(trunc); + JS_DECLARE_NATIVE_FUNCTION(sin); + JS_DECLARE_NATIVE_FUNCTION(cos); + JS_DECLARE_NATIVE_FUNCTION(tan); + JS_DECLARE_NATIVE_FUNCTION(pow); + JS_DECLARE_NATIVE_FUNCTION(exp); + JS_DECLARE_NATIVE_FUNCTION(expm1); + JS_DECLARE_NATIVE_FUNCTION(sign); + JS_DECLARE_NATIVE_FUNCTION(clz32); }; } |