Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ncave committed Aug 18, 2024
1 parent 0df9b83 commit c17c32f
Show file tree
Hide file tree
Showing 9 changed files with 619 additions and 391 deletions.
868 changes: 543 additions & 325 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
"posttest-ts": "mocha build/tests/TypeScriptCompiled/build/tests/TypeScript -reporter dot -t 10000"
},
"dependencies": {
"@types/node": "^20.12.4",
"@types/node": "^22.4.0",
"concurrently": "^8.2.2",
"ghreleases": "^3.0.2",
"mocha": "^10.4.0",
"nodemon": "^3.1.0",
"rollup": "^4.14.0",
"terser": "^5.30.3",
"typescript": "^5.4.4"
"mocha": "^10.7.3",
"nodemon": "^3.1.4",
"rollup": "^4.21.0",
"terser": "^5.31.6",
"typescript": "^5.5.4"
},
"devDependencies": {
"markdownlint-cli": "^0.38.0"
"markdownlint-cli": "^0.41.0"
}
}
9 changes: 8 additions & 1 deletion src/Fable.Cli/Main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,14 @@ let private compilationCycle (state: State) (changes: ISet<string>) =
let projCracked, fableCompiler, filesToCompile =
match state.ProjectCrackedAndFableCompiler with
| None ->
let projCracked = ProjectCracked.Init(cliArgs, state.UseMSBuildForCracking)
// #if DEBUG
// let evaluateOnly = true
// #else
let evaluateOnly = false
// #endif
let projCracked =
ProjectCracked.Init(cliArgs, state.UseMSBuildForCracking, evaluateOnly)

projCracked, None, projCracked.SourceFilePaths

| Some(projCracked, fableCompiler) ->
Expand Down
16 changes: 9 additions & 7 deletions src/Fable.Compiler/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,16 @@ let makeProjectOptions (opts: CrackerOptions) otherOptions sources : FSharpProje
let tryGetFablePackage (opts: CrackerOptions) (dllPath: string) =
let tryFileWithPattern dir pattern =
try
let files = IO.Directory.GetFiles(dir, pattern)

match files.Length with
| 0 -> None
| 1 -> Some files[0]
| _ ->
Log.always ("More than one file found in " + dir + " with pattern " + pattern)
if IO.Directory.Exists dir then
let files = IO.Directory.GetFiles(dir, pattern)

match files.Length with
| 0 -> None
| 1 -> Some files[0]
| _ ->
Log.always ("More than one file found in " + dir + " with pattern " + pattern)
None
else
None
with _ ->
None
Expand Down
84 changes: 42 additions & 42 deletions src/Fable.Transforms/Rust/Fable2Rust.fs
Original file line number Diff line number Diff line change
Expand Up @@ -611,14 +611,15 @@ module TypeInfo =
| Fable.GenericParam(name, isMeasure, _) -> not (isInferredGenericParam com ctx name isMeasure)
| _ -> false

let typeImplementsCopyTrait (com: IRustCompiler) ctx typ =
let rec typeImplementsCopyTrait (com: IRustCompiler) ctx typ =
match typ with
| Fable.Number(BigInt, _) -> false
| Fable.Unit
| Fable.Boolean
| Fable.Char
| Fable.Number _ -> // all numbers except BigInt
true
| Replacements.Util.IsByRefType com t -> typeImplementsCopyTrait com ctx t
| _ -> false

let rec tryGetIdentName =
Expand Down Expand Up @@ -2021,7 +2022,7 @@ module Util =
match e with
| MaybeCasted(Fable.IdentExpr ident) ->
// clone non-mutable idents if used more than once
not (ident.IsMutable) && not (isUsedOnce ctx ident.Name)
not (ident.IsMutable) && not (isUsedOnce ctx ident.Name) //&& not (isByRefType com ident.Type)
| Fable.Get(_, Fable.FieldGet _, _, _) -> true // always clone field get exprs
// | Fable.Get(_, _, _, _) -> //TODO: clone other gets ???
| _ -> false
Expand All @@ -2034,6 +2035,10 @@ module Util =

// Careful moving this, as idents mutably subtract their count as they are seen, so ident transforming must happen AFTER checking
let expr =
// match e with
// | Fable.IdentExpr ident when isIdentAtTailPos (fun i -> isByRefType com i.Type) e ->
// transformIdent com ctx None ident
// | _ ->
//only valid for this level, so must reset for nested expressions
let ctx = { ctx with IsParamByRefPreferred = false }
com.TransformExpr(ctx, e)
Expand All @@ -2042,42 +2047,37 @@ module Util =
| _, _, false, true, _, false -> expr |> mkAddrOfExpr
| _, _, true, true, _, false -> expr
| _, _, true, false, _, false -> expr |> makeClone
| true, _, false, false, _, false -> expr
| false, true, _, false, true, false -> expr |> makeClone
| _ -> expr
//|> BLOCK_COMMENT_SUFFIX (sprintf implCopy: %b, "implClone: %b, sourceIsRef; %b, targetIsRef: %b, isOnlyRef: %b (%i), isUnreachable: %b" implCopy implClone sourceIsRef targetIsRef isOnlyRef isUnreachable varAttrs.UsageCount)

