@ugo-studio/jspp 0.2.8 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/analysis/typeAnalyzer.js +42 -27
  2. package/dist/core/codegen/class-handlers.js +6 -6
  3. package/dist/core/codegen/control-flow-handlers.js +4 -4
  4. package/dist/core/codegen/declaration-handlers.js +21 -3
  5. package/dist/core/codegen/destructuring-handlers.js +187 -0
  6. package/dist/core/codegen/expression-handlers.js +7 -0
  7. package/dist/core/codegen/function-handlers.js +58 -36
  8. package/dist/core/codegen/helpers.js +288 -52
  9. package/dist/core/codegen/index.js +7 -4
  10. package/dist/core/codegen/statement-handlers.js +43 -23
  11. package/package.json +1 -1
  12. package/scripts/precompile-headers.ts +13 -5
  13. package/src/prelude/any_value.hpp +362 -361
  14. package/src/prelude/any_value_access.hpp +170 -170
  15. package/src/prelude/any_value_defines.hpp +189 -189
  16. package/src/prelude/any_value_helpers.hpp +374 -365
  17. package/src/prelude/library/array.hpp +185 -185
  18. package/src/prelude/library/console.hpp +111 -111
  19. package/src/prelude/library/error.hpp +112 -112
  20. package/src/prelude/library/function.hpp +10 -10
  21. package/src/prelude/library/math.hpp +307 -307
  22. package/src/prelude/library/object.hpp +275 -275
  23. package/src/prelude/library/performance.hpp +1 -1
  24. package/src/prelude/library/process.hpp +39 -39
  25. package/src/prelude/library/promise.hpp +123 -123
  26. package/src/prelude/library/symbol.hpp +52 -52
  27. package/src/prelude/library/timer.hpp +91 -91
  28. package/src/prelude/types.hpp +178 -178
  29. package/src/prelude/utils/access.hpp +411 -393
  30. package/src/prelude/utils/operators.hpp +336 -329
  31. package/src/prelude/values/array.hpp +0 -1
  32. package/src/prelude/values/async_iterator.hpp +83 -81
  33. package/src/prelude/values/function.hpp +82 -82
  34. package/src/prelude/values/helpers/array.hpp +198 -208
  35. package/src/prelude/values/helpers/async_iterator.hpp +275 -271
  36. package/src/prelude/values/helpers/function.hpp +108 -108
  37. package/src/prelude/values/helpers/iterator.hpp +144 -107
  38. package/src/prelude/values/helpers/promise.hpp +253 -253
  39. package/src/prelude/values/helpers/string.hpp +37 -47
  40. package/src/prelude/values/iterator.hpp +32 -5
  41. package/src/prelude/values/promise.hpp +72 -72
  42. package/src/prelude/values/prototypes/array.hpp +54 -42
  43. package/src/prelude/values/prototypes/iterator.hpp +201 -74
  44. package/src/prelude/values/prototypes/promise.hpp +196 -196
  45. package/src/prelude/values/prototypes/string.hpp +564 -542
  46. package/src/prelude/values/string.hpp +25 -26
