goscript 0.0.5 → 0.0.7

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 (130) hide show
  1. package/README.md +9 -2
  2. package/builtin/builtin.ts +31 -21
  3. package/compiler/compile.go +2 -3
  4. package/compiler/compile_expr.go +7 -3
  5. package/compiler/compile_stmt.go +3 -7
  6. package/compiler/output.go +10 -0
  7. package/compiler/pkg_compiler.go +1 -2
  8. package/compiler/types/tokens.go +65 -0
  9. package/compiler/types/types.go +46 -0
  10. package/dist/builtin/builtin.d.ts +1 -1
  11. package/dist/builtin/builtin.js +29 -18
  12. package/dist/builtin/builtin.js.map +1 -1
  13. package/dist/compliance/tests/array_literal/array_literal.gs.d.ts +1 -0
  14. package/dist/compliance/tests/array_literal/array_literal.gs.js +14 -0
  15. package/dist/compliance/tests/array_literal/array_literal.gs.js.map +1 -0
  16. package/dist/compliance/tests/async_basic/async_basic.gs.d.ts +1 -0
  17. package/dist/compliance/tests/async_basic/async_basic.gs.js +24 -0
  18. package/dist/compliance/tests/async_basic/async_basic.gs.js.map +1 -0
  19. package/dist/compliance/tests/basic_arithmetic/basic_arithmetic.gs.d.ts +1 -0
  20. package/dist/compliance/tests/basic_arithmetic/basic_arithmetic.gs.js +16 -0
  21. package/dist/compliance/tests/basic_arithmetic/basic_arithmetic.gs.js.map +1 -0
  22. package/dist/compliance/tests/boolean_logic/boolean_logic.gs.d.ts +1 -0
  23. package/dist/compliance/tests/boolean_logic/boolean_logic.gs.js +14 -0
  24. package/dist/compliance/tests/boolean_logic/boolean_logic.gs.js.map +1 -0
  25. package/dist/compliance/tests/channel_basic/channel_basic.gs.d.ts +1 -0
  26. package/dist/compliance/tests/channel_basic/channel_basic.gs.js +14 -0
  27. package/dist/compliance/tests/channel_basic/channel_basic.gs.js.map +1 -0
  28. package/dist/compliance/tests/composite_literal_assignment/composite_literal_assignment.gs.d.ts +1 -0
  29. package/dist/compliance/tests/composite_literal_assignment/composite_literal_assignment.gs.js +23 -0
  30. package/dist/compliance/tests/composite_literal_assignment/composite_literal_assignment.gs.js.map +1 -0
  31. package/dist/compliance/tests/constants/constants.gs.d.ts +1 -0
  32. package/dist/compliance/tests/constants/constants.gs.js +16 -0
  33. package/dist/compliance/tests/constants/constants.gs.js.map +1 -0
  34. package/dist/compliance/tests/copy_independence/copy_independence.gs.d.ts +1 -0
  35. package/dist/compliance/tests/copy_independence/copy_independence.gs.js +31 -0
  36. package/dist/compliance/tests/copy_independence/copy_independence.gs.js.map +1 -0
  37. package/dist/compliance/tests/float64/float64.gs.d.ts +1 -0
  38. package/dist/compliance/tests/float64/float64.gs.js +23 -0
  39. package/dist/compliance/tests/float64/float64.gs.js.map +1 -0
  40. package/dist/compliance/tests/for_loop_basic/for_loop_basic.gs.d.ts +1 -0
  41. package/dist/compliance/tests/for_loop_basic/for_loop_basic.gs.js +10 -0
  42. package/dist/compliance/tests/for_loop_basic/for_loop_basic.gs.js.map +1 -0
  43. package/dist/compliance/tests/for_loop_condition_only/main.gs.d.ts +1 -0
  44. package/dist/compliance/tests/for_loop_condition_only/main.gs.js +10 -0
  45. package/dist/compliance/tests/for_loop_condition_only/main.gs.js.map +1 -0
  46. package/dist/compliance/tests/for_range/for_range.gs.d.ts +1 -0
  47. package/dist/compliance/tests/for_range/for_range.gs.js +39 -0
  48. package/dist/compliance/tests/for_range/for_range.gs.js.map +1 -0
  49. package/dist/compliance/tests/for_range_index_use/for_range_index_use.gs.d.ts +1 -0
  50. package/dist/compliance/tests/for_range_index_use/for_range_index_use.gs.js +15 -0
  51. package/dist/compliance/tests/for_range_index_use/for_range_index_use.gs.js.map +1 -0
  52. package/dist/compliance/tests/func_literal/func_literal.gs.d.ts +1 -0
  53. package/dist/compliance/tests/func_literal/func_literal.gs.js +10 -0
  54. package/dist/compliance/tests/func_literal/func_literal.gs.js.map +1 -0
  55. package/dist/compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.d.ts +10 -0
  56. package/dist/compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.js +26 -0
  57. package/dist/compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.js.map +1 -0
  58. package/dist/compliance/tests/if_statement/if_statement.gs.d.ts +1 -0
  59. package/dist/compliance/tests/if_statement/if_statement.gs.js +13 -0
  60. package/dist/compliance/tests/if_statement/if_statement.gs.js.map +1 -0
  61. package/dist/compliance/tests/interface_to_interface_type_assertion/interface_to_interface_type_assertion.gs.d.ts +1 -0
  62. package/dist/compliance/tests/interface_to_interface_type_assertion/interface_to_interface_type_assertion.gs.js +26 -0
  63. package/dist/compliance/tests/interface_to_interface_type_assertion/interface_to_interface_type_assertion.gs.js.map +1 -0
  64. package/dist/compliance/tests/interface_type_assertion/interface_type_assertion.gs.d.ts +1 -0
  65. package/dist/compliance/tests/interface_type_assertion/interface_type_assertion.gs.js +26 -0
  66. package/dist/compliance/tests/interface_type_assertion/interface_type_assertion.gs.js.map +1 -0
  67. package/dist/compliance/tests/map_support/map_support.gs.d.ts +1 -0
  68. package/dist/compliance/tests/map_support/map_support.gs.js +88 -0
  69. package/dist/compliance/tests/map_support/map_support.gs.js.map +1 -0
  70. package/dist/compliance/tests/method_call_on_pointer_receiver/method_call_on_pointer_receiver.gs.d.ts +1 -0
  71. package/dist/compliance/tests/method_call_on_pointer_receiver/method_call_on_pointer_receiver.gs.js +22 -0
  72. package/dist/compliance/tests/method_call_on_pointer_receiver/method_call_on_pointer_receiver.gs.js.map +1 -0
  73. package/dist/compliance/tests/method_call_on_pointer_via_value/method_call_on_pointer_via_value.gs.d.ts +1 -0
  74. package/dist/compliance/tests/method_call_on_pointer_via_value/method_call_on_pointer_via_value.gs.js +30 -0
  75. package/dist/compliance/tests/method_call_on_pointer_via_value/method_call_on_pointer_via_value.gs.js.map +1 -0
  76. package/dist/compliance/tests/method_call_on_value_receiver/method_call_on_value_receiver.gs.d.ts +1 -0
  77. package/dist/compliance/tests/method_call_on_value_receiver/method_call_on_value_receiver.gs.js +19 -0
  78. package/dist/compliance/tests/method_call_on_value_receiver/method_call_on_value_receiver.gs.js.map +1 -0
  79. package/dist/compliance/tests/method_call_on_value_via_pointer/method_call_on_value_via_pointer.gs.d.ts +1 -0
  80. package/dist/compliance/tests/method_call_on_value_via_pointer/method_call_on_value_via_pointer.gs.js +30 -0
  81. package/dist/compliance/tests/method_call_on_value_via_pointer/method_call_on_value_via_pointer.gs.js.map +1 -0
  82. package/dist/compliance/tests/multiple_return_values/multiple_return_values.gs.d.ts +1 -0
  83. package/dist/compliance/tests/multiple_return_values/multiple_return_values.gs.js +17 -0
  84. package/dist/compliance/tests/multiple_return_values/multiple_return_values.gs.js.map +1 -0
  85. package/dist/compliance/tests/pointer_assignment_no_copy/pointer_assignment_no_copy.gs.d.ts +1 -0
  86. package/dist/compliance/tests/pointer_assignment_no_copy/pointer_assignment_no_copy.gs.js +26 -0
  87. package/dist/compliance/tests/pointer_assignment_no_copy/pointer_assignment_no_copy.gs.js.map +1 -0
  88. package/dist/compliance/tests/pointer_composite_literal_assignment/pointer_composite_literal_assignment.gs.d.ts +1 -0
  89. package/dist/compliance/tests/pointer_composite_literal_assignment/pointer_composite_literal_assignment.gs.js +24 -0
  90. package/dist/compliance/tests/pointer_composite_literal_assignment/pointer_composite_literal_assignment.gs.js.map +1 -0
  91. package/dist/compliance/tests/pointer_deref_multiassign/pointer_deref_multiassign.gs.d.ts +1 -0
  92. package/dist/compliance/tests/pointer_deref_multiassign/pointer_deref_multiassign.gs.js +19 -0
  93. package/dist/compliance/tests/pointer_deref_multiassign/pointer_deref_multiassign.gs.js.map +1 -0
  94. package/dist/compliance/tests/pointer_initialization/pointer_initialization.gs.d.ts +1 -0
  95. package/dist/compliance/tests/pointer_initialization/pointer_initialization.gs.js +18 -0
  96. package/dist/compliance/tests/pointer_initialization/pointer_initialization.gs.js.map +1 -0
  97. package/dist/compliance/tests/select_receive_on_closed_channel_no_default/select_receive_on_closed_channel_no_default.gs.d.ts +1 -0
  98. package/dist/compliance/tests/select_receive_on_closed_channel_no_default/select_receive_on_closed_channel_no_default.gs.js +27 -0
  99. package/dist/compliance/tests/select_receive_on_closed_channel_no_default/select_receive_on_closed_channel_no_default.gs.js.map +1 -0
  100. package/dist/compliance/tests/select_send_on_full_buffered_channel_with_default/select_send_on_full_buffered_channel_with_default.gs.d.ts +1 -0
  101. package/dist/compliance/tests/select_send_on_full_buffered_channel_with_default/select_send_on_full_buffered_channel_with_default.gs.js +29 -0
  102. package/dist/compliance/tests/select_send_on_full_buffered_channel_with_default/select_send_on_full_buffered_channel_with_default.gs.js.map +1 -0
  103. package/dist/compliance/tests/select_statement/select_statement.gs.d.ts +1 -0
  104. package/dist/compliance/tests/select_statement/select_statement.gs.js +209 -0
  105. package/dist/compliance/tests/select_statement/select_statement.gs.js.map +1 -0
  106. package/dist/compliance/tests/simple/simple.gs.d.ts +1 -0
  107. package/dist/compliance/tests/simple/simple.gs.js +6 -0
  108. package/dist/compliance/tests/simple/simple.gs.js.map +1 -0
  109. package/dist/compliance/tests/simple_deref_assignment/simple_deref_assignment.gs.d.ts +1 -0
  110. package/dist/compliance/tests/simple_deref_assignment/simple_deref_assignment.gs.js +22 -0
  111. package/dist/compliance/tests/simple_deref_assignment/simple_deref_assignment.gs.js.map +1 -0
  112. package/dist/compliance/tests/slices/slices.gs.d.ts +1 -0
  113. package/dist/compliance/tests/slices/slices.gs.js +21 -0
  114. package/dist/compliance/tests/slices/slices.gs.js.map +1 -0
  115. package/dist/compliance/tests/string_rune_conversion/string_rune_conversion.gs.d.ts +1 -0
  116. package/dist/compliance/tests/string_rune_conversion/string_rune_conversion.gs.js +17 -0
  117. package/dist/compliance/tests/string_rune_conversion/string_rune_conversion.gs.js.map +1 -0
  118. package/dist/compliance/tests/struct_field_access/struct_field_access.gs.d.ts +1 -0
  119. package/dist/compliance/tests/struct_field_access/struct_field_access.gs.js +16 -0
  120. package/dist/compliance/tests/struct_field_access/struct_field_access.gs.js.map +1 -0
  121. package/dist/compliance/tests/struct_value_init_clone/struct_value_init_clone.gs.d.ts +1 -0
  122. package/dist/compliance/tests/struct_value_init_clone/struct_value_init_clone.gs.js +27 -0
  123. package/dist/compliance/tests/struct_value_init_clone/struct_value_init_clone.gs.js.map +1 -0
  124. package/dist/compliance/tests/switch_statement/switch_statement.gs.d.ts +1 -0
  125. package/dist/compliance/tests/switch_statement/switch_statement.gs.js +76 -0
  126. package/dist/compliance/tests/switch_statement/switch_statement.gs.js.map +1 -0
  127. package/dist/compliance/tests/value_type_copy_behavior/value_type_copy_behavior.gs.d.ts +1 -0
  128. package/dist/compliance/tests/value_type_copy_behavior/value_type_copy_behavior.gs.js +29 -0
  129. package/dist/compliance/tests/value_type_copy_behavior/value_type_copy_behavior.gs.js.map +1 -0
  130. package/package.json +1 -1
