Open declarations
An import declaration specifies a module or namespace whose elements you can reference without using a fully qualified name.
For details on how the AST node works, please refer to the Fantomas Core documentation.
Constructors
Constructors |
Description |
---|---|
Open(values: string list) |
Creates an OpenListNode AST node |
Open(value: string) |
Creates an OpenListNode AST node |
OpenType(values: string) |
Creates an OpenListNode AST node |
OpenType(value: string) |
Creates an OpenListNode AST node |
#r "../../src/Fabulous.AST/bin/Release/netstandard2.1/publish/Fantomas.Core.dll"
#r "../../src/Fabulous.AST/bin/Release/netstandard2.1/publish/Fabulous.AST.dll"
#r "../../src/Fabulous.AST/bin/Release/netstandard2.1/publish/Fantomas.FCS.dll"
open Fabulous.AST
open type Fabulous.AST.Ast
Oak() {
AnonymousModule() {
Open([ "System"; "IO" ])
.triviaBefore(SingleLine("Open a .NET Framework namespace."))
Open("Fabulous.AST").triviaAfter(Newline())
OpenType([ "System.Math" ])
.triviaBefore(SingleLine("This will expose all accessible static fields and members on the type."))
.triviaAfter(Newline())
OpenGlobal("A")
.triviaBefore(SingleLine("Open from root path only with global specifier"))
OpenGlobal("B")
OpenGlobal([ "A"; "B" ])
}
|> _.triviaBefore(SingleLine("Import declarations: The open keyword"))
}
|> Gen.mkOak
|> Gen.run
|> printfn "%s"
// produces the following code:
|
namespace Fabulous
namespace Fabulous.AST
type Ast =
class end
Multiple items
static member Ast.Oak: unit -> CollectionBuilder<Fantomas.Core.SyntaxOak.Oak,'marker>
--------------------
module Oak from Fabulous.AST
static member Ast.Oak: unit -> CollectionBuilder<Fantomas.Core.SyntaxOak.Oak,'marker>
--------------------
module Oak from Fabulous.AST
static member Ast.AnonymousModule: unit -> CollectionBuilder<Fantomas.Core.SyntaxOak.ModuleOrNamespaceNode,Fantomas.Core.SyntaxOak.ModuleDecl>
Multiple items
static member Ast.Open: value: string -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
static member Ast.Open: values: string list -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
--------------------
module Open from Fabulous.AST
static member Ast.Open: value: string -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
static member Ast.Open: values: string list -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
--------------------
module Open from Fabulous.AST
static member Ast.SingleLine: text: string -> WidgetBuilder<Fantomas.Core.SyntaxOak.TriviaContent>
Multiple items
static member Ast.Newline: unit -> WidgetBuilder<Fantomas.Core.SyntaxOak.TriviaContent>
--------------------
module Newline from Fabulous.AST
static member Ast.Newline: unit -> WidgetBuilder<Fantomas.Core.SyntaxOak.TriviaContent>
--------------------
module Newline from Fabulous.AST
static member Ast.OpenType: value: string -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
static member Ast.OpenType: values: string list -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
static member Ast.OpenType: values: string list -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
static member Ast.OpenGlobal: value: string -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
static member Ast.OpenGlobal: values: string list -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
static member Ast.OpenGlobal: values: string list -> WidgetBuilder<Fantomas.Core.SyntaxOak.OpenListNode>
module Gen
from Fabulous.AST
<summary> It takes the root of the widget tree and create the corresponding Fantomas node, and recursively creating all children nodes </summary>
<summary> It takes the root of the widget tree and create the corresponding Fantomas node, and recursively creating all children nodes </summary>
val mkOak: root: WidgetBuilder<'node> -> 'node
val run: oak: Fantomas.Core.SyntaxOak.Oak -> string
val printfn: format: Printf.TextWriterFormat<'T> -> 'T