Skip to content

Commit 61d054d

Browse files
authored
Update scripts in documentation. (#15935)
1 parent 41b6ed7 commit 61d054d

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

docs/fcs/editor.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ let decls =
184184

185185
// Print the names of available items
186186
for item in decls.Items do
187-
printfn " - %s" item.Name
187+
printfn " - %s" item.NameInList
188188

189189
(**
190190

docs/fcs/filesystem.fsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ let B = File1.A + File1.A"""
130130
member _.IsStableFileHeuristic(path) =
131131
defaultFileSystem.IsStableFileHeuristic(path)
132132

133+
member this.ChangeExtensionShim(path, extension) =
134+
defaultFileSystem.ChangeExtensionShim(path, extension)
135+
133136
let myFileSystem = MyFileSystem()
134137
FileSystem <- MyFileSystem()
135138

docs/fcs/tokenizer.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ file name of the source code. The defined symbols are required because the
3636
tokenizer handles `#if` directives. The file name is required only to specify
3737
locations of the source code (and it does not have to exist):
3838
*)
39-
let sourceTok = FSharpSourceTokenizer([], Some "C:\\test.fsx")
39+
let sourceTok = FSharpSourceTokenizer([], Some "C:\\test.fsx", Some "PREVIEW", None)
4040
(**
4141
Using the `sourceTok` object, we can now (repeatedly) tokenize lines of
4242
F# source code.

docs/fcs/untypedtree.fsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ used more often):
111111
/// Walk over a pattern - this is for example used in
112112
/// let <pat> = <expr> or in the 'match' expression
113113
let rec visitPattern = function
114-
| SynPat.Wild(_) ->
114+
| SynPat.Wild _ ->
115115
printfn " .. underscore pattern"
116-
| SynPat.Named(name, _, _, _) ->
116+
| SynPat.Named(ident = SynIdent(ident = name)) ->
117117
printfn " .. named as '%s'" name.idText
118-
| SynPat.LongIdent(LongIdentWithDots(ident, _), _, _, _, _, _, _) ->
118+
| SynPat.LongIdent(longDotId = SynLongIdent(id = ident)) ->
119119
let names = String.concat "." [ for i in ident -> i.idText ]
120120
printfn " .. identifier: %s" names
121121
| pat -> printfn " .. other pattern: %A" pat
@@ -145,9 +145,7 @@ let rec visitExpression e =
145145
// for 'let .. = .. and .. = .. in ...'
146146
printfn "LetOrUse with the following bindings:"
147147
for binding in bindings do
148-
let (SynBinding(
149-
access, kind, isInline, isMutable, attrs, xmlDoc, data,
150-
headPat, retInfo, init, equalsRange, debugPoint, trivia)) = binding
148+
let (SynBinding(headPat = headPat; expr = init)) = binding
151149
visitPattern headPat
152150
visitExpression init
153151
// Visit the body expression
@@ -177,9 +175,7 @@ let visitDeclarations decls =
177175
// Let binding as a declaration is similar to let binding
178176
// as an expression (in visitExpression), but has no body
179177
for binding in bindings do
180-
let (SynBinding(
181-
access, kind, isInline, isMutable, attrs, xmlDoc,
182-
valData, pat, retInfo, body, equalsRange, debugPoint, trivia)) = binding
178+
let (SynBinding(headPat = pat; expr = body)) = binding
183179
visitPattern pat
184180
visitExpression body
185181
| _ -> printfn " - not supported declaration: %A" declaration
@@ -194,7 +190,7 @@ with multiple `namespace Foo` declarations:
194190
/// does not explicitly define it..
195191
let visitModulesAndNamespaces modulesOrNss =
196192
for moduleOrNs in modulesOrNss do
197-
let (SynModuleOrNamespace(lid, isRec, isMod, decls, xml, attrs, accessibility, range)) = moduleOrNs
193+
let (SynModuleOrNamespace(longId = lid; decls = decls)) = moduleOrNs
198194
printfn "Namespace or module: %A" lid
199195
visitDeclarations decls
200196
(**
@@ -238,7 +234,7 @@ in the previous step:
238234
match tree with
239235
| ParsedInput.ImplFile(implFile) ->
240236
// Extract declarations and walk over them
241-
let (ParsedImplFileInput(fn, script, name, _, _, modules, _, _)) = implFile
237+
let (ParsedImplFileInput(contents = modules)) = implFile
242238
visitModulesAndNamespaces modules
243239
| _ -> failwith "F# Interface file (*.fsi) not supported."
244240
(**

0 commit comments

Comments
 (0)