From 7912f33ea0c223b88ff79ad4c072ec87dd0c29c4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 12 Mar 2020 19:53:31 +0100 Subject: LibJS: Add NativeFunction, a callable wrapper around a C++ lambda This can be used to implement arbitrary functionality, callable from JavaScript. To make this work, I had to change the way CallExpression passes arguments to the callee. Instead of a HashMap, we now pass an ordered list of Argument { String name; Value value; }. This patch includes a native "print(argument)" function. :^) --- Base/home/anon/js/native-function.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 Base/home/anon/js/native-function.js (limited to 'Base/home/anon/js') diff --git a/Base/home/anon/js/native-function.js b/Base/home/anon/js/native-function.js new file mode 100644 index 0000000000..932eb9cf56 --- /dev/null +++ b/Base/home/anon/js/native-function.js @@ -0,0 +1 @@ +print("Hello friends!") -- cgit v1.2.3