Address code review comments

This commit is contained in:
Mohamed Hegazy 2014-10-27 15:30:38 -07:00
parent b6f4aa9da9
commit 962c4de875
3 changed files with 29 additions and 5 deletions

View File

@ -2021,7 +2021,7 @@ module ts {
var text = sourceFile.text;
var width = comment.end - comment.pos;
// is single line comment or just /*
if (width <=2 || text.charCodeAt(comment.pos + 1) === CharacterCodes.slash) {
if (width <= 2 || text.charCodeAt(comment.pos + 1) === CharacterCodes.slash) {
return true;
}
else {
@ -2484,9 +2484,6 @@ module ts {
}
function isInStringOrRegularExpressionLiteral(previousToken: Node): boolean {
//var token = getTouchingPropertyName(sourceFile, position);
// || token.kind === SyntaxKind.RegularExpressionLiteral
if (previousToken.kind === SyntaxKind.StringLiteral) {
// The position has to be either: 1. entirely within the token text, or
// 2. at the end position, and the string literal is not terminated
@ -2498,7 +2495,9 @@ module ts {
else if (position === end) {
var width = end - start;
var text = previousToken.getSourceFile().text;
return width <= 1 || text.charCodeAt(start) !== text.charCodeAt(end - 1);
return width <= 1 ||
text.charCodeAt(start) !== text.charCodeAt(end - 1) ||
text.charCodeAt(end - 2) === CharacterCodes.backslash;
}
}
else if (previousToken.kind === SyntaxKind.RegularExpressionLiteral) {

View File

@ -0,0 +1,13 @@
/// <reference path='fourslash.ts' />
////// Outside the function expression
////declare var f1: (a: number) => void; /*1*/
////
////declare var f1: (b: number, b2: /*2*/) => void;
goTo.marker("1");
verify.not.completionListContains("a");
goTo.marker("2");
verify.completionListContains("b");

View File

@ -0,0 +1,12 @@
/// <reference path='fourslash.ts' />
////// Outside the function expression
////var x1 = (a: number) => { }/*1*/;
////
////var x2 = (b: number) => {/*2*/ };
goTo.marker("1");
verify.not.completionListContains("a");
goTo.marker("2");
verify.completionListContains("b");