未验证 提交 778b04c0 编写于 作者: D Don Syme 提交者: GitHub

update fantomas (#13206)

上级 d0baa9a5
......@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "5.0.0-alpha-006",
"version": "5.0.0-alpha-008",
"commands": [
"fantomas"
]
......
......@@ -5143,8 +5143,8 @@ let decodeILAttribData (ca: ILAttribute) =
try
let parser = ILTypeSigParser n
parser.ParseTypeSpec(), sigptr
with
| exn -> failwith (sprintf "decodeILAttribData: error parsing type in custom attribute blob: %s" exn.Message)
with exn ->
failwith (sprintf "decodeILAttribData: error parsing type in custom attribute blob: %s" exn.Message)
| ILType.Boxed tspec when tspec.Name = "System.Object" ->
let et, sigptr = sigptr_get_u8 bytes sigptr
......
......@@ -184,8 +184,8 @@ let cattr_ty2ty f (c: ILAttribute) =
let elems = elems |> List.map (celem_ty2ty f)
let namedArgs = namedArgs |> List.map (cnamedarg_ty2ty f)
mkILCustomAttribMethRef (meth, elems, namedArgs)
with
| _ -> c.WithMethod(meth)
with _ ->
c.WithMethod(meth)
else
c.WithMethod(meth)
......
......@@ -253,8 +253,8 @@ type COFFResourceReader() =
if int64 relocLastAddress > stream.Length then
raise <| ResourceException "CoffResourceInvalidRelocation"
with
| :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidRelocation"))
with :? OverflowException ->
(raise <| ResourceException("CoffResourceInvalidRelocation"))
let mutable relocationOffsets = Array.zeroCreate (int rsrc1.NumberOfRelocations)
......@@ -284,8 +284,8 @@ type COFFResourceReader() =
if lastSymAddress > stream.Length then
raise <| ResourceException "CoffResourceInvalidSymbol"
with
| :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidSymbol"))
with :? OverflowException ->
(raise <| ResourceException("CoffResourceInvalidSymbol"))
let mutable outputStream = new MemoryStream(imageResourceSectionBytes)
let mutable writer = new BinaryWriter(outputStream)
......
......@@ -41,15 +41,15 @@ let _ =
let noStableFileHeuristic =
try
(Environment.GetEnvironmentVariable("FSharp_NoStableFileHeuristic") <> null)
with
| _ -> false
with _ ->
false
let alwaysMemoryMapFSC =
try
(Environment.GetEnvironmentVariable("FSharp_AlwaysMemoryMapCommandLineCompiler")
<> null)
with
| _ -> false
with _ ->
false
let stronglyHeldReaderCacheSizeDefault = 30
......@@ -58,8 +58,8 @@ let stronglyHeldReaderCacheSize =
(match Environment.GetEnvironmentVariable("FSharp_StronglyHeldBinaryReaderCacheSize") with
| null -> stronglyHeldReaderCacheSizeDefault
| s -> int32 s)
with
| _ -> stronglyHeldReaderCacheSizeDefault
with _ ->
stronglyHeldReaderCacheSizeDefault
let singleOfBits (x: int32) =
BitConverter.ToSingle(BitConverter.GetBytes x, 0)
......@@ -3804,8 +3804,7 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int
[] (* <REVIEW> scopes fail for mscorlib </REVIEW> scopes rootScope *)
// REVIEW: look through sps to get ranges? Use GetRanges?? Change AbsIL??
(localPdbInfos, None, seqpoints)
with
| e ->
with e ->
// "* Warning: PDB info for method "+nm+" could not be read and will be ignored: "+e.Message
[], None, []
#endif
......@@ -4222,8 +4221,7 @@ let getPdbReader pdbDirPath fileName =
| _ -> failwith ("Document with URL " + url + " not found in list of documents in the PDB file")
Some(pdbr, docfun)
with
| e ->
with e ->
dprintn ("* Warning: PDB file could not be read and will be ignored: " + e.Message)
None
#endif
......@@ -5111,8 +5109,8 @@ let stableFileHeuristicApplies fileName =
not noStableFileHeuristic
&& try
FileSystem.IsStableFileHeuristic fileName
with
| _ -> false
with _ ->
false
let createByteFileChunk opts fileName chunk =
// If we're trying to reduce memory usage then we are willing to go back and re-read the binary, so we can use
......@@ -5184,8 +5182,7 @@ let OpenILModuleReader fileName opts =
ILModuleReaderCacheKey(fullPath, writeTime, opts.pdbDirPath.IsSome, opts.reduceMemoryUsage, opts.metadataOnly)
key, true
with
| exn ->
with exn ->
Debug.Assert(
false,
sprintf
......
......@@ -646,8 +646,8 @@ let envUpdateCreatedTypeRef emEnv (tref: ILTypeRef) =
try
System.Runtime.Serialization.FormatterServices.GetUninitializedObject ty
|> ignore
with
| _ -> ()
with _ ->
()
#endif
{ emEnv with
emTypMap = Zmap.add tref (typT, typB, typeDef, Some ty) emEnv.emTypMap
......@@ -1117,8 +1117,8 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) : MethodInfo =
(null: ParameterModifier[])
)
// This can fail if there is an ambiguity w.r.t. return type
with
| _ -> null
with _ ->
null
if (isNotNull methInfo && equalTypes resT methInfo.ReturnType) then
methInfo
......@@ -2759,8 +2759,8 @@ let EmitDynamicAssemblyFragment
try
ignore (typB.InvokeMemberAndLog(methodName, BindingFlags.InvokeMethod ||| BindingFlags.Public ||| BindingFlags.Static, [||]))
None
with
| :? TargetInvocationException as exn -> Some exn.InnerException
with :? TargetInvocationException as exn ->
Some exn.InnerException
let emEnv, entryPts = envPopEntryPts emEnv
let execs = List.map execEntryPtFun entryPts
......
......@@ -704,8 +704,7 @@ type ILStrongNameSigner =
let pkSignatureSize pk =
try
signerSignatureSize pk
with
| exn ->
with exn ->
failwith ("A call to StrongNameSignatureSize failed (" + exn.Message + ")")
0x80
......
......@@ -1039,8 +1039,8 @@ let pdbClose (writer: PdbWriter) dllFilename pdbFilename =
FileSystem.OpenFileForWriteShim(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None)
false
with
| _ -> true
with _ ->
true
let mutable attempts = 0
......@@ -1072,8 +1072,8 @@ let internal setCheckSum (url: string, writer: ISymUnmanagedDocumentWriter) =
if (checkSum.Length = hashSizeOfMD5) then
writer.SetCheckSum(guidSourceHashMD5, hashSizeOfMD5, checkSum)
with
| _ -> ()
with _ ->
()
let pdbDefineDocument (writer: PdbWriter) (url: string) =
//3F5162F8-07C6-11D3-9053-00C04FA302A1
......@@ -1204,8 +1204,8 @@ let pdbReadOpen (moduleName: string) (path: string) : PdbReader =
)
{ symReader = reader :?> ISymbolReader }
with
| _ -> { symReader = null }
with _ ->
{ symReader = null }
#else
let symbolBinder = new System.Diagnostics.SymbolStore.SymBinder()
......
......@@ -184,8 +184,8 @@ let checkSum (url: string) (checksumAlgorithm: HashAlgorithm) =
let checkSum = alg.ComputeHash file
Some(guid, checkSum)
with
| _ -> None
with _ ->
None
//---------------------------------------------------------------------
// Portable PDB Writer
......@@ -935,14 +935,14 @@ let writePdbInfo showTimes outfile pdbfile info cvChunk =
try
FileSystem.FileDeleteShim pdbfile
with
| _ -> ()
with _ ->
()
let pdbw =
try
pdbInitialize outfile pdbfile
with
| _ -> error (Error(FSComp.SR.ilwriteErrorCreatingPdb pdbfile, rangeCmdArgs))
with _ ->
error (Error(FSComp.SR.ilwriteErrorCreatingPdb pdbfile, rangeCmdArgs))
match info.EntryPoint with
| None -> ()
......@@ -1119,16 +1119,16 @@ let writeMdbInfo fmdb f info =
// Note, if we can't delete it code will fail later
try
FileSystem.FileDeleteShim fmdb
with
| _ -> ()
with _ ->
()
// Try loading the MDB symbol writer from an assembly available on Mono dynamically
// Report an error if the assembly is not available.
let wr =
try
createWriter f
with
| _ -> error (Error(FSComp.SR.ilwriteErrorCreatingMdb (), rangeCmdArgs))
with _ ->
error (Error(FSComp.SR.ilwriteErrorCreatingMdb (), rangeCmdArgs))
// NOTE: MonoSymbolWriter doesn't need information about entrypoints, so 'info.EntryPoint' is unused here.
// Write information about Documents. Returns '(SourceFileEntry*CompileUnitEntry)[]'
......
......@@ -381,12 +381,11 @@ module MemoryMappedFileExtensions =
use stream = mmf.CreateViewStream(0L, length, MemoryMappedFileAccess.ReadWrite)
copyTo stream
Some mmf
with
| _ ->
with _ ->
mmf.Dispose()
None
with
| _ -> None
with _ ->
None
type MemoryMappedFile with
......@@ -615,8 +614,8 @@ type DefaultFileSystem() as this =
ifs.GetFullPathShim path
else
path
with
| _ -> path
with _ ->
path
abstract IsInvalidPathShim: path: string -> bool
......
......@@ -71,8 +71,7 @@ module internal PervasiveAutoOpens =
// "How can I detect if am running in Mono?" section
try
Type.GetType "Mono.Runtime" <> null
with
| _ ->
with _ ->
// Must be robust in the case that someone else has installed a handler into System.AppDomain.OnTypeResolveEvent
// that is not reliable.
// This is related to bug 5506--the issue is actually a bug in VSTypeResolutionService.EnsurePopulated which is
......@@ -373,8 +372,8 @@ module Option =
let attempt (f: unit -> 'T) =
try
Some(f ())
with
| _ -> None
with _ ->
None
module List =
......@@ -991,8 +990,8 @@ module Cancellable =
match f ct with
| ValueOrCancelled.Value res -> ValueOrCancelled.Value(Choice1Of2 res)
| ValueOrCancelled.Cancelled exn -> ValueOrCancelled.Cancelled exn
with
| err -> ValueOrCancelled.Value(Choice2Of2 err))
with err ->
ValueOrCancelled.Value(Choice2Of2 err))
/// Implement try/finally for a cancellable computation
let inline tryFinally comp compensation =
......@@ -1162,8 +1161,7 @@ type LazyWithContext<'T, 'Ctxt> =
x.value <- res
x.funcOrException <- null
res
with
| exn ->
with exn ->
x.funcOrException <- box (LazyWithContextFailure(exn))
reraise ()
| _ -> failwith "unreachable"
......@@ -1281,8 +1279,8 @@ module NameMap =
(fun n x2 acc ->
try
f n (Map.find n m1) x2 acc
with
| :? KeyNotFoundException -> errf n x2)
with :? KeyNotFoundException ->
errf n x2)
m2
acc
......
......@@ -531,18 +531,21 @@ module internal NameMap =
val layer: m1: NameMap<'T> -> m2: Map<string, 'T> -> Map<string, 'T>
/// Not a very useful function - only called in one place - should be changed
val layerAdditive: addf: ('a list -> 'b -> 'a list) -> m1: Map<'c, 'b> -> m2: Map<'c, 'a list> -> Map<'c, 'a list>
when 'c: comparison
val layerAdditive:
addf: ('a list -> 'b -> 'a list) -> m1: Map<'c, 'b> -> m2: Map<'c, 'a list> -> Map<'c, 'a list>
when 'c: comparison
/// Union entries by identical key, using the provided function to union sets of values
val union: unionf: (seq<'a> -> 'b) -> ms: seq<NameMap<'a>> -> Map<string, 'b>
/// For every entry in m2 find an entry in m1 and fold
val subfold2: errf: ('a -> 'b -> 'c) -> f: ('a -> 'd -> 'b -> 'c -> 'c) -> m1: Map<'a, 'd> -> m2: Map<'a, 'b> -> acc: 'c -> 'c
when 'a: comparison
val subfold2:
errf: ('a -> 'b -> 'c) -> f: ('a -> 'd -> 'b -> 'c -> 'c) -> m1: Map<'a, 'd> -> m2: Map<'a, 'b> -> acc: 'c -> 'c
when 'a: comparison
val suball2: errf: ('a -> 'b -> bool) -> p: ('c -> 'b -> bool) -> m1: Map<'a, 'c> -> m2: Map<'a, 'b> -> bool
when 'a: comparison
val suball2:
errf: ('a -> 'b -> bool) -> p: ('c -> 'b -> bool) -> m1: Map<'a, 'c> -> m2: Map<'a, 'b> -> bool
when 'a: comparison
val mapFold: f: ('a -> string -> 'T -> 'b * 'a) -> s: 'a -> l: NameMap<'T> -> Map<string, 'b> * 'a
......
......@@ -363,8 +363,8 @@ type Range(code1: int64, code2: int64) =
|> Seq.take (m.EndLine - m.StartLine + 1)
|> String.concat "\n"
|> fun s -> s.Substring(startCol + 1, s.LastIndexOf("\n", StringComparison.Ordinal) + 1 - startCol + endCol)
with
| e -> e.ToString()
with e ->
e.ToString()
member m.ToShortString() =
sprintf "(%d,%d--%d,%d)" m.StartLine m.StartColumn m.EndLine m.EndColumn
......@@ -542,5 +542,5 @@ module Range =
match nonEmptyLine with
| Some (i, s) -> mkRange file (mkPos (i + 1) 0) (mkPos (i + 1) s.Length)
| None -> mkRange file (mkPos 1 0) (mkPos 1 80)
with
| _ -> mkRange file (mkPos 1 0) (mkPos 1 80)
with _ ->
mkRange file (mkPos 1 0) (mkPos 1 80)
......@@ -589,14 +589,14 @@ module Display =
ty.GetMethod("ToString", BindingFlags.Public ||| BindingFlags.Instance, null, [||], null)
methInfo.DeclaringType = typeof<Object>
with
| _e -> false
with _e ->
false
let catchExn f =
try
Choice1Of2(f ())
with
| e -> Choice2Of2 e
with e ->
Choice2Of2 e
// An implementation of break stack.
// Uses mutable state, relying on linear threading of the state.
......@@ -1039,8 +1039,7 @@ module Display =
path.Remove(x) |> ignore
res
with
| e ->
with e ->
countNodes 1
wordL (tagText ("Error: " + e.Message))
......@@ -1157,8 +1156,8 @@ module Display =
)
)
)
with
| _ -> None
with _ ->
None
// Seed with an empty layout with a space to the left for formatting purposes
buildObjMessageL txt [ leftL (tagText "") ]
......@@ -1463,12 +1462,11 @@ module Display =
tagProperty m.Name),
(try
Some(nestedObjL nDepth Precedence.BracketIfTuple ((getProperty ty obj m.Name), ty))
with
| _ ->
with _ ->
try
Some(nestedObjL nDepth Precedence.BracketIfTuple ((getField obj (m :?> FieldInfo)), ty))
with
| _ -> None)))
with _ ->
None)))
|> Array.toList
|> makePropertiesL)
......@@ -1594,8 +1592,7 @@ module Display =
match text with
| null -> ""
| _ -> text
with
| e ->
with e ->
// If a .ToString() call throws an exception, catch it and use the message as the result.
// This may be informative, e.g. division by zero etc...
"<ToString exception: " + e.Message + ">"
......
......@@ -35,8 +35,8 @@ type CreateFSharpManifestResourceName public () =
let runningOnMono =
try
System.Type.GetType("Mono.Runtime") <> null
with
| e -> false
with e ->
false
let fileName =
if
......
......@@ -118,8 +118,7 @@ module internal {1} =
File.WriteAllText(sourcePath, body.ToString())
printMessage <| sprintf "Done: %s" sourcePath
Some(sourcePath)
with
| e ->
with e ->
printf "An exception occurred when processing '%s'\n%s" resx (e.ToString())
None
......
......@@ -236,8 +236,7 @@ type FSharpEmbedResourceText() =
let str =
try
System.String.Format(Unquote(txt.Substring i)) // Format turns e.g '\n' into that char, but also requires that we 'escape' curlies in the original .txt file, e.g. "{{"
with
| e ->
with e ->
Err(
fileName,
lineNum,
......@@ -551,8 +550,7 @@ open Printf
xd.Save outXmlStream
printMessage (sprintf "Done %s" outFileName)
Some(fileName, outFileName, outXmlFileName)
with
| e ->
with e ->
PrintErr(fileName, 0, sprintf "An exception occurred when processing '%s'\n%s" fileName (e.ToString()))
None
......
......@@ -68,8 +68,8 @@ type public Fsc() as this =
let locationOfThisDll =
try
Some(Path.GetDirectoryName(typeof<Fsc>.Assembly.Location))
with
| _ -> None
with _ ->
None
match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(locationOfThisDll) with
| Some s -> s
......@@ -677,8 +677,7 @@ type public Fsc() as this =
try
invokeCompiler baseCallDelegate
with
| e ->
with e ->
Debug.Fail(
"HostObject received by Fsc task did not have a Compile method or the compile method threw an exception. "
+ (e.ToString())
......
......@@ -51,8 +51,8 @@ type public Fsi() as this =
let locationOfThisDll =
try
Some(Path.GetDirectoryName(typeof<Fsi>.Assembly.Location))
with
| _ -> None
with _ ->
None
match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(locationOfThisDll) with
| Some s -> s
......@@ -361,8 +361,7 @@ type public Fsi() as this =
try
invokeCompiler baseCallDelegate
with
| e ->
with e ->
Debug.Assert(
false,
"HostObject received by Fsi task did not have a Compile method or the compile method threw an exception. "
......
......@@ -87,8 +87,8 @@ type SubstituteText() =
Directory.CreateDirectory(directory) |> ignore
File.WriteAllText(targetPath, contents)
with
| _ -> ()
with _ ->
()
copiedFiles.Add(item)
......
......@@ -166,7 +166,6 @@ type WriteCodeFragment() =
_outputFile <- outputFileItem
true
with
| e ->
with e ->
printf "Error writing code fragment: %s" (e.ToString())
false
......@@ -52,8 +52,8 @@ type internal SimpleEventLoop() =
result <-
try
Some(f ())
with
| _ -> None)
with _ ->
None)
setSignal doneSignal
run ()
......
......@@ -34,7 +34,8 @@ type DelegateEvent<'Delegate when 'Delegate :> System.Delegate> =
///
/// <category index="3">Events and Observables</category>
[<CompiledName("FSharpEvent`2")>]
type Event<'Delegate, 'Args when 'Delegate: delegate<'Args, unit> and 'Delegate :> System.Delegate and 'Delegate: not struct> =
type Event<'Delegate, 'Args
when 'Delegate: delegate<'Args, unit> and 'Delegate :> System.Delegate and 'Delegate: not struct> =
/// <summary>Creates an event object suitable for delegate types following the standard .NET Framework convention of a first 'sender' argument.</summary>
/// <returns>The created event.</returns>
......
......@@ -43,8 +43,9 @@ module internal List =
val distinctWithComparer: System.Collections.Generic.IEqualityComparer<'T> -> 'T list -> 'T list
val distinctByWithComparer: System.Collections.Generic.IEqualityComparer<'Key> -> ('T -> 'Key) -> list: 'T list -> 'T list
when 'Key: equality
val distinctByWithComparer:
System.Collections.Generic.IEqualityComparer<'Key> -> ('T -> 'Key) -> list: 'T list -> 'T list
when 'Key: equality
val init: int -> (int -> 'T) -> 'T list
val filter: predicate: ('T -> bool) -> 'T list -> 'T list
......
......@@ -484,8 +484,9 @@ module Map =
/// Evaluates to <c>"1 a 2 b initial"</c>
/// </example>
[<CompiledName("FoldBack")>]
val foldBack<'Key, 'T, 'State> : folder: ('Key -> 'T -> 'State -> 'State) -> table: Map<'Key, 'T> -> state: 'State -> 'State
when 'Key: comparison
val foldBack<'Key, 'T, 'State> :
folder: ('Key -> 'T -> 'State -> 'State) -> table: Map<'Key, 'T> -> state: 'State -> 'State
when 'Key: comparison
/// <summary>Folds over the bindings in the map </summary>
///
......@@ -504,8 +505,9 @@ module Map =
/// Evaluates to <c>"initial 1 a 2 b"</c>.
/// </example>
[<CompiledName("Fold")>]
val fold<'Key, 'T, 'State> : folder: ('State -> 'Key -> 'T -> 'State) -> state: 'State -> table: Map<'Key, 'T> -> 'State
when 'Key: comparison
val fold<'Key, 'T, 'State> :
folder: ('State -> 'Key -> 'T -> 'State) -> state: 'State -> table: Map<'Key, 'T> -> 'State
when 'Key: comparison
/// <summary>Applies the given function to each binding in the dictionary</summary>
///
......
......@@ -100,8 +100,8 @@ module RuntimeHelpers =
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
val EnumerateUsing: resource: 'T -> source: ('T -> 'Collection) -> seq<'U>
when 'T :> IDisposable and 'Collection :> seq<'U>
val EnumerateUsing:
resource: 'T -> source: ('T -> 'Collection) -> seq<'U> when 'T :> IDisposable and 'Collection :> seq<'U>
/// <summary>Creates an anonymous event with the given handlers.</summary>
///
......
......@@ -471,8 +471,8 @@ module Set =
/// The reverse of the set is [3; 2; 1]</c>
/// </example>
[<CompiledName("Fold")>]
val fold<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> set: Set<'T> -> 'State
when 'T: comparison
val fold<'T, 'State> :
folder: ('State -> 'T -> 'State) -> state: 'State -> set: Set<'T> -> 'State when 'T: comparison
/// <summary>Applies the given accumulating function to all the elements of the set.</summary>
///
......@@ -492,8 +492,8 @@ module Set =
/// The set is [1; 2; 3]</c>
/// </example>
[<CompiledName("FoldBack")>]
val foldBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> set: Set<'T> -> state: 'State -> 'State
when 'T: comparison
val foldBack<'T, 'State> :
folder: ('T -> 'State -> 'State) -> set: Set<'T> -> state: 'State -> 'State when 'T: comparison
/// <summary>Tests if all elements of the collection satisfy the given predicate.
/// If the input function is <c>f</c> and the elements are <c>i0...iN</c> and "j0...jN"
......
......@@ -88,8 +88,8 @@ module internal ProjectFile =
.ReadAllText(resolutionsFile)
.Split([| '\r'; '\n' |], StringSplitOptions.None)
|> Array.filter (fun line -> not (String.IsNullOrEmpty(line)))
with
| _ -> [||]
with _ ->
[||]
[|
for line in lines do
......
......@@ -267,8 +267,8 @@ type FSharpDependencyManager(outputDirectory: string option) =
Directory.CreateDirectory(directory) |> ignore
directory
with
| _ -> directory
with _ ->
directory
let deleteScripts () =
try
......@@ -279,16 +279,16 @@ type FSharpDependencyManager(outputDirectory: string option) =
#else
()
#endif
with
| _ -> ()
with _ ->
()
let emitFile fileName (body: string) =
try
// Create a file to write to
use sw = File.CreateText(fileName)
sw.WriteLine(body)
with
| _ -> ()
with _ ->
()
let prepareDependencyResolutionFiles
(
......
......@@ -81,8 +81,8 @@ let main (argv) =
member _.Exit(n) =
try
exit n
with
| _ -> ()
with _ ->
()
failwithf "%s" (FSComp.SR.elSysEnvExitDidntExit ())
}
......@@ -116,8 +116,7 @@ let main (argv) =
0
with
| e ->
with e ->
// Last-chance error recovery (note, with a poor error range)
errorRecovery e Range.range0
1
......@@ -76,8 +76,7 @@ module internal Utils =
let guard (f) =
try
f ()
with
| e ->
with e ->
warning (
Failure(
sprintf
......@@ -197,8 +196,8 @@ type internal ReadLineConsole() =
|> Seq.iter (fun option -> optionsCache.Add(option))
optionsCache.Root <- root
with
| _ -> optionsCache.Clear()
with _ ->
optionsCache.Clear()
optionsCache, true
else
......
......@@ -139,8 +139,7 @@ let internal TrySetUnhandledExceptionMode () =
try
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException)
with
| _ ->
with _ ->
decr i
()
......@@ -155,8 +154,7 @@ let StartServer (fsiSession: FsiEvaluationSession) (fsiServerName) =
//printf "FSI-SERVER: received CTRL-C request...\n"
try
fsiSession.Interrupt()
with
| _ ->
with _ ->
// Final sanity check! - catch all exns - but not expected
assert false
()
......@@ -200,8 +198,7 @@ let evaluateSession (argv: string[]) =
let _ = Console.ForegroundColor
let _ = Console.CursorLeft <- Console.CursorLeft
true
with
| _ ->
with _ ->
//if progress then fprintfn outWriter "probe failed, we have no console..."
false
else
......@@ -248,8 +245,7 @@ let evaluateSession (argv: string[]) =
lazy
try
Some(WinFormsEventLoop())
with
| e ->
with e ->
printfn "Your system doesn't seem to support WinForms correctly. You will"
printfn "need to set fsi.EventLoop use GUI windows from F# Interactive."
printfn "You can set different event loops for MonoMac, Gtk#, WinForms and other"
......@@ -341,8 +337,8 @@ let evaluateSession (argv: string[]) =
if fsiSession.IsGui then
try
Application.EnableVisualStyles()
with
| _ -> ()
with _ ->
()
// Route GUI application exceptions to the exception handlers
Application.add_ThreadException (
......@@ -352,14 +348,14 @@ let evaluateSession (argv: string[]) =
let runningOnMono =
try
System.Type.GetType("Mono.Runtime") <> null
with
| e -> false
with e ->
false
if not runningOnMono then
try
TrySetUnhandledExceptionMode()
with
| _ -> ()
with _ ->
()
fsiWinFormsLoop.Value |> Option.iter (fun l -> l.LCID <- fsiSession.LCID)
#endif
......@@ -400,8 +396,8 @@ let MainMain argv =
member _.Dispose() =
try
Console.SetOut(savedOut)
with
| _ -> ()
with _ ->
()
}
#if !FX_NO_APP_DOMAINS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册