goscript 0.0.14 → 0.0.16
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.
- package/README.md +154 -40
- package/builtin/builtin.ts +1168 -178
- package/compiler/analysis.go +726 -0
- package/compiler/compiler.go +5701 -4
- package/compiler/compiler_test.go +104 -0
- package/compiler/config.go +3 -3
- package/compiler/config_test.go +89 -0
- package/compiler/output.go +26 -0
- package/compiler/write-type-spec.go +506 -0
- package/compiler/writer.go +11 -0
- package/dist/builtin/builtin.d.ts +204 -67
- package/dist/builtin/builtin.js +845 -144
- package/dist/builtin/builtin.js.map +1 -1
- package/go.mod +4 -5
- package/go.sum +6 -11
- package/package.json +4 -3
- package/compiler/compile.go +0 -190
- package/compiler/compile_comment.go +0 -41
- package/compiler/compile_decls.go +0 -84
- package/compiler/compile_expr.go +0 -1022
- package/compiler/compile_field.go +0 -110
- package/compiler/compile_spec.go +0 -566
- package/compiler/compile_stmt.go +0 -1616
- package/compiler/context.go +0 -9
- package/compiler/file_compiler.go +0 -80
- package/compiler/output_path.go +0 -31
- package/compiler/pkg_compiler.go +0 -72
- package/compiler/types/tokens.go +0 -66
- package/compiler/types/types.go +0 -46
- package/dist/compliance/tests/array_literal/array_literal.gs.d.ts +0 -1
- package/dist/compliance/tests/array_literal/array_literal.gs.js +0 -15
- package/dist/compliance/tests/array_literal/array_literal.gs.js.map +0 -1
- package/dist/compliance/tests/async_basic/async_basic.gs.d.ts +0 -1
- package/dist/compliance/tests/async_basic/async_basic.gs.js +0 -24
- package/dist/compliance/tests/async_basic/async_basic.gs.js.map +0 -1
- package/dist/compliance/tests/async_defer_statement/async_defer_statement.gs.d.ts +0 -1
- package/dist/compliance/tests/async_defer_statement/async_defer_statement.gs.js +0 -82
- package/dist/compliance/tests/async_defer_statement/async_defer_statement.gs.js.map +0 -1
- package/dist/compliance/tests/basic_arithmetic/basic_arithmetic.gs.d.ts +0 -1
- package/dist/compliance/tests/basic_arithmetic/basic_arithmetic.gs.js +0 -16
- package/dist/compliance/tests/basic_arithmetic/basic_arithmetic.gs.js.map +0 -1
- package/dist/compliance/tests/boolean_logic/boolean_logic.gs.d.ts +0 -1
- package/dist/compliance/tests/boolean_logic/boolean_logic.gs.js +0 -14
- package/dist/compliance/tests/boolean_logic/boolean_logic.gs.js.map +0 -1
- package/dist/compliance/tests/channel_basic/channel_basic.gs.d.ts +0 -1
- package/dist/compliance/tests/channel_basic/channel_basic.gs.js +0 -14
- package/dist/compliance/tests/channel_basic/channel_basic.gs.js.map +0 -1
- package/dist/compliance/tests/composite_literal_assignment/composite_literal_assignment.gs.d.ts +0 -1
- package/dist/compliance/tests/composite_literal_assignment/composite_literal_assignment.gs.js +0 -27
- package/dist/compliance/tests/composite_literal_assignment/composite_literal_assignment.gs.js.map +0 -1
- package/dist/compliance/tests/constants/constants.gs.d.ts +0 -1
- package/dist/compliance/tests/constants/constants.gs.js +0 -16
- package/dist/compliance/tests/constants/constants.gs.js.map +0 -1
- package/dist/compliance/tests/copy_independence/copy_independence.gs.d.ts +0 -1
- package/dist/compliance/tests/copy_independence/copy_independence.gs.js +0 -33
- package/dist/compliance/tests/copy_independence/copy_independence.gs.js.map +0 -1
- package/dist/compliance/tests/defer_statement/defer_statement.gs.d.ts +0 -1
- package/dist/compliance/tests/defer_statement/defer_statement.gs.js +0 -75
- package/dist/compliance/tests/defer_statement/defer_statement.gs.js.map +0 -1
- package/dist/compliance/tests/embedded_interface_assertion/embedded_interface_assertion.gs.d.ts +0 -1
- package/dist/compliance/tests/embedded_interface_assertion/embedded_interface_assertion.gs.js +0 -37
- package/dist/compliance/tests/embedded_interface_assertion/embedded_interface_assertion.gs.js.map +0 -1
- package/dist/compliance/tests/flag_bitwise_op/flag_bitwise_op.gs.d.ts +0 -1
- package/dist/compliance/tests/flag_bitwise_op/flag_bitwise_op.gs.js +0 -29
- package/dist/compliance/tests/flag_bitwise_op/flag_bitwise_op.gs.js.map +0 -1
- package/dist/compliance/tests/float64/float64.gs.d.ts +0 -1
- package/dist/compliance/tests/float64/float64.gs.js +0 -24
- package/dist/compliance/tests/float64/float64.gs.js.map +0 -1
- package/dist/compliance/tests/for_loop_basic/for_loop_basic.gs.d.ts +0 -1
- package/dist/compliance/tests/for_loop_basic/for_loop_basic.gs.js +0 -10
- package/dist/compliance/tests/for_loop_basic/for_loop_basic.gs.js.map +0 -1
- package/dist/compliance/tests/for_loop_condition_only/for_loop_condition_only.gs.d.ts +0 -1
- package/dist/compliance/tests/for_loop_condition_only/for_loop_condition_only.gs.js +0 -11
- package/dist/compliance/tests/for_loop_condition_only/for_loop_condition_only.gs.js.map +0 -1
- package/dist/compliance/tests/for_loop_condition_only/main.gs.d.ts +0 -1
- package/dist/compliance/tests/for_loop_condition_only/main.gs.js +0 -10
- package/dist/compliance/tests/for_loop_condition_only/main.gs.js.map +0 -1
- package/dist/compliance/tests/for_loop_infinite/for_loop_infinite.gs.d.ts +0 -1
- package/dist/compliance/tests/for_loop_infinite/for_loop_infinite.gs.js +0 -14
- package/dist/compliance/tests/for_loop_infinite/for_loop_infinite.gs.js.map +0 -1
- package/dist/compliance/tests/for_range/for_range.gs.d.ts +0 -1
- package/dist/compliance/tests/for_range/for_range.gs.js +0 -39
- package/dist/compliance/tests/for_range/for_range.gs.js.map +0 -1
- package/dist/compliance/tests/for_range_index_use/for_range_index_use.gs.d.ts +0 -1
- package/dist/compliance/tests/for_range_index_use/for_range_index_use.gs.js +0 -15
- package/dist/compliance/tests/for_range_index_use/for_range_index_use.gs.js.map +0 -1
- package/dist/compliance/tests/func_literal/func_literal.gs.d.ts +0 -1
- package/dist/compliance/tests/func_literal/func_literal.gs.js +0 -10
- package/dist/compliance/tests/func_literal/func_literal.gs.js.map +0 -1
- package/dist/compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.d.ts +0 -12
- package/dist/compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.js +0 -30
- package/dist/compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.js.map +0 -1
- package/dist/compliance/tests/if_statement/if_statement.gs.d.ts +0 -1
- package/dist/compliance/tests/if_statement/if_statement.gs.js +0 -13
- package/dist/compliance/tests/if_statement/if_statement.gs.js.map +0 -1
- package/dist/compliance/tests/interface_method_comments/interface_method_comments.gs.d.ts +0 -1
- package/dist/compliance/tests/interface_method_comments/interface_method_comments.gs.js +0 -12
- package/dist/compliance/tests/interface_method_comments/interface_method_comments.gs.js.map +0 -1
- package/dist/compliance/tests/interface_multi_param_return/interface_multi_param_return.gs.d.ts +0 -1
- package/dist/compliance/tests/interface_multi_param_return/interface_multi_param_return.gs.js +0 -34
- package/dist/compliance/tests/interface_multi_param_return/interface_multi_param_return.gs.js.map +0 -1
- package/dist/compliance/tests/interface_to_interface_type_assertion/interface_to_interface_type_assertion.gs.d.ts +0 -1
- package/dist/compliance/tests/interface_to_interface_type_assertion/interface_to_interface_type_assertion.gs.js +0 -32
- package/dist/compliance/tests/interface_to_interface_type_assertion/interface_to_interface_type_assertion.gs.js.map +0 -1
- package/dist/compliance/tests/interface_type_assertion/interface_type_assertion.gs.d.ts +0 -1
- package/dist/compliance/tests/interface_type_assertion/interface_type_assertion.gs.js +0 -40
- package/dist/compliance/tests/interface_type_assertion/interface_type_assertion.gs.js.map +0 -1
- package/dist/compliance/tests/interface_type_assertion_signature_mismatch/interface_type_assertion_signature_mismatch.gs.d.ts +0 -1
- package/dist/compliance/tests/interface_type_assertion_signature_mismatch/interface_type_assertion_signature_mismatch.gs.js +0 -51
- package/dist/compliance/tests/interface_type_assertion_signature_mismatch/interface_type_assertion_signature_mismatch.gs.js.map +0 -1
- package/dist/compliance/tests/map_support/map_support.gs.d.ts +0 -1
- package/dist/compliance/tests/map_support/map_support.gs.js +0 -88
- package/dist/compliance/tests/map_support/map_support.gs.js.map +0 -1
- package/dist/compliance/tests/method_call_on_pointer_receiver/method_call_on_pointer_receiver.gs.d.ts +0 -1
- package/dist/compliance/tests/method_call_on_pointer_receiver/method_call_on_pointer_receiver.gs.js +0 -24
- package/dist/compliance/tests/method_call_on_pointer_receiver/method_call_on_pointer_receiver.gs.js.map +0 -1
- package/dist/compliance/tests/method_call_on_pointer_via_value/method_call_on_pointer_via_value.gs.d.ts +0 -1
- package/dist/compliance/tests/method_call_on_pointer_via_value/method_call_on_pointer_via_value.gs.js +0 -33
- package/dist/compliance/tests/method_call_on_pointer_via_value/method_call_on_pointer_via_value.gs.js.map +0 -1
- package/dist/compliance/tests/method_call_on_value_receiver/method_call_on_value_receiver.gs.d.ts +0 -1
- package/dist/compliance/tests/method_call_on_value_receiver/method_call_on_value_receiver.gs.js +0 -22
- package/dist/compliance/tests/method_call_on_value_receiver/method_call_on_value_receiver.gs.js.map +0 -1
- package/dist/compliance/tests/method_call_on_value_via_pointer/method_call_on_value_via_pointer.gs.d.ts +0 -1
- package/dist/compliance/tests/method_call_on_value_via_pointer/method_call_on_value_via_pointer.gs.js +0 -33
- package/dist/compliance/tests/method_call_on_value_via_pointer/method_call_on_value_via_pointer.gs.js.map +0 -1
- package/dist/compliance/tests/multiple_return_values/multiple_return_values.gs.d.ts +0 -1
- package/dist/compliance/tests/multiple_return_values/multiple_return_values.gs.js +0 -17
- package/dist/compliance/tests/multiple_return_values/multiple_return_values.gs.js.map +0 -1
- package/dist/compliance/tests/pointer_assignment_no_copy/pointer_assignment_no_copy.gs.d.ts +0 -1
- package/dist/compliance/tests/pointer_assignment_no_copy/pointer_assignment_no_copy.gs.js +0 -29
- package/dist/compliance/tests/pointer_assignment_no_copy/pointer_assignment_no_copy.gs.js.map +0 -1
- package/dist/compliance/tests/pointer_composite_literal_assignment/pointer_composite_literal_assignment.gs.d.ts +0 -1
- package/dist/compliance/tests/pointer_composite_literal_assignment/pointer_composite_literal_assignment.gs.js +0 -27
- package/dist/compliance/tests/pointer_composite_literal_assignment/pointer_composite_literal_assignment.gs.js.map +0 -1
- package/dist/compliance/tests/pointer_deref_multiassign/pointer_deref_multiassign.gs.d.ts +0 -1
- package/dist/compliance/tests/pointer_deref_multiassign/pointer_deref_multiassign.gs.js +0 -22
- package/dist/compliance/tests/pointer_deref_multiassign/pointer_deref_multiassign.gs.js.map +0 -1
- package/dist/compliance/tests/pointer_initialization/pointer_initialization.gs.d.ts +0 -1
- package/dist/compliance/tests/pointer_initialization/pointer_initialization.gs.js +0 -20
- package/dist/compliance/tests/pointer_initialization/pointer_initialization.gs.js.map +0 -1
- package/dist/compliance/tests/select_receive_on_closed_channel_no_default/select_receive_on_closed_channel_no_default.gs.d.ts +0 -1
- package/dist/compliance/tests/select_receive_on_closed_channel_no_default/select_receive_on_closed_channel_no_default.gs.js +0 -28
- package/dist/compliance/tests/select_receive_on_closed_channel_no_default/select_receive_on_closed_channel_no_default.gs.js.map +0 -1
- package/dist/compliance/tests/select_send_on_full_buffered_channel_with_default/select_send_on_full_buffered_channel_with_default.gs.d.ts +0 -1
- package/dist/compliance/tests/select_send_on_full_buffered_channel_with_default/select_send_on_full_buffered_channel_with_default.gs.js +0 -30
- package/dist/compliance/tests/select_send_on_full_buffered_channel_with_default/select_send_on_full_buffered_channel_with_default.gs.js.map +0 -1
- package/dist/compliance/tests/select_statement/select_statement.gs.d.ts +0 -1
- package/dist/compliance/tests/select_statement/select_statement.gs.js +0 -207
- package/dist/compliance/tests/select_statement/select_statement.gs.js.map +0 -1
- package/dist/compliance/tests/simple/simple.gs.d.ts +0 -1
- package/dist/compliance/tests/simple/simple.gs.js +0 -6
- package/dist/compliance/tests/simple/simple.gs.js.map +0 -1
- package/dist/compliance/tests/simple_deref_assignment/simple_deref_assignment.gs.d.ts +0 -1
- package/dist/compliance/tests/simple_deref_assignment/simple_deref_assignment.gs.js +0 -24
- package/dist/compliance/tests/simple_deref_assignment/simple_deref_assignment.gs.js.map +0 -1
- package/dist/compliance/tests/slices/slices.gs.d.ts +0 -1
- package/dist/compliance/tests/slices/slices.gs.js +0 -294
- package/dist/compliance/tests/slices/slices.gs.js.map +0 -1
- package/dist/compliance/tests/string_conversion/string_conversion.gs.d.ts +0 -1
- package/dist/compliance/tests/string_conversion/string_conversion.gs.js +0 -41
- package/dist/compliance/tests/string_conversion/string_conversion.gs.js.map +0 -1
- package/dist/compliance/tests/string_rune_conversion/string_rune_conversion.gs.d.ts +0 -1
- package/dist/compliance/tests/string_rune_conversion/string_rune_conversion.gs.js +0 -17
- package/dist/compliance/tests/string_rune_conversion/string_rune_conversion.gs.js.map +0 -1
- package/dist/compliance/tests/struct_embedding/struct_embedding.gs.d.ts +0 -1
- package/dist/compliance/tests/struct_embedding/struct_embedding.gs.js +0 -48
- package/dist/compliance/tests/struct_embedding/struct_embedding.gs.js.map +0 -1
- package/dist/compliance/tests/struct_field_access/struct_field_access.gs.d.ts +0 -1
- package/dist/compliance/tests/struct_field_access/struct_field_access.gs.js +0 -19
- package/dist/compliance/tests/struct_field_access/struct_field_access.gs.js.map +0 -1
- package/dist/compliance/tests/struct_pointer_interface_fields/struct_pointer_interface_fields.gs.d.ts +0 -1
- package/dist/compliance/tests/struct_pointer_interface_fields/struct_pointer_interface_fields.gs.js +0 -26
- package/dist/compliance/tests/struct_pointer_interface_fields/struct_pointer_interface_fields.gs.js.map +0 -1
- package/dist/compliance/tests/struct_value_init_clone/struct_value_init_clone.gs.d.ts +0 -1
- package/dist/compliance/tests/struct_value_init_clone/struct_value_init_clone.gs.js +0 -30
- package/dist/compliance/tests/struct_value_init_clone/struct_value_init_clone.gs.js.map +0 -1
- package/dist/compliance/tests/switch_statement/switch_statement.gs.d.ts +0 -1
- package/dist/compliance/tests/switch_statement/switch_statement.gs.js +0 -76
- package/dist/compliance/tests/switch_statement/switch_statement.gs.js.map +0 -1
- package/dist/compliance/tests/value_type_copy_behavior/value_type_copy_behavior.gs.d.ts +0 -1
- package/dist/compliance/tests/value_type_copy_behavior/value_type_copy_behavior.gs.js +0 -31
- package/dist/compliance/tests/value_type_copy_behavior/value_type_copy_behavior.gs.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// Generated file based on defer_statement.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
4
|
-
if (value !== null && value !== void 0) {
|
|
5
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
6
|
-
var dispose, inner;
|
|
7
|
-
if (async) {
|
|
8
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
9
|
-
dispose = value[Symbol.asyncDispose];
|
|
10
|
-
}
|
|
11
|
-
if (dispose === void 0) {
|
|
12
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
13
|
-
dispose = value[Symbol.dispose];
|
|
14
|
-
if (async) inner = dispose;
|
|
15
|
-
}
|
|
16
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
17
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
18
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
19
|
-
}
|
|
20
|
-
else if (async) {
|
|
21
|
-
env.stack.push({ async: true });
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
26
|
-
return function (env) {
|
|
27
|
-
function fail(e) {
|
|
28
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
29
|
-
env.hasError = true;
|
|
30
|
-
}
|
|
31
|
-
var r, s = 0;
|
|
32
|
-
function next() {
|
|
33
|
-
while (r = env.stack.pop()) {
|
|
34
|
-
try {
|
|
35
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
36
|
-
if (r.dispose) {
|
|
37
|
-
var result = r.dispose.call(r.value);
|
|
38
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
39
|
-
}
|
|
40
|
-
else s |= 1;
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
fail(e);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
47
|
-
if (env.hasError) throw env.error;
|
|
48
|
-
}
|
|
49
|
-
return next();
|
|
50
|
-
};
|
|
51
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
52
|
-
var e = new Error(message);
|
|
53
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
54
|
-
});
|
|
55
|
-
import * as goscript from "@goscript/builtin";
|
|
56
|
-
export async function main() {
|
|
57
|
-
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
58
|
-
try {
|
|
59
|
-
const __defer = __addDisposableResource(env_1, new goscript.AsyncDisposableStack(), true);
|
|
60
|
-
__defer.defer(() => {
|
|
61
|
-
console.log("deferred");
|
|
62
|
-
});
|
|
63
|
-
console.log("main");
|
|
64
|
-
}
|
|
65
|
-
catch (e_1) {
|
|
66
|
-
env_1.error = e_1;
|
|
67
|
-
env_1.hasError = true;
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
const result_1 = __disposeResources(env_1);
|
|
71
|
-
if (result_1)
|
|
72
|
-
await result_1;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=defer_statement.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defer_statement.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/defer_statement/defer_statement.gs.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,yDAAyD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,IAAI;;;QACzB,MAAY,OAAO,kCAAG,IAAI,QAAQ,CAAC,oBAAoB,EAAE,OAAA,CAAC;QAC1D,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;YAClB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;QAAA,CAAC,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;;;;;;;;;;;CACnB"}
|
package/dist/compliance/tests/embedded_interface_assertion/embedded_interface_assertion.gs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
package/dist/compliance/tests/embedded_interface_assertion/embedded_interface_assertion.gs.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Generated file based on embedded_interface_assertion.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
import * as goscript from "@goscript/builtin";
|
|
4
|
-
// Register this interface with the runtime type system
|
|
5
|
-
const Reader__typeInfo = goscript.registerType('Reader', goscript.TypeKind.Interface, null, new Set(['Read']), undefined);
|
|
6
|
-
// Register this interface with the runtime type system
|
|
7
|
-
const Closer__typeInfo = goscript.registerType('Closer', goscript.TypeKind.Interface, null, new Set(['Close']), undefined);
|
|
8
|
-
// Register this interface with the runtime type system
|
|
9
|
-
const ReadCloser__typeInfo = goscript.registerType('ReadCloser', goscript.TypeKind.Interface, null, new Set(['Close', 'Read']), undefined);
|
|
10
|
-
class MyStruct {
|
|
11
|
-
Read(p) {
|
|
12
|
-
const m = this;
|
|
13
|
-
return [0, null];
|
|
14
|
-
}
|
|
15
|
-
Close() {
|
|
16
|
-
const m = this;
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
constructor(init) { if (init)
|
|
20
|
-
Object.assign(this, init); }
|
|
21
|
-
clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
|
|
22
|
-
// Register this type with the runtime type system
|
|
23
|
-
static __typeInfo = goscript.registerType('MyStruct', goscript.TypeKind.Struct, new MyStruct(), new Set(['Read', 'Close']), MyStruct);
|
|
24
|
-
}
|
|
25
|
-
export async function main() {
|
|
26
|
-
let rwc = null;
|
|
27
|
-
let s = new MyStruct({});
|
|
28
|
-
rwc = s.clone();
|
|
29
|
-
let { ok: ok } = goscript.typeAssert(rwc, 'ReadCloser');
|
|
30
|
-
if (ok) {
|
|
31
|
-
console.log("Embedded interface assertion successful");
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
console.log("Embedded interface assertion failed");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=embedded_interface_assertion.gs.js.map
|
package/dist/compliance/tests/embedded_interface_assertion/embedded_interface_assertion.gs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"embedded_interface_assertion.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/embedded_interface_assertion/embedded_interface_assertion.gs.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAM9C,uDAAuD;AACvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,YAAY,CAC5C,QAAQ,EACR,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EACjB,SAAS,CACV,CAAC;AAMF,uDAAuD;AACvD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,YAAY,CAC5C,QAAQ,EACR,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,EAClB,SAAS,CACV,CAAC;AAKF,uDAAuD;AACvD,MAAM,oBAAoB,GAAG,QAAQ,CAAC,YAAY,CAChD,YAAY,EACZ,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAC1B,SAAS,CACV,CAAC;AAEF,MAAM,QAAQ;IAEN,IAAI,CAAC,CAAW;QACtB,MAAM,CAAC,GAAG,IAAI,CAAA;QACd,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;IACjB,CAAC;IAEM,KAAK;QACX,MAAM,CAAC,GAAG,IAAI,CAAA;QACd,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,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;IAEvG,kDAAkD;IAClD,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,YAAY,CACvC,UAAU,EACV,QAAQ,CAAC,QAAQ,CAAC,MAAM,EACxB,IAAI,QAAQ,EAAE,EACd,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1B,QAAQ,CACT,CAAC;;AAGH,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,GAAG,GAAsB,IAAI,CAAC;IAClC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAE,CAAC,CAAA;IACxB,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IAEf,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAa,GAAG,EAAE,YAAY,CAAC,CAAA;IACnE,IAAI,EAAE,EAAE,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAA;IACvD,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;IACnD,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Generated file based on flag_bitwise_op.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
let O_WRONLY = 0x1;
|
|
5
|
-
let O_CREATE = 0x40;
|
|
6
|
-
let O_APPEND = 0x400;
|
|
7
|
-
let O_TRUNC = 0x200;
|
|
8
|
-
let flag = ((O_WRONLY | O_CREATE) | O_APPEND);
|
|
9
|
-
if ((flag & O_APPEND) != 0) {
|
|
10
|
-
console.log("O_APPEND is set: Expected: O_APPEND is set, Actual: O_APPEND is set");
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
console.log("O_APPEND is not set: Expected: (no output)");
|
|
14
|
-
}
|
|
15
|
-
if ((flag & O_TRUNC) != 0) {
|
|
16
|
-
console.log("O_TRUNC is set: Expected: (no output)");
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
console.log("O_TRUNC is not set: Expected: O_TRUNC is not set, Actual: O_TRUNC is not set");
|
|
20
|
-
}
|
|
21
|
-
flag = (O_WRONLY | O_CREATE);
|
|
22
|
-
if ((flag & O_APPEND) != 0) {
|
|
23
|
-
console.log("O_APPEND is set: Expected: (no output)");
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
console.log("O_APPEND is not set: Expected: O_APPEND is not set, Actual: O_APPEND is not set");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=flag_bitwise_op.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flag_bitwise_op.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/flag_bitwise_op/flag_bitwise_op.gs.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,QAAQ,GAAW,GAAG,CAAC;IAC3B,IAAI,QAAQ,GAAW,IAAI,CAAC;IAC5B,IAAI,QAAQ,GAAW,KAAK,CAAC;IAC7B,IAAI,OAAO,GAAW,KAAK,CAAC;IAC5B,IAAI,IAAI,GAAG,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAA;IAC7C,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAA;IACnF,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAA;IAC1D,CAAC;IACD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAA;IACrD,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,8EAA8E,CAAC,CAAA;IAC5F,CAAC;IAED,IAAI,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA;IAC5B,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;IACtD,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,iFAAiF,CAAC,CAAA;IAC/F,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Generated file based on float64.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
//nolint:staticcheck
|
|
5
|
-
let a = 1.23;
|
|
6
|
-
let b = 4.56;
|
|
7
|
-
let c;
|
|
8
|
-
c = a + b;
|
|
9
|
-
console.log("a + b =", c);
|
|
10
|
-
c = a - b;
|
|
11
|
-
console.log("a - b =", c);
|
|
12
|
-
c = a * b;
|
|
13
|
-
console.log("a * b =", c);
|
|
14
|
-
c = a / b;
|
|
15
|
-
console.log("a / b =", c);
|
|
16
|
-
// Assignment
|
|
17
|
-
let d = 7.89;
|
|
18
|
-
c = d;
|
|
19
|
-
console.log("c =", c);
|
|
20
|
-
// More complex expression
|
|
21
|
-
let e = (a + b) * (c - d) / a;
|
|
22
|
-
console.log("(a + b) * (c - d) / a =", e);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=float64.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"float64.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/float64/float64.gs.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,oBAAoB;IACpB,IAAI,CAAC,GAAW,IAAI,CAAC;IACrB,IAAI,CAAC,GAAG,IAAI,CAAA;IACZ,IAAI,CAAS,CAAC;IAEd,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAEzB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAEzB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAEzB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAEzB,aAAa;IACb,IAAI,CAAC,GAAG,IAAI,CAAA;IACZ,CAAC,GAAG,CAAC,CAAA;IACL,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAErB,0BAA0B;IAC1B,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;IAC7B,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Generated file based on for_loop_basic.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
console.log("Starting loop");
|
|
5
|
-
for (let i = 0; i < 3; i++) {
|
|
6
|
-
console.log("Iteration:", i);
|
|
7
|
-
}
|
|
8
|
-
console.log("Loop finished");
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=for_loop_basic.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"for_loop_basic.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/for_loop_basic/for_loop_basic.gs.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IAC7B,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Generated file based on for_loop_condition_only.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
let i = 0;
|
|
5
|
-
for (; i < 3;) {
|
|
6
|
-
console.log("Current value:", i);
|
|
7
|
-
i = i + 1;
|
|
8
|
-
}
|
|
9
|
-
console.log("Loop finished");
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=for_loop_condition_only.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"for_loop_condition_only.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/for_loop_condition_only/for_loop_condition_only.gs.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,CAAC,GAAI,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAA;QAChC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACV,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/for_loop_condition_only/main.gs.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,CAAC,GAAG,CAAC,GAAI,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACd,CAAC,EAAE,CAAA;IACJ,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Generated file based on for_loop_infinite.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
let i = 0;
|
|
5
|
-
for (;;) {
|
|
6
|
-
console.log("Looping forever...");
|
|
7
|
-
i++;
|
|
8
|
-
if (i >= 3) {
|
|
9
|
-
break;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
console.log("Loop finished");
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=for_loop_infinite.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"for_loop_infinite.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/for_loop_infinite/for_loop_infinite.gs.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,SAAW,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;QACjC,CAAC,EAAE,CAAA;QACH,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACZ,MAAK;QACN,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Generated file based on for_range.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
import * as goscript from "@goscript/builtin";
|
|
4
|
-
export async function main() {
|
|
5
|
-
let nums = [2, 3, 4];
|
|
6
|
-
let sum = 0;
|
|
7
|
-
for (let i = 0; i < nums.length; i++) {
|
|
8
|
-
const num = nums[i];
|
|
9
|
-
{
|
|
10
|
-
sum += num;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
console.log("sum:", sum);
|
|
14
|
-
for (let i = 0; i < nums.length; i++) {
|
|
15
|
-
const num = nums[i];
|
|
16
|
-
{
|
|
17
|
-
console.log("index:", i, "value:", num);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
// Test ranging over an array
|
|
21
|
-
let arr = ["a", "b", "c"];
|
|
22
|
-
for (let i = 0; i < arr.length; i++) {
|
|
23
|
-
const s = arr[i];
|
|
24
|
-
{
|
|
25
|
-
console.log("index:", i, "value:", s);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// Test ranging over a string
|
|
29
|
-
let str = "go";
|
|
30
|
-
// Note: c will be a rune (int32)
|
|
31
|
-
const _runes = goscript.stringToRunes(str);
|
|
32
|
-
for (let i = 0; i < _runes.length; i++) {
|
|
33
|
-
const c = _runes[i];
|
|
34
|
-
{
|
|
35
|
-
console.log("index:", i, "value:", c); // Note: c will be a rune (int32)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=for_range.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"for_range.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/for_range/for_range.gs.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACpB,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;YACA,GAAG,IAAI,GAAG,CAAA;QACX,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAExB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;YACA,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;QACxC,CAAC;IACF,CAAC;IAED,6BAA6B;IAC7B,IAAI,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;QAChB,CAAC;YACA,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;QACtC,CAAC;IACF,CAAC;IAED,6BAA6B;IAC7B,IAAI,GAAG,GAAG,IAAI,CAAA;IAEd,iCAAiC;IACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;YACA,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA,CAAC,iCAAiC;QACxE,CAAC;IACF,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Generated file based on for_range_index_use.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
let slice = [10, 20, 30, 40, 50];
|
|
5
|
-
let sum = 0;
|
|
6
|
-
for (let idx = 0; idx < slice.length; idx++) {
|
|
7
|
-
const val = slice[idx];
|
|
8
|
-
{
|
|
9
|
-
sum += val;
|
|
10
|
-
console.log("Range idx:", idx, "val:", val);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
console.log("Sum:", sum);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=for_range_index_use.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"for_range_index_use.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/for_range_index_use/for_range_index_use.gs.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,KAAK,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAChC,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;QAC7C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;QACtB,CAAC;YACA,GAAG,IAAI,GAAG,CAAA;YACV,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;QAC5C,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Generated file based on func_literal.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
let greet = (name) => {
|
|
5
|
-
return "Hello, " + name;
|
|
6
|
-
};
|
|
7
|
-
let message = greet("world");
|
|
8
|
-
console.log(message);
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=func_literal.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"func_literal.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/func_literal/func_literal.gs.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,KAAK,GAAG,CAAC,IAAY,EAAU,EAAE;QACpC,OAAO,SAAS,GAAG,IAAI,CAAA;IACxB,CAAC,CAAA;IAGD,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAA;IAC5B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;AACrB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as goscript from "@goscript/builtin";
|
|
2
|
-
declare class MyStruct {
|
|
3
|
-
MyInt: number;
|
|
4
|
-
MyString: string;
|
|
5
|
-
private myBool;
|
|
6
|
-
constructor(init?: Partial<MyStruct>);
|
|
7
|
-
clone(): MyStruct;
|
|
8
|
-
static __typeInfo: goscript.TypeInfo;
|
|
9
|
-
}
|
|
10
|
-
export declare function NewMyStruct(s: string): MyStruct;
|
|
11
|
-
export declare function main(): Promise<void>;
|
|
12
|
-
export {};
|
package/dist/compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Generated file based on function_call_result_assignment.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
import * as goscript from "@goscript/builtin";
|
|
4
|
-
class MyStruct {
|
|
5
|
-
MyInt = 0;
|
|
6
|
-
MyString = "";
|
|
7
|
-
//nolint:unused
|
|
8
|
-
myBool = false;
|
|
9
|
-
constructor(init) { if (init)
|
|
10
|
-
Object.assign(this, init); }
|
|
11
|
-
clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
|
|
12
|
-
// Register this type with the runtime type system
|
|
13
|
-
static __typeInfo = goscript.registerType('MyStruct', goscript.TypeKind.Struct, new MyStruct(), new Set([]), MyStruct);
|
|
14
|
-
}
|
|
15
|
-
// NewMyStruct creates a new MyStruct instance.
|
|
16
|
-
export function NewMyStruct(s) {
|
|
17
|
-
return new MyStruct({ MyString: s });
|
|
18
|
-
}
|
|
19
|
-
export async function main() {
|
|
20
|
-
// === Function Call Result Assignment (Value Copy) ===
|
|
21
|
-
// Assigning the result of a function that returns a struct creates a copy.
|
|
22
|
-
let structFromFunc = NewMyStruct("function result").clone();
|
|
23
|
-
let structFromFuncCopy = structFromFunc.clone();
|
|
24
|
-
structFromFuncCopy.MyString = "modified function result copy";
|
|
25
|
-
// Expected: "function result"
|
|
26
|
-
console.log("Original struct from function: Expected: function result, Actual: " + structFromFunc.MyString);
|
|
27
|
-
// Expected: "modified function result copy"
|
|
28
|
-
console.log("Modified struct from function copy: Expected: modified function result copy, Actual: " + structFromFuncCopy.MyString);
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=function_call_result_assignment.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function_call_result_assignment.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/function_call_result_assignment/function_call_result_assignment.gs.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAClB,QAAQ,GAAW,EAAE,CAAC;IAC7B,eAAe;IACP,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;IAEvG,kDAAkD;IAClD,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,YAAY,CACvC,UAAU,EACV,QAAQ,CAAC,QAAQ,CAAC,MAAM,EACxB,IAAI,QAAQ,EAAE,EACd,IAAI,GAAG,CAAC,EAAE,CAAC,EACX,QAAQ,CACT,CAAC;;AAGH,+CAA+C;AAC/C,MAAM,UAAU,WAAW,CAAC,CAAS;IACpC,OAAO,IAAI,QAAQ,CAAC,EAAC,QAAQ,EAAE,CAAC,EAAC,CAAC,CAAA;AACnC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,uDAAuD;IACvD,2EAA2E;IAC3E,IAAI,cAAc,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAA;IAC3D,IAAI,kBAAkB,GAAG,cAAc,CAAC,KAAK,EAAE,CAAA;IAC/C,kBAAkB,CAAC,QAAQ,GAAG,+BAA+B,CAAA;IAC7D,8BAA8B;IAC9B,OAAO,CAAC,GAAG,CAAC,oEAAoE,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAA;IAC3G,4CAA4C;IAC5C,OAAO,CAAC,GAAG,CAAC,uFAAuF,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAA;AACnI,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Generated file based on if_statement.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
export async function main() {
|
|
4
|
-
// === If Statement ===
|
|
5
|
-
let n = 7;
|
|
6
|
-
if (n % 2 == 0) {
|
|
7
|
-
console.log("Even: Expected: (no output)");
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
console.log("Odd: Expected: Odd, Actual: Odd");
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=if_statement.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"if_statement.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/if_statement/if_statement.gs.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,yDAAyD;AAIzD,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,uBAAuB;IACvB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;IAC3C,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;IAC/C,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Generated file based on interface_method_comments.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
import * as goscript from "@goscript/builtin";
|
|
4
|
-
// Register this interface with the runtime type system
|
|
5
|
-
const MyInterface__typeInfo = goscript.registerType('MyInterface', goscript.TypeKind.Interface, null, new Set(['MyMethod']), undefined);
|
|
6
|
-
export async function main() {
|
|
7
|
-
// This test verifies that comments on interface methods are preserved.
|
|
8
|
-
console.log("Test started");
|
|
9
|
-
// No actual execution needed, just compilation check.
|
|
10
|
-
console.log("Test finished");
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=interface_method_comments.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface_method_comments.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/interface_method_comments/interface_method_comments.gs.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAO9C,uDAAuD;AACvD,MAAM,qBAAqB,GAAG,QAAQ,CAAC,YAAY,CACjD,aAAa,EACb,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,EACrB,SAAS,CACV,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,uEAAuE;IACvE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAC3B,sDAAsD;IACtD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC7B,CAAC"}
|
package/dist/compliance/tests/interface_multi_param_return/interface_multi_param_return.gs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
package/dist/compliance/tests/interface_multi_param_return/interface_multi_param_return.gs.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Generated file based on interface_multi_param_return.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
import * as goscript from "@goscript/builtin";
|
|
4
|
-
// Register this interface with the runtime type system
|
|
5
|
-
const MultiParamReturner__typeInfo = goscript.registerType('MultiParamReturner', goscript.TypeKind.Interface, null, new Set(['Process']), undefined);
|
|
6
|
-
class MyProcessor {
|
|
7
|
-
Process(data, count, _) {
|
|
8
|
-
const p = this;
|
|
9
|
-
if (count > 0 && goscript.len(data) > 0) {
|
|
10
|
-
console.log("Processing successful");
|
|
11
|
-
return [true, null];
|
|
12
|
-
}
|
|
13
|
-
console.log("Processing failed");
|
|
14
|
-
return [false, null];
|
|
15
|
-
}
|
|
16
|
-
constructor(init) { if (init)
|
|
17
|
-
Object.assign(this, init); }
|
|
18
|
-
clone() { return Object.assign(Object.create(MyProcessor.prototype), this); }
|
|
19
|
-
// Register this type with the runtime type system
|
|
20
|
-
static __typeInfo = goscript.registerType('MyProcessor', goscript.TypeKind.Struct, new MyProcessor(), new Set(['Process']), MyProcessor);
|
|
21
|
-
}
|
|
22
|
-
export async function main() {
|
|
23
|
-
let processor = null;
|
|
24
|
-
processor = new MyProcessor({});
|
|
25
|
-
let data = [1, 2, 3];
|
|
26
|
-
let [success,] = processor.Process(data, 5, "unused");
|
|
27
|
-
if (success) {
|
|
28
|
-
console.log("Main: Success reported");
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
console.log("Main: Failure reported");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=interface_multi_param_return.gs.js.map
|
package/dist/compliance/tests/interface_multi_param_return/interface_multi_param_return.gs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface_multi_param_return.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/interface_multi_param_return/interface_multi_param_return.gs.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAM9C,uDAAuD;AACvD,MAAM,4BAA4B,GAAG,QAAQ,CAAC,YAAY,CACxD,oBAAoB,EACpB,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EACpB,SAAS,CACV,CAAC;AAEF,MAAM,WAAW;IAET,OAAO,CAAC,IAAc,EAAE,KAAa,EAAE,CAAS;QACtD,MAAM,CAAC,GAAG,IAAI,CAAA;QACd,IAAI,KAAK,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;YACpC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QACpB,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;QAChC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IACrB,CAAC;IAED,YAAY,IAA2B,IAAI,IAAI,IAAI;QAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAW,CAAC,CAAC,CAAC,CAAC;IACjF,KAAK,KAAkB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhH,kDAAkD;IAClD,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,YAAY,CACvC,aAAa,EACb,QAAQ,CAAC,QAAQ,CAAC,MAAM,EACxB,IAAI,WAAW,EAAE,EACjB,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EACpB,WAAW,CACZ,CAAC;;AAGH,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,SAAS,GAA8B,IAAI,CAAC;IAChD,SAAS,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAA;IAE/B,IAAI,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IACpB,IAAI,CAAC,OAAO,EAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;IAEtD,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IACtC,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IACtC,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Generated file based on interface_to_interface_type_assertion.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
import * as goscript from "@goscript/builtin";
|
|
4
|
-
// Register this interface with the runtime type system
|
|
5
|
-
const MyInterface__typeInfo = goscript.registerType('MyInterface', goscript.TypeKind.Interface, null, new Set(['Method1']), undefined);
|
|
6
|
-
class MyStruct {
|
|
7
|
-
Value = 0;
|
|
8
|
-
Method1() {
|
|
9
|
-
const m = this;
|
|
10
|
-
return m.Value;
|
|
11
|
-
}
|
|
12
|
-
constructor(init) { if (init)
|
|
13
|
-
Object.assign(this, init); }
|
|
14
|
-
clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
|
|
15
|
-
// Register this type with the runtime type system
|
|
16
|
-
static __typeInfo = goscript.registerType('MyStruct', goscript.TypeKind.Struct, new MyStruct(), new Set(['Method1']), MyStruct);
|
|
17
|
-
}
|
|
18
|
-
// Register this interface with the runtime type system
|
|
19
|
-
const MyOtherInterface__typeInfo = goscript.registerType('MyOtherInterface', goscript.TypeKind.Interface, null, new Set(['Method1']), undefined);
|
|
20
|
-
export async function main() {
|
|
21
|
-
let i = null;
|
|
22
|
-
let s = new MyStruct({ Value: 10 });
|
|
23
|
-
i = s.clone();
|
|
24
|
-
let { ok: ok } = goscript.typeAssert(i, 'MyOtherInterface');
|
|
25
|
-
if (ok) {
|
|
26
|
-
console.log("Type assertion successful");
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
console.log("Type assertion failed");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=interface_to_interface_type_assertion.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface_to_interface_type_assertion.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/interface_to_interface_type_assertion/interface_to_interface_type_assertion.gs.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAM9C,uDAAuD;AACvD,MAAM,qBAAqB,GAAG,QAAQ,CAAC,YAAY,CACjD,aAAa,EACb,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EACpB,SAAS,CACV,CAAC;AAEF,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAElB,OAAO;QACb,MAAM,CAAC,GAAG,IAAI,CAAA;QACd,OAAO,CAAC,CAAC,KAAK,CAAA;IACf,CAAC;IAED,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;IAEvG,kDAAkD;IAClD,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,YAAY,CACvC,UAAU,EACV,QAAQ,CAAC,QAAQ,CAAC,MAAM,EACxB,IAAI,QAAQ,EAAE,EACd,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EACpB,QAAQ,CACT,CAAC;;AAOH,uDAAuD;AACvD,MAAM,0BAA0B,GAAG,QAAQ,CAAC,YAAY,CACtD,kBAAkB,EAClB,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EACpB,SAAS,CACV,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,CAAC,GAAuB,IAAI,CAAC;IACjC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,CAAC,CAAA;IACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IAEb,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAmB,CAAC,EAAE,kBAAkB,CAAC,CAAA;IAC7E,IAAI,EAAE,EAAE,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACzC,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IACrC,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Generated file based on interface_type_assertion.go
|
|
2
|
-
// Updated when compliance tests are re-run, DO NOT EDIT!
|
|
3
|
-
import * as goscript from "@goscript/builtin";
|
|
4
|
-
// Register this interface with the runtime type system
|
|
5
|
-
const MyInterface__typeInfo = goscript.registerType('MyInterface', goscript.TypeKind.Interface, null, new Set(['Method1']), undefined);
|
|
6
|
-
class MyStruct {
|
|
7
|
-
Value = 0;
|
|
8
|
-
Method1() {
|
|
9
|
-
const m = this;
|
|
10
|
-
return m.Value;
|
|
11
|
-
}
|
|
12
|
-
constructor(init) { if (init)
|
|
13
|
-
Object.assign(this, init); }
|
|
14
|
-
clone() { return Object.assign(Object.create(MyStruct.prototype), this); }
|
|
15
|
-
// Register this type with the runtime type system
|
|
16
|
-
static __typeInfo = goscript.registerType('MyStruct', goscript.TypeKind.Struct, new MyStruct(), new Set(['Method1']), MyStruct);
|
|
17
|
-
}
|
|
18
|
-
export async function main() {
|
|
19
|
-
let i = null;
|
|
20
|
-
let s = new MyStruct({ Value: 10 });
|
|
21
|
-
i = s.clone();
|
|
22
|
-
let { ok: ok } = goscript.typeAssert(i, 'MyStruct');
|
|
23
|
-
if (ok) {
|
|
24
|
-
console.log("Type assertion successful");
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
console.log("Type assertion failed");
|
|
28
|
-
}
|
|
29
|
-
// try a second time since this generates something different when using = and not :=
|
|
30
|
-
({ ok: ok } = goscript.typeAssert(i, 'unknown'));
|
|
31
|
-
// expected
|
|
32
|
-
if (ok) {
|
|
33
|
-
console.log("Type assertion successful");
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// expected
|
|
37
|
-
console.log("Type assertion failed");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=interface_type_assertion.gs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface_type_assertion.gs.js","sourceRoot":"","sources":["../../../../compliance/tests/interface_type_assertion/interface_type_assertion.gs.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yDAAyD;AAEzD,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAM9C,uDAAuD;AACvD,MAAM,qBAAqB,GAAG,QAAQ,CAAC,YAAY,CACjD,aAAa,EACb,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EACpB,SAAS,CACV,CAAC;AAEF,MAAM,QAAQ;IACN,KAAK,GAAW,CAAC,CAAC;IAElB,OAAO;QACb,MAAM,CAAC,GAAG,IAAI,CAAA;QACd,OAAO,CAAC,CAAC,KAAK,CAAA;IACf,CAAC;IAED,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;IAEvG,kDAAkD;IAClD,MAAM,CAAC,UAAU,GAAG,QAAQ,CAAC,YAAY,CACvC,UAAU,EACV,QAAQ,CAAC,QAAQ,CAAC,MAAM,EACxB,IAAI,QAAQ,EAAE,EACd,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,EACpB,QAAQ,CACT,CAAC;;AAGH,MAAM,CAAC,KAAK,UAAU,IAAI;IACzB,IAAI,CAAC,GAAuB,IAAI,CAAC;IACjC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,CAAC,CAAA;IACjC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IAEb,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAW,CAAC,EAAE,UAAU,CAAC,CAAA;IAC7D,IAAI,EAAE,EAAE,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACzC,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IACrC,CAAC;IAED,qFAAqF;IACrF,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAkB,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;IAEjE,WAAW;IACX,IAAI,EAAE,EAAE,CAAC;QACR,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACzC,CAAC;SAAM,CAAC;QACP,WAAW;QACX,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;IACrC,CAAC;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|