Skip to content

Commit ed1e5e2

Browse files
committed
Respond to PR feedback
1 parent 993a7b2 commit ed1e5e2

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

lib/Parser/Scan.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ IdentPtr Scanner<EncodingPolicy>::PidOfIdentiferAt(EncodedCharPtr p, EncodedChar
587587
}
588588

589589
template <typename EncodingPolicy>
590-
typename Scanner<EncodingPolicy>::EncodedCharPtr Scanner<EncodingPolicy>::FScanNumber(EncodedCharPtr p, double *pdbl, bool& likelyInt, size_t saveMultiUnits)
590+
typename Scanner<EncodingPolicy>::EncodedCharPtr Scanner<EncodingPolicy>::FScanNumber(EncodedCharPtr p, double *pdbl, bool& likelyInt, size_t savedMultiUnits)
591591
{
592592
EncodedCharPtr last = m_pchLast;
593593
EncodedCharPtr pchT = nullptr;
@@ -686,7 +686,7 @@ typename Scanner<EncodingPolicy>::EncodedCharPtr Scanner<EncodingPolicy>::FScanN
686686
}
687687
if (this->charClassifier->IsIdStart(outChar))
688688
{
689-
this->RestoreMultiUnits(saveMultiUnits);
689+
this->RestoreMultiUnits(savedMultiUnits);
690690
Error(ERRIdAfterLit);
691691
}
692692

@@ -696,14 +696,14 @@ typename Scanner<EncodingPolicy>::EncodedCharPtr Scanner<EncodingPolicy>::FScanN
696696
startingLocation++; // TryReadEscape expects us to point to the 'u', and since it is by reference we need to do it beforehand.
697697
if (TryReadEscape(startingLocation, m_pchLast, &outChar))
698698
{
699-
this->RestoreMultiUnits(saveMultiUnits);
699+
this->RestoreMultiUnits(savedMultiUnits);
700700
Error(ERRIdAfterLit);
701701
}
702702
}
703703

704704
if (Js::NumberUtilities::IsDigit(*startingLocation))
705705
{
706-
this->RestoreMultiUnits(saveMultiUnits);
706+
this->RestoreMultiUnits(savedMultiUnits);
707707
Error(ERRbadNumber);
708708
}
709709

@@ -1590,7 +1590,7 @@ tokens Scanner<EncodingPolicy>::ScanCore(bool identifyKwds)
15901590
m_tkPrevious = m_ptoken->tk;
15911591
m_iecpLimTokPrevious = IecpLimTok(); // Introduced for use by lambda parsing to find correct span of expression lambdas
15921592
m_ichLimTokPrevious = IchLimTok();
1593-
size_t saveMultiUnits = this->m_cMultiUnits;
1593+
size_t savedMultiUnits = this->m_cMultiUnits;
15941594

15951595
if (p >= last)
15961596
{
@@ -1724,10 +1724,10 @@ tokens Scanner<EncodingPolicy>::ScanCore(bool identifyKwds)
17241724
p = m_pchMinTok;
17251725
this->RestoreMultiUnits(m_cMinTokMultiUnits);
17261726
bool likelyInt = true;
1727-
pchT = FScanNumber(p, &dbl, likelyInt, saveMultiUnits);
1727+
pchT = FScanNumber(p, &dbl, likelyInt, savedMultiUnits);
17281728
if (p == pchT)
17291729
{
1730-
this->RestoreMultiUnits(saveMultiUnits);
1730+
this->RestoreMultiUnits(savedMultiUnits);
17311731
Assert(this->PeekFirst(p, last) != '.');
17321732
Error(ERRbadNumber);
17331733
}

lib/Parser/Scan.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ class Scanner : public IScanner, public EncodingPolicy
787787
tokens SkipComment(EncodedCharPtr *pp, /* out */ bool* containTypeDef);
788788
tokens ScanRegExpConstant(ArenaAllocator* alloc);
789789
tokens ScanRegExpConstantNoAST(ArenaAllocator* alloc);
790-
EncodedCharPtr FScanNumber(EncodedCharPtr p, double *pdbl, bool& likelyInt, size_t saveMultiUnits);
790+
EncodedCharPtr FScanNumber(EncodedCharPtr p, double *pdbl, bool& likelyInt, size_t savedMultiUnits);
791791
IdentPtr PidOfIdentiferAt(EncodedCharPtr p, EncodedCharPtr last, bool fHadEscape, bool fHasMultiChar);
792792
IdentPtr PidOfIdentiferAt(EncodedCharPtr p, EncodedCharPtr last);
793793
uint32 UnescapeToTempBuf(EncodedCharPtr p, EncodedCharPtr last);

test/Scanner/NumericLiteralSuffix.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,11 @@ var tests = [
8686
{
8787
name: "Multi-unit count updated in the middle of a token",
8888
body: function () {
89-
assert.throws(() => eval('\u20091a'), SyntaxError, 'Multi-unit whitespace followed by numeric literal followed by identifier', 'Unexpected identifier after numeric literal');
90-
assert.throws(() => eval('\u20091\\u0065'), SyntaxError, 'Multi-unit whitespace followed by numeric literal followed by unicode escape sequence', 'Unexpected identifier after numeric literal');
91-
assert.throws(() => eval('\u20090o1239'), SyntaxError, 'Multi-unit whitespace followed by invalid octal numeric literal', 'Invalid number');
89+
if (WScript.Platform.INTL_LIBRARY === "winglob" || WScript.Platform.INTL_LIBRARY === "icu") {
90+
assert.throws(() => eval('\u20091a'), SyntaxError, 'Multi-unit whitespace followed by numeric literal followed by identifier', 'Unexpected identifier after numeric literal');
91+
assert.throws(() => eval('\u20091\\u0065'), SyntaxError, 'Multi-unit whitespace followed by numeric literal followed by unicode escape sequence', 'Unexpected identifier after numeric literal');
92+
assert.throws(() => eval('\u20090o1239'), SyntaxError, 'Multi-unit whitespace followed by invalid octal numeric literal', 'Invalid number');
93+
}
9294
}
9395
}
9496
];

0 commit comments

Comments
 (0)