Skip to content

Commit

Permalink
[Rust] Added decision tree multiple target references (fable-compiler…
Browse files Browse the repository at this point in the history
  • Loading branch information
ncave authored Oct 23, 2024
1 parent 619ab07 commit 891605c
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 140 deletions.
1 change: 1 addition & 0 deletions src/Fable.Cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [Rust] Added String.Replace(char, char) and test (by @ncave)
* [Rust] Support type extensions for external types (by @ncave)
* [Rust] Support more System.Array methods and tests (by @ncave)
* [Rust] Added decision tree multiple target references (by @ncave)
* [JS] Add `System.String.Normalize` support (by @DashieTM)

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Cli/Main.fs
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,13 @@ and FableCompiler(checker: InteractiveChecker, projCracked: ProjectCracked, fabl
// It seems when there's a pair .fsi/.fs the F# compiler gives the .fsi extension to the implementation file
let fileName = file.FileName |> Path.normalizePath |> Path.ensureFsExtension

// For Rust, delay last file's compilation until other files finish compiling
// For Rust, delay last file's compilation so other files can finish compiling
if
projCracked.CliArgs.CompilerOptions.Language = Rust
&& fileName = Array.last state.FilesToCompile
&& state.FableFilesCompiledCount < state.FableFilesToCompileExpectedCount - 1
then
do! Async.Sleep(100)
do! Async.Sleep(1000)

Log.verbose (
lazy $"Type checked: {IO.Path.GetRelativePath(projCracked.CliArgs.RootDir, file.FileName)}"
Expand Down
4 changes: 2 additions & 2 deletions src/Fable.Transforms/Rust/AST/Rust.AST.Helpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ module Locals =
tokens = None
}

let mkIdentLocal attrs name ty init : Local =
let pat = mkIdentPat name false false
let mkIdentLocal attrs name isRef isMut ty init : Local =
let pat = mkIdentPat name isRef isMut
mkLocal attrs pat ty init

[<AutoOpen>]
Expand Down
2 changes: 1 addition & 1 deletion src/Fable.Transforms/Rust/AST/Tests/Sample.AST.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let stmt1 =
|> mkBracketCommaDelimitedMacCall "vec"
|> mkMacCallExpr
|> Some
|> mkIdentLocal [] "a" None
|> mkIdentLocal [] "a" false false None
|> mkLocalStmt

let stmt2 =
Expand Down
Loading

0 comments on commit 891605c

Please sign in to comment.