5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-03 01:43:15 +08:00
wails/v3/internal/parser
Lea Anthony b606561f8d
Move struct cache into parsed package
Fix bug in package path calculation
2023-02-21 07:18:08 +11:00
..
testdata Parse Models 2023-02-20 20:36:58 +11:00
models.go [v3] Improved parser for bound structs 2023-02-17 20:57:31 +11:00
parser_test.go Parse Models 2023-02-20 20:36:58 +11:00
parser.go Move struct cache into parsed package 2023-02-21 07:18:08 +11:00
README.md Parse Models 2023-02-20 20:36:58 +11:00

Parser

This package contains the static analyser used for parsing Wails projects so that we may:

  • Generate the bindings for the frontend
  • Generate Typescript definitions for the structs used by the bindings

Implemented

  • Parsing of bound methods
    • Method names
    • Method parameters
      • Zero parameters
      • Single input parameter
      • Single output parameter
      • Multiple input parameters
      • Multiple output parameters
      • Named output parameters
      • int
        • Pointer
      • uint
        • Pointer
      • float
        • Pointer
      • string
        • Pointer
      • bool
        • Pointer
      • Struct
        • Pointer
      • Slices
        • Pointer
        • Recursive
      • Maps
        • Pointer
  • Model Parsing
    • In same package
    • In different package
    • Multiple named fields, e.g. one,two,three string
    • Scalars
    • Arrays
    • Maps
    • Structs
      • Anonymous structs
  • Generation of models
    • Scalars
    • Arrays
    • Maps
    • Structs
  • Generation of bindings

Limitations

There are many ways to write a Go program so there are many different program structures that we would need to support. This is a work in progress and will be improved over time. The current limitations are:

  • The call to application.New() must be in the main package
  • Bound structs must be declared as struct literals