Fix compiler error. Add test.

This commit is contained in:
Lea Anthony
2023-09-21 06:33:08 +10:00
parent 27b4a984d5
commit 013ec1d726
5 changed files with 1585 additions and 1 deletions
+1 -1
View File
@@ -395,7 +395,7 @@ func (p *Project) parseBoundStructMethods(name string, pkg *ParsedPackage) error
var ident *ast.Ident
var ok bool
switch v := funcDecl.Recv.List[0].Type.(type) {
switch funcDecl.Recv.List[0].Type.(type) {
case *ast.StarExpr:
recv := funcDecl.Recv.List[0].Type.(*ast.StarExpr)
ident, ok = recv.X.(*ast.Ident)
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,356 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {main} from './models';
window.go = window.go || {};
window.go.main = {
GreetService: {
/**
* GreetService.ArrayInt
*
* @param _in {number[]}
* @returns {Promise<void>}
**/
ArrayInt: function(_in) { wails.CallByID(3862002418, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.BoolInBoolOut
*
* @param _in {boolean}
* @returns {Promise<boolean>}
**/
BoolInBoolOut: function(_in) { wails.CallByID(2424639793, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Float32InFloat32Out
*
* @param _in {number}
* @returns {Promise<number>}
**/
Float32InFloat32Out: function(_in) { wails.CallByID(3132595881, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Float64InFloat64Out
*
* @param _in {number}
* @returns {Promise<number>}
**/
Float64InFloat64Out: function(_in) { wails.CallByID(2182412247, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Greet
* Greet someone
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int16InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int16InIntOut: function(_in) { wails.CallByID(3306292566, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int16PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int16PointerInAndOutput: function(_in) { wails.CallByID(1754277916, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int32InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int32InIntOut: function(_in) { wails.CallByID(1909469092, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int32PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int32PointerInAndOutput: function(_in) { wails.CallByID(4251088558, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int64InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int64InIntOut: function(_in) { wails.CallByID(1343888303, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int64PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int64PointerInAndOutput: function(_in) { wails.CallByID(2205561041, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int8InIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
Int8InIntOut: function(_in) { wails.CallByID(572240879, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.Int8PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
Int8PointerInAndOutput: function(_in) { wails.CallByID(2189402897, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntInIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
IntInIntOut: function(_in) { wails.CallByID(642881729, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntPointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
IntPointerInAndOutput: function(_in) { wails.CallByID(1066151743, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.IntPointerInputNamedOutputs
*
* @param _in {number | null}
* @returns {Promise<number | null, void>}
**/
IntPointerInputNamedOutputs: function(_in) { wails.CallByID(2718999663, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntInt: function(_in) { wails.CallByID(2386486356, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntPointerInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntPointerInt: function(_in) { wails.CallByID(550413585, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntSliceInt
*
* @param _in {map}
* @returns {Promise<void>}
**/
MapIntSliceInt: function(_in) { wails.CallByID(2900172572, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.MapIntSliceIntInMapIntSliceIntOut
*
* @param _in {map}
* @returns {Promise<map>}
**/
MapIntSliceIntInMapIntSliceIntOut: function(_in) { wails.CallByID(881980169, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.NoInputsStringOut
*
*
* @returns {Promise<string>}
**/
NoInputsStringOut: function() { wails.CallByID(1075577233, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerBoolInBoolOut
*
* @param _in {boolean | null}
* @returns {Promise<boolean | null>}
**/
PointerBoolInBoolOut: function(_in) { wails.CallByID(3589606958, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerFloat32InFloat32Out
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
PointerFloat32InFloat32Out: function(_in) { wails.CallByID(224675106, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerFloat64InFloat64Out
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
PointerFloat64InFloat64Out: function(_in) { wails.CallByID(2124953624, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerMapIntInt
*
* @param _in {map | null}
* @returns {Promise<void>}
**/
PointerMapIntInt: function(_in) { wails.CallByID(3516977899, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.PointerStringInStringOut
*
* @param _in {string | null}
* @returns {Promise<string | null>}
**/
PointerStringInStringOut: function(_in) { wails.CallByID(229603958, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputNamedOutput
*
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
StringArrayInputNamedOutput: function(_in) { wails.CallByID(3678582682, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputNamedOutputs
*
* @param _in {string[]}
* @returns {Promise<string[], void>}
**/
StringArrayInputNamedOutputs: function(_in) { wails.CallByID(319259595, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputStringArrayOut
*
* @param _in {string[]}
* @returns {Promise<string[]>}
**/
StringArrayInputStringArrayOut: function(_in) { wails.CallByID(383995060, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StringArrayInputStringOut
*
* @param _in {string[]}
* @returns {Promise<string>}
**/
StringArrayInputStringOut: function(_in) { wails.CallByID(1091960237, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructInputStructOutput
*
* @param _in {main.Person}
* @returns {Promise<main.Person>}
**/
StructInputStructOutput: function(_in) { wails.CallByID(3835643147, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructPointerInputErrorOutput
*
* @param _in {main.Person | null}
* @returns {Promise<void>}
**/
StructPointerInputErrorOutput: function(_in) { wails.CallByID(2447692557, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.StructPointerInputStructPointerOutput
*
* @param _in {main.Person | null}
* @returns {Promise<main.Person | null>}
**/
StructPointerInputStructPointerOutput: function(_in) { wails.CallByID(2943477349, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt16InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt16InUIntOut: function(_in) { wails.CallByID(3401034892, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt16PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt16PointerInAndOutput: function(_in) { wails.CallByID(1236957573, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt32InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt32InUIntOut: function(_in) { wails.CallByID(1160383782, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt32PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt32PointerInAndOutput: function(_in) { wails.CallByID(1739300671, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt64InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt64InUIntOut: function(_in) { wails.CallByID(793803239, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt64PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt64PointerInAndOutput: function(_in) { wails.CallByID(1403757716, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt8InUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UInt8InUIntOut: function(_in) { wails.CallByID(2988345717, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UInt8PointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UInt8PointerInAndOutput: function(_in) { wails.CallByID(518250834, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UIntInUIntOut
*
* @param _in {number}
* @returns {Promise<number>}
**/
UIntInUIntOut: function(_in) { wails.CallByID(2836661285, ...Array.prototype.slice.call(arguments, 0)); },
/**
* GreetService.UIntPointerInAndOutput
*
* @param _in {number | null}
* @returns {Promise<number | null>}
**/
UIntPointerInAndOutput: function(_in) { wails.CallByID(1367187362, ...Array.prototype.slice.call(arguments, 0)); },
},
};
@@ -0,0 +1,205 @@
package main
import (
_ "embed"
"log"
"strings"
"github.com/wailsapp/wails/v3/pkg/application"
)
type Person struct {
Name string
Parent *Person
Details struct {
Age int
Address struct {
Street string
}
}
}
// GreetService is great
type GreetService struct {
SomeVariable int
lowerCase string
}
// Greet someone
func (GreetService) Greet(name string) string {
return "Hello " + name
}
func (GreetService) NoInputsStringOut() string {
return "Hello"
}
func (GreetService) StringArrayInputStringOut(in []string) string {
return strings.Join(in, ",")
}
func (GreetService) StringArrayInputStringArrayOut(in []string) []string {
return in
}
func (GreetService) StringArrayInputNamedOutput(in []string) (output []string) {
return in
}
func (GreetService) StringArrayInputNamedOutputs(in []string) (output []string, err error) {
return in, nil
}
func (GreetService) IntPointerInputNamedOutputs(in *int) (output *int, err error) {
return in, nil
}
func (GreetService) UIntPointerInAndOutput(in *uint) *uint {
return in
}
func (GreetService) UInt8PointerInAndOutput(in *uint8) *uint8 {
return in
}
func (GreetService) UInt16PointerInAndOutput(in *uint16) *uint16 {
return in
}
func (GreetService) UInt32PointerInAndOutput(in *uint32) *uint32 {
return in
}
func (GreetService) UInt64PointerInAndOutput(in *uint64) *uint64 {
return in
}
func (GreetService) IntPointerInAndOutput(in *int) *int {
return in
}
func (GreetService) Int8PointerInAndOutput(in *int8) *int8 {
return in
}
func (GreetService) Int16PointerInAndOutput(in *int16) *int16 {
return in
}
func (GreetService) Int32PointerInAndOutput(in *int32) *int32 {
return in
}
func (GreetService) Int64PointerInAndOutput(in *int64) *int64 {
return in
}
func (GreetService) IntInIntOut(in int) int {
return in
}
func (GreetService) Int8InIntOut(in int8) int8 {
return in
}
func (GreetService) Int16InIntOut(in int16) int16 {
return in
}
func (GreetService) Int32InIntOut(in int32) int32 {
return in
}
func (GreetService) Int64InIntOut(in int64) int64 {
return in
}
func (GreetService) UIntInUIntOut(in uint) uint {
return in
}
func (GreetService) UInt8InUIntOut(in uint8) uint8 {
return in
}
func (GreetService) UInt16InUIntOut(in uint16) uint16 {
return in
}
func (GreetService) UInt32InUIntOut(in uint32) uint32 {
return in
}
func (GreetService) UInt64InUIntOut(in uint64) uint64 {
return in
}
func (GreetService) Float32InFloat32Out(in float32) float32 {
return in
}
func (GreetService) Float64InFloat64Out(in float64) float64 {
return in
}
func (GreetService) PointerFloat32InFloat32Out(in *float32) *float32 {
return in
}
func (GreetService) PointerFloat64InFloat64Out(in *float64) *float64 {
return in
}
func (GreetService) BoolInBoolOut(in bool) bool {
return in
}
func (GreetService) PointerBoolInBoolOut(in *bool) *bool {
return in
}
func (GreetService) PointerStringInStringOut(in *string) *string {
return in
}
func (GreetService) StructPointerInputErrorOutput(in *Person) error {
return nil
}
func (GreetService) StructInputStructOutput(in Person) Person {
return in
}
func (GreetService) StructPointerInputStructPointerOutput(in *Person) *Person {
return in
}
func (GreetService) MapIntInt(in map[int]int) {
}
func (GreetService) PointerMapIntInt(in *map[int]int) {
}
func (GreetService) MapIntPointerInt(in map[*int]int) {
}
func (GreetService) MapIntSliceInt(in map[int][]int) {
}
func (GreetService) MapIntSliceIntInMapIntSliceIntOut(in map[int][]int) (out map[int][]int) {
return nil
}
func (GreetService) ArrayInt(in [4]int) {
}
func main() {
app := application.New(application.Options{
Bind: []interface{}{
&GreetService{},
},
})
app.NewWebviewWindow()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
@@ -0,0 +1,64 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export namespace main {
export class Person {
name: string;
parent: Person;
details: anon1;
static createFrom(source: any = {}) {
return new Person(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) {
source = JSON.parse(source);
}
this.name = source['name'];
this.parent = Person.createFrom(source['parent']);
this.details = anon1.createFrom(source['details']);
}
}
export class anon1 {
age: number;
address: anon2;
static createFrom(source: any = {}) {
return new anon1(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) {
source = JSON.parse(source);
}
this.age = source['age'];
this.address = anon2.createFrom(source['address']);
}
}
export class anon2 {
street: string;
static createFrom(source: any = {}) {
return new anon2(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) {
source = JSON.parse(source);
}
this.street = source['street'];
}
}
}