5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-05 05:21:03 +08:00
wails/v3/internal/parser
Fabio Massaioli 45b2681dfc
[v3] Fix binding generator output and import paths (#3334)
* Fix relative import path computation

* Fix models output path

* Add option to generate bindings using bundled runtime

* Update binding example

* Fix testdata

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-22 21:18:04 +11:00
..
templates Update bindings generator to generate bindings in packages and files. 2023-12-22 20:01:42 +11:00
testdata [v3] Fix binding generator output and import paths (#3334) 2024-03-22 21:18:04 +11:00
bindings_test.go [v3] Fix binding generator output and import paths (#3334) 2024-03-22 21:18:04 +11:00
bindings.go [v3] Fix binding generator output and import paths (#3334) 2024-03-22 21:18:04 +11:00
constants_test.go Add generate constants tool 2023-09-13 16:45:19 +10:00
constants.go Add generate constants tool 2023-09-13 16:45:19 +10:00
models_test.go Update bindings generator to generate bindings in packages and files. 2023-12-22 20:01:42 +11:00
models.go [v3] Fix binding generator output and import paths (#3334) 2024-03-22 21:18:04 +11:00
parser_enum_test.go [bindings] Support aliases in package imports 2024-01-14 08:07:47 +11:00
parser_function_test.go [bindings] Support aliases in package imports 2024-01-14 08:07:47 +11:00
parser_struct_literal_multiple_test.go [bindings] Support aliases in package imports 2024-01-14 08:07:47 +11:00
parser_struct_literal_non_pointer_single_test.go [bindings] Support aliases in package imports 2024-01-14 08:07:47 +11:00
parser_struct_literal_single_test.go [bindings] Support aliases in package imports 2024-01-14 08:07:47 +11:00
parser_variable_single_test.go [bindings] Support aliases in package imports 2024-01-14 08:07:47 +11:00
parser.go [v3] Fix binding generator output and import paths (#3334) 2024-03-22 21:18:04 +11:00
README.md Support bindings, model & enum generation 2023-12-12 21:51:40 +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

  • Bound types

    • Struct Literal Pointer
    • Variable
      • Assignment
        • Struct Literal Pointer
        • Function
          • Same package
          • Different package
    • Function
  • 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/8/16/32/64
        • Pointer
      • uint/8/16/32/64
        • Pointer
      • float
        • Pointer
      • string
        • Pointer
      • bool
        • Pointer
      • Struct
        • Pointer
      • Slices
        • Pointer
      • Maps
        • Pointer
  • Model Parsing

    • In same package
    • In different package
    • Multiple named fields, e.g. one,two,three string
    • Scalars
    • Arrays
    • Maps
    • Structs
      • Recursive
      • Anonymous
  • Generation of models

    • Scalars
    • Arrays
    • Maps
    • Structs
  • Generation of bindings

    • Classes
    • Interfaces
    • Enums

Limitations

There are many ways to write a Go program so there are many 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