@@ -1,72 +1,72 @@
1
- #pragma once
2
-
3
- #include "types.hpp"
4
- #include "any_value.hpp"
5
- #include <vector>
6
- #include <functional>
7
- #include <memory>
8
- #include <variant>
9
- #include <coroutine>
10
- #include <unordered_map>
11
- #include <string>
12
-
13
- namespace jspp
14
- {
15
- // Forward declaration of AnyValue
16
- class AnyValue;
17
-
18
- enum class PromiseStatus { Pending, Fulfilled, Rejected };
19
-
20
- struct PromiseState
21
- {
22
- PromiseStatus status = PromiseStatus::Pending;
23
- AnyValue result; // Value if fulfilled, reason if rejected
24
- std::vector<std::function<void(const AnyValue&)>> onFulfilled;
25
- std::vector<std::function<void(const AnyValue&)>> onRejected;
26
-
27
- PromiseState(); // Defined in helpers
28
- };
29
-
30
- struct JsPromisePromiseType; // Forward declaration
31
-
32
- struct JsPromise : HeapObject
33
- {
34
- using promise_type = JsPromisePromiseType;
35
-
36
- std::shared_ptr<PromiseState> state;
37
- std::unordered_map<std::string, AnyValue> props;
38
-
39
- JsPromise();
40
-
41
- JsType get_heap_type() const override { return JsType::Promise; }
42
-
43
- // --- Promise Logic ---
44
- void resolve(const AnyValue& value);
45
- void reject(const AnyValue& reason);
46
- void then(std::function<void(const AnyValue&)> onFulfilled, std::function<void(const AnyValue&)> onRejected = nullptr);
47
-
48
- // --- Methods ---
49
- std::string to_std_string() const;
50
- AnyValue get_property(const std::string& key, const AnyValue& thisVal);
51
- AnyValue set_property(const std::string& key, const AnyValue& value, const AnyValue& thisVal);
52
-
53
- auto operator co_await() const;
54
- };
55
-
56
- struct JsPromisePromiseType {
57
- JsPromise promise;
58
-
59
- JsPromise get_return_object() { return promise; }
60
- std::suspend_never initial_suspend() { return {}; }
61
- std::suspend_never final_suspend() noexcept { return {}; }
62
-
63
- void return_value(const AnyValue& val);
64
-
65
- void unhandled_exception();
66
-
67
- // await_transform for AnyValue
68
- auto await_transform(const AnyValue& value);
69
- // await_transform for JsPromise
70
- auto await_transform(const JsPromise& value);
71
- };
72
- }
1
+ #pragma once
2
+
3
+ #include "types.hpp"
4
+ #include "any_value.hpp"
5
+ #include <vector>
6
+ #include <functional>
7
+ #include <memory>
8
+ #include <variant>
9
+ #include <coroutine>
10
+ #include <unordered_map>
11
+ #include <string>
12
+
13
+ namespace jspp
14
+ {
15
+ // Forward declaration of AnyValue
16
+ class AnyValue;
17
+
18
+ enum class PromiseStatus { Pending, Fulfilled, Rejected };
19
+
20
+ struct PromiseState
21
+ {
22
+ PromiseStatus status = PromiseStatus::Pending;
23
+ AnyValue result; // Value if fulfilled, reason if rejected
24
+ std::vector<std::function<void(const AnyValue&)>> onFulfilled;
25
+ std::vector<std::function<void(const AnyValue&)>> onRejected;
26
+
27
+ PromiseState(); // Defined in helpers
28
+ };
29
+
30
+ struct JsPromisePromiseType; // Forward declaration
31
+
32
+ struct JsPromise : HeapObject
33
+ {
34
+ using promise_type = JsPromisePromiseType;
35
+
36
+ std::shared_ptr<PromiseState> state;
37
+ std::unordered_map<std::string, AnyValue> props;
38
+
39
+ JsPromise();
40
+
41
+ JsType get_heap_type() const override { return JsType::Promise; }
42
+
43
+ // --- Promise Logic ---
44
+ void resolve(AnyValue value);
45
+ void reject(AnyValue reason);
46
+ void then(std::function<void(AnyValue)> onFulfilled, std::function<void(AnyValue)> onRejected = nullptr);
47
+
48
+ // --- Methods ---
49
+ std::string to_std_string() const;
50
+ AnyValue get_property(const std::string& key, AnyValue thisVal);
51
+ AnyValue set_property(const std::string& key, AnyValue value, AnyValue thisVal);
52
+
53
+ auto operator co_await() const;
54
+ };
55
+
56
+ struct JsPromisePromiseType {
57
+ JsPromise promise;
58
+
59
+ JsPromise get_return_object() { return promise; }
60
+ std::suspend_never initial_suspend() { return {}; }
61
+ std::suspend_never final_suspend() noexcept { return {}; }
62
+
63
+ void return_value(AnyValue val);
64
+
65
+ void unhandled_exception();
66
+
67
+ // await_transform for AnyValue
68
+ auto await_transform(AnyValue value);
69
+ // await_transform for JsPromise
70
+ auto await_transform(const JsPromise& value);
71
+ };
72
+ }
@@ -22,20 +22,26 @@ namespace jspp
22
22
 
23
23
  inline AnyValue &get_iterator_fn()
