Skip to content

Commit fb10deb

Browse files
committed
Scanner updates for decorators
1 parent efd8a89 commit fb10deb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/compiler/scanner.ts

+16
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ module ts {
148148
"&=": SyntaxKind.AmpersandEqualsToken,
149149
"|=": SyntaxKind.BarEqualsToken,
150150
"^=": SyntaxKind.CaretEqualsToken,
151+
"@": SyntaxKind.AtToken,
151152
};
152153

153154
/*
@@ -315,6 +316,19 @@ module ts {
315316
return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);
316317
}
317318

319+
export function lineBreakBetween(sourceFile: SourceFile, firstPos: number, secondPos: number): boolean {
320+
var lineStarts = getLineStarts(sourceFile);
321+
var firstLine = binarySearch(lineStarts, firstPos);
322+
var secondLine = binarySearch(lineStarts, secondPos);
323+
if (firstLine < 0) {
324+
firstLine = ~firstLine - 1;
325+
}
326+
if (secondLine < 0) {
327+
secondLine = ~secondLine - 1;
328+
}
329+
return firstLine !== secondLine;
330+
}
331+
318332
let hasOwnProperty = Object.prototype.hasOwnProperty;
319333

320334
export function isWhiteSpace(ch: number): boolean {
@@ -1247,6 +1261,8 @@ module ts {
12471261
return pos++, token = SyntaxKind.CloseBraceToken;
12481262
case CharacterCodes.tilde:
12491263
return pos++, token = SyntaxKind.TildeToken;
1264+
case CharacterCodes.at:
1265+
return pos++, token = SyntaxKind.AtToken;
12501266
case CharacterCodes.backslash:
12511267
let cookedChar = peekUnicodeEscape();
12521268
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {

0 commit comments

Comments
 (0)