Report exact position of invalid characters in scanner (#44671)
This commit is contained in:
parent
0e905be42b
commit
0a9b218b11
|
@ -2063,8 +2063,9 @@ namespace ts {
|
|||
pos += charSize(ch);
|
||||
continue;
|
||||
}
|
||||
error(Diagnostics.Invalid_character);
|
||||
pos += charSize(ch);
|
||||
const size = charSize(ch);
|
||||
error(Diagnostics.Invalid_character, pos, size);
|
||||
pos += size;
|
||||
return token = SyntaxKind.Unknown;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ tests/cases/conformance/es6/memberFunctionDeclarations/MemberFunctionDeclaration
|
|||
if (a) ¬ * bar;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'a'.
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
|
|
|
@ -8,9 +8,9 @@ tests/cases/compiler/emitBOM.js(1,3): error TS1127: Invalid character.
|
|||
|
||||
==== tests/cases/compiler/emitBOM.js (2 errors) ====
|
||||
// JS and d.ts output should have a BOM but not the sourcemap
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
var x;
|
||||
//# sourceMappingURL=emitBOM.js.map
|
||||
|
|
|
@ -6,6 +6,6 @@ tests/cases/compiler/parseErrorInHeritageClause1.ts(1,19): error TS1127: Invalid
|
|||
class C extends A ¬ {
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'A'.
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
}
|
|
@ -4,7 +4,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecov
|
|||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/Blocks/parserErrorRecovery_Block2.ts (1 errors) ====
|
||||
function f() {
|
||||
¬
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
return;
|
||||
}
|
|
@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErr
|
|||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErrorRecovery_ClassElement3.ts (4 errors) ====
|
||||
module M {
|
||||
¬
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
class C {
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ClassElements/parserErr
|
|||
~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
¬
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
|
||||
!!! error TS1005: '}' expected.
|
|
@ -3,6 +3,6 @@ tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ParameterLists/parserEr
|
|||
|
||||
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ParameterLists/parserErrorRecovery_ParameterList4.ts (1 errors) ====
|
||||
function f(a,¬) {
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
}
|
|
@ -20,7 +20,7 @@ tests/cases/conformance/parser/ecmascript5/SkippedTokens/parserSkippedTokens16.t
|
|||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
function Foo () ¬ { }
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
4+:5
|
||||
~
|
||||
|
|
Binary file not shown.
|
@ -6,11 +6,11 @@ tests/cases/compiler/unicodeIdentifierName2.ts(1,26): error TS1127: Invalid char
|
|||
|
||||
==== tests/cases/compiler/unicodeIdentifierName2.ts (4 errors) ====
|
||||
var a₁ = "hello"; alert(a₁)
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
||||
~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
~~~~~~~
|
||||
!!! error TS1134: Variable declaration expected.
|
||||
|
||||
~
|
||||
!!! error TS1127: Invalid character.
|
Loading…
Reference in a new issue