Skip to content

Commit 9b20da0

Browse files
committed
fix: export reflect struct field constructor
Signed-off-by: Christian Stewart <christian@aperture.us>
1 parent 88df22d commit 9b20da0

File tree

6 files changed

+62
-1
lines changed

6 files changed

+62
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
StructField Name: TestField
2+
StructField Type: string

compliance/tests/reflect_struct_field/index.ts

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import "reflect"
4+
5+
func main() {
6+
// Test creating a StructField value
7+
field := reflect.StructField{
8+
Name: "TestField",
9+
Type: reflect.TypeOf(""),
10+
}
11+
println("StructField Name:", field.Name)
12+
println("StructField Type:", field.Type.String())
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Generated file based on reflect_struct_field.go
2+
// Updated when compliance tests are re-run, DO NOT EDIT!
3+
4+
import * as $ from "@goscript/builtin/index.js"
5+
6+
import * as reflect from "@goscript/reflect/index.js"
7+
8+
export async function main(): Promise<void> {
9+
// Test creating a StructField value
10+
let field = $.markAsStructValue(new reflect.StructField({Name: "TestField", Type: reflect.TypeOf("")}))
11+
console.log("StructField Name:", field.Name)
12+
console.log("StructField Type:", field.Type!.String())
13+
}
14+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"compilerOptions": {
3+
"allowImportingTsExtensions": true,
4+
"lib": [
5+
"es2022",
6+
"esnext.disposable",
7+
"dom"
8+
],
9+
"module": "nodenext",
10+
"moduleResolution": "nodenext",
11+
"noEmit": true,
12+
"paths": {
13+
"*": [
14+
"./*"
15+
],
16+
"@goscript/*": [
17+
"../../../gs/*",
18+
"../../../compliance/deps/*"
19+
],
20+
"@goscript/github.com/aperturerobotics/goscript/compliance/tests/reflect_struct_field/*": [
21+
"./*"
22+
]
23+
},
24+
"sourceMap": true,
25+
"target": "es2022"
26+
},
27+
"extends": "../../../tsconfig.json",
28+
"include": [
29+
"index.ts",
30+
"reflect_struct_field.gs.ts"
31+
]
32+
}

gs/reflect/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export { Swapper } from './swapper.js'
3535
// Export new types and constants
3636
export {
3737
StructTag,
38+
StructField,
3839
ValueError,
3940
SelectDir,
4041
SelectSend,
@@ -45,7 +46,6 @@ export {
4546
export type {
4647
uintptr,
4748
Pointer,
48-
StructField,
4949
Method,
5050
SelectCase,
5151
SliceHeader,

0 commit comments

Comments
 (0)