Skip to content

Commit

Permalink
Scanner updates for decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuckton committed Mar 17, 2015
1 parent efd8a89 commit fb10deb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/compiler/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ module ts {
"&=": SyntaxKind.AmpersandEqualsToken,
"|=": SyntaxKind.BarEqualsToken,
"^=": SyntaxKind.CaretEqualsToken,
"@": SyntaxKind.AtToken,
};

/*
Expand Down Expand Up @@ -315,6 +316,19 @@ module ts {
return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position);
}

export function lineBreakBetween(sourceFile: SourceFile, firstPos: number, secondPos: number): boolean {

This comment has been minimized.

Copy link
@JsonFreeman

JsonFreeman Mar 18, 2015

Contributor

hasLineBreakBetween

This comment has been minimized.

Copy link
@rbuckton

rbuckton Mar 23, 2015

Author Member

Removed for now, it was only used for reparsing the covering grammar.

var lineStarts = getLineStarts(sourceFile);
var firstLine = binarySearch(lineStarts, firstPos);
var secondLine = binarySearch(lineStarts, secondPos);
if (firstLine < 0) {
firstLine = ~firstLine - 1;
}
if (secondLine < 0) {
secondLine = ~secondLine - 1;
}
return firstLine !== secondLine;
}

let hasOwnProperty = Object.prototype.hasOwnProperty;

export function isWhiteSpace(ch: number): boolean {
Expand Down Expand Up @@ -1247,6 +1261,8 @@ module ts {
return pos++, token = SyntaxKind.CloseBraceToken;
case CharacterCodes.tilde:
return pos++, token = SyntaxKind.TildeToken;
case CharacterCodes.at:
return pos++, token = SyntaxKind.AtToken;
case CharacterCodes.backslash:
let cookedChar = peekUnicodeEscape();
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {
Expand Down

0 comments on commit fb10deb

Please sign in to comment.