@@ -0,0 +1,26 @@
1
+ // Generated file based on pointer_assignment_no_copy.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ class MyStruct {
4
+ MyInt = 0;
5
+ MyString = "";
6
+ constructor(init) { if (init)
7
+ Object.assign(this, init); }
8
+ clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
9
+ }
10
+ export async function main() {
11
+ let original = new MyStruct({ MyInt: 10, MyString: "original" });
12
+ // === Pointer Assignment (No Copy) ===
13
+ // Assigning a pointer variable to another pointer variable.
14
+ let pointerCopy = original;
15
+ // Modify the struct through the original pointer.
16
+ original.MyString = "modified original";
17
+ // The change should be reflected when accessing through the copied pointer.
18
+ // Expected: "modified original"
19
+ console.log("Pointer copy value: Expected: modified original, Actual: " + pointerCopy.MyString);
20
+ // Modify the struct through the copied pointer.
21
+ pointerCopy.MyInt = 20;
22
+ // The change should be reflected when accessing through the original pointer.
23
+ // Expected: 20
24
+ console.log("Original value after pointer copy modification: Expected: 20, Actual:", original.MyInt);
25
+ }
26
+ //# sourceMappingURL=pointer_assignment_no_copy.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointer_assignment_no_copy.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/pointer_assignment_no_copy/pointer_assignment_no_copy.gs.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,yDAAyD;AAIzD,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAClB,QAAQ,GAAW,EAAE,CAAC;IAE7B,YAAY,IAAwB,IAAI,IAAI,IAAI;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC,CAAC;IAC9E,KAAK,KAAe,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACvG;AAED,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,QAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAA;IAEhE,uCAAuC;IACvC,4DAA4D;IAC5D,IAAI,WAAW,GAAG,QAAQ,CAAA;IAE1B,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,GAAG,mBAAmB,CAAA;IAEvC,4EAA4E;IAC5E,gCAAgC;IAChC,OAAO,CAAC,GAAG,CAAC,2DAA2D,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;IAE/F,gDAAgD;IAChD,WAAW,CAAC,KAAK,GAAG,EAAE,CAAA;IAEtB,8EAA8E;IAC9E,eAAe;IACf,OAAO,CAAC,GAAG,CAAC,uEAAuE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;AACrG,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,24 @@
1
+ // Generated file based on pointer_composite_literal_assignment.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ class MyStruct {
4
+ MyInt = 0;
5
+ MyString = "";
6
+ constructor(init) { if (init)
7
+ Object.assign(this, init); }
8
+ clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
9
+ }
10
+ export async function main() {
11
+ // === Pointer Composite Literal Assignment ===
12
+ // Creating a pointer to a struct directly using a composite literal with &
13
+ let structPointer = new MyStruct({ MyInt: 42, MyString: "composite literal pointer" });
14
+ // Access fields through the pointer
15
+ // Expected: 42
16
+ console.log("MyInt via pointer: Expected: 42, Actual:", structPointer.MyInt);
17
+ // Expected: "composite literal pointer"
18
+ console.log("MyString via pointer: Expected: composite literal pointer, Actual: " + structPointer.MyString);
19
+ // Modify through the pointer
20
+ structPointer.MyInt = 99;
21
+ // Expected: 99
22
+ console.log("MyInt after modification: Expected: 99, Actual:", structPointer.MyInt);
23
+ }
24
+ //# sourceMappingURL=pointer_composite_literal_assignment.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointer_composite_literal_assignment.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/pointer_composite_literal_assignment/pointer_composite_literal_assignment.gs.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,yDAAyD;AAIzD,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAClB,QAAQ,GAAW,EAAE,CAAC;IAE7B,YAAY,IAAwB,IAAI,IAAI,IAAI;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC,CAAC;IAC9E,KAAK,KAAe,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACvG;AAED,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,+CAA+C;IAC/C,2EAA2E;IAC3E,IAAI,aAAa,GAAG,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,2BAA2B,EAAE,CAAC,CAAA;IAEtF,oCAAoC;IACpC,eAAe;IACf,OAAO,CAAC,GAAG,CAAC,0CAA0C,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;IAC5E,wCAAwC;IACxC,OAAO,CAAC,GAAG,CAAC,qEAAqE,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IAE3G,6BAA6B;IAC7B,aAAa,CAAC,KAAK,GAAG,EAAE,CAAA;IACxB,eAAe;IACf,OAAO,CAAC,GAAG,CAAC,iDAAiD,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;AACpF,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,19 @@
1
+ // Generated file based on pointer_deref_multiassign.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ class MyStruct {
4
+ MyInt = 0;
5
+ MyString = "";
6
+ myBool = false;
7
+ constructor(init) { if (init)
8
+ Object.assign(this, init); }
9
+ clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
10
+ }
11
+ export async function main() {
12
+ let structPointer = new MyStruct({ MyInt: 4, MyString: "hello world" });
13
+ // === Pointer Dereference and Multi-Assignment ===
14
+ // Dereference structPointer to get a copy of the struct.
15
+ // Also demonstrates multi-variable assignment and the use of the blank identifier '_'.
16
+ let dereferencedStructCopy = structPointer.clone();
17
+ let unusedString = "hello"; // testing _ set
18
+ }
19
+ //# sourceMappingURL=pointer_deref_multiassign.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointer_deref_multiassign.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/pointer_deref_multiassign/pointer_deref_multiassign.gs.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,yDAAyD;AAIzD,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAClB,QAAQ,GAAW,EAAE,CAAC;IACrB,MAAM,GAAY,KAAK,CAAC;IAEhC,YAAY,IAAwB,IAAI,IAAI,IAAI;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC,CAAC;IAC9E,KAAK,KAAe,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACvG;AAED,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,aAAa,GAAG,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAA;IACvE,mDAAmD;IACnD,yDAAyD;IACzD,uFAAuF;IACvF,IAAI,sBAAsB,GAAG,aAAa,CAAC,KAAK,EAAE,CAAA;IAClD,IAAI,YAAY,GAAG,OAAO,CAAA,CAAC,gBAAgB;AAC5C,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,18 @@
1
+ // Generated file based on pointer_initialization.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ class MyStruct {
4
+ MyInt = 0;
5
+ MyString = "";
6
+ myBool = false;
7
+ constructor(init) { if (init)
8
+ Object.assign(this, init); }
9
+ clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
10
+ }
11
+ export async function main() {
12
+ // === Pointer Initialization ===
13
+ // Create a pointer to a MyStruct instance using a composite literal.
14
+ let structPointer = new MyStruct({ MyInt: 4, MyString: "hello world" });
15
+ // Expected: "hello world"
16
+ console.log("Initial MyString (via pointer): Expected: hello world, Actual: " + structPointer.MyString);
17
+ }
18
+ //# sourceMappingURL=pointer_initialization.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointer_initialization.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/pointer_initialization/pointer_initialization.gs.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,yDAAyD;AAIzD,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAClB,QAAQ,GAAW,EAAE,CAAC;IACrB,MAAM,GAAY,KAAK,CAAC;IAEhC,YAAY,IAAwB,IAAI,IAAI,IAAI;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC,CAAC;IAC9E,KAAK,KAAe,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACvG;AAED,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,iCAAiC;IACjC,qEAAqE;IACrE,IAAI,aAAa,GAAG,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAA;IACvE,0BAA0B;IAC1B,OAAO,CAAC,GAAG,CAAC,iEAAiE,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;AACxG,CAAC"}
@@ -0,0 +1,27 @@
1
+ // Generated file based on select_receive_on_closed_channel_no_default.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ import * as goscript from "@go/builtin";
4
+ export async function main() {
5
+ let ch = goscript.makeChannel(0, 0); // Unbuffered
6
+ ch.close();
7
+ // Should not be reached
8
+ // Should be reached
9
+ const _tempVar1 = [];
10
+ _tempVar1.push({
11
+ id: 0,
12
+ isSend: false,
13
+ channel: ch,
14
+ onSelected: async (result) => {
15
+ const val = result.value;
16
+ const ok = result.ok;
17
+ if (ok) {
18
+ console.log("Received value with ok==true:", val); // Should not be reached
19
+ }
20
+ else {
21
+ console.log("Received zero value with ok==false:", val); // Should be reached
22
+ }
23
+ }
24
+ }),
25
+ await goscript.selectStatement(_tempVar1, false);
26
+ }
27
+ //# sourceMappingURL=select_receive_on_closed_channel_no_default.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select_receive_on_closed_channel_no_default.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/select_receive_on_closed_channel_no_default/select_receive_on_closed_channel_no_default.gs.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAS,CAAC,EAAE,CAAC,CAAC,CAAA,CAAC,aAAa;IACzD,EAAE,CAAC,KAAK,EAAE,CAAA;IAEV,wBAAwB;IAExB,oBAAoB;IACpB,MAAM,SAAS,GAA+B,EAAE,CAAA;IAChD,SAAS,CAAC,IAAI,CAAC;QACd,EAAE,EAAE,CAAC;QACL,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAA;YACxB,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAA;YACpB,IAAI,EAAE,EAAE,CAAC;gBACR,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAA,CAAC,wBAAwB;YAC3E,CAAC;iBAAM,CAAC;gBACP,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAA,CAAC,oBAAoB;YAC7E,CAAC;QACF,CAAC;KACD,CAAC;QAEF,MAAM,QAAQ,CAAC,eAAe,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;AACjD,CAAC"}
@@ -0,0 +1,29 @@
1
+ // Generated file based on select_send_on_full_buffered_channel_with_default.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ import * as goscript from "@go/builtin";
4
+ export async function main() {
5
+ let ch = goscript.makeChannel(1, 0);
6
+ await ch.send(1);
7
+ // Should not be reached
8
+ // Should be reached
9
+ const _tempVar1 = [];
10
+ _tempVar1.push({
11
+ id: 0,
12
+ isSend: true,
13
+ channel: ch,
14
+ value: 2,
15
+ onSelected: async (result) => {
16
+ console.log("Sent value");
17
+ }
18
+ }),
19
+ _tempVar1.push({
20
+ id: -1,
21
+ isSend: false,
22
+ channel: null,
23
+ onSelected: async (result) => {
24
+ console.log("Default case hit");
25
+ }
26
+ }),
27
+ await goscript.selectStatement(_tempVar1, true);
28
+ }
29
+ //# sourceMappingURL=select_send_on_full_buffered_channel_with_default.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select_send_on_full_buffered_channel_with_default.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/select_send_on_full_buffered_channel_with_default/select_send_on_full_buffered_channel_with_default.gs.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAS,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3C,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAEhB,wBAAwB;IAExB,oBAAoB;IACpB,MAAM,SAAS,GAA+B,EAAE,CAAA;IAChD,SAAS,CAAC,IAAI,CAAC;QACd,EAAE,EAAE,CAAC;QACL,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAC1B,CAAC;KACD,CAAC;QAEF,SAAS,CAAC,IAAI,CAAC;YACd,EAAE,EAAE,CAAC,CAAC;YACN,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC5B,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;YAChC,CAAC;SACD,CAAC;QAEF,MAAM,QAAQ,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAChD,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,209 @@
1
+ // Generated file based on select_statement.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ import * as goscript from "@go/builtin";
4
+ export async function main() {
5
+ // Test 1: Simple deterministic select with default
6
+ // Create a buffered channel so sends don't block
7
+ let ch1 = goscript.makeChannel(1, "");
8
+ // First test: empty channel, should hit default
9
+ const _tempVar1 = [];
10
+ _tempVar1.push({
11
+ id: 0,
12
+ isSend: false,
13
+ channel: ch1,
14
+ onSelected: async (result) => {
15
+ const msg = result.value;
16
+ console.log("TEST1: Received unexpected value:", msg);
17
+ }
18
+ }),
19
+ _tempVar1.push({
20
+ id: -1,
21
+ isSend: false,
22
+ channel: null,
23
+ onSelected: async (result) => {
24
+ console.log("TEST1: Default case hit correctly");
25
+ }
26
+ }),
27
+ await goscript.selectStatement(_tempVar1, true);
28
+ // Now put something in the channel
29
+ await ch1.send("hello");
30
+ // Second test: should read from channel
31
+ const _tempVar2 = [];
32
+ _tempVar2.push({
33
+ id: 0,
34
+ isSend: false,
35
+ channel: ch1,
36
+ onSelected: async (result) => {
37
+ const msg = result.value;
38
+ console.log("TEST2: Received expected value:", msg);
39
+ }
40
+ }),
41
+ _tempVar2.push({
42
+ id: -1,
43
+ isSend: false,
44
+ channel: null,
45
+ onSelected: async (result) => {
46
+ console.log("TEST2: Default case hit unexpectedly");
47
+ }
48
+ }),
49
+ await goscript.selectStatement(_tempVar2, true);
50
+ // Test 3: Select with channel closing and ok value
51
+ let ch2 = goscript.makeChannel(1, 0);
52
+ await ch2.send(42);
53
+ ch2.close();
54
+ // First receive gets the buffered value
55
+ const _tempVar3 = [];
56
+ _tempVar3.push({
57
+ id: 0,
58
+ isSend: false,
59
+ channel: ch2,
60
+ onSelected: async (result) => {
61
+ const val = result.value;
62
+ const ok = result.ok;
63
+ if (ok) {
64
+ console.log("TEST3: Received buffered value with ok==true:", val);
65
+ }
66
+ else {
67
+ console.log("TEST3: Unexpected ok==false");
68
+ }
69
+ }
70
+ }),
71
+ _tempVar3.push({
72
+ id: -1,
73
+ isSend: false,
74
+ channel: null,
75
+ onSelected: async (result) => {
76
+ console.log("TEST3: Default hit unexpectedly");
77
+ }
78
+ }),
79
+ await goscript.selectStatement(_tempVar3, true);
80
+ // Second receive gets the zero value with ok==false
81
+ const _tempVar4 = [];
82
+ _tempVar4.push({
83
+ id: 0,
84
+ isSend: false,
85
+ channel: ch2,
86
+ onSelected: async (result) => {
87
+ const val = result.value;
88
+ const ok = result.ok;
89
+ if (ok) {
90
+ console.log("TEST4: Unexpected ok==true:", val);
91
+ }
92
+ else {
93
+ console.log("TEST4: Received zero value with ok==false:", val);
94
+ }
95
+ }
96
+ }),
97
+ _tempVar4.push({
98
+ id: -1,
99
+ isSend: false,
100
+ channel: null,
101
+ onSelected: async (result) => {
102
+ console.log("TEST4: Default hit unexpectedly");
103
+ }
104
+ }),
105
+ await goscript.selectStatement(_tempVar4, true);
106
+ // Test 5: Send operations
107
+ let ch3 = goscript.makeChannel(1, 0);
108
+ // First send should succeed (buffer not full)
109
+ const _tempVar5 = [];
110
+ _tempVar5.push({
111
+ id: 0,
112
+ isSend: true,
113
+ channel: ch3,
114
+ value: 5,
115
+ onSelected: async (result) => {
116
+ console.log("TEST5: Sent value successfully");
117
+ }
118
+ }),
119
+ _tempVar5.push({
120
+ id: -1,
121
+ isSend: false,
122
+ channel: null,
123
+ onSelected: async (result) => {
124
+ console.log("TEST5: Default hit unexpectedly");
125
+ }
126
+ }),
127
+ await goscript.selectStatement(_tempVar5, true);
128
+ // Second send should hit default (buffer full)
129
+ const _tempVar6 = [];
130
+ _tempVar6.push({
131
+ id: 0,
132
+ isSend: true,
133
+ channel: ch3,
134
+ value: 10,
135
+ onSelected: async (result) => {
136
+ console.log("TEST6: Sent unexpectedly");
137
+ }
138
+ }),
139
+ _tempVar6.push({
140
+ id: -1,
141
+ isSend: false,
142
+ channel: null,
143
+ onSelected: async (result) => {
144
+ console.log("TEST6: Default hit correctly (channel full)");
145
+ }
146
+ }),
147
+ await goscript.selectStatement(_tempVar6, true);
148
+ // Test 7: Multiple channel select (with known values)
149
+ let ch4 = goscript.makeChannel(1, "");
150
+ let ch5 = goscript.makeChannel(1, "");
151
+ await ch4.send("from ch4");
152
+ // Should select ch4 because it has data, ch5 is empty
153
+ const _tempVar7 = [];
154
+ _tempVar7.push({
155
+ id: 0,
156
+ isSend: false,
157
+ channel: ch4,
158
+ onSelected: async (result) => {
159
+ const msg = result.value;
160
+ console.log("TEST7: Selected ch4 correctly:", msg);
161
+ }
162
+ }),
163
+ _tempVar7.push({
164
+ id: 1,
165
+ isSend: false,
166
+ channel: ch5,
167
+ onSelected: async (result) => {
168
+ const msg = result.value;
169
+ console.log("TEST7: Selected ch5 unexpectedly:", msg);
170
+ }
171
+ }),
172
+ await goscript.selectStatement(_tempVar7, false);
173
+ // Now ch4 is empty and ch5 is empty
174
+ await ch5.send("from ch5");
175
+ // Should select ch5 because it has data, ch4 is empty
176
+ const _tempVar8 = [];
177
+ _tempVar8.push({
178
+ id: 0,
179
+ isSend: false,
180
+ channel: ch4,
181
+ onSelected: async (result) => {
182
+ const msg = result.value;
183
+ console.log("TEST8: Selected ch4 unexpectedly:", msg);
184
+ }
185
+ }),
186
+ _tempVar8.push({
187
+ id: 1,
188
+ isSend: false,
189
+ channel: ch5,
190
+ onSelected: async (result) => {
191
+ const msg = result.value;
192
+ console.log("TEST8: Selected ch5 correctly:", msg);
193
+ }
194
+ }),
195
+ await goscript.selectStatement(_tempVar8, false);
196
+ // Test 9: Channel closing test case for a separate test
197
+ let chClose = goscript.makeChannel(0, false);
198
+ chClose.close();
199
+ const _tempVar9 = await chClose.receiveWithOk();
200
+ let val = _tempVar9.value;
201
+ let ok = _tempVar9.ok;
202
+ if (!ok) {
203
+ console.log("TEST9: Channel is closed, ok is false, val:", val);
204
+ }
205
+ else {
206
+ console.log("TEST9: Channel reports as not closed");
207
+ }
208
+ }
209
+ //# sourceMappingURL=select_statement.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select_statement.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/select_statement/select_statement.gs.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,yDAAyD;AAEzD,OAAO,KAAK,Q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nD,CAAC;SACD,CAAC;QAEF,MAAM,QAAQ,CAAC,eAAe,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;IAEhD,wDAAwD;IACxD,IAAI,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAU,CAAC,EAAE,KAAK,CAAC,CAAA;IACrD,OAAO,CAAC,KAAK,EAAE,CAAA;IACf,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,aAAa,EAAE,CAAA;IAC/C,IAAI,GAAG,GAAG,SAAS,CAAC,KAAK,CAAA;IACzB,IAAI,EAAE,GAAG,SAAS,CAAC,EAAE,CAAA;IACrB,IAAI,CAAC,EAAE,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,6CAA6C,EAAE,GAAG,CAAC,CAAA;IAChE,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAA;IACpD,CAAC;AACF,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,6 @@
1
+ // Generated file based on simple.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ export async function main() {
4
+ console.log("Hello world!");
5
+ }
6
+ //# sourceMappingURL=simple.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/simple/simple.gs.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;AAC5B,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,22 @@
1
+ // Generated file based on simple_deref_assignment.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ class MyStruct {
4
+ MyInt = 0;
5
+ MyString = "";
6
+ myBool = false;
7
+ constructor(init) { if (init)
8
+ Object.assign(this, init); }
9
+ clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
10
+ }
11
+ export async function main() {
12
+ let structPointer = new MyStruct({ MyInt: 4, MyString: "hello world" });
13
+ // === Simple Dereference Assignment (Value Copy) ===
14
+ let simpleDereferencedCopy = structPointer.clone();
15
+ // Modifying the copy does not affect the original struct pointed to by structPointer.
16
+ simpleDereferencedCopy.MyString = "modified dereferenced copy";
17
+ // Expected: "hello world"
18
+ console.log("Original structPointer after modifying simpleDereferencedCopy: Expected: hello world, Actual: " + structPointer.MyString);
19
+ // Expected: "modified dereferenced copy"
20
+ console.log("Simple Dereferenced Copy: Expected: modified dereferenced copy, Actual: " + simpleDereferencedCopy.MyString);
21
+ }
22
+ //# sourceMappingURL=simple_deref_assignment.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple_deref_assignment.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/simple_deref_assignment/simple_deref_assignment.gs.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,yDAAyD;AAIzD,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAClB,QAAQ,GAAW,EAAE,CAAC;IACrB,MAAM,GAAY,KAAK,CAAC;IAEhC,YAAY,IAAwB,IAAI,IAAI,IAAI;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC,CAAC;IAC9E,KAAK,KAAe,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACvG;AAED,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,aAAa,GAAG,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,CAAA;IACvE,qDAAqD;IACrD,IAAI,sBAAsB,GAAG,aAAa,CAAC,KAAK,EAAE,CAAA;IAClD,sFAAsF;IACtF,sBAAsB,CAAC,QAAQ,GAAG,4BAA4B,CAAA;IAC9D,0BAA0B;IAC1B,OAAO,CAAC,GAAG,CAAC,gGAAgG,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtI,yCAAyC;IACzC,OAAO,CAAC,GAAG,CAAC,0EAA0E,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAA;AAC1H,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,21 @@
1
+ // Generated file based on slices.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ import * as goscript from "@go/builtin";
4
+ export async function main() {
5
+ // Create a slice of integers with length 5 and capacity 10
6
+ let s = goscript.makeSlice(5, 10);
7
+ console.log(goscript.len(s));
8
+ console.log(goscript.cap(s));
9
+ // Create a slice of strings with length 3
10
+ let s2 = goscript.makeSlice(3);
11
+ console.log(goscript.len(s2));
12
+ console.log(goscript.cap(s2));
13
+ // Assign values
14
+ s[0] = 10;
15
+ s[4] = 20;
16
+ s2[1] = "hello";
17
+ console.log(s[0]);
18
+ console.log(s[4]);
19
+ console.log(s2[1]);
20
+ }
21
+ //# sourceMappingURL=slices.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slices.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/slices/slices.gs.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,2DAA2D;IAC3D,IAAI,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACjC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAE5B,0CAA0C;IAC1C,IAAI,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;IAC7B,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;IAE7B,gBAAgB;IAChB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;IACT,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;IACT,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;IAEf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACjB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACjB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,17 @@
1
+ // Generated file based on string_rune_conversion.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ export async function main() {
4
+ // === string(rune) Conversion ===
5
+ let r = 65;
6
+ let s = String.fromCharCode(r);
7
+ console.log(s);
8
+ // 'a'
9
+ let r2 = 97;
10
+ let s2 = String.fromCharCode(r2);
11
+ console.log(s2);
12
+ // '€'
13
+ let r3 = 0x20AC;
14
+ let s3 = String.fromCharCode(r3);
15
+ console.log(s3);
16
+ }
17
+ //# sourceMappingURL=string_rune_conversion.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string_rune_conversion.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/string_rune_conversion/string_rune_conversion.gs.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,kCAAkC;IAClC,IAAI,CAAC,GAAW,EAAE,CAAC;IACnB,IAAI,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAEd,MAAM;IACN,IAAI,EAAE,GAAW,EAAE,CAAC;IACpB,IAAI,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;IAChC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAEf,MAAM;IACN,IAAI,EAAE,GAAW,MAAM,CAAC;IACxB,IAAI,EAAE,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;IAChC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAChB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,16 @@
1
+ // Generated file based on struct_field_access.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ class MyStruct {
4
+ MyInt = 0;
5
+ MyString = "";
6
+ constructor(init) { if (init)
7
+ Object.assign(this, init); }
8
+ clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
9
+ }
10
+ export async function main() {
11
+ // === Struct Field Access ===
12
+ let ms = new MyStruct({ MyInt: 42, MyString: "foo" });
13
+ console.log("MyInt: Expected: 42, Actual:", ms.MyInt);
14
+ console.log("MyString: Expected: foo, Actual:", ms.MyString);
15
+ }
16
+ //# sourceMappingURL=struct_field_access.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"struct_field_access.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/struct_field_access/struct_field_access.gs.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,yDAAyD;AAIzD,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAClB,QAAQ,GAAW,EAAE,CAAC;IAE7B,YAAY,IAAwB,IAAI,IAAI,IAAI;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC,CAAC;IAC9E,KAAK,KAAe,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;CACvG;AAED,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,8BAA8B;IAC9B,IAAI,EAAE,GAAG,IAAI,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IACrD,OAAO,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;IACrD,OAAO,CAAC,GAAG,CAAC,kCAAkC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAA;AAC7D,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function main(): Promise<void>;
@@ -0,0 +1,27 @@
1
+ // Generated file based on struct_value_init_clone.go
2
+ // Updated when compliance tests are re-run, DO NOT EDIT!
3
+ class Point {
4
+ X = 0;
5
+ Y = 0;
6
+ constructor(init) { if (init)
7
+ Object.assign(this, init); }
8
+ clone() { return Object.assign(Object.create(Point.prototype), this); }
9
+ }
10
+ export async function main() {
11
+ // Initialize directly
12
+ let p1 = new Point({ X: 1, Y: 2 });
13
+ console.log("p1:", p1.X, p1.Y);
14
+ // Assign to another variable (should trigger clone)
15
+ let p2 = p1.clone();
16
+ p2.X = 10; // Modify the copy
17
+ // Print both to show they are independent
18
+ console.log("p1 after p2 mod:", p1.X, p1.Y);
19
+ console.log("p2:", p2.X, p2.Y);
20
+ // Initialize via variable assignment
21
+ let v = new Point({ X: 3, Y: 4 });
22
+ let p3 = v.clone(); // Should trigger clone
23
+ p3.Y = 40; // Modify the copy
24
+ console.log("v after p3 mod:", v.X, v.Y);
25
+ console.log("p3:", p3.X, p3.Y);
26
+ }
27
+ //# sourceMappingURL=struct_value_init_clone.gs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"struct_value_init_clone.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/struct_value_init_clone/struct_value_init_clone.gs.ts"],"names":[],"m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