5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 17:39:58 +08:00
wails/v3/internal/parser
Adam Tenderholt 130fab6c01 Feature/v3 parser: expand TS model generation tests & some fixes (#2485)
* v3 parser: add tests for model generation

* v3 parser: use single quotes for got model.ts

* v3 parser: fixes for some failing tests

* v3 parser: misc simplification and cleanup

* v3 parser: fix model tests when no structs returned

* v3 parser: fix last failing test case

* Update contributors list

* v3 parser: update README

* Revert "Update contributors list"

This reverts commit f429d2ba89.

* Changelog: add line about my contribution
2023-03-25 10:09:17 +11:00
..
templates Feature/v3 parser: expand TS model generation tests & some fixes (#2485) 2023-03-25 10:09:17 +11:00
testdata Feature/v3 parser: expand TS model generation tests & some fixes (#2485) 2023-03-25 10:09:17 +11:00
bindings_test.go Create bindings file per package 2023-03-07 18:22:33 +11:00
bindings.go Fix reserve word check. 2023-03-07 19:48:30 +11:00
models_test.go Feature/v3 parser: expand TS model generation tests & some fixes (#2485) 2023-03-25 10:09:17 +11:00
models.go Feature/v3 parser: expand TS model generation tests & some fixes (#2485) 2023-03-25 10:09:17 +11:00
parser_test.go Add tests for bound structs returned by function calls. 2023-02-26 19:18:47 +11:00
parser.go Feature/v3 parser: expand TS model generation tests & some fixes (#2485) 2023-03-25 10:09:17 +11:00
README.md Feature/v3 parser: expand TS model generation tests & some fixes (#2485) 2023-03-25 10:09:17 +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

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