mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 09:24:19 -06:00
parent
455364cf5a
commit
c777d5c68a
@ -662,11 +662,14 @@ module ts {
|
||||
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
|
||||
pos += 2;
|
||||
|
||||
while (pos < len) {
|
||||
var safeLength = len - 1; // For lookahead.
|
||||
var commentClosed = false;
|
||||
while (pos < safeLength) {
|
||||
var ch = text.charCodeAt(pos);
|
||||
|
||||
if (ch === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) {
|
||||
pos += 2;
|
||||
commentClosed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -676,6 +679,11 @@ module ts {
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (!commentClosed) {
|
||||
pos++;
|
||||
onError(Diagnostics.Asterisk_Slash_expected);
|
||||
}
|
||||
|
||||
if (onComment) {
|
||||
onComment(tokenPos, pos);
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/parserKeywordsAsIdentifierName2.ts (2 errors) ====
|
||||
// 'public' should be marked unusable, should complain on trailing /*
|
||||
a.public /*
|
||||
|
||||
!!! '*/' expected.
|
||||
~
|
||||
!!! Cannot find name 'a'.
|
||||
@ -1,5 +0,0 @@
|
||||
//// [parserKeywordsAsIdentifierName2.ts]
|
||||
// 'public' shoudl be marked unusable because it has a trailing /*
|
||||
//a.public /*
|
||||
|
||||
//// [parserKeywordsAsIdentifierName2.js]
|
||||
17
tests/baselines/reference/scannerS7.4_A2_T2.errors.txt
Normal file
17
tests/baselines/reference/scannerS7.4_A2_T2.errors.txt
Normal file
@ -0,0 +1,17 @@
|
||||
==== tests/cases/conformance/scanner/ecmascript5/scannerS7.4_A2_T2.ts (1 errors) ====
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/**
|
||||
* Correct interpretation of multi line comments
|
||||
*
|
||||
* @path ch07/7.4/S7.4_A2_T2.js
|
||||
* @description Try use /*CHECK#1/. This is not closed multi line comment
|
||||
* @negative
|
||||
*/
|
||||
|
||||
/*CHECK#1/
|
||||
|
||||
|
||||
|
||||
!!! '*/' expected.
|
||||
@ -1,17 +0,0 @@
|
||||
//// [scannerS7.4_A2_T2.ts]
|
||||
// Copyright 2009 the Sputnik authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/**
|
||||
* Correct interpretation of multi line comments
|
||||
*
|
||||
* @path ch07/7.4/S7.4_A2_T2.js
|
||||
* @description Try use /*CHECK#1/. This is not closed multi line comment
|
||||
* @negative
|
||||
*/
|
||||
|
||||
/*CHECK#1/
|
||||
|
||||
|
||||
|
||||
//// [scannerS7.4_A2_T2.js]
|
||||
@ -1,2 +1,2 @@
|
||||
// 'public' shoudl be marked unusable because it has a trailing /*
|
||||
//a.public /*
|
||||
// 'public' should be marked unusable, should complain on trailing /*
|
||||
a.public /*
|
||||
Loading…
x
Reference in New Issue
Block a user