Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Fable.Compiler/Globbing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ module Glob =
let inline normalizePath (path: string) =
path.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar)

[<Struct>]
type private SearchOption =
| Directory of string
| Drive of string
| Directory of dir: string
| Drive of drive: string
| Recursive
| FilePattern of string
| FilePattern of pattern: string

let private checkSubDirs absolute (dir: string) root =
if dir.Contains "*" then
Expand Down
7 changes: 4 additions & 3 deletions src/Fable.Compiler/Globbing.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ module Glob =

val inline normalizePath: path: string -> string

[<Struct>]
type private SearchOption =
| Directory of string
| Drive of string
| Directory of dir: string
| Drive of drive: string
| Recursive
| FilePattern of string
| FilePattern of pattern: string

val internal getRoot: baseDirectory: string -> pattern: string -> string
val internal search: baseDir: string -> originalInput: string -> string list
Expand Down
9 changes: 5 additions & 4 deletions src/Fable.Compiler/Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,12 @@ module Json =
open Fable.AST

// TODO: Check which other parameters are accepted by attributes (arrays?)
[<Struct>]
type AttParam =
| Int of int
| Float of float
| Bool of bool
| String of string
| Int of intValue: int
| Float of floatValue: float
| Bool of boolValue: bool
| String of stringValue: string

static member From(values: obj list) =
(Ok [], values)
Expand Down
4 changes: 4 additions & 0 deletions src/Fable.Transforms/Dart/Dart.fs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Loosely based on https://pub.dev/documentation/analyzer/latest/dart_ast_ast/dart_ast_ast-library.html
module rec Fable.AST.Dart

[<Struct>]
type UpdateOperator =
| UpdateMinus
| UpdatePlus

[<Struct>]
type AssignmentOperator =
| AssignEqual
| AssignMinus
Expand Down Expand Up @@ -259,6 +261,7 @@ type Expression =
static member throwExpression(value, typ) = ThrowExpression(value, typ)
static member rethrowExpression(typ) = RethrowExpression typ

[<Struct>]
type VariableDeclarationKind =
| Final
| Const
Expand Down Expand Up @@ -378,6 +381,7 @@ type InstanceVariable(ident, ?value, ?kind, ?isOverride, ?isLate) =
member _.IsOverride = defaultArg isOverride false
member _.IsLate = defaultArg isLate false

[<Struct>]
type MethodKind =
| IsMethod
| IsGetter
Expand Down
1 change: 1 addition & 0 deletions src/Fable.Transforms/Dart/DartPrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ open Fable.AST
open Fable.AST.Dart
open Fable.Transforms.Printer

[<Struct>]
type ListPos =
| IsFirst
| IsMiddle
Expand Down
1 change: 1 addition & 0 deletions src/Fable.Transforms/Dart/Fable2Dart.fs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Context =

{ this with EntityAndMemberGenericParams = this.EntityAndMemberGenericParams @ genParams }

[<Struct>]
type MemberKind =
| ClassConstructor
| NonAttached of funcName: string
Expand Down
7 changes: 4 additions & 3 deletions src/Fable.Transforms/FSharp2Fable.Util.fs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,11 @@ type FsField(fi: FSharpField) =
| n -> name + "_" + (string<int> n)

[<RequireQualifiedAccess>]
[<Struct>]
type CompiledValue =
| Integer of int
| Float of float
| Boolean of bool
| Integer of intValue: int
| Float of floatValue: float
| Boolean of boolValue: bool

type FsUnionCase(uci: FSharpUnionCase) =
/// FSharpUnionCase.CompiledName doesn't give the value of CompiledNameAttribute
Expand Down
2 changes: 2 additions & 0 deletions src/Fable.Transforms/Fable2Babel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type ReturnStrategy =
| Assign of Expression
| Target of Identifier

[<Struct>]
type ConstructorRef =
| Annotation
| ActualConsRef
Expand Down Expand Up @@ -1329,6 +1330,7 @@ module Util =

scopedTypeParams, typeParams

[<Struct>]
type MemberKind =
| ClassConstructor
| NonAttached of funcName: string
Expand Down
6 changes: 6 additions & 0 deletions src/Fable.Transforms/Global/Babel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ namespace rec Fable.AST.Babel

open Fable.AST

[<Struct>]
type UpdateOperator =
| UpdateMinus
| UpdatePlus

[<Struct>]
type AssignmentOperator =
| AssignEqual
| AssignMinus
Expand Down Expand Up @@ -204,6 +206,7 @@ type Declaration =

/// A directive prologue as defined in ECMA specification
/// https://tc39.es/ecma262/#sec-directive-prologues-and-the-use-strict-directive
[<Struct>]
type DirectivePrologue = | DirectivePrologue of text: string

/// A module import or export declaration.
Expand Down Expand Up @@ -300,6 +303,7 @@ type VariableDeclarator =
init: Expression option *
loc: SourceLocation option

[<Struct>]
type VariableDeclarationKind =
| Var
| Let
Expand Down Expand Up @@ -412,6 +416,7 @@ type ObjectMember =
// let shorthand = defaultArg shorthand_ false
// member _.Shorthand: bool = shorthand