(*
let enumerator2iterator com ctx =
let enumerator = Expression.callExpression(get None (Expression.identifier("this")) "GetEnumerator", [||])
BlockStatement([| Statement.returnStatement(libCall com ctx None [] "Util" "toIterator" [|enumerator|])|])
let extractBaseExprFromBaseCall (com: IRustCompiler) (ctx: Context) (baseType: Fable.DeclaredType option) baseCall =
match baseCall, baseType with
| Some(Fable.Call(baseRef, info, _, _)), _ ->
let baseExpr =
match baseRef with
| Fable.IdentExpr ident -> typedIdent com ctx ident |> Expression.Identifier
| _ -> transformExpr com ctx baseRef
let args = transformCallArgs com ctx info.Args
Some(baseExpr, args)
| Some(Fable.Value _), Some baseType ->
// let baseEnt = com.GetEntity(baseType.Entity)
// let entityName = FSharp2Fable.Helpers.getEntityDeclarationName com baseType.Entity
// let entityType = FSharp2Fable.Util.getEntityType baseEnt
// let baseRefId = makeTypedIdent entityType entityName
// let baseExpr = (baseRefId |> typedIdent com ctx) :> Expression
// Some(baseExpr, []) // default base constructor
let range = baseCall |> Option.bind (fun x -> x.Range)
$"Ignoring base call for %s{baseType.Entity.FullName}" |> addWarning com [] range
None
| Some _, _ ->
let range = baseCall |> Option.bind (fun x -> x.Range)
"Unexpected base call expression, please report" |> addError com [] range
None
| None, _ ->
None
*)
// |> BLOCK_COMMENT_SUFFIX (sprintf implCopy: %b, "implClone: %b, sourceIsRef; %b, targetIsRef: %b, isOnlyRef: %b (%i), isUnreachable: %b" implCopy implClone sourceIsRef targetIsRef isOnlyRef isUnreachable varAttrs.UsageCount)


// let extractBaseExprFromBaseCall (com: IRustCompiler) (ctx: Context) (baseType: Fable.DeclaredType option) baseCall =
// match baseCall, baseType with
// | Some(Fable.Call(baseRef, info, _, _)), _ ->
// let baseExpr =
// match baseRef with
// | Fable.IdentExpr ident -> typedIdent com ctx ident |> Expression.Identifier
// | _ -> transformExpr com ctx baseRef
// let args = transformCallArgs com ctx info.Args
// Some(baseExpr, args)
// | Some(Fable.Value _), Some baseType ->
// // let baseEnt = com.GetEntity(baseType.Entity)
// // let entityName = FSharp2Fable.Helpers.getEntityDeclarationName com baseType.Entity
// // let entityType = FSharp2Fable.Util.getEntityType baseEnt
// // let baseRefId = makeTypedIdent entityType entityName
// // let baseExpr = (baseRefId |> typedIdent com ctx) :> Expression
// // Some(baseExpr, []) // default base constructor
// let range = baseCall |> Option.bind (fun x -> x.Range)
// $"Ignoring base call for %s{baseType.Entity.FullName}" |> addWarning com [] range
// None
// | Some _, _ ->
// let range = baseCall |> Option.bind (fun x -> x.Range)
// "Unexpected base call expression, please report" |> addError com [] range
// None
// | None, _ ->
// None


let makeObjectExprMemberDecl (com: IRustCompiler) ctx (memb: Fable.ObjectExprMember) =
let capturedIdents = getCapturedIdents com ctx (Some memb.Name) memb.Args memb.Body
Expand Down Expand Up @@ -2336,7 +2336,7 @@ module Util =
// mutable module values (transformed as function calls)
| Fable.IdentExpr ident when ident.IsMutable && isModuleMemberCall com callInfo ->
let expr = transformIdent com ctx range ident
mutableGet (mkCallExpr expr [])
mkCallExpr expr [] |> mutableGet

| Fable.Get(calleeExpr, (Fable.FieldGet info as kind), t, _r) ->
// this is an instance call
Expand Down Expand Up @@ -2369,7 +2369,7 @@ module Util =
let callee = transformImport com ctx r t info genArgsOpt

if memb.IsMutable && memb.IsValue then
mutableGet (mkCallExpr callee [])
mkCallExpr callee [] |> mutableGet
else
mkCallExpr callee args
| None, Fable.LibraryImport memberInfo ->
Expand Down Expand Up @@ -3995,11 +3995,10 @@ module Util =
// | Fable.DeclaredType(entRef, _) -> entRef.FullName = ent.FullName
// | _ -> false

// does the member body return thisArg
let isFluentMemberBody (body: Fable.Expr) =
let isIdentAtTailPos (predicate: Fable.Ident -> bool) (body: Fable.Expr) =
let rec loop =
function
| Fable.IdentExpr ident when ident.IsThisArgument -> true
| Fable.IdentExpr ident when predicate ident -> true
| Fable.Sequential exprs -> loop (List.last exprs)
| Fable.Let(_, value, body) -> loop body
| Fable.LetRec(bindings, body) -> loop body
Expand Down Expand Up @@ -4060,7 +4059,8 @@ module Util =
transformFunc com ctx parameters (Some name) args body

let fnBody =
if isFluentMemberBody body then
if isIdentAtTailPos (fun ident -> ident.IsThisArgument) body then
// body returns ThisArg, i.e. Fluent API
fnBody |> makeFluentValue com ctx
else
fnBody
Expand Down
6 changes: 3 additions & 3 deletions tests/Php/Fable.Tests.Php.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="XUnit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="XUnit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions tests/Python/Fable.Tests.Python.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<RootNamespace>Fable.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="XUnit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="XUnit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
1 change: 1 addition & 0 deletions tests/Rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[features]
no_std = ["fable_library_rust/no_std"]
static_do_bindings = ["fable_library_rust/static_do_bindings"]
threaded = ["fable_library_rust/threaded"]
# default = ["threaded"] # Uncomment when attempting to debug/use rust analyzer to switch to threaded mode

Expand Down
6 changes: 3 additions & 3 deletions tests/Rust/Fable.Tests.Rust.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="XUnit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="XUnit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit c17c32f

Please sign in to comment.