24
24
  {
25
- static AnyValue fn = AnyValue::make_generator([](const AnyValue &thisVal, std::span<const AnyValue> _) -> AnyValue
26
- { return AnyValue::from_iterator(thisVal.as_array()->get_iterator()); },
25
+ static AnyValue fn = AnyValue::make_generator([](AnyValue thisVal, std::vector<AnyValue> _) -> jspp::JsIterator<jspp::AnyValue>
26
+ {
27
+ auto arr = thisVal.as_array();
28
+ for (uint64_t idx = 0; idx < arr->length; ++idx)
29
+ {
30
+ co_yield arr->get_property(static_cast<uint32_t>(idx));
31
+ }
32
+ co_return Constants::UNDEFINED; },
27
33
  "Symbol.iterator");
28
34
  return fn;
29
35
  }
30
36
 
31
37
  inline AnyValue &get_length_desc()
32
38
  {
33
- static auto getter = [](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
39
+ static auto getter = [](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
34
40
  {
35
41
  return AnyValue::make_number(thisVal.as_array()->length);
36
42
  };
37
43
 
38
- static auto setter = [](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
44
+ static auto setter = [](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
39
45
  {
40
46
  if (args.empty())
41
47
  {
@@ -84,7 +90,7 @@ namespace jspp
84
90
 
85
91
  inline AnyValue &get_push_fn()
86
92
  {
87
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
93
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
88
94
  {
89
95
  auto self = thisVal.as_array();
90
96
  for (const auto &arg : args)
@@ -98,7 +104,7 @@ namespace jspp
98
104
 
99
105
  inline AnyValue &get_pop_fn()
100
106
  {
101
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
107
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
102
108
  {
103
109
  auto self = thisVal.as_array();
104
110
  if (self->length == 0)
@@ -124,7 +130,7 @@ namespace jspp
124
130
 
125
131
  inline AnyValue &get_shift_fn()
126
132
  {
127
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
133
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
128
134
  {
129
135
  auto self = thisVal.as_array();
130
136
  if (self->length == 0)
@@ -156,7 +162,7 @@ namespace jspp
156
162
 
157
163
  inline AnyValue &get_unshift_fn()
158
164
  {
159
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
165
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
160
166
  {
161
167
  auto self = thisVal.as_array();
162
168
  size_t args_count = args.size();
@@ -184,7 +190,7 @@ namespace jspp
184
190
 
185
191
  inline AnyValue &get_join_fn()
186
192
  {
187
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
193
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
188
194
  {
189
195
  auto self = thisVal.as_array();
190
196
  std::string sep = ",";
@@ -213,7 +219,7 @@ namespace jspp
213
219
 
214
220
  inline AnyValue &get_forEach_fn()
215
221
  {
216
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
222
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
217
223
  {
218
224
  auto self = thisVal.as_array();
219
225
  if (args.empty() || !args[0].is_function())
@@ -238,7 +244,7 @@ namespace jspp
238
244
 
239
245
  inline AnyValue &get_at_fn()
240
246
  {
241
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
247
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
242
248
  {
243
249
  auto self = thisVal.as_array();
244
250
  double len = static_cast<double>(self->length);
@@ -254,7 +260,7 @@ namespace jspp
254
260
 
255
261
  inline AnyValue &get_includes_fn()
256
262
  {
257
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
263
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
258
264
  {
259
265
  auto self = thisVal.as_array();
260
266
  AnyValue searchElement = args.empty() ? Constants::UNDEFINED : args[0];
@@ -280,7 +286,7 @@ namespace jspp
280
286
 
281
287
  inline AnyValue &get_indexOf_fn()
282
288
  {
283
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
289
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
284
290
  {
285
291
  auto self = thisVal.as_array();
286
292
  AnyValue searchElement = args.empty() ? Constants::UNDEFINED : args[0];
@@ -306,7 +312,7 @@ namespace jspp
306
312
 
307
313
  inline AnyValue &get_lastIndexOf_fn()
308
314
  {
309
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
315
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
310
316
  {
311
317
  auto self = thisVal.as_array();
312
318
  AnyValue searchElement = args.empty() ? Constants::UNDEFINED : args[0];
@@ -333,7 +339,7 @@ namespace jspp
333
339
 
334
340
  inline AnyValue &get_find_fn()
335
341
  {
336
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
342
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
337
343
  {
338
344
  auto self = thisVal.as_array();
339
345
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -357,7 +363,7 @@ namespace jspp
357
363
 
358
364
  inline AnyValue &get_findIndex_fn()
359
365
  {
360
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
366
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
361
367
  {
362
368
  auto self = thisVal.as_array();
363
369
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -381,7 +387,7 @@ namespace jspp
381
387
 
382
388
  inline AnyValue &get_findLast_fn()
383
389
  {
384
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
390
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
385
391
  {
386
392
  auto self = thisVal.as_array();
387
393
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -405,7 +411,7 @@ namespace jspp
405
411
 
406
412
  inline AnyValue &get_findLastIndex_fn()
407
413
  {
408
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
414
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
409
415
  {
410
416
  auto self = thisVal.as_array();
411
417
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -429,15 +435,21 @@ namespace jspp
429
435
 
430
436
  inline AnyValue &get_values_fn()
431
437
  {
432
- static AnyValue fn = AnyValue::make_generator([](const AnyValue &thisVal, std::span<const AnyValue> _) -> jspp::JsIterator<jspp::AnyValue>
433
- { return thisVal.as_array()->get_iterator(); },
438
+ static AnyValue fn = AnyValue::make_generator([](AnyValue thisVal, std::vector<AnyValue> _) -> jspp::JsIterator<jspp::AnyValue>
439
+ {
440
+ auto arr = thisVal.as_array();
441
+ for (uint64_t idx = 0; idx < arr->length; ++idx)
442
+ {
443
+ co_yield arr->get_property(static_cast<uint32_t>(idx));
444
+ }
445
+ co_return Constants::UNDEFINED; },
434
446
  "values");
435
447
  return fn;
436
448
  }
437
449
 
438
450
  inline AnyValue &get_keys_fn()
439
451
  {
440
- static AnyValue fn = AnyValue::make_generator([](const AnyValue &thisVal, std::span<const AnyValue> _) -> jspp::JsIterator<jspp::AnyValue>
452
+ static AnyValue fn = AnyValue::make_generator([](AnyValue thisVal, std::vector<AnyValue> _) -> jspp::JsIterator<jspp::AnyValue>
441
453
  {
442
454
  auto self = thisVal.as_array();
443
455
  for (uint64_t i = 0; i < self->length; ++i) {
@@ -450,7 +462,7 @@ namespace jspp
450
462
 
451
463
  inline AnyValue &get_entries_fn()
452
464
  {
453
- static AnyValue fn = AnyValue::make_generator([](const AnyValue &thisVal, std::span<const AnyValue> _) -> jspp::JsIterator<jspp::AnyValue>
465
+ static AnyValue fn = AnyValue::make_generator([](AnyValue thisVal, std::vector<AnyValue> _) -> jspp::JsIterator<jspp::AnyValue>
454
466
  {
455
467
  auto self = thisVal.as_array();
456
468
  for (uint64_t i = 0; i < self->length; ++i) {
@@ -466,7 +478,7 @@ namespace jspp
466
478
 
467
479
  inline AnyValue &get_map_fn()
468
480
  {
469
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
481
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
470
482
  {
471
483
  auto self = thisVal.as_array();
472
484
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -493,7 +505,7 @@ namespace jspp
493
505
 
494
506
  inline AnyValue &get_filter_fn()
495
507
  {
496
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
508
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
497
509
  {
498
510
  auto self = thisVal.as_array();
499
511
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -519,7 +531,7 @@ namespace jspp
519
531
 
520
532
  inline AnyValue &get_every_fn()
521
533
  {
522
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
534
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
523
535
  {
524
536
  auto self = thisVal.as_array();
525
537
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -543,7 +555,7 @@ namespace jspp
543
555
 
544
556
  inline AnyValue &get_some_fn()
545
557
  {
546
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
558
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
547
559
  {
548
560
  auto self = thisVal.as_array();
549
561
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -567,7 +579,7 @@ namespace jspp
567
579
 
568
580
  inline AnyValue &get_reduce_fn()
569
581
  {
570
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
582
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
571
583
  {
572
584
  auto self = thisVal.as_array();
573
585
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -607,7 +619,7 @@ namespace jspp
607
619
 
608
620
  inline AnyValue &get_reduceRight_fn()
609
621
  {
610
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
622
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
611
623
  {
612
624
  auto self = thisVal.as_array();
613
625
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -647,7 +659,7 @@ namespace jspp
647
659
 
648
660
  inline AnyValue &get_flat_fn()
649
661
  {
650
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
662
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
651
663
  {
652
664
  auto self = thisVal.as_array();
653
665
  double depthVal = (args.size() > 0 && !args[0].is_undefined()) ? Operators_Private::ToNumber(args[0]) : 1;
@@ -681,7 +693,7 @@ namespace jspp
681
693
 
682
694
  inline AnyValue &get_flatMap_fn()
683
695
  {
684
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
696
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
685
697
  {
686
698
  auto self = thisVal.as_array();
687
699
  if (args.empty() || !args[0].is_function()) throw Exception::make_exception("callback is not a function", "TypeError");
@@ -716,7 +728,7 @@ namespace jspp
716
728
 
717
729
  inline AnyValue &get_fill_fn()
718
730
  {
719
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
731
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
720
732
  {
721
733
  auto self = thisVal.as_array();
722
734
  AnyValue value = args.empty() ? Constants::UNDEFINED : args[0];
@@ -742,7 +754,7 @@ namespace jspp
742
754
 
743
755
  inline AnyValue &get_reverse_fn()
744
756
  {
745
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
757
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
746
758
  {
747
759
  auto self = thisVal.as_array();
748
760
  uint64_t len = self->length;
@@ -775,7 +787,7 @@ namespace jspp
775
787
 
776
788
  inline AnyValue &get_sort_fn()
777
789
  {
778
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
790
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
779
791
  {
780
792
  auto self = thisVal.as_array();
781
793
  AnyValue compareFn = args.empty() ? Constants::UNDEFINED : args[0];
@@ -818,7 +830,7 @@ namespace jspp
818
830
 
819
831
  inline AnyValue &get_splice_fn()
820
832
  {
821
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
833
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
822
834
  {
823
835
  auto self = thisVal.as_array();
824
836
  double len = static_cast<double>(self->length);
@@ -890,7 +902,7 @@ namespace jspp
890
902
 
891
903
  inline AnyValue &get_copyWithin_fn()
892
904
  {
893
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
905
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
894
906
  {
895
907
  auto self = thisVal.as_array();
896
908
  double len = static_cast<double>(self->length);
@@ -942,7 +954,7 @@ namespace jspp
942
954
 
943
955
  inline AnyValue &get_concat_fn()
944
956
  {
945
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
957
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
946
958
  {
947
959
  auto self = thisVal.as_array();
948
960
  std::vector<AnyValue> result;
@@ -989,7 +1001,7 @@ namespace jspp
989
1001
 
990
1002
  inline AnyValue &get_slice_fn()
991
1003
  {
992
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
1004
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
993
1005
  {
994
1006
  auto self = thisVal.as_array();
995
1007
  double len = static_cast<double>(self->length);
@@ -1021,7 +1033,7 @@ namespace jspp
1021
1033
 
1022
1034
  inline AnyValue &get_toReversed_fn()
1023
1035
  {
1024
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
1036
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
1025
1037
  {
1026
1038
  auto copy = thisVal.get_property_with_receiver("slice", thisVal).call(thisVal, {});
1027
1039
  copy.get_own_property("reverse").call(copy, {});
@@ -1032,7 +1044,7 @@ namespace jspp
1032
1044
 
1033
1045
  inline AnyValue &get_toSorted_fn()
1034
1046
  {
1035
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
1047
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
1036
1048
  {
1037
1049
  auto copy = thisVal.get_property_with_receiver("slice", thisVal).call(thisVal, {});
1038
1050
  copy.get_own_property("sort").call(copy, args);
@@ -1043,7 +1055,7 @@ namespace jspp
1043
1055
 
1044
1056
  inline AnyValue &get_toSpliced_fn()
1045
1057
  {
1046
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
1058
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
1047
1059
  {
1048
1060
  auto copy = thisVal.get_property_with_receiver("slice", thisVal).call(thisVal, {});
1049
1061
  copy.get_own_property("splice").call(copy, args);
@@ -1054,7 +1066,7 @@ namespace jspp
1054
1066
 
1055
1067
  inline AnyValue &get_with_fn()
1056
1068
  {
1057
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
1069
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
1058
1070
  {
1059
1071
  auto self = thisVal.as_array();
1060
1072
  auto copy = thisVal.get_property_with_receiver("slice", thisVal).call(thisVal, {});
@@ -1075,7 +1087,7 @@ namespace jspp
1075
1087
 
1076
1088
  inline AnyValue &get_toLocaleString_fn()
1077
1089
  {
1078
- static AnyValue fn = AnyValue::make_function([](const AnyValue &thisVal, std::span<const AnyValue> args) -> AnyValue
1090
+ static AnyValue fn = AnyValue::make_function([](AnyValue thisVal, std::span<const AnyValue> args) -> AnyValue
1079
1091
  {
1080
1092
  auto self = thisVal.as_array();
1081
1093
  std::string result = "";