[<Struct>]
type ObjectMethodKind =
| ObjectGetter
| ObjectSetter
Expand Down Expand Up @@ -440,6 +445,7 @@ type ObjectMethodKind =


// Classes
[<Struct>]
type AccessModifier =
| Public
| Private
Expand Down
2 changes: 2 additions & 0 deletions src/Fable.Transforms/Global/Compiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ type CompilerOptionsHelper =
}

[<RequireQualifiedAccess>]
[<Struct>]
type Severity =
| Warning
| Error
| Info

[<RequireQualifiedAccess>]
[<Struct>]
type OutputType =
| Library
| Exe
Expand Down
5 changes: 3 additions & 2 deletions src/Fable.Transforms/Php/Fable2Php.fs
Original file line number Diff line number Diff line change
Expand Up @@ -756,15 +756,16 @@ let convertRecord (com: IPhpCompiler) (decl: Fable.ClassDecl) (info: Fable.Entit
/// F# is expression based, but some constructs have to be transpiled as
/// statements in other languages. This types indicates how the result
/// should be passed to the resto of the code.
[<Struct>]
type ReturnStrategy =
/// The statement should return the value
| Return
/// The statement should define a new variable and assign it
| Let of string
| Let of varName: string
/// No return value
| Do
/// used in decision tree when multiple cases result in the same code
| Target of string
| Target of targetName: string

let nsreplacement (ns: string) =
match ns.Replace(".", @"\") with
Expand Down
23 changes: 13 additions & 10 deletions src/Fable.Transforms/Php/Php.fs
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
namespace rec Fable.AST.Php

[<Struct>]
type PhpConst =
| PhpConstNumber of float
| PhpConstString of string
| PhpConstBool of bool
| PhpConstNumber of number: float
| PhpConstString of str: string
| PhpConstBool of flag: bool
| PhpConstNull

[<Struct>]
type PhpArrayIndex =
| PhpArrayNoIndex
| PhpArrayInt of int
| PhpArrayString of string
| PhpArrayInt of index: int
| PhpArrayString of key: string

type PhpField =
{
Name: string
Type: string
}

[<Struct>]
type Capture =
| ByValue of string
| ByRef of string
| ByValue of valueName: string
| ByRef of refName: string

type Prop =
| Field of PhpField
Expand Down Expand Up @@ -70,9 +73,9 @@ and PhpStatement =
| PhpFor of ident: string * start: PhpExpr * limit: PhpExpr * isUp: bool * body: PhpStatement list
| PhpDo of PhpExpr

and PhpCase =
| IntCase of int
| StringCase of string
and [<Struct>] PhpCase =
| IntCase of intValue: int
| StringCase of strValue: string
| DefaultCase

and PhpTypeRef =
Expand Down
1 change: 1 addition & 0 deletions src/Fable.Transforms/Python/Fable2Python.Types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type ITailCallOpportunity =
abstract Args: Arg list
abstract IsRecursiveRef: Fable.Expr -> bool

[<Struct>]
type MemberKind =
| ClassConstructor
| NonAttached of funcName: string
Expand Down
6 changes: 6 additions & 0 deletions src/Fable.Transforms/Python/Python.AST.fs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ type Literal =
| TupleLiteral of Literal list
| FrozensetLiteral of Literal list

[<Struct>]
type Operator =
| Add
| Sub
Expand All @@ -148,10 +149,12 @@ type Operator =
| BitAnd
| MatMult

[<Struct>]
type BoolOperator =
| And
| Or

[<Struct>]
type ComparisonOperator =
| Eq
| NotEq
Expand All @@ -164,17 +167,20 @@ type ComparisonOperator =
| In
| NotIn

[<Struct>]
type UnaryOperator =
| Invert
| Not
| UAdd
| USub

[<Struct>]
type ExpressionContext =
| Load
| Del
| Store

[<Struct>]
type Identifier =
| Identifier of name: string

Expand Down
1 change: 1 addition & 0 deletions src/Fable.Transforms/Rust/AST/Rust.AST.Parser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type AssocOp =

//#[derive(PartialEq, Debug)]
[<RequireQualifiedAccess>]
[<Struct>]
type Fixity =
/// The operator is left-associative
| Left
Expand Down
1 change: 1 addition & 0 deletions src/Fable.Transforms/Rust/AST/Rust.AST.Pretty.fs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ open type Macros

/// How to break. Described in more detail in the module docs.
[<RequireQualifiedAccess>]
[<Struct>]
type Breaks =
| Consistent
| Inconsistent
Expand Down
2 changes: 2 additions & 0 deletions src/Fable.Transforms/Rust/AST/Rust.AST.State.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type AsmArg =
type SourceMap() = class end

[<RequireQualifiedAccess>]
[<Struct>]
type CommentStyle =
/// No code on either side of each line of the comment
| Isolated
Expand Down Expand Up @@ -117,6 +118,7 @@ type State =
}

[<RequireQualifiedAccess>]
[<Struct>]
type Edition =
/// The 2015 edition
| Edition2015
Expand Down
Loading
Loading