Skip to content

Commit

Permalink
Replace (nearly) all ref cells in the compiler with mutable values (d…
Browse files Browse the repository at this point in the history
…otnet#8063)

* # This is a combination of 9 commits.
# This is the 1st commit message:

ref -> mutable in more places in the compiler

# The commit message #2 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191229.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19629.1

# The commit message #3 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191230.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19630.1

# The commit message #4 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191231.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19631.1

# The commit message #5 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20200101.1
#
# - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.20051.1

# The commit message #6 will be skipped:

# Update dependencies from https://github.com/dotnet/arcade build 20191216.5 (dotnet#8079)
#
# - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19616.5

# The commit message #7 will be skipped:

# dispose fsi at the end of a scripting session (dotnet#8084)
#

# The commit message #8 will be skipped:

# Added static link tests and extended CompilerAssert (dotnet#8101)
#
# * Changed CompilerAssert to static class. Added Compile/Execute methods that take a Compilation description. Added static link tests
# 
# * Hiding compilation description internals
# 
# * Added another test to check for sanity
# 
# * Making a few optional parameters
# 
# * Hiding internals of CompilationReference

# The commit message #9 will be skipped:

# Parameterize product version (dotnet#8031)
#
# * Parameterize Product details
# 
# * fcs
# 
# * Repack pkgdef

* no ilread
  • Loading branch information
cartermp authored and nosami committed Feb 22, 2021
1 parent 8641546 commit baa380b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions LanguageService/Tokenizer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ module internal Tokenizer =
let lineTokenizer = sourceTokenizer.CreateLineTokenizer(lineContents)
let tokens = ResizeArray<SavedTokenInfo>()
let mutable tokenInfoOption = None
let previousLexState = ref lexState
let mutable previousLexState = lexState

let processToken() =
let classificationType = compilerTokenToRoslynToken(tokenInfoOption.Value.ColorClass)
Expand All @@ -471,9 +471,9 @@ module internal Tokenizer =
tokens.Add savedToken

let scanAndColorNextToken() =
let info, nextLexState = lineTokenizer.ScanToken(!previousLexState)
let info, nextLexState = lineTokenizer.ScanToken(previousLexState)
tokenInfoOption <- info
previousLexState := nextLexState
previousLexState <- nextLexState

// Apply some hacks to clean up the token stream (we apply more later)
match info with
Expand Down Expand Up @@ -519,7 +519,7 @@ module internal Tokenizer =
classifiedSpans.Add(new ClassifiedSpan(classificationType, textSpan))
startPosition <- endPosition

SourceLineData(textLine.Start, lexState, previousLexState.Value, lineContents.GetHashCode(), classifiedSpans.ToArray(), tokens.ToArray())
SourceLineData(textLine.Start, lexState, previousLexState, lineContents.GetHashCode(), classifiedSpans.ToArray(), tokens.ToArray())


// We keep incremental data per-document. When text changes we correlate text line-by-line (by hash codes of lines)
Expand Down

0 comments on commit baa380b

Please sign in to comment.