Skip to content

Commit

Permalink
Tidy a little
Browse files Browse the repository at this point in the history
  • Loading branch information
tboby committed Sep 22, 2022
1 parent 44abcb2 commit e25f16f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/Compiler/Checking/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5468,12 +5468,11 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy.Commit, env.AccessRights)
TcConstExpr cenv overallTy env m tpenv synConst
| SynExpr.DotLambda (synExpr, m) ->
let unitVar = mkSynId m "unitVar"
let svar = mkSynCompGenSimplePatVar unitVar
let pushedExpr = pushUnitArg synExpr unitVar
let unaryArg = mkSynId m (cenv.synArgNameGenerator.New())
let svar = mkSynCompGenSimplePatVar unaryArg
let pushedExpr = pushUnaryArg synExpr unaryArg
let lambda = SynExpr.Lambda(false, false, SynSimplePats.SimplePats([ svar ], m), pushedExpr, None, m, SynExprLambdaTrivia.Zero)
TcIteratedLambdas cenv true env overallTy Set.empty tpenv lambda
// TcIteratedLambda
| SynExpr.Lambda _ ->
TcIteratedLambdas cenv true env overallTy Set.empty tpenv synExpr

Expand Down
12 changes: 6 additions & 6 deletions src/Compiler/SyntaxTree/SyntaxTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let mkSynSimplePatVar isOpt id =
let mkSynCompGenSimplePatVar id =
SynSimplePat.Id(id, None, true, false, false, id.idRange)

let rec pushUnitArg expr arg =
let rec pushUnaryArg expr arg =
match expr with
| SynExpr.App (ExprAtomicFlag.Atomic, infix, SynExpr.Ident ident, x1, m1) ->
SynExpr.App(
Expand All @@ -86,17 +86,17 @@ let rec pushUnitArg expr arg =
m1
)
| SynExpr.App (ExprAtomicFlag.Atomic, infix, (SynExpr.App (_) as innerApp), x1, m1) ->
SynExpr.App(ExprAtomicFlag.Atomic, infix, (pushUnitArg innerApp arg), x1, m1)
SynExpr.App(ExprAtomicFlag.Atomic, infix, (pushUnaryArg innerApp arg), x1, m1)
| SynExpr.App (ExprAtomicFlag.Atomic, infix, SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range), x1, m1) ->
SynExpr.App(ExprAtomicFlag.Atomic, infix, SynExpr.DotGet((pushUnitArg synExpr arg), rangeOfDot, synLongIdent, range), x1, m1)
SynExpr.App(ExprAtomicFlag.Atomic, infix, SynExpr.DotGet((pushUnaryArg synExpr arg), rangeOfDot, synLongIdent, range), x1, m1)
| SynExpr.App (ExprAtomicFlag.Atomic, infix, innerExpr, x1, m1) ->
SynExpr.App(ExprAtomicFlag.Atomic, infix, pushUnitArg innerExpr arg, x1, m1)
SynExpr.App(ExprAtomicFlag.Atomic, infix, pushUnaryArg innerExpr arg, x1, m1)
| SynExpr.Ident ident -> SynExpr.LongIdent(false, SynLongIdent(arg :: ident :: [], [ ident.idRange ], [ None ]), None, ident.idRange)
| SynExpr.LongIdent (isOptional, SynLongIdent (id, dotRanges, trivia), altNameRefCell, range) ->
SynExpr.LongIdent(isOptional, SynLongIdent(arg :: id, dotRanges, trivia), altNameRefCell, range)
| SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range) -> SynExpr.DotGet(pushUnitArg synExpr arg, rangeOfDot, synLongIdent, range)
| SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range) -> SynExpr.DotGet(pushUnaryArg synExpr arg, rangeOfDot, synLongIdent, range)
| SynExpr.DotIndexedGet (objectExpr, indexArgs, dotRange, range) ->
SynExpr.DotIndexedGet(pushUnitArg objectExpr arg, indexArgs, dotRange, range)
SynExpr.DotIndexedGet(pushUnaryArg objectExpr arg, indexArgs, dotRange, range)
| _ -> expr
// | SynExpr.App(ExprAtomicFlag.Atomic, infix, innerExpr, x1, m1)
let (|SynSingleIdent|_|) x =
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/SyntaxTree/SyntaxTreeOps.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ val mkSynSimplePatVar: isOpt: bool -> id: Ident -> SynSimplePat

val mkSynCompGenSimplePatVar: id: Ident -> SynSimplePat

val pushUnitArg: expr: SynExpr -> arg: Ident -> SynExpr
val pushUnaryArg: expr: SynExpr -> arg: Ident -> SynExpr

/// Match a long identifier, including the case for single identifiers which gets a more optimized node in the syntax tree.
val (|LongOrSingleIdent|_|):
Expand Down

0 comments on commit e25f16f

Please sign in to comment.