未验证 提交 edee6d0f 编写于 作者: S SchlenkR 提交者: GitHub

"trees" docu: (#13258)

* errors corrected
* partially addd sym names instead of wildcards (consistency with surropunding code)
* slightly changed formatting
Co-authored-by: NSchlenkR <ronald.schlenker@binarygears.de>
上级 d4846d79
......@@ -189,7 +189,7 @@ let rec visitExpr f (e:FSharpExpr) =
visitObjArg f objExprOpt; visitExprs f argExprs
| FSharpExprPatterns.Coerce(targetType, inpExpr) ->
visitExpr f inpExpr
| FSharpExprPatterns.FastIntegerForLoop(startExpr, limitExpr, consumeExpr, isUp) ->
| FSharpExprPatterns.FastIntegerForLoop(startExpr, limitExpr, consumeExpr, isUp, _, _) ->
visitExpr f startExpr; visitExpr f limitExpr; visitExpr f consumeExpr
| FSharpExprPatterns.ILAsm(asmCode, typeArgs, argExprs) ->
visitExprs f argExprs
......@@ -201,10 +201,11 @@ let rec visitExpr f (e:FSharpExpr) =
visitExpr f guardExpr; visitExpr f thenExpr; visitExpr f elseExpr
| FSharpExprPatterns.Lambda(lambdaVar, bodyExpr) ->
visitExpr f bodyExpr
| FSharpExprPatterns.Let((bindingVar, bindingExpr), bodyExpr) ->
| FSharpExprPatterns.Let((bindingVar, bindingExpr, dbg), bodyExpr) ->
visitExpr f bindingExpr; visitExpr f bodyExpr
| FSharpExprPatterns.LetRec(recursiveBindings, bodyExpr) ->
List.iter (snd >> visitExpr f) recursiveBindings; visitExpr f bodyExpr
| FSharpExprPatterns.LetRec(recursiveBindings, bodyExpr) ->
for _,bindingExpr,_ in recursiveBindings do visitExpr f bindingExpr
visitExpr f bodyExpr
| FSharpExprPatterns.NewArray(arrayType, argExprs) ->
visitExprs f argExprs
| FSharpExprPatterns.NewDelegate(delegateType, delegateBodyExpr) ->
......@@ -229,9 +230,9 @@ let rec visitExpr f (e:FSharpExpr) =
visitObjArg f objExprOpt; visitExpr f argExpr
| FSharpExprPatterns.Sequential(firstExpr, secondExpr) ->
visitExpr f firstExpr; visitExpr f secondExpr
| FSharpExprPatterns.TryFinally(bodyExpr, finalizeExpr) ->
| FSharpExprPatterns.TryFinally(bodyExpr, finalizeExpr, dbgTry, dbgFinally) ->
visitExpr f bodyExpr; visitExpr f finalizeExpr
| FSharpExprPatterns.TryWith(bodyExpr, _, _, catchVar, catchExpr) ->
| FSharpExprPatterns.TryWith(bodyExpr, _, _, catchVar, catchExpr, dbgTry, dbgWith) ->
visitExpr f bodyExpr; visitExpr f catchExpr
| FSharpExprPatterns.TupleGet(tupleType, tupleElemIndex, tupleExpr) ->
visitExpr f tupleExpr
......@@ -259,7 +260,7 @@ let rec visitExpr f (e:FSharpExpr) =
visitExprs f argExprs
| FSharpExprPatterns.ValueSet(valToSet, valueExpr) ->
visitExpr f valueExpr
| FSharpExprPatterns.WhileLoop(guardExpr, bodyExpr) ->
| FSharpExprPatterns.WhileLoop(guardExpr, bodyExpr, dbg) ->
visitExpr f guardExpr; visitExpr f bodyExpr
| FSharpExprPatterns.BaseValue baseType -> ()
| FSharpExprPatterns.DefaultValue defaultType -> ()
......
......@@ -115,7 +115,7 @@ let rec visitPattern = function
printfn " .. underscore pattern"
| SynPat.Named(name, _, _, _) ->
printfn " .. named as '%s'" name.idText
| SynPat.LongIdent(LongIdentWithDots(ident, _), _, _, _, _, _) ->
| SynPat.LongIdent(LongIdentWithDots(ident, _), _, _, _, _, _, _) ->
let names = String.concat "." [ for i in ident -> i.idText ]
printfn " .. identifier: %s" names
| pat -> printfn " .. other pattern: %A" pat
......@@ -140,12 +140,14 @@ let rec visitExpression e =
visitExpression trueBranch
falseBranchOpt |> Option.iter visitExpression
| SynExpr.LetOrUse(_, _, bindings, body, _) ->
| SynExpr.LetOrUse(_, _, bindings, body, _, _) ->
// Visit bindings (there may be multiple
// for 'let .. = .. and .. = .. in ...'
printfn "LetOrUse with the following bindings:"
for binding in bindings do
let (SynBinding(access, kind, isInline, isMutable, attrs, xmlDoc, data, headPat, retInfo, equalsRange, init, m, debugPoint)) = binding
let (SynBinding(
access, kind, isInline, isMutable, attrs, xmlDoc, data,
headPat, retInfo, init, equalsRange, debugPoint, trivia)) = binding
visitPattern headPat
visitExpression init
// Visit the body expression
......@@ -175,8 +177,9 @@ let visitDeclarations decls =
// Let binding as a declaration is similar to let binding
// as an expression (in visitExpression), but has no body
for binding in bindings do
let (SynBinding(access, kind, isInline, isMutable, attrs, xmlDoc,
valData, pat, retInfo, equalsRange, body, m, sp)) = binding
let (SynBinding(
access, kind, isInline, isMutable, attrs, xmlDoc,
valData, pat, retInfo, body, equalsRange, debugPoint, trivia)) = binding
visitPattern pat
visitExpression body
| _ -> printfn " - not supported declaration: %A" declaration
......@@ -191,7 +194,7 @@ with multiple `namespace Foo` declarations:
/// does not explicitly define it..
let visitModulesAndNamespaces modulesOrNss =
for moduleOrNs in modulesOrNss do
let (SynModuleOrNamespace(lid, isRec, isMod, decls, xml, attrs, _, m)) = moduleOrNs
let (SynModuleOrNamespace(lid, isRec, isMod, decls, xml, attrs, accessibility, range)) = moduleOrNs
printfn "Namespace or module: %A" lid
visitDeclarations decls
(**
......@@ -235,7 +238,7 @@ in the previous step:
match tree with
| ParsedInput.ImplFile(implFile) ->
// Extract declarations and walk over them
let (ParsedImplFileInput(fn, script, name, _, _, modules, _)) = implFile
let (ParsedImplFileInput(fn, script, name, _, _, modules, _, _)) = implFile
visitModulesAndNamespaces modules
| _ -> failwith "F# Interface file (*.fsi) not supported."
(**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册