Skip to content

Commit

Permalink
Missing blob creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nguerrera committed Jul 28, 2016
1 parent f0bcb4c commit 8a5619f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Compilers/Core/Portable/Text/SourceText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,13 @@ public static SourceText From(byte[] buffer, int length, Encoding encoding, Sour
/// <exception cref="ArgumentException"><paramref name="checksumAlgorithm"/> is not supported.</exception>
/// <exception cref="DecoderFallbackException">If the given encoding is set to use a throwing decoder as a fallback</exception>
/// <exception cref="InvalidDataException">Two consecutive NUL characters were detected in the decoded text and <paramref name="throwIfBinaryDetected"/> was true.</exception>
public static SourceText From(byte[] buffer, int length, Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, bool throwIfBinaryDetected = false, bool canBeEmbedded = false)
public static SourceText From(
byte[] buffer,
int length,
Encoding encoding = null,
SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
bool throwIfBinaryDetected = false,
bool canBeEmbedded = false)
{
if (buffer == null)
{
Expand All @@ -215,7 +221,8 @@ public static SourceText From(byte[] buffer, int length, Encoding encoding = nul

// Since we have the bytes in hand, it's easy to compute the checksum.
var checksum = CalculateChecksum(buffer, 0, length, checksumAlgorithm);
return new StringText(text, encoding, checksum, checksumAlgorithm);
var embeddedTextBlob = canBeEmbedded ? EmbeddedText.CreateBlob(buffer, length) : default(ImmutableArray<byte>);
return new StringText(text, encoding, checksum, checksumAlgorithm, embeddedTextBlob);
}

/// <summary>
Expand Down

0 comments on commit 8a5619f

Please sign in to comment.