Skip to content

Commit

Permalink
Cleanup of ast and tkinter modules (#74)
Browse files Browse the repository at this point in the history
* Fixes for interfaces in ast and tkinter

* Bump dep version

* Update fable
  • Loading branch information
dbrattli committed Sep 22, 2022
1 parent cb4075d commit 5f24e18
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"fable": {
"version": "4.0.0-theta-006",
"version": "4.0.0-theta-008",
"commands": [
"fable"
]
Expand Down
18 changes: 18 additions & 0 deletions src/stdlib/Ast.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,34 @@ open Fable.Core
type _identifier = string


[<Import("AST", "ast")>]
type AST =
abstract foo: int

[<Import("mod", "ast")>]
type ``mod`` =
inherit AST

[<Import("expr", "ast")>]
type expr =
inherit AST

[<Import("Module", "ast")>]
type Module =
inherit ``mod``
abstract body: stmt array

[<Import("Expression", "ast")>]
type Expression =
inherit ``mod``
abstract body: expr

[<Import("Module", "ast")>]
type stmt =
inherit AST


[<Import("FunctionDef", "ast")>]
type FunctionDef =
inherit stmt

Expand All @@ -37,6 +44,7 @@ type FunctionDef =
abstract decorator_list: expr array
abstract returns: expr option

[<Import("ClassDef", "ast")>]
type ClassDef =
inherit stmt
abstract name: _identifier
Expand All @@ -45,35 +53,42 @@ type ClassDef =
abstract body: stmt array
abstract decorator_list: expr array

[<Import("Return", "ast")>]
type Return =
inherit stmt
abstract value: expr option

[<Import("Delete", "ast")>]
type Delete =
inherit stmt
abstract targets: expr array

[<Import("Assign", "ast")>]
type Assign =
inherit stmt
abstract targets: expr array
abstract value: expr

[<Import("Import", "ast")>]
type Import =
inherit stmt
abstract names: alias array

[<Import("ImportFrom", "ast")>]
type ImportFrom =
inherit stmt
abstract ``module``: _identifier option
abstract names: alias array
abstract level: int

[<Import("If", "ast")>]
type If =
inherit stmt
abstract test: expr
abstract body: stmt array
abstract orelse: stmt array

[<Import("arguments", "ast")>]
type arguments =
inherit AST

Expand All @@ -85,16 +100,19 @@ type arguments =
abstract kwarg: arg option
abstract defaults: expr array

[<Import("arg", "ast")>]
type arg =
inherit AST
abstract arg: _identifier
abstract annotation: expr option

[<Import("keyword", "ast")>]
type keyword =
inherit AST
abstract arg: _identifier option
abstract value: expr

[<Import("alias", "ast")>]
type alias =
inherit AST
abstract name: _identifier
Expand Down
4 changes: 4 additions & 0 deletions src/stdlib/TkInter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ module Fable.Python.TkInter

open Fable.Core

[<Import("Event", "tkinter")>]
type Event =
abstract member x : int
abstract member y : int

[<Import("Misc", "tkinter")>]
type Misc =
abstract member bind : sequence: string * func: (Event -> unit) -> string option

[<Import("Wm", "tkinter")>]

type Wm =
abstract member title : unit -> string
abstract member title : string: string -> unit
Expand Down

0 comments on commit 5f24e18

Please sign in to comment.