Merge branch 'master' into multiLineEmit2

Conflicts:
	tests/baselines/reference/computedPropertyNames11_ES5.js
	tests/baselines/reference/computedPropertyNames1_ES5.js
	tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js
	tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js
	tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js
	tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js
This commit is contained in:
Cyrus Najmabadi
2015-02-21 15:00:23 -08:00
102 changed files with 760 additions and 340 deletions
+16 -16
View File
@@ -3409,7 +3409,7 @@ module ts {
return isContextSensitive((<ConditionalExpression>node).whenTrue) ||
isContextSensitive((<ConditionalExpression>node).whenFalse);
case SyntaxKind.BinaryExpression:
return (<BinaryExpression>node).operator === SyntaxKind.BarBarToken &&
return (<BinaryExpression>node).operatorToken.kind === SyntaxKind.BarBarToken &&
(isContextSensitive((<BinaryExpression>node).left) || isContextSensitive((<BinaryExpression>node).right));
case SyntaxKind.PropertyAssignment:
return isContextSensitive((<PropertyAssignment>node).initializer);
@@ -4591,7 +4591,7 @@ module ts {
return links.assignmentChecks[symbol.id] = isAssignedIn(node);
function isAssignedInBinaryExpression(node: BinaryExpression) {
if (node.operator >= SyntaxKind.FirstAssignment && node.operator <= SyntaxKind.LastAssignment) {
if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) {
var n = node.left;
while (n.kind === SyntaxKind.ParenthesizedExpression) {
n = (<ParenthesizedExpression>n).expression;
@@ -4724,10 +4724,10 @@ module ts {
case SyntaxKind.BinaryExpression:
// In the right operand of an && or ||, narrow based on left operand
if (child === (<BinaryExpression>node).right) {
if ((<BinaryExpression>node).operator === SyntaxKind.AmpersandAmpersandToken) {
if ((<BinaryExpression>node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) {
narrowedType = narrowType(type, (<BinaryExpression>node).left, /*assumeTrue*/ true);
}
else if ((<BinaryExpression>node).operator === SyntaxKind.BarBarToken) {
else if ((<BinaryExpression>node).operatorToken.kind === SyntaxKind.BarBarToken) {
narrowedType = narrowType(type, (<BinaryExpression>node).left, /*assumeTrue*/ false);
}
}
@@ -4765,7 +4765,7 @@ module ts {
return type;
}
var typeInfo = primitiveTypeInfo[right.text];
if (expr.operator === SyntaxKind.ExclamationEqualsEqualsToken) {
if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) {
assumeTrue = !assumeTrue;
}
if (assumeTrue) {
@@ -4855,7 +4855,7 @@ module ts {
case SyntaxKind.ParenthesizedExpression:
return narrowType(type, (<ParenthesizedExpression>expr).expression, assumeTrue);
case SyntaxKind.BinaryExpression:
var operator = (<BinaryExpression>expr).operator;
var operator = (<BinaryExpression>expr).operatorToken.kind;
if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) {
return narrowTypeByEquality(type, <BinaryExpression>expr, assumeTrue);
}
@@ -5202,7 +5202,7 @@ module ts {
function getContextualTypeForBinaryOperand(node: Expression): Type {
var binaryExpression = <BinaryExpression>node.parent;
var operator = binaryExpression.operator;
var operator = binaryExpression.operatorToken.kind;
if (operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) {
// In an assignment expression, the right operand is contextually typed by the type of the left operand.
if (node === binaryExpression.right) {
@@ -5452,7 +5452,7 @@ module ts {
// an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'.
function isAssignmentTarget(node: Node): boolean {
var parent = node.parent;
if (parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).operator === SyntaxKind.EqualsToken && (<BinaryExpression>parent).left === node) {
if (parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).operatorToken.kind === SyntaxKind.EqualsToken && (<BinaryExpression>parent).left === node) {
return true;
}
if (parent.kind === SyntaxKind.PropertyAssignment) {
@@ -7108,7 +7108,7 @@ module ts {
}
function checkDestructuringAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type {
if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operator === SyntaxKind.EqualsToken) {
if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
checkBinaryExpression(<BinaryExpression>target, contextualMapper);
target = (<BinaryExpression>target).left;
}
@@ -7131,13 +7131,13 @@ module ts {
function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) {
// Grammar checking
if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) {
if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operatorToken.kind)) {
// ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an
// Assignment operator(11.13) or of a PostfixExpression(11.3)
checkGrammarEvalOrArgumentsInStrictMode(node, <Identifier>node.left);
}
var operator = node.operator;
var operator = node.operatorToken.kind;
if (operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) {
return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper);
}
@@ -7178,8 +7178,8 @@ module ts {
// try and return them a helpful suggestion
if ((leftType.flags & TypeFlags.Boolean) &&
(rightType.flags & TypeFlags.Boolean) &&
(suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) {
error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operator), tokenToString(suggestedOperator));
(suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) {
error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operatorToken.kind), tokenToString(suggestedOperator));
}
else {
// otherwise just check each operand separately and report errors as normal
@@ -7312,7 +7312,7 @@ module ts {
}
function reportOperatorError() {
error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operator), typeToString(leftType), typeToString(rightType));
error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType));
}
}
@@ -9252,7 +9252,7 @@ module ts {
if (right === undefined) {
return undefined;
}
switch ((<BinaryExpression>e).operator) {
switch ((<BinaryExpression>e).operatorToken.kind) {
case SyntaxKind.BarToken: return left | right;
case SyntaxKind.AmpersandToken: return left & right;
case SyntaxKind.GreaterThanGreaterThanToken: return left >> right;
@@ -10827,7 +10827,7 @@ module ts {
}
var computedPropertyName = <ComputedPropertyName>node;
if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>computedPropertyName.expression).operator === SyntaxKind.CommaToken) {
if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>computedPropertyName.expression).operatorToken.kind === SyntaxKind.CommaToken) {
return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
}
+82 -18
View File
@@ -2082,7 +2082,9 @@ module ts {
function emitLinePreservingList(parent: Node, nodes: NodeArray<Node>, allowTrailingComma: boolean, spacesBetweenBraces: boolean) {
Debug.assert(nodes.length > 0);
increaseIndent();
if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) {
if (spacesBetweenBraces) {
write(" ");
@@ -2113,6 +2115,7 @@ module ts {
}
decreaseIndent();
if (closeTokenIsOnSameLineAsLastElement) {
if (spacesBetweenBraces) {
write(" ");
@@ -2304,7 +2307,7 @@ module ts {
// spread ('...') unary operators that are anticipated for ES6.
switch (expression.kind) {
case SyntaxKind.BinaryExpression:
switch ((<BinaryExpression>expression).operator) {
switch ((<BinaryExpression>expression).operatorToken.kind) {
case SyntaxKind.AsteriskToken:
case SyntaxKind.SlashToken:
case SyntaxKind.PercentToken:
@@ -2523,22 +2526,18 @@ module ts {
}
}
function isSpreadElementExpression(node: Node) {
return node.kind === SyntaxKind.SpreadElementExpression;
}
function emitArrayLiteral(node: ArrayLiteralExpression) {
var elements = node.elements;
if (elements.length === 0) {
write("[]");
}
else if (languageVersion >= ScriptTarget.ES6) {
else if (languageVersion >= ScriptTarget.ES6 || !forEach(elements, isSpreadElementExpression)) {
write("[");
var multiLine = (node.flags & NodeFlags.MultiLine) !== 0;
if (multiLine) {
increaseIndent();
}
emitList(elements, 0, elements.length, /*multiLine*/ multiLine,
/*trailingComma*/ elements.hasTrailingComma);
if (multiLine) {
decreaseIndent();
}
emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false);
write("]");
}
else {
@@ -2708,7 +2707,7 @@ module ts {
function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression {
var result = <BinaryExpression>createSynthesizedNode(SyntaxKind.BinaryExpression);
result.operator = operator;
result.operatorToken = createSynthesizedNode(operator);
result.left = left;
result.right = right;
@@ -3082,19 +3081,84 @@ module ts {
}
function emitBinaryExpression(node: BinaryExpression) {
if (languageVersion < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken &&
if (languageVersion < ScriptTarget.ES6 && node.operatorToken.kind === SyntaxKind.EqualsToken &&
(node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) {
emitDestructuring(node);
}
else {
emit(node.left);
if (node.operator !== SyntaxKind.CommaToken) write(" ");
write(tokenToString(node.operator));
write(" ");
if (node.operatorToken.kind !== SyntaxKind.CommaToken) {
write(" ");
}
write(tokenToString(node.operatorToken.kind));
// We'd like to preserve newlines found in the original binary expression. i.e. if a user has:
//
// Foo() ||
// Bar();
//
// Then we'd like to emit it as such. It seems like we'd only need to check for a newline and
// then just indent and emit. However, that will lead to a problem with deeply nested code.
// i.e. if you have:
//
// Foo() ||
// Bar() ||
// Baz();
//
// Then we don't want to emit it as:
//
// Foo() ||
// Bar() ||
// Baz();
//
// So we only indent if the right side of the binary expression starts further in on the line
// versus the left.
var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end);
var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos));
// Check if the right expression is on a different line versus the operator itself. If so,
// we'll emit newline.
var onDifferentLine = operatorEnd.line !== rightStart.line;
if (onDifferentLine) {
// Also, if the right expression starts further in on the line than the left, then we'll indent.
var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos));
var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line);
var shouldIndent = rightStart.character > firstCharOfExpr;
if (shouldIndent) {
increaseIndent();
}
writeLine();
}
else {
write(" ");
}
emit(node.right);
if (shouldIndent) {
decreaseIndent();
}
}
}
function getFirstNonWhitespaceCharacterIndexOnLine(line: number): number {
var lineStart = getLineStarts(currentSourceFile)[line];
var text = currentSourceFile.text;
for (var i = lineStart; i < text.length; i++) {
var ch = text.charCodeAt(i);
if (!isWhiteSpace(text.charCodeAt(i)) || isLineBreak(ch)) {
break;
}
}
return i - lineStart;
}
function emitConditionalExpression(node: ConditionalExpression) {
emit(node.condition);
write(" ? ");
@@ -3436,7 +3500,7 @@ module ts {
// Return the expression 'value === void 0 ? defaultValue : value'
var equals = <BinaryExpression>createNode(SyntaxKind.BinaryExpression);
equals.left = value;
equals.operator = SyntaxKind.EqualsEqualsEqualsToken;
equals.operatorToken = createNode(SyntaxKind.EqualsEqualsEqualsToken);
equals.right = createVoidZero();
var cond = <ConditionalExpression>createNode(SyntaxKind.ConditionalExpression);
cond.condition = equals;
@@ -3519,7 +3583,7 @@ module ts {
}
function emitDestructuringAssignment(target: Expression, value: Expression) {
if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operator === SyntaxKind.EqualsToken) {
if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
value = createDefaultValueCheck(value,(<BinaryExpression>target).right);
target = (<BinaryExpression>target).left;
}
+14 -18
View File
@@ -152,6 +152,7 @@ module ts {
return visitNode(cbNode, (<PostfixUnaryExpression>node).operand);
case SyntaxKind.BinaryExpression:
return visitNode(cbNode, (<BinaryExpression>node).left) ||
visitNode(cbNode, (<BinaryExpression>node).operatorToken) ||
visitNode(cbNode, (<BinaryExpression>node).right);
case SyntaxKind.ConditionalExpression:
return visitNode(cbNode, (<ConditionalExpression>node).condition) ||
@@ -1311,6 +1312,12 @@ module ts {
return undefined;
}
function parseTokenNode<T extends Node>(): T {
var node = <T>createNode(token);
nextToken();
return finishNode(node);
}
function canParseSemicolon() {
// If there's a real semicolon, then we can always parse it out.
if (token === SyntaxKind.SemicolonToken) {
@@ -2084,14 +2091,6 @@ module ts {
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTokenNode<T extends Node>(): T {
var node = <T>createNode(token);
nextToken();
return finishNode(node);
}
function parseTemplateExpression(): TemplateExpression {
var template = <TemplateExpression>createNode(SyntaxKind.TemplateExpression);
@@ -2801,8 +2800,9 @@ module ts {
// Expression[in] , AssignmentExpression[in]
var expr = parseAssignmentExpressionOrHigher();
while (parseOptional(SyntaxKind.CommaToken)) {
expr = makeBinaryExpression(expr, SyntaxKind.CommaToken, parseAssignmentExpressionOrHigher());
var operatorToken: Node;
while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) {
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher());
}
return expr;
}
@@ -2881,9 +2881,7 @@ module ts {
// Note: we call reScanGreaterToken so that we get an appropriately merged token
// for cases like > > = becoming >>=
if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) {
var operator = token;
nextToken();
return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher());
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher());
}
// It wasn't an assignment or a lambda. This is a conditional expression:
@@ -3187,9 +3185,7 @@ module ts {
break;
}
var operator = token;
nextToken();
leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence));
leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence));
}
return leftOperand;
@@ -3245,10 +3241,10 @@ module ts {
return -1;
}
function makeBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression {
function makeBinaryExpression(left: Expression, operatorToken: Node, right: Expression): BinaryExpression {
var node = <BinaryExpression>createNode(SyntaxKind.BinaryExpression, left.pos);
node.left = left;
node.operator = operator;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
+1 -1
View File
@@ -623,7 +623,7 @@ module ts {
export interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
+1 -1
View File
@@ -69,7 +69,7 @@ module ts.BreakpointResolver {
return textSpan(node);
}
if (node.parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node.parent).operator === SyntaxKind.CommaToken) {
if (node.parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node.parent).operatorToken.kind === SyntaxKind.CommaToken) {
// if this is comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
+11 -12
View File
@@ -93,17 +93,16 @@ module ts.formatting {
savedPos = scanner.getStartPos();
}
function shouldRescanGreaterThanToken(container: Node): boolean {
if (container.kind !== SyntaxKind.BinaryExpression) {
return false;
}
switch ((<BinaryExpression>container).operator) {
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
return true;
function shouldRescanGreaterThanToken(node: Node): boolean {
if (node) {
switch (node.kind) {
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanToken:
return true;
}
}
return false;
@@ -164,7 +163,7 @@ module ts.formatting {
if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) {
currentToken = scanner.reScanGreaterToken();
Debug.assert((<BinaryExpression>n).operator === currentToken);
Debug.assert(n.kind === currentToken);
lastScanAction = ScanAction.RescanGreaterThanToken;
}
else if (expectedScanAction === ScanAction.RescanSlashToken && startsWithSlashToken(currentToken)) {
+1 -1
View File
@@ -4648,7 +4648,7 @@ module ts {
return true;
}
else if (parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>parent).left === node) {
var operator = (<BinaryExpression>parent).operator;
var operator = (<BinaryExpression>parent).operatorToken.kind;
return SyntaxKind.FirstAssignment <= operator && operator <= SyntaxKind.LastAssignment;
}
}
@@ -527,7 +527,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -1587,9 +1587,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) {
break;
case ts.SyntaxKind.BinaryExpression:
var op = (<ts.BinaryExpression>node).operator;
var op = (<ts.BinaryExpression>node).operatorToken.kind;
if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) {
report(node, "Use '===' and '!=='.")
@@ -558,7 +558,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -1998,12 +1998,13 @@ function delint(sourceFile) {
if (ifStatement.thenStatement.kind !== 172 /* Block */) {
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
}
if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) {
if (ifStatement.elseStatement &&
ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) {
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
}
break;
case 165 /* BinaryExpression */:
var op = node.operator;
var op = node.operatorToken.kind;
if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) {
report(node, "Use '===' and '!=='.");
}
@@ -173,15 +173,17 @@ export function delint(sourceFile: ts.SourceFile) {
>SyntaxKind : typeof ts.SyntaxKind
>BinaryExpression : ts.SyntaxKind
var op = (<ts.BinaryExpression>node).operator;
var op = (<ts.BinaryExpression>node).operatorToken.kind;
>op : ts.SyntaxKind
>(<ts.BinaryExpression>node).operator : ts.SyntaxKind
>(<ts.BinaryExpression>node).operatorToken.kind : ts.SyntaxKind
>(<ts.BinaryExpression>node).operatorToken : ts.Node
>(<ts.BinaryExpression>node) : ts.BinaryExpression
><ts.BinaryExpression>node : ts.BinaryExpression
>ts : unknown
>BinaryExpression : ts.BinaryExpression
>node : ts.Node
>operator : ts.SyntaxKind
>operatorToken : ts.Node
>kind : ts.SyntaxKind
if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) {
>op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean
@@ -1731,9 +1733,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -559,7 +559,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -1683,9 +1683,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -596,7 +596,7 @@ declare module "typescript" {
}
interface BinaryExpression extends Expression {
left: Expression;
operator: SyntaxKind;
operatorToken: Node;
right: Expression;
}
interface ConditionalExpression extends Expression {
@@ -1856,9 +1856,9 @@ declare module "typescript" {
>left : Expression
>Expression : Expression
operator: SyntaxKind;
>operator : SyntaxKind
>SyntaxKind : SyntaxKind
operatorToken: Node;
>operatorToken : Node
>Node : Node
right: Expression;
>right : Expression
@@ -12,6 +12,8 @@ obj[Symbol.foo];
//// [ES5SymbolProperty1.js]
var Symbol;
var obj = (_a = {}, _a[Symbol.foo] = 0, _a);
var obj = (_a = {}, _a[Symbol.foo] =
0,
_a);
obj[Symbol.foo];
var _a;
@@ -2,5 +2,7 @@
var v = { [yield]: foo }
//// [FunctionDeclaration8_es6.js]
var v = (_a = {}, _a[yield] = foo, _a);
var v = (_a = {}, _a[yield] =
foo,
_a);
var _a;
@@ -5,6 +5,8 @@ function * foo() {
//// [FunctionDeclaration9_es6.js]
function foo() {
var v = (_a = {}, _a[] = foo, _a);
var v = (_a = {}, _a[] =
foo,
_a);
var _a;
}
@@ -2,5 +2,6 @@
var v = { *[foo()]() { } }
//// [FunctionPropertyAssignments5_es6.js]
var v = (_a = {}, _a[foo()] = function () { }, _a);
var v = (_a = {}, _a[foo()] = function () { },
_a);
var _a;
+4 -2
View File
@@ -37,7 +37,9 @@ y
//// [asiArith.js]
var x = 1;
var y = 1;
var z = x + + +y;
var z = x +
+ +y;
var a = 1;
var b = 1;
var c = x - - -y;
var c = x -
- -y;
@@ -20,5 +20,6 @@ var v = {
var s;
var n;
var a;
var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, _a);
var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { },
_a);
var _a;
@@ -20,5 +20,6 @@ var v = {
var s;
var n;
var a;
var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a);
var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }),
_a);
var _a;
@@ -7,6 +7,8 @@ function foo() {
//// [computedPropertyNames18_ES5.js]
function foo() {
var obj = (_a = {}, _a[this.bar] = 0, _a);
var obj = (_a = {}, _a[this.bar] =
0,
_a);
var _a;
}
@@ -8,6 +8,8 @@ module M {
//// [computedPropertyNames19_ES5.js]
var M;
(function (M) {
var obj = (_a = {}, _a[this.bar] = 0, _a);
var obj = (_a = {}, _a[this.bar] =
0,
_a);
var _a;
})(M || (M = {}));
@@ -5,5 +5,6 @@ var v = {
}
//// [computedPropertyNames1_ES5.js]
var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a);
var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }),
_a);
var _a;
@@ -4,5 +4,7 @@ var obj = {
}
//// [computedPropertyNames20_ES5.js]
var obj = (_a = {}, _a[this.bar] = 0, _a);
var obj = (_a = {}, _a[this.bar] =
0,
_a);
var _a;
@@ -13,7 +13,8 @@ var C = (function () {
function C() {
}
C.prototype.bar = function () {
var obj = (_a = {}, _a[this.bar()] = function () { }, _a);
var obj = (_a = {}, _a[this.bar()] = function () { },
_a);
return 0;
var _a;
};
@@ -15,7 +15,9 @@ var C = (function () {
C.prototype.bar = function () {
return 0;
};
C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { };
C.prototype[(_a = {}, _a[this.bar()] =
1,
_a)[0]] = function () { };
return C;
})();
var _a;
@@ -34,7 +34,8 @@ var C = (function (_super) {
_super.apply(this, arguments);
}
C.prototype.foo = function () {
var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, _a);
var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { },
_a);
return 0;
var _a;
};
@@ -34,7 +34,9 @@ var C = (function (_super) {
}
// Gets emitted as super, not _super, which is consistent with
// use of super in static properties initializers.
C.prototype[(_a = {}, _a[super.bar.call(this)] = 1, _a)[0]] = function () { };
C.prototype[(_a = {}, _a[super.bar.call(this)] =
1,
_a)[0]] = function () { };
return C;
})(Base);
var _a;
@@ -26,7 +26,8 @@ var C = (function (_super) {
__extends(C, _super);
function C() {
_super.call(this);
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, _a);
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
_a);
var _a;
}
return C;
@@ -17,7 +17,8 @@ var C = (function () {
C.prototype.bar = function () {
var _this = this;
(function () {
var obj = (_a = {}, _a[_this.bar()] = function () { }, _a);
var obj = (_a = {}, _a[_this.bar()] = function () { },
_a);
var _a;
});
return 0;
@@ -32,7 +32,8 @@ var C = (function (_super) {
function C() {
_super.call(this);
(function () {
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, _a);
var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { },
_a);
var _a;
});
}
@@ -38,7 +38,8 @@ var C = (function (_super) {
C.prototype.foo = function () {
var _this = this;
(function () {
var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, _a);
var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { },
_a);
var _a;
});
return 0;
@@ -15,7 +15,8 @@ var C = (function () {
function C() {
}
C.prototype.bar = function () {
var obj = (_a = {}, _a[foo()] = function () { }, _a);
var obj = (_a = {}, _a[foo()] = function () { },
_a);
return 0;
var _a;
};
@@ -15,7 +15,8 @@ var C = (function () {
function C() {
}
C.bar = function () {
var obj = (_a = {}, _a[foo()] = function () { }, _a);
var obj = (_a = {}, _a[foo()] = function () { },
_a);
return 0;
var _a;
};
@@ -4,5 +4,7 @@ var o = {
};
//// [computedPropertyNames46_ES5.js]
var o = (_a = {}, _a["" || 0] = 0, _a);
var o = (_a = {}, _a["" || 0] =
0,
_a);
var _a;
@@ -14,5 +14,7 @@ var E2;
(function (E2) {
E2[E2["x"] = 0] = "x";
})(E2 || (E2 = {}));
var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = 0, _a);
var o = (_a = {}, _a[0 /* x */ || 0 /* x */] =
0,
_a);
var _a;
@@ -23,7 +23,13 @@ var E;
E[E["x"] = 0] = "x";
})(E || (E = {}));
var a;
extractIndexer((_a = {}, _a[a] = "", _a)); // Should return string
extractIndexer((_b = {}, _b[0 /* x */] = "", _b)); // Should return string
extractIndexer((_c = {}, _c["" || 0] = "", _c)); // Should return any (widened form of undefined)
extractIndexer((_a = {}, _a[a] =
"",
_a)); // Should return string
extractIndexer((_b = {}, _b[0 /* x */] =
"",
_b)); // Should return string
extractIndexer((_c = {}, _c["" || 0] =
"",
_c)); // Should return any (widened form of undefined)
var _a, _b, _c;
@@ -28,7 +28,8 @@ var x = {
//// [computedPropertyNames49_ES5.js]
var x = (_a = {
p1: 10
}, _a.p1 = 10, _a[1 + 1] = Object.defineProperty({ get: function () {
}, _a.p1 =
10, _a[1 + 1] = Object.defineProperty({ get: function () {
throw 10;
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () {
return 10;
@@ -39,5 +40,7 @@ var x = (_a = {
if (1 == 1) {
return 10;
}
}, enumerable: true, configurable: true }), _a.p2 = 20, _a);
}, enumerable: true, configurable: true }), _a.p2 =
20,
_a);
var _a;
@@ -20,5 +20,17 @@ var v = {
var s;
var n;
var a;
var v = (_a = {}, _a[s] = 0, _a[n] = n, _a[s + s] = 1, _a[s + n] = 2, _a[+s] = s, _a[""] = 0, _a[0] = 0, _a[a] = 1, _a[true] = 0, _a["hello bye"] = 0, _a["hello " + a + " bye"] = 0, _a);
var v = (_a = {}, _a[s] =
0, _a[n] =
n, _a[s + s] =
1, _a[s + n] =
2, _a[+s] =
s, _a[""] =
0, _a[0] =
0, _a[a] =
1, _a[true] =
0, _a["hello bye"] =
0, _a["hello " + a + " bye"] =
0,
_a);
var _a;
@@ -33,7 +33,8 @@ var x = (_a = {
return 10;
}
}
}, _a.p1 = 10, _a.foo = Object.defineProperty({ get: function () {
}, _a.p1 =
10, _a.foo = Object.defineProperty({ get: function () {
if (1 == 1) {
return 10;
}
@@ -44,5 +45,7 @@ var x = (_a = {
throw 10;
}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () {
return 10;
}, enumerable: true, configurable: true }), _a.p2 = 20, _a);
}, enumerable: true, configurable: true }), _a.p2 =
20,
_a);
var _a;
@@ -11,5 +11,12 @@ var v = {
//// [computedPropertyNames5_ES5.js]
var b;
var v = (_a = {}, _a[b] = 0, _a[true] = 1, _a[[]] = 0, _a[{}] = 0, _a[undefined] = undefined, _a[null] = null, _a);
var v = (_a = {}, _a[b] =
0, _a[true] =
1, _a[[]] =
0, _a[{}] =
0, _a[undefined] =
undefined, _a[null] =
null,
_a);
var _a;
@@ -12,5 +12,9 @@ var v = {
var p1;
var p2;
var p3;
var v = (_a = {}, _a[p1] = 0, _a[p2] = 1, _a[p3] = 2, _a);
var v = (_a = {}, _a[p1] =
0, _a[p2] =
1, _a[p3] =
2,
_a);
var _a;
@@ -11,5 +11,7 @@ var E;
(function (E) {
E[E["member"] = 0] = "member";
})(E || (E = {}));
var v = (_a = {}, _a[0 /* member */] = 0, _a);
var v = (_a = {}, _a[0 /* member */] =
0,
_a);
var _a;
@@ -12,6 +12,9 @@ function f<T, U extends string>() {
function f() {
var t;
var u;
var v = (_a = {}, _a[t] = 0, _a[u] = 1, _a);
var v = (_a = {}, _a[t] =
0, _a[u] =
1,
_a);
var _a;
}
@@ -12,5 +12,9 @@ var v = {
//// [computedPropertyNames9_ES5.js]
function f(x) { }
var v = (_a = {}, _a[f("")] = 0, _a[f(0)] = 0, _a[f(true)] = 0, _a);
var v = (_a = {}, _a[f("")] =
0, _a[f(0)] =
0, _a[f(true)] =
0,
_a);
var _a;
@@ -9,5 +9,8 @@ var o: I = {
}
//// [computedPropertyNamesContextualType10_ES5.js]
var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a);
var o = (_a = {}, _a[+"foo"] =
"", _a[+"bar"] =
0,
_a);
var _a;
@@ -10,5 +10,7 @@ var o: I = {
}
//// [computedPropertyNamesContextualType1_ES5.js]
var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = function (y) { return y.length; }, _a);
var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] =
function (y) { return y.length; },
_a);
var _a;
@@ -10,5 +10,7 @@ var o: I = {
}
//// [computedPropertyNamesContextualType2_ES5.js]
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = function (y) { return y.length; }, _a);
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] =
function (y) { return y.length; },
_a);
var _a;
@@ -9,5 +9,7 @@ var o: I = {
}
//// [computedPropertyNamesContextualType3_ES5.js]
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = function (y) { return y.length; }, _a);
var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] =
function (y) { return y.length; },
_a);
var _a;
@@ -10,5 +10,8 @@ var o: I = {
}
//// [computedPropertyNamesContextualType4_ES5.js]
var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a);
var o = (_a = {}, _a["" + "foo"] =
"", _a["" + "bar"] =
0,
_a);
var _a;
@@ -10,5 +10,8 @@ var o: I = {
}
//// [computedPropertyNamesContextualType5_ES5.js]
var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a);
var o = (_a = {}, _a[+"foo"] =
"", _a[+"bar"] =
0,
_a);
var _a;
@@ -17,5 +17,11 @@ foo({
foo((_a = {
p: "",
0: function () { }
}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a));
}, _a.p =
"", _a[0] =
function () { }, _a["hi" + "bye"] =
true, _a[0 + 1] =
0, _a[+"hi"] =
[0],
_a));
var _a;
@@ -17,5 +17,11 @@ foo({
foo((_a = {
p: "",
0: function () { }
}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a));
}, _a.p =
"", _a[0] =
function () { }, _a["hi" + "bye"] =
true, _a[0 + 1] =
0, _a[+"hi"] =
[0],
_a));
var _a;
@@ -10,5 +10,8 @@ var o: I = {
}
//// [computedPropertyNamesContextualType8_ES5.js]
var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a);
var o = (_a = {}, _a["" + "foo"] =
"", _a["" + "bar"] =
0,
_a);
var _a;
@@ -10,5 +10,8 @@ var o: I = {
}
//// [computedPropertyNamesContextualType9_ES5.js]
var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a);
var o = (_a = {}, _a[+"foo"] =
"", _a[+"bar"] =
0,
_a);
var _a;
@@ -7,7 +7,9 @@ var v = {
}
//// [computedPropertyNamesDeclarationEmit5_ES5.js]
var v = (_a = {}, _a["" + ""] = 0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), _a);
var v = (_a = {}, _a["" + ""] =
0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }),
_a);
var _a;
@@ -8,6 +8,7 @@ var v = {
//// [computedPropertyNamesSourceMap2_ES5.js]
var v = (_a = {}, _a["hello"] = function () {
debugger;
}, _a);
},
_a);
var _a;
//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
@@ -1,2 +1,2 @@
//// [computedPropertyNamesSourceMap2_ES5.js.map]
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA,EACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"}
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"}
@@ -95,16 +95,11 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0)
3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0)
---
>>>}, _a);
>>>},
1 >
2 >^
3 >
4 > ^^
5 > ^^
6 >
7 > ^
8 > ^
9 > ^->
4 > ^^^^->
1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1)
1 >
@@ -115,42 +110,50 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
3 >
4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 4) Source(1, 1) + SourceIndex(0) nameIndex (-1)
4 >
5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 6) Source(1, 1) + SourceIndex(0) nameIndex (-1)
5 >
6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
6 >
7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 7) Source(5, 2) + SourceIndex(0) nameIndex (-1)
7 >
8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1)
8 >
1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0)
2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0)
3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0)
4 >Emitted(3, 4) Source(1, 1) + SourceIndex(0)
5 >Emitted(3, 6) Source(1, 1) + SourceIndex(0)
6 >Emitted(3, 6) Source(0, NaN) + SourceIndex(0)
7 >Emitted(3, 7) Source(5, 2) + SourceIndex(0)
8 >Emitted(3, 8) Source(5, 2) + SourceIndex(0)
---
>>>_a);
1->
2 >^^
3 >
4 > ^
5 > ^
6 > ^^^^->
1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1->
2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 >
3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1)
3 >
4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1)
4 >
5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found
5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1)
5 >
1->Emitted(4, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0)
3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0)
4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0)
5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0)
---
>>>var _a;
1->^^^^
2 > ^^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1)
1->
2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 4) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1)
2 >
1->Emitted(4, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0)
1->Emitted(5, 5) Source(1, 1) + SourceIndex(0)
2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0)
---
!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded
!!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA
@@ -314,10 +314,12 @@ var TypeScriptAllInOne;
Program.prototype.if = function (retValue) {
if (retValue === void 0) { retValue = != 0; }
return 1;
^ retValue;
^
retValue;
bfs.TYPES();
if (retValue != 0) {
return 1 && ;
return 1 &&
;
}
retValue = bfs.OPERATOR;
' );;
@@ -348,7 +350,8 @@ var BasicFeatures = (function () {
BasicFeatures.prototype.VARIABLES = function () {
var local = Number.MAX_VALUE;
var min = Number.MIN_VALUE;
var inf = Number.NEGATIVE_INFINITY - ;
var inf = Number.NEGATIVE_INFINITY -
;
var nan = Number.NaN;
var undef = undefined;
var _\uD4A5\u7204\uC316, uE59F = local;
@@ -357,14 +360,16 @@ var BasicFeatures = (function () {
var local6 = local5 instanceof fs.File;
var hex = 0xBADC0DE, Hex = 0XDEADBEEF;
var float = 6.02e23, float2 = 6.02E-23;
var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != ;
var char = 'c', \u0066 = '\u0066', hexchar = '\x42' !=
;
var quoted = '"', quoted2 = "'";
var reg = /\w*/;
var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, instanceof: function () { return 'objLit{42}'; } };
var weekday = 0 /* Monday */;
var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday;
//
var any = 0 ^= ;
var any = 0 ^=
;
var bool = 0;
var declare = 0;
var constructor = 0;
@@ -380,7 +385,8 @@ var BasicFeatures = (function () {
var public = 0;
var set = 0;
var static = 0;
var string = 0 / > ;
var string = 0 / >
;
var yield = 0;
var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield;
return 0;
@@ -536,7 +542,8 @@ while ()
: string, ;
rest: string[];
{
& public;
&
public;
DefaultValue(value ? : string = "Hello");
{ }
}
@@ -150,26 +150,27 @@ var i1Ori2 = {
propertyOnlyInI2: "Hello"
};
var arrayI1OrI2 = [i1, i2, {
commonPropertyType: "hello",
commonMethodType: function (a) { return a; },
commonMethodWithTypeParameter: function (a) { return a; },
methodOnlyInI1: function (a) { return a; },
propertyOnlyInI1: "Hello"
}, {
commonPropertyType: "hello",
commonMethodType: function (a) { return a; },
commonMethodWithTypeParameter: function (a) { return a; },
methodOnlyInI2: function (a) { return a; },
propertyOnlyInI2: "Hello"
}, {
commonPropertyType: "hello",
commonMethodType: function (a) { return a; },
commonMethodWithTypeParameter: function (a) { return a; },
methodOnlyInI1: function (a) { return a; },
propertyOnlyInI1: "Hello",
methodOnlyInI2: function (a) { return a; },
propertyOnlyInI2: "Hello"
}];
commonPropertyType: "hello",
commonMethodType: function (a) { return a; },
commonMethodWithTypeParameter: function (a) { return a; },
methodOnlyInI1: function (a) { return a; },
propertyOnlyInI1: "Hello"
},
{
commonPropertyType: "hello",
commonMethodType: function (a) { return a; },
commonMethodWithTypeParameter: function (a) { return a; },
methodOnlyInI2: function (a) { return a; },
propertyOnlyInI2: "Hello"
}, {
commonPropertyType: "hello",
commonMethodType: function (a) { return a; },
commonMethodWithTypeParameter: function (a) { return a; },
methodOnlyInI1: function (a) { return a; },
propertyOnlyInI1: "Hello",
methodOnlyInI2: function (a) { return a; },
propertyOnlyInI2: "Hello"
}];
var i11;
var i21;
var i11Ori21 = i11;
@@ -191,17 +192,17 @@ var i11Ori21 = {
commonPropertyDifferentType: 10
};
var arrayOrI11OrI21 = [i11, i21, i11 || i21, {
// Like i1
commonMethodDifferentReturnType: function (a, b) {
var z = a.charAt(b);
return z;
},
commonPropertyDifferentType: "hello"
}, {
// Like i2
commonMethodDifferentReturnType: function (a, b) {
var z = a.charCodeAt(b);
return z;
},
commonPropertyDifferentType: 10
}];
// Like i1
commonMethodDifferentReturnType: function (a, b) {
var z = a.charAt(b);
return z;
},
commonPropertyDifferentType: "hello"
}, {
// Like i2
commonMethodDifferentReturnType: function (a, b) {
var z = a.charCodeAt(b);
return z;
},
commonPropertyDifferentType: 10
}];
@@ -422,22 +422,38 @@ exports.tests = (function () {
}));
// File pattern matching tests
testRunner.addTest(new TestCase("Check text file match", function () {
return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js"));
return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") &&
FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") &&
FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js"));
}));
testRunner.addTest(new TestCase("Check makefile match", function () {
return FileManager.FileBuffer.isTextFile("C:\\some dir\\makefile");
}));
testRunner.addTest(new TestCase("Check binary file doesn't match", function () {
return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll"));
return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") &&
!FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll"));
}));
// Command-line parameter tests
testRunner.addTest(new TestCase("Check App defaults", function () {
var app = new App.App([]);
return (app.fixLines === false && app.recurse === true && app.lineEndings === "CRLF" && app.matchPattern === undefined && app.rootDirectory === ".\\" && app.encodings[0] === "ascii" && app.encodings[1] === "utf8nobom");
return (app.fixLines === false &&
app.recurse === true &&
app.lineEndings === "CRLF" &&
app.matchPattern === undefined &&
app.rootDirectory === ".\\" &&
app.encodings[0] === "ascii" &&
app.encodings[1] === "utf8nobom");
}));
testRunner.addTest(new TestCase("Check App params", function () {
var app = new App.App(["-dir=C:\\test dir", "-lineEndings=LF", "-encodings=utf16be,ascii", "-recurse=false", "-fixlines"]);
return (app.fixLines === true && app.lineEndings === "LF" && app.recurse === false && app.matchPattern === undefined && app.rootDirectory === "C:\\test dir" && app.encodings[0] === "utf16be" && app.encodings[1] === "ascii" && app.encodings.length === 2);
return (app.fixLines === true &&
app.lineEndings === "LF" &&
app.recurse === false &&
app.matchPattern === undefined &&
app.rootDirectory === "C:\\test dir" &&
app.encodings[0] === "utf16be" &&
app.encodings[1] === "ascii" &&
app.encodings.length === 2);
}));
// File BOM detection tests
testRunner.addTest(new TestCase("Check encoding detection no BOM", function () {
+2 -14
View File
@@ -150,21 +150,9 @@ var E9;
// (refer to .js to validate)
// Enum constant members are propagated
var doNotPropagate = [
E8.B,
E7.A,
E4.Z,
E3.X,
E3.Y,
E3.Z
E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z
];
// Enum computed members are not propagated
var doPropagate = [
0 /* A */,
E9.B,
0 /* B */,
1 /* C */,
0 /* A */,
0 /* A */,
3 /* B */,
4 /* C */
0 /* A */, E9.B, 0 /* B */, 1 /* C */, 0 /* A */, 0 /* A */, 3 /* B */, 4 /* C */
];
@@ -61,5 +61,22 @@ function Foo<
//// [genericsManyTypeParameters.js]
function Foo(x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18) {
return [x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18];
return [x1, y1, z1, a1, b1, c1,
x2, y2, z2, a2, b2, c2,
x3, y3, z3, a3, b3, c3,
x4, y4, z4, a4, b4, c4,
x5, y5, z5, a5, b5, c5,
x6, y6, z6, a6, b6, c6,
x7, y7, z7, a7, b7, c7,
x8, y8, z8, a8, b8, c8,
x9, y9, z9, a9, b9, c9,
x10, y12, z10, a10, b10, c10,
x11, y13, z11, a11, b11, c11,
x12, y14, z12, a12, b12, c12,
x13, y15, z13, a13, b13, c13,
x14, y16, z14, a14, b14, c14,
x15, y17, z15, a15, b15, c15,
x16, y18, z16, a16, b16, c16,
x17, y19, z17, a17, b17, c17,
x18, y10, z18, a18, b18, c18];
}
@@ -41,7 +41,10 @@ function testcase() {
var one = 1;
var _float = -(4 / 3);
var a = new Array(false, undefined, null, "0", obj, -1.3333333333333, "str", -0, true, +0, one, 1, 0, false, _float, -(4 / 3));
if (a.indexOf(-(4 / 3)) === 14 && a.indexOf(0) === 7 && a.indexOf(-0) === 7 && a.indexOf(1) === 10) {
if (a.indexOf(-(4 / 3)) === 14 &&
a.indexOf(0) === 7 &&
a.indexOf(-0) === 7 &&
a.indexOf(1) === 10) {
return true;
}
}
@@ -2,5 +2,7 @@
var v = { [e]: 1 };
//// [parserES5ComputedPropertyName2.js]
var v = (_a = {}, _a[e] = 1, _a);
var v = (_a = {}, _a[e] =
1,
_a);
var _a;
@@ -2,5 +2,6 @@
var v = { [e]() { } };
//// [parserES5ComputedPropertyName3.js]
var v = (_a = {}, _a[e] = function () { }, _a);
var v = (_a = {}, _a[e] = function () { },
_a);
var _a;
@@ -2,5 +2,6 @@
var v = { get [e]() { } };
//// [parserES5ComputedPropertyName4.js]
var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), _a);
var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }),
_a);
var _a;
@@ -3,4 +3,5 @@ var v = [1, 2, 3
4, 5, 6, 7];
//// [parserErrorRecoveryArrayLiteralExpression1.js]
var v = [1, 2, 3, 4, 5, 6, 7];
var v = [1, 2, 3,
4, 5, 6, 7];
@@ -5,4 +5,5 @@ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0
//// [parserErrorRecoveryArrayLiteralExpression2.js]
var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048];
var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0,
.7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048];
@@ -6,6 +6,7 @@ function f() {
//// [parserErrorRecovery_Block1.js]
function f() {
1 + ;
1 +
;
return;
}
@@ -10,8 +10,10 @@ switch (e) {
//// [parserErrorRecovery_SwitchStatement1.js]
switch (e) {
case 1:
1 + ;
1 +
;
case 2:
1 + ;
1 +
;
default:
}
@@ -5,4 +5,5 @@
2;
//// [parserGreaterThanTokenAmbiguity10.js]
1 >>> 2;
1 >>>
2;
@@ -3,5 +3,6 @@
= 2;
//// [parserGreaterThanTokenAmbiguity14.js]
1 >> ;
1 >>
;
2;
@@ -5,4 +5,5 @@
2;
//// [parserGreaterThanTokenAmbiguity15.js]
1 >>= 2;
1 >>=
2;
@@ -3,5 +3,6 @@
= 2;
//// [parserGreaterThanTokenAmbiguity19.js]
1 >>> ;
1 >>>
;
2;
@@ -5,4 +5,5 @@
2;
//// [parserGreaterThanTokenAmbiguity20.js]
1 >>>= 2;
1 >>>=
2;
@@ -3,4 +3,5 @@
> 2;
//// [parserGreaterThanTokenAmbiguity4.js]
1 > > 2;
1 >
> 2;
@@ -5,4 +5,5 @@
2;
//// [parserGreaterThanTokenAmbiguity5.js]
1 >> 2;
1 >>
2;
@@ -3,4 +3,5 @@
> 2;
//// [parserGreaterThanTokenAmbiguity9.js]
1 >> > 2;
1 >>
> 2;
@@ -813,7 +813,8 @@ var TypeScript;
else {
var tokenInfo = lookupToken(this.tokenId);
if (tokenInfo != undefined) {
if ((tokenInfo.unopNodeType != NodeType.None) || (tokenInfo.binopNodeType != NodeType.None)) {
if ((tokenInfo.unopNodeType != NodeType.None) ||
(tokenInfo.binopNodeType != NodeType.None)) {
return 2 /* Operator */;
}
}
@@ -2488,7 +2488,8 @@ var TypeScript;
if (context.parser !== null) {
context.parser.getSourceLineCol(lineCol, this.minChar);
context.parser.getSourceLineCol(limLineCol, this.limChar);
context.write("(" + lineCol.line + "," + lineCol.col + ")--" + "(" + limLineCol.line + "," + limLineCol.col + "): ");
context.write("(" + lineCol.line + "," + lineCol.col + ")--" +
"(" + limLineCol.line + "," + limLineCol.col + "): ");
}
var lab = this.printLabel();
if (hasFlag(this.flags, ASTFlags.Error)) {
@@ -4001,13 +4002,16 @@ var TypeScript;
var target = cond.target;
if (target.nodeType == NodeType.Dot) {
var binex = target;
if ((binex.operand1.nodeType == NodeType.Name) && (this.obj.nodeType == NodeType.Name) && (binex.operand1.actualText == this.obj.actualText)) {
if ((binex.operand1.nodeType == NodeType.Name) &&
(this.obj.nodeType == NodeType.Name) &&
(binex.operand1.actualText == this.obj.actualText)) {
var prop = binex.operand2;
if (prop.actualText == "hasOwnProperty") {
var args = cond.arguments;
if ((args !== null) && (args.members.length == 1)) {
var arg = args.members[0];
if ((arg.nodeType == NodeType.Name) && (this.lval.nodeType == NodeType.Name)) {
if ((arg.nodeType == NodeType.Name) &&
(this.lval.nodeType == NodeType.Name)) {
if ((this.lval.actualText) == arg.actualText) {
return true;
}
+171 -48
View File
@@ -656,167 +656,288 @@ var TypeScript;
AstPath.prototype.isNameOfClass = function () {
if (this.ast() === null || this.parent() === null)
return false;
return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && (this.parent().name === this.ast());
return (this.ast().nodeType === TypeScript.NodeType.Name) &&
(this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) &&
(this.parent().name === this.ast());
};
AstPath.prototype.isNameOfInterface = function () {
if (this.ast() === null || this.parent() === null)
return false;
return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && (this.parent().name === this.ast());
return (this.ast().nodeType === TypeScript.NodeType.Name) &&
(this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) &&
(this.parent().name === this.ast());
};
AstPath.prototype.isNameOfArgument = function () {
if (this.ast() === null || this.parent() === null)
return false;
return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && (this.parent().id === this.ast());
return (this.ast().nodeType === TypeScript.NodeType.Name) &&
(this.parent().nodeType === TypeScript.NodeType.ArgDecl) &&
(this.parent().id === this.ast());
};
AstPath.prototype.isNameOfVariable = function () {
if (this.ast() === null || this.parent() === null)
return false;
return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.VarDecl) && (this.parent().id === this.ast());
return (this.ast().nodeType === TypeScript.NodeType.Name) &&
(this.parent().nodeType === TypeScript.NodeType.VarDecl) &&
(this.parent().id === this.ast());
};
AstPath.prototype.isNameOfModule = function () {
if (this.ast() === null || this.parent() === null)
return false;
return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && (this.parent().name === this.ast());
return (this.ast().nodeType === TypeScript.NodeType.Name) &&
(this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) &&
(this.parent().name === this.ast());
};
AstPath.prototype.isNameOfFunction = function () {
if (this.ast() === null || this.parent() === null)
return false;
return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && (this.parent().name === this.ast());
return (this.ast().nodeType === TypeScript.NodeType.Name) &&
(this.parent().nodeType === TypeScript.NodeType.FuncDecl) &&
(this.parent().name === this.ast());
};
AstPath.prototype.isChildOfScript = function () {
var ast = lastOf(this.asts);
return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script;
return this.count() >= 3 &&
this.asts[this.top] === ast &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script;
};
AstPath.prototype.isChildOfModule = function () {
var ast = lastOf(this.asts);
return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration;
return this.count() >= 3 &&
this.asts[this.top] === ast &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration;
};
AstPath.prototype.isChildOfClass = function () {
var ast = lastOf(this.asts);
return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration;
return this.count() >= 3 &&
this.asts[this.top] === ast &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration;
};
AstPath.prototype.isArgumentOfClassConstructor = function () {
var ast = lastOf(this.asts);
return this.count() >= 5 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && (this.asts[this.top - 2].isConstructor) && (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]);
return this.count() >= 5 &&
this.asts[this.top] === ast &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl &&
this.asts[this.top - 3].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration &&
(this.asts[this.top - 2].isConstructor) &&
(this.asts[this.top - 2].arguments === this.asts[this.top - 1]) &&
(this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]);
};
AstPath.prototype.isChildOfInterface = function () {
var ast = lastOf(this.asts);
return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration;
return this.count() >= 3 &&
this.asts[this.top] === ast &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration;
};
AstPath.prototype.isTopLevelImplicitModule = function () {
return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile);
return this.count() >= 1 &&
this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration &&
TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile);
};
AstPath.prototype.isBodyOfTopLevelImplicitModule = function () {
return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0] && TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile);
return this.count() >= 2 &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration &&
this.asts[this.top - 1].members == this.asts[this.top - 0] &&
TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile);
};
AstPath.prototype.isBodyOfScript = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && this.asts[this.top - 1].bod == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script &&
this.asts[this.top - 1].bod == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfSwitch = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].caseList == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch &&
this.asts[this.top - 1].caseList == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfModule = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration &&
this.asts[this.top - 1].members == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfClass = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration &&
this.asts[this.top - 1].members == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfFunction = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].bod == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl &&
this.asts[this.top - 1].bod == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfInterface = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration &&
this.asts[this.top - 1].members == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfBlock = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 1].statements == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block &&
this.asts[this.top - 1].statements == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfFor = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.For &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfCase = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfTry = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfCatch = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfDoWhile = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfWhile = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.While &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfForIn = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfWith = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.With &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfFinally = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && this.asts[this.top - 1].body == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally &&
this.asts[this.top - 1].body == this.asts[this.top - 0];
};
AstPath.prototype.isCaseOfSwitch = function () {
return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1];
return this.count() >= 3 &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].caseList == this.asts[this.top - 1];
};
AstPath.prototype.isDefaultCaseOfSwitch = function () {
return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1] && this.asts[this.top - 2].defaultCase == this.asts[this.top - 0];
return this.count() >= 3 &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].caseList == this.asts[this.top - 1] &&
this.asts[this.top - 2].defaultCase == this.asts[this.top - 0];
};
AstPath.prototype.isListOfObjectLit = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].operand == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfObjectLit = function () {
return this.isListOfObjectLit();
};
AstPath.prototype.isEmptyListOfObjectLit = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0] && this.asts[this.top - 0].members.length == 0;
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].operand == this.asts[this.top - 0] &&
this.asts[this.top - 0].members.length == 0;
};
AstPath.prototype.isMemberOfObjectLit = function () {
return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 2].operand == this.asts[this.top - 1];
return this.count() >= 3 &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member &&
this.asts[this.top - 2].operand == this.asts[this.top - 1];
};
AstPath.prototype.isNameOfMemberOfObjectLit = function () {
return this.count() >= 4 && this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && this.asts[this.top - 3].operand == this.asts[this.top - 2];
return this.count() >= 4 &&
this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name &&
this.asts[this.top - 3].operand == this.asts[this.top - 2];
};
AstPath.prototype.isListOfArrayLit = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].operand == this.asts[this.top - 0];
};
AstPath.prototype.isTargetOfMember = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand1 === this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member &&
this.asts[this.top - 1].operand1 === this.asts[this.top - 0];
};
AstPath.prototype.isMemberOfMember = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand2 === this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member &&
this.asts[this.top - 1].operand2 === this.asts[this.top - 0];
};
AstPath.prototype.isItemOfList = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List;
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List;
//(<Tools.ASTList>this.asts[this.top - 1]).operand2 === this.asts[this.top - 0];
};
AstPath.prototype.isThenOfIf = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].thenBod == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.If &&
this.asts[this.top - 1].thenBod == this.asts[this.top - 0];
};
AstPath.prototype.isElseOfIf = function () {
return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].elseBod == this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.If &&
this.asts[this.top - 1].elseBod == this.asts[this.top - 0];
};
AstPath.prototype.isBodyOfDefaultCase = function () {
return this.isBodyOfCase();
};
AstPath.prototype.isSingleStatementList = function () {
return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.List && this.asts[this.top].members.length === 1;
return this.count() >= 1 &&
this.asts[this.top].nodeType === TypeScript.NodeType.List &&
this.asts[this.top].members.length === 1;
};
AstPath.prototype.isArgumentListOfFunction = function () {
return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].arguments === this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl &&
this.asts[this.top - 1].arguments === this.asts[this.top - 0];
};
AstPath.prototype.isArgumentOfFunction = function () {
return this.count() >= 3 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 2].arguments === this.asts[this.top - 1];
return this.count() >= 3 &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl &&
this.asts[this.top - 2].arguments === this.asts[this.top - 1];
};
AstPath.prototype.isArgumentListOfCall = function () {
return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && this.asts[this.top - 1].arguments === this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call &&
this.asts[this.top - 1].arguments === this.asts[this.top - 0];
};
AstPath.prototype.isArgumentListOfNew = function () {
return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && this.asts[this.top - 1].arguments === this.asts[this.top - 0];
return this.count() >= 2 &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.List &&
this.asts[this.top - 1].nodeType === TypeScript.NodeType.New &&
this.asts[this.top - 1].arguments === this.asts[this.top - 0];
};
AstPath.prototype.isSynthesizedBlock = function () {
return this.count() >= 1 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 0].isStatementBlock === false;
return this.count() >= 1 &&
this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block &&
this.asts[this.top - 0].isStatementBlock === false;
};
return AstPath;
})();
@@ -877,7 +998,9 @@ var TypeScript;
// bar
// 0123
// If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid
var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case
var inclusive = hasFlag(options, 1 /* EdgeInclusive */) ||
cur.nodeType === TypeScript.NodeType.Name ||
pos === script.limChar; // Special "EOF" case
var minChar = cur.minChar;
var limChar = cur.limChar + (inclusive ? 1 : 0);
if (pos >= minChar && pos < limChar) {
@@ -329,7 +329,8 @@ var TypeScript;
// is has not been fully re-parsed yet.
if (ast.nodeType == NodeType.Script && context.pos > limChar)
limChar = context.pos;
if ((minChar <= context.pos) && (limChar >= context.pos)) {
if ((minChar <= context.pos) &&
(limChar >= context.pos)) {
switch (ast.nodeType) {
case NodeType.Script:
var script = ast;
+27 -6
View File
@@ -1053,7 +1053,8 @@ var TypeScript;
if (isExported) {
typeSymbol.flags |= SymbolFlags.Exported;
}
if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) {
if ((context.scopeChain.moduleDecl) ||
(context.scopeChain.container == context.checker.gloMod)) {
typeSymbol.flags |= SymbolFlags.ModuleMember;
}
moduleDecl.mod = modType;
@@ -1079,7 +1080,11 @@ var TypeScript;
// REVIEW-CLASSES
if (!typeSymbol) {
var valTypeSymbol = scopeChain.scope.findLocal(className, false, false);
if (valTypeSymbol && valTypeSymbol.isType() && valTypeSymbol.declAST && valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && valTypeSymbol.declAST.isSignature()) {
if (valTypeSymbol &&
valTypeSymbol.isType() &&
valTypeSymbol.declAST &&
valTypeSymbol.declAST.nodeType == NodeType.FuncDecl &&
valTypeSymbol.declAST.isSignature()) {
typeSymbol = valTypeSymbol;
foundValSymbol = true;
if (isExported) {
@@ -1233,7 +1238,10 @@ var TypeScript;
if (context.scopeChain.moduleDecl) {
context.scopeChain.moduleDecl.recordNonInterface();
}
if (isProperty || isExported || (context.scopeChain.container == context.checker.gloMod) || context.scopeChain.moduleDecl) {
if (isProperty ||
isExported ||
(context.scopeChain.container == context.checker.gloMod) ||
context.scopeChain.moduleDecl) {
if (isAmbient) {
var existingSym = scopeChain.scope.findLocal(varDecl.id.text, false, false);
if (existingSym) {
@@ -1254,7 +1262,8 @@ var TypeScript;
}
field.symbol = fieldSymbol;
fieldSymbol.declAST = ast;
if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) {
if ((context.scopeChain.moduleDecl) ||
(context.scopeChain.container == context.checker.gloMod)) {
fieldSymbol.flags |= SymbolFlags.ModuleMember;
fieldSymbol.declModule = context.scopeChain.moduleDecl;
}
@@ -1305,7 +1314,12 @@ var TypeScript;
// If the parent is the constructor, and this isn't an instance method, skip it.
// That way, we'll set the type during scope assignment, and can be sure that the
// function will be placed in the constructor-local scope
if (!funcDecl.isConstructor && containerSym && containerSym.declAST && containerSym.declAST.nodeType == NodeType.FuncDecl && containerSym.declAST.isConstructor && !funcDecl.isMethod()) {
if (!funcDecl.isConstructor &&
containerSym &&
containerSym.declAST &&
containerSym.declAST.nodeType == NodeType.FuncDecl &&
containerSym.declAST.isConstructor &&
!funcDecl.isMethod()) {
return go;
}
// Interfaces and overloads
@@ -1394,7 +1408,14 @@ var TypeScript;
}
}
// REVIEW: Move this check into the typecheck phase? It's only being run over properties...
if (fgSym && !fgSym.isAccessor() && fgSym.type && fgSym.type.construct && fgSym.type.construct.signatures != [] && (fgSym.type.construct.signatures[0].declAST == null || !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && !funcDecl.isConstructor) {
if (fgSym &&
!fgSym.isAccessor() &&
fgSym.type &&
fgSym.type.construct &&
fgSym.type.construct.signatures != [] &&
(fgSym.type.construct.signatures[0].declAST == null ||
!hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) &&
!funcDecl.isConstructor) {
context.checker.errorReporter.simpleError(funcDecl, "Functions may not have class overloads");
}
if (fgSym && !(fgSym.kind() == SymbolKind.Type) && funcDecl.isMethod() && !funcDecl.isAccessor() && !funcDecl.isConstructor) {
+17 -4
View File
@@ -632,7 +632,8 @@ var TypeScript;
// the enclosing scope
// REVIEW: Some twisted logic here - this needs to be cleaned up once old classes are removed
// - if it's a new class, always use the contained scope, since we initialize the constructor scope below
if (context.scopeChain.thisType && (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) {
if (context.scopeChain.thisType &&
(!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) {
var instType = context.scopeChain.thisType;
if (!(instType.typeFlags & TypeFlags.IsClass) && !hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) {
if (!funcDecl.isMethod() || isStatic) {
@@ -644,7 +645,10 @@ var TypeScript;
}
}
else {
if (context.scopeChain.previous.scope.container && context.scopeChain.previous.scope.container.declAST && context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && context.scopeChain.previous.scope.container.declAST.isConstructor) {
if (context.scopeChain.previous.scope.container &&
context.scopeChain.previous.scope.container.declAST &&
context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl &&
context.scopeChain.previous.scope.container.declAST.isConstructor) {
// if the parent is the class constructor, use the constructor scope
parentScope = instType.constructorScope;
}
@@ -681,7 +685,12 @@ var TypeScript;
outerFnc.innerStaticFuncs[outerFnc.innerStaticFuncs.length] = funcDecl;
}
else {
if (!funcDecl.isConstructor && container && container.declAST && container.declAST.nodeType == NodeType.FuncDecl && container.declAST.isConstructor && !funcDecl.isMethod()) {
if (!funcDecl.isConstructor &&
container &&
container.declAST &&
container.declAST.nodeType == NodeType.FuncDecl &&
container.declAST.isConstructor &&
!funcDecl.isMethod()) {
funcScope = context.scopeChain.thisType.constructorScope; //locals;
}
else {
@@ -702,7 +711,11 @@ var TypeScript;
}
context.typeFlow.checker.createFunctionSignature(funcDecl, container, funcScope, fgSym, fgSym == null);
// it's a getter or setter for a class property
if (!funcDecl.accessorSymbol && (funcDecl.fncFlags & FncFlags.ClassMethod) && container && ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || (fgSym && fgSym.isAccessor())) {
if (!funcDecl.accessorSymbol &&
(funcDecl.fncFlags & FncFlags.ClassMethod) &&
container &&
((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) ||
(fgSym && fgSym.isAccessor())) {
funcDecl.accessorSymbol = context.typeFlow.checker.createAccessorSymbol(funcDecl, fgSym, container.getType(), (funcDecl.isMethod() && isStatic), true, funcScope, container);
}
funcDecl.type.symbol.flags |= SymbolFlags.TypeSetDuringScopeAssignment;
+10 -4
View File
@@ -778,7 +778,10 @@ var Formatting;
}
Indenter.prototype.GetIndentationEdits = function (token, nextToken, node, sameLineIndent) {
if (this.logger.information()) {
this.logger.log("GetIndentationEdits(" + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + ")");
this.logger.log("GetIndentationEdits(" +
"t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " +
"t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" +
")");
}
var result = this.GetIndentationEditsWorker(token, nextToken, node, sameLineIndent);
if (this.logger.information()) {
@@ -938,7 +941,8 @@ var Formatting;
};
Indenter.prototype.GetSpecialCaseIndentationForLCurly = function (node) {
var indentationInfo = null;
if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) {
if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl ||
node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) {
// flushed with the node (function & if)
indentationInfo = node.GetNodeStartLineIndentation(this);
return indentationInfo;
@@ -1233,7 +1237,8 @@ var Formatting;
// Get the parent that is really on a different line from the self node
var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset);
parent = tree.StartNodeSelf.Parent;
while (parent != null && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) {
while (parent != null &&
startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) {
parent = parent.Parent;
}
}
@@ -1331,7 +1336,8 @@ var Formatting;
}
};
Indenter.prototype.IsMultiLineString = function (token) {
return token.tokenID === TypeScript.TokenID.StringLiteral && this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition());
return token.tokenID === TypeScript.TokenID.StringLiteral &&
this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition());
};
return Indenter;
})();
+4 -1
View File
@@ -11,6 +11,9 @@ var y: {
//// [privateIndexer2.js]
// private indexers not allowed
var x = (_a = {}, _a[x] = string, _a.string = , _a);
var x = (_a = {}, _a[x] =
string, _a.string =
,
_a);
var y;
var _a;
+3 -1
View File
@@ -33,7 +33,9 @@ var CharacterInfo = (function () {
return c >= CharacterCodes._0 && c <= CharacterCodes._9;
};
CharacterInfo.isHexDigit = function (c) {
return isDecimalDigit(c) || (c >= CharacterCodes.A && c <= CharacterCodes.F) || (c >= CharacterCodes.a && c <= CharacterCodes.f);
return isDecimalDigit(c) ||
(c >= CharacterCodes.A && c <= CharacterCodes.F) ||
(c >= CharacterCodes.a && c <= CharacterCodes.f);
};
CharacterInfo.hexValue = function (c) {
Debug.assert(isHexDigit(c));
+4 -3
View File
@@ -108,6 +108,7 @@ function C(a, b) {
this.a = a;
this.b = b;
}
C.prototype = { a: 0, b: 0, C1M1: function (c, d) {
return (this.a + c) + (this.b + d);
} };
C.prototype =
{ a: 0, b: 0, C1M1: function (c, d) {
return (this.a + c) + (this.b + d);
} };
@@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` ||
"abc0abc" !== `abc${0}abc`;
//// [templateStringInEqualityChecks.js]
var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && "abc" + 0 + "abc" == "abc0abc" && "abc0abc" !== "abc" + 0 + "abc";
var x = "abc" + 0 + "abc" === "abc" ||
"abc" !== "abc" + 0 + "abc" &&
"abc" + 0 + "abc" == "abc0abc" &&
"abc0abc" !== "abc" + 0 + "abc";
@@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` ||
"abc0abc" !== `abc${0}abc`;
//// [templateStringInEqualityChecksES6.js]
var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc`;
var x = `abc${0}abc` === `abc` ||
`abc` !== `abc${0}abc` &&
`abc${0}abc` == "abc0abc" &&
"abc0abc" !== `abc${0}abc`;
@@ -116,8 +116,11 @@ var B = (function () {
this.prop1 = this;
this.prop2 = function () { return _this; };
this.prop3 = function () { return function () { return function () { return function () { return _this; }; }; }; };
this.prop4 = ' ' + function () {
} + ' ' + (function () { return function () { return function () { return _this; }; }; });
this.prop4 = ' ' +
function () {
} +
' ' +
(function () { return function () { return function () { return _this; }; }; });
this.prop5 = {
a: function () { return _this; }
};
@@ -29,8 +29,7 @@ var menuData = [
"type": "image",
"link": "",
"icon": "modules/menu/logo.svg"
},
{
}, {
"id": "productName",
"type": "default",
"link": "",
@@ -9,8 +9,8 @@ var functions = [function () {
//// [typeCheckingInsideFunctionExpressionInArray.js]
var functions = [function () {
var k = 10;
k = new Object();
[1, 2, 3].NonexistantMethod();
derp();
}];
var k = 10;
k = new Object();
[1, 2, 3].NonexistantMethod();
derp();
}];
@@ -142,7 +142,8 @@ function foo7(x) {
}
function foo8(x) {
var b;
return typeof x === "string" ? x === "hello" : ((b = x) && (typeof x === "boolean" ? x // boolean
return typeof x === "string" ? x === "hello" : ((b = x) &&
(typeof x === "boolean" ? x // boolean
: x == 10)); // number
}
function foo9(x) {
@@ -11,6 +11,6 @@ var functions = [function() {
//// [undefinedSymbolReferencedInArrayLiteral1.js]
var tokens = [{ startIndex: deltaOffset }];
var functions = [function () {
[1, 2, 3].NonexistantMethod();
anotherNonExistingMethod();
}];
[1, 2, 3].NonexistantMethod();
anotherNonExistingMethod();
}];
@@ -240,7 +240,9 @@ var ts;
this.flags = flags;
}
Property.prototype.equals = function (other) {
return this.name === other.name && this.flags === other.flags && this.type.equals(other.type);
return this.name === other.name &&
this.flags === other.flags &&
this.type.equals(other.type);
};
return Property;
})(Symbol);
@@ -258,10 +260,14 @@ var ts;
this.returnType = returnType;
}
Signature.prototype.equalsNoReturn = function (other) {
return this.parameters.length === other.parameters.length && this.typeParameters.length === other.typeParameters.length && arrayEquals(this.parameters, other.parameters) && arrayEquals(this.typeParameters, other.typeParameters);
return this.parameters.length === other.parameters.length &&
this.typeParameters.length === other.typeParameters.length &&
arrayEquals(this.parameters, other.parameters) &&
arrayEquals(this.typeParameters, other.typeParameters);
};
Signature.prototype.equals = function (other) {
return this.equalsNoReturn(other) && this.returnType.equals(other.returnType);
return this.equalsNoReturn(other) &&
this.returnType.equals(other.returnType);
};
return Signature;
})(Symbol);
@@ -274,7 +280,9 @@ var ts;
this.flags = flags;
}
Parameter.prototype.equals = function (other) {
return this.name === other.name && this.flags === other.flags && this.type.equals(other.type);
return this.name === other.name &&
this.flags === other.flags &&
this.type.equals(other.type);
};
return Parameter;
})(Symbol);

Some files were not shown because too many files have changed in this diff Show More