Merge branch 'master' into MergingErrors

Conflicts:
	src/compiler/checker.ts
This commit is contained in:
Anders Hejlsberg 2014-07-16 16:31:08 -07:00
Родитель bc0be761cd cb6a44e086
Коммит 6b112b1a46
255 изменённых файлов: 1514 добавлений и 1450 удалений

30
.gitignore поставляемый
Просмотреть файл

@ -1,6 +1,5 @@
node_modules/
built/
bin/wrapped_tsc.js
tests/cases/*.js
tests/cases/*/*.js
tests/cases/*/*/*.js
@ -14,14 +13,7 @@ tests/cases/*/*/*/*/*.js.map
tests/cases/rwc/*
tests/cases/perf/*
!tests/cases/webharness/compilerToString.js
tests/runners/*.js
tests/runners/*/*.js
tests/runners/rwc/*
!tests/runners/rwc/rwcRunner.ts
!tests/runners/rwc/loggedIO.ts
diff-*.html
test-args.txt
*.suo
~*.docx
tests/baselines/local/*
tests/baselines/reference/projectOutput/
@ -32,35 +24,15 @@ tests/services/baselines/prototyping/local/*
tests/services/browser/typescriptServices.js
scripts/processDiagnosticMessages.d.ts
scripts/processDiagnosticMessages.js
src/compiler/*.js
src/compiler/syntax/wrapped_SyntaxGenerator.js
src/compiler/syntax/SyntaxGenerator.js
src/compiler/syntax/SyntaxGenerator.d.ts
src/compiler/prototype/*.js
src/services/*.js
src/services/*/*.js
src/harness/*.js
src/prototype/*.js
src/prototype/*/*.js
baseline-report.html
fidelity-report.html
rwc-report.html
*.swp
build.json
monaco.editor.json
samples/win8/encyclopedia/Encyclopedia/js/*.js
samples/win8/encyclopedia/Encyclopedia/js/*.js.map
samples/win8/encyclopedia/Encyclopedia/bin/
samples/win8/encyclopedia/Encyclopedia/bld/
samples/win8/encyclopedia/Encyclopedia/Encyclopedia.jsproj.user
*.actual
tests/Fidelity/*.d.ts
tests/Fidelity/*.js
tests/cases/webharness/*.d.ts
tests/webhost/*.d.ts
tests/webhost/webtsc.js
tests/*.js
tests/*.d.ts
*.config
scripts/debug.bat
scripts/run.bat
scripts/run.bat

Просмотреть файл

@ -1,12 +1,5 @@
built
doc
samples
src
tests
typings
bin/winjs.d.ts
bin/winrt.d.ts
bin/*.bat
bin/jquery.d.ts
bin/typescriptServices.js
Jakefile

Просмотреть файл

@ -23,8 +23,8 @@ tsc hello.ts
## Building
1. Install Node if you haven't already (http://nodejs.org/)
2. Install Jake, the tool we use to build our compiler (https://github.com/mde/jake). To do this, run "npm install -g jake".
1. Install [node](http://nodejs.org/) if you haven't already
2. Install dependencies ([Jake](https://github.com/mde/jake), [mocha](http://visionmedia.github.io/mocha/), [Chai](http://chaijs.com/) and [browserify](http://browserify.org/) the tool we use to build our compiler. To do this, run `npm install`.
3. To use jake, run one of the following commands:
- jake local - This builds the compiler. The output is in built/local in the public directory
- jake clean - deletes the build compiler

Просмотреть файл

@ -1,2 +1,2 @@
#!/usr/bin/env node
require('./tsc.js')
require('./tc.js')

Просмотреть файл

@ -6,7 +6,7 @@
"licenses": [
{
"type": "Apache License 2.0",
"url": "http://typescript.codeplex.com/license"
"url": "https://github.com/Microsoft/TypeScript/blob/master/LICENSE.txt"
}
],
"description": "TypeScript is a language for application scale JavaScript development",
@ -18,14 +18,14 @@
"javascript"
],
"bugs": {
"url" : "http://typescript.codeplex.com/workitem/list/basic"
"url" : "https://github.com/Microsoft/TypeScript/issues"
},
"repository" : {
"type" : "git",
"url" : "https://git01.codeplex.com/typescript"
"url" : "https://github.com/Microsoft/TypeScript.git"
},
"preferGlobal" : true,
"main" : "./bin/typescript.js",
"main" : "./bin/tc.js",
"bin" : {
"tsc" : "./bin/tsc"
},

Просмотреть файл

@ -181,6 +181,10 @@ module ts {
return <SourceFile>getAncestor(node, SyntaxKind.SourceFile);
}
function isGlobalSourceFile(node: Node) {
return node.kind === SyntaxKind.SourceFile && !(node.flags & NodeFlags.ExternalModule);
}
function getSymbol(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol {
if (meaning && hasProperty(symbols, name)) {
var symbol = symbols[name];
@ -226,7 +230,7 @@ module ts {
while (location) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
if (location.locals && (location.kind !== SyntaxKind.SourceFile || location.flags & NodeFlags.ExternalModule)) {
if (location.locals && !isGlobalSourceFile(location)) {
if (result = getSymbol(location.locals, name, meaning)) {
return returnResolvedSymbol(result);
}
@ -594,14 +598,134 @@ module ts {
return (propertySymbol.valueDeclaration.flags & NodeFlags.QuestionMark) && propertySymbol.valueDeclaration.kind !== SyntaxKind.Parameter;
}
function symbolToString(symbol: Symbol) {
if (symbol.declarations && symbol.declarations.length > 0) {
var declaration = symbol.declarations[0];
if (declaration.name) {
return identifierToString(declaration.name);
function forEachSymbolTableInScope<T>(enclosingDeclaration: Node, callback: (symbolTable: SymbolTable) => T): T {
var result: T;
for (var location = enclosingDeclaration; location; location = location.parent) {
// Locals of a source file are not in scope (because they get merged into the global symbol table)
if (location.locals && !isGlobalSourceFile(location)) {
if (result = callback(location.locals)) {
return result;
}
}
switch (location.kind) {
case SyntaxKind.SourceFile:
if (!(location.flags & NodeFlags.ExternalModule)) {
break;
}
case SyntaxKind.ModuleDeclaration:
if (result = callback(getSymbolOfNode(location).exports)) {
return result;
}
break;
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
if (result = callback(getSymbolOfNode(location).members)) {
return result;
}
break;
}
}
return symbol.name;
return callback(globals);
}
function getAccessibleSymbol(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) {
function getAccessibleSymbolFromSymbolTable(symbols: SymbolTable) {
function isAccessible(symbolFromSymbolTable: Symbol, resolvedAliasSymbol?: Symbol) {
if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) {
// If the symbol is equivalent and doesnt need futher qualification, this symbol is accessible
if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {
return true;
}
// If symbol needs qualification, make sure that parent is accessible, if it is then this symbol is accessible too
var accessibleParent = getAccessibleSymbol(symbolFromSymbolTable.parent, enclosingDeclaration, SymbolFlags.Namespace);
return !!accessibleParent;
}
}
// If symbol is directly available by its name in the symbol table
if (isAccessible(symbols[symbol.name])) {
return symbol;
}
// Check if symbol is any of the alias
return forEachValue(symbols, symbolFromSymbolTable => {
if (symbolFromSymbolTable.flags & SymbolFlags.Import) {
if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) {
return symbolFromSymbolTable;
}
}
});
}
if (symbol) {
return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolFromSymbolTable);
}
}
function needsQualification(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags) {
var qualify = false;
forEachSymbolTableInScope(enclosingDeclaration, symbolTable => {
// If symbol of this name is not available in the symbol table we are ok
if (!symbolTable[symbol.name]) {
// Continue to the next symbol table
return false;
}
// If the symbol with this name is present it should refer to the symbol
var symbolFromSymbolTable = symbolTable[symbol.name];
if (symbolFromSymbolTable === symbol) {
// No need to qualify
return true;
}
// Qualify if the symbol from symbol table has same meaning as expected
symbolFromSymbolTable = (symbolFromSymbolTable.flags & SymbolFlags.Import) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
}
// Continue to the next symbol table
return false;
});
return qualify
}
// Enclosing declaration is optional when we dont want to get qualified name in the enclosing declaration scope
// Meaning needs to be specified if the enclosing declaration is given
function symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) {
function getSymbolName(symbol: Symbol) {
if (symbol.declarations && symbol.declarations.length > 0) {
var declaration = symbol.declarations[0];
if (declaration.name) {
return identifierToString(declaration.name);
}
}
return symbol.name;
}
// Get qualified name
if (enclosingDeclaration &&
// Properties/methods/Signatures/Constructors/TypeParameters do not need qualification
!(symbol.flags & SymbolFlags.PropertyOrAccessor & SymbolFlags.Signature & SymbolFlags.Constructor & SymbolFlags.Method & SymbolFlags.TypeParameter)) {
var symbolName: string;
while (symbol) {
var isFirstName = !symbolName;
var meaningToLook = isFirstName ? meaning : SymbolFlags.Namespace;
var accessibleSymbol = getAccessibleSymbol(symbol, enclosingDeclaration, meaningToLook);
symbolName = getSymbolName(accessibleSymbol || symbol) + (isFirstName ? "" : ("." + symbolName));
if (accessibleSymbol && !needsQualification(accessibleSymbol, enclosingDeclaration, meaningToLook)) {
break;
}
symbol = accessibleSymbol ? accessibleSymbol.parent : symbol.parent;
}
return symbolName;
}
return getSymbolName(symbol);
}
function createSingleLineTextWriter() {
@ -623,7 +747,6 @@ module ts {
}
function writeTypeToTextWriter(type: Type, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter) {
// TODO(shkamat): usage of enclosingDeclaration
var typeStack: Type[];
return writeType(type, /*allowFunctionOrConstructorTypeLiteral*/ true);
@ -635,7 +758,7 @@ module ts {
writeTypeReference(<TypeReference>type);
}
else if (type.flags & (TypeFlags.Class | TypeFlags.Interface | TypeFlags.Enum | TypeFlags.TypeParameter)) {
writer.write(symbolToString(type.symbol));
writer.write(symbolToString(type.symbol, enclosingDeclaration, SymbolFlags.Type));
}
else if (type.flags & TypeFlags.Anonymous) {
writeAnonymousType(<ObjectType>type, allowFunctionOrConstructorTypeLiteral);
@ -657,7 +780,7 @@ module ts {
writer.write("[]");
}
else {
writer.write(symbolToString(type.target.symbol));
writer.write(symbolToString(type.target.symbol, enclosingDeclaration, SymbolFlags.Type));
writer.write("<");
for (var i = 0; i < type.typeArguments.length; i++) {
if (i > 0) {
@ -691,7 +814,7 @@ module ts {
function writeTypeofSymbol(type: ObjectType) {
writer.write("typeof ");
writer.write(symbolToString(type.symbol));
writer.write(symbolToString(type.symbol, enclosingDeclaration, SymbolFlags.Value));
}
function writeLiteralType(type: ObjectType, allowFunctionOrConstructorTypeLiteral: boolean) {
@ -809,6 +932,122 @@ module ts {
}
}
function isDeclarationVisible(node: Declaration): boolean {
function getContainingExternalModule(node: Node) {
for (; node; node = node.parent) {
if (node.kind === SyntaxKind.ModuleDeclaration) {
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral) {
return node;
}
}
else if (node.kind === SyntaxKind.SourceFile) {
return (node.flags & NodeFlags.ExternalModule) ? node : undefined;
}
}
Debug.fail("getContainingModule cant reach here");
}
function isUsedInExportAssignment(node: Node) {
// Get source File and see if it is external module and has export assigned symbol
var externalModule = getContainingExternalModule(node);
if (externalModule) {
// This is export assigned symbol node
var externalModuleSymbol = getSymbolOfNode(externalModule);
var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol);
var symbolOfNode = getSymbolOfNode(node);
if (exportAssignmentSymbol === symbolOfNode) {
return true;
}
if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & SymbolFlags.Import)) {
// if export assigned symbol is import declaration, resolve the import
var resolvedExportSymbol = resolveImport(exportAssignmentSymbol);
if (resolvedExportSymbol === symbolOfNode) {
return true;
}
// TODO(shkamat): Chained import assignment
// eg. a should be visible too.
//module m {
// export module c {
// export class c {
// }
// }
//}
//import a = m.c;
//import b = a;
//export = b;
// Container of resolvedExportSymbol is visible
return forEach(resolvedExportSymbol.declarations, declaration => {
while (declaration) {
if (declaration === node) {
return true;
}
declaration = declaration.parent;
}
});
}
}
}
function determineIfDeclarationIsVisible() {
switch (node.kind) {
case SyntaxKind.VariableDeclaration:
if (!(node.flags & NodeFlags.Export)) {
// node.parent is variable statement so look at the variable statement's parent
return isGlobalSourceFile(node.parent.parent) || isUsedInExportAssignment(node);
}
// Exported members are visible if parent is visible
return isDeclarationVisible(node.parent.parent);
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.ImportDeclaration:
if (!(node.flags & NodeFlags.Export)) {
// TODO(shkamat): non exported aliases can be visible if they are referenced else where for value/type/namespace
return isGlobalSourceFile(node.parent) || isUsedInExportAssignment(node);
}
// Exported members are visible if parent is visible
return isDeclarationVisible(node.parent);
case SyntaxKind.Property:
case SyntaxKind.Method:
if (node.flags & NodeFlags.Private) {
// Private properties/methods are not visible
return false;
}
// Public properties/methods are visible if its parents are visible, so let it fall into next case statement
case SyntaxKind.Constructor:
case SyntaxKind.ConstructSignature:
case SyntaxKind.CallSignature:
case SyntaxKind.IndexSignature:
case SyntaxKind.Parameter:
case SyntaxKind.ModuleBlock:
return isDeclarationVisible(node.parent);
// Source file is always visible
case SyntaxKind.SourceFile:
return true;
default:
Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + SyntaxKind[node.kind]);
}
}
if (node) {
var links = getNodeLinks(node);
if (links.isVisible === undefined) {
links.isVisible = determineIfDeclarationIsVisible();
}
return links.isVisible;
}
}
function getApparentType(type: Type): ApparentType {
if (type.flags & TypeFlags.TypeParameter) {
do {
@ -4788,7 +5027,7 @@ module ts {
checkTypeAssignableTo(checkAndMarkExpression(node.initializer, type), type, node, /*chainedMessage*/ undefined, /*terminalMessage*/ undefined);
}
}
checkCollisionWithCapturedSuperVariable(node, node.name);
if (!useTypeFromValueDeclaration) {
// TypeScript 1.0 spec (April 2014): 5.1
@ -5343,7 +5582,7 @@ module ts {
}
}
if (node.name.kind === SyntaxKind.StringLiteral) {
if (node.parent.kind !== SyntaxKind.SourceFile || node.parent.flags & NodeFlags.ExternalModule) {
if (!isGlobalSourceFile(node.parent)) {
error(node.name, Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules);
}
if (isExternalModuleNameRelative(node.name.text)) {
@ -5588,7 +5827,7 @@ module ts {
}
}
while (location) {
if (location.locals && (location.kind !== SyntaxKind.SourceFile || location.flags & NodeFlags.ExternalModule)) {
if (location.locals && !isGlobalSourceFile(location)) {
copySymbols(location.locals, meaning);
}
switch (location.kind) {
@ -5822,22 +6061,6 @@ module ts {
return false;
}
function isReferencedInExportAssignment(node: Declaration): boolean {
var exportAssignedSymbol = getExportAssignmentSymbol(getSymbolOfNode(getContainerOfModuleElementDeclaration(node)));
if (exportAssignedSymbol) {
var symbol = getSymbolOfNode(node);
if (exportAssignedSymbol === symbol) {
// This symbol was export assigned symbol
return true;
}
// TODO(shkamat): if export assignment is alias, the alias target would make the node as referenced in export assignment
}
return false;
}
function isImplementationOfOverload(node: FunctionDeclaration) {
if (node.body) {
var symbol = getSymbolOfNode(node);
@ -5879,7 +6102,7 @@ module ts {
getEnumMemberValue: getEnumMemberValue,
isTopLevelValueImportedViaEntityName: isTopLevelValueImportedViaEntityName,
shouldEmitDeclarations: shouldEmitDeclarations,
isReferencedInExportAssignment: isReferencedInExportAssignment,
isDeclarationVisible: isDeclarationVisible,
isImplementationOfOverload: isImplementationOfOverload,
writeTypeAtLocation: writeTypeAtLocation,
writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration

Просмотреть файл

@ -1898,34 +1898,6 @@ module ts {
writeLine();
}
function isModuleElementExternallyVisible(node: Declaration) {
if (node.flags & NodeFlags.Export) {
// Exported member - emit this declaration
return true;
}
// If this node is in external module, check if this is export assigned
var moduleDeclaration = getContainerOfModuleElementDeclaration(node);
if ((moduleDeclaration.flags & NodeFlags.ExternalModule) || // Source file with external module flag
// Ambient external module declaration
(moduleDeclaration.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>moduleDeclaration).name.kind === SyntaxKind.StringLiteral)) {
return resolver.isReferencedInExportAssignment(node);
}
return false;
}
function canEmitModuleElementDeclaration(node: Declaration) {
if (isModuleElementExternallyVisible(node)) {
// Either exported module element or is referenced in export assignment
return true;
}
// emit the declaration if this is in global scope source file
var moduleDeclaration = getContainerOfModuleElementDeclaration(node);
return moduleDeclaration.kind === SyntaxKind.SourceFile && !(moduleDeclaration.flags & NodeFlags.ExternalModule);
}
function emitDeclarationFlags(node: Declaration) {
if (node.flags & NodeFlags.Static) {
if (node.flags & NodeFlags.Private) {
@ -1952,8 +1924,7 @@ module ts {
}
function emitImportDeclaration(node: ImportDeclaration) {
// TODO(shkamat): Emit if import decl is used to declare type in this context
if (isModuleElementExternallyVisible(node)) {
if (resolver.isDeclarationVisible(node)) {
if (node.flags & NodeFlags.Export) {
write("export ");
}
@ -1974,7 +1945,7 @@ module ts {
}
function emitModuleDeclaration(node: ModuleDeclaration) {
if (canEmitModuleElementDeclaration(node)) {
if (resolver.isDeclarationVisible(node)) {
emitDeclarationFlags(node);
write("module ");
emitSourceTextOfNode(node.name);
@ -1997,7 +1968,7 @@ module ts {
}
function emitEnumDeclaration(node: EnumDeclaration) {
if (canEmitModuleElementDeclaration(node)) {
if (resolver.isDeclarationVisible(node)) {
emitDeclarationFlags(node);
write("enum ");
emitSourceTextOfNode(node.name);
@ -2060,7 +2031,7 @@ module ts {
}
}
if (canEmitModuleElementDeclaration(node)) {
if (resolver.isDeclarationVisible(node)) {
emitDeclarationFlags(node);
write("class ");
emitSourceTextOfNode(node.name);
@ -2084,7 +2055,7 @@ module ts {
}
function emitInterfaceDeclaration(node: InterfaceDeclaration) {
if (canEmitModuleElementDeclaration(node)) {
if (resolver.isDeclarationVisible(node)) {
emitDeclarationFlags(node);
write("interface ");
emitSourceTextOfNode(node.name);
@ -2111,8 +2082,9 @@ module ts {
}
function emitVariableDeclaration(node: VariableDeclaration) {
// If we are emitting property it isnt moduleElement and doesnt need canEmitModuleElement check
if (node.kind !== SyntaxKind.VariableDeclaration || canEmitModuleElementDeclaration(node)) {
// If we are emitting property it isnt moduleElement and hence we already know it needs to be emitted
// so there is no check needed to see if declaration is visible
if (node.kind !== SyntaxKind.VariableDeclaration || resolver.isDeclarationVisible(node)) {
emitSourceTextOfNode(node.name);
// If optional property emit ?
if (node.kind === SyntaxKind.Property && (node.flags & NodeFlags.QuestionMark)) {
@ -2126,7 +2098,7 @@ module ts {
}
function emitVariableStatement(node: VariableStatement) {
var hasDeclarationWithEmit = forEach(node.declarations, varDeclaration => canEmitModuleElementDeclaration(varDeclaration));
var hasDeclarationWithEmit = forEach(node.declarations, varDeclaration => resolver.isDeclarationVisible(varDeclaration));
if (hasDeclarationWithEmit) {
emitDeclarationFlags(node);
write("var ");
@ -2151,8 +2123,9 @@ module ts {
}
function emitFunctionDeclaration(node: FunctionDeclaration) {
// If we are emitting Method/Constructor it isnt moduleElement and doesnt need canEmitModuleElement check
if ((node.kind !== SyntaxKind.FunctionDeclaration || canEmitModuleElementDeclaration(node)) &&
// If we are emitting Method/Constructor it isnt moduleElement and hence already determined to be emitting
// so no need to verify if the declaration is visible
if ((node.kind !== SyntaxKind.FunctionDeclaration || resolver.isDeclarationVisible(node)) &&
!resolver.isImplementationOfOverload(node)) {
emitDeclarationFlags(node);
if (node.kind === SyntaxKind.FunctionDeclaration) {

Просмотреть файл

@ -273,12 +273,6 @@ module ts {
return s.parameters.length > 0 && (s.parameters[s.parameters.length - 1].flags & NodeFlags.Rest) !== 0;
}
export function getContainerOfModuleElementDeclaration(node: Declaration) {
// If the declaration is var declaration, then the parent is variable statement but we actually want the module
var container = node.kind === SyntaxKind.VariableDeclaration ? node.parent.parent : node.parent;
return container.kind == SyntaxKind.ModuleBlock ? container.parent : container;
}
enum ParsingContext {
SourceElements, // Elements in source file
ModuleElements, // Elements in module declaration
@ -619,14 +613,14 @@ module ts {
}
// True if positioned at the start of a list element
function isListElement(kind: ParsingContext): boolean {
function isListElement(kind: ParsingContext, inErrorRecovery: boolean): boolean {
switch (kind) {
case ParsingContext.SourceElements:
case ParsingContext.ModuleElements:
return isSourceElement();
return isSourceElement(inErrorRecovery);
case ParsingContext.BlockStatements:
case ParsingContext.SwitchClauseStatements:
return isStatement();
return isStatement(inErrorRecovery);
case ParsingContext.SwitchClauses:
return token === SyntaxKind.CaseKeyword || token === SyntaxKind.DefaultKeyword;
case ParsingContext.TypeMembers:
@ -650,6 +644,8 @@ module ts {
case ParsingContext.TypeArguments:
return isType();
}
Debug.fail("Non-exhaustive case in 'isListElement'.");
}
// True if positioned at a list terminator
@ -717,10 +713,12 @@ module ts {
}
// True if positioned at element or terminator of the current list or any enclosing list
function isInParsingContext(): boolean {
function isInSomeParsingContext(): boolean {
for (var kind = 0; kind < ParsingContext.Count; kind++) {
if (parsingContext & (1 << kind)) {
if (isListElement(kind) || isListTerminator(kind)) return true;
if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) {
return true;
}
}
}
@ -734,12 +732,12 @@ module ts {
var result = <NodeArray<T>>[];
result.pos = getNodePos();
while (!isListTerminator(kind)) {
if (isListElement(kind)) {
if (isListElement(kind, /* inErrorRecovery */ false)) {
result.push(parseElement());
}
else {
error(parsingContextErrors(kind));
if (isInParsingContext()) {
if (isInSomeParsingContext()) {
break;
}
nextToken();
@ -761,7 +759,7 @@ module ts {
var errorCountBeforeParsingList = file.syntacticErrors.length;
var commaStart = -1; // Meaning the previous token was not a comma
while (true) {
if (isListElement(kind)) {
if (isListElement(kind, /* inErrorRecovery */ false)) {
result.push(parseElement());
commaStart = scanner.getTokenPos();
if (parseOptional(SyntaxKind.CommaToken)) {
@ -791,7 +789,7 @@ module ts {
}
else {
error(parsingContextErrors(kind));
if (token !== SyntaxKind.CommaToken && isInParsingContext()) {
if (isInSomeParsingContext()) {
break;
}
nextToken();
@ -2066,12 +2064,19 @@ module ts {
return finishNode(node);
}
function isStatement(): boolean {
function isStatement(inErrorRecovery: boolean): boolean {
switch (token) {
case SyntaxKind.SemicolonToken:
// If we're in error recovery, then we don't want to treat ';' as an empty statement.
// The problem is that ';' can show up in far too many contexts, and if we see one
// and assume it's a statement, then we may bail out innapropriately from whatever
// we're parsing. For example, if we have a semicolon in the middle of a class, then
// we really don't want to assume the class is over and we're on a statement in the
// outer module. We just want to consume and move on.
return !inErrorRecovery;
case SyntaxKind.OpenBraceToken:
case SyntaxKind.VarKeyword:
case SyntaxKind.FunctionKeyword:
case SyntaxKind.SemicolonToken:
case SyntaxKind.IfKeyword:
case SyntaxKind.DoKeyword:
case SyntaxKind.WhileKeyword:
@ -2103,8 +2108,8 @@ module ts {
}
}
function isStatementOrFunction(): boolean {
return token === SyntaxKind.FunctionKeyword || isStatement();
function isStatementOrFunction(inErrorRecovery: boolean): boolean {
return token === SyntaxKind.FunctionKeyword || isStatement(inErrorRecovery);
}
function parseStatement(): Statement {
@ -2813,8 +2818,8 @@ module ts {
return result;
}
function isSourceElement(): boolean {
return isDeclaration() || isStatement();
function isSourceElement(inErrorRecovery: boolean): boolean {
return isDeclaration() || isStatement(inErrorRecovery);
}
function parseSourceElement() {

Просмотреть файл

@ -79,8 +79,6 @@ module ts {
function reportErrors(errors: Diagnostic[]) {
for (var i = 0; i < errors.length; i++) {
var error = errors[i];
// TODO(jfreeman): Remove assert
Debug.assert(error.messageText.indexOf("{NL}") < 0);
if (error.file) {
var loc = error.file.getLineAndCharacterFromPosition(error.start);
sys.writeErr(error.file.filename + "(" + loc.line + "," + loc.character + "): " + error.messageText + sys.newLine);

Просмотреть файл

@ -621,7 +621,7 @@ module ts {
getNodeCheckFlags(node: Node): NodeCheckFlags;
getEnumMemberValue(node: EnumMember): number;
shouldEmitDeclarations(): boolean;
isReferencedInExportAssignment(node: Declaration): boolean;
isDeclarationVisible(node: Declaration): boolean;
isImplementationOfOverload(node: FunctionDeclaration): boolean;
writeTypeAtLocation(location: Node, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void;
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: TextWriter): void;
@ -740,6 +740,7 @@ module ts {
flags?: NodeCheckFlags; // Set of flags specific to Node
enumMemberValue?: number; // Constant value of enum member
isIllegalTypeReferenceInConstraint?: boolean; // Is type reference in constraint refers to the type parameter from the same list
isVisible?: boolean; // Is this node visible
}
export enum TypeFlags {

Просмотреть файл

@ -1,12 +1,10 @@
==== tests/cases/compiler/ambientGetters.ts (3 errors) ====
==== tests/cases/compiler/ambientGetters.ts (2 errors) ====
declare class A {
get length() : number;
~
!!! '{' expected.
}
~
!!! Declaration or statement expected.
declare class B {
get length() { return 0; }

Просмотреть файл

@ -254,7 +254,7 @@ declare module m1 {
function foo2Export(a: string): void;
function foo3Export(): void;
}
declare var myvar: c;
declare var myvar: m1.m2.c;
declare module m2.m3 {
class c {
}

Просмотреть файл

@ -32,4 +32,4 @@ declare module "SubModule" {
}
//// [declFileAmbientExternalModuleWithSingleExportedModule_1.d.ts]
/// <reference path='declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts' />
export declare var x: c;
export declare var x: SubModule.m.m3.c;

Просмотреть файл

@ -31,5 +31,21 @@ module.exports = m;
//// [declFileExportAssignmentImportInternalModule.d.ts]
declare module m3 {
module m2 {
interface connectModule {
(res: any, req: any, next: any): void;
}
interface connectExport {
use: (mod: connectModule) => connectExport;
listen: (port: number) => void;
}
}
var server: {
(): m2.connectExport;
test1: m2.connectModule;
test2(): m2.connectModule;
};
}
import m = m3;
export = m;

Просмотреть файл

@ -28,4 +28,4 @@ interface Foo<T> {
}
export = Foo;
//// [declFileExportAssignmentOfGenericInterface_1.d.ts]
export declare var x: Foo<Foo<string>>;
export declare var x: a<a<string>>;

Просмотреть файл

@ -74,4 +74,4 @@ export = b;
//// [declFileExportImportChain_c.d.ts]
export import b1 = require("declFileExportImportChain_b1");
//// [declFileExportImportChain_d.d.ts]
export declare var x: c1;
export declare var x: m1.m2.c1;

Просмотреть файл

@ -65,4 +65,4 @@ export = a;
//// [declFileExportImportChain2_c.d.ts]
export import b = require("declFileExportImportChain2_b");
//// [declFileExportImportChain2_d.d.ts]
export declare var x: c1;
export declare var x: m1.m2.c1;

Просмотреть файл

@ -130,16 +130,16 @@ export declare module C {
constructor(val: T);
}
}
export declare var a: A<B>;
export declare var b: <T>(x: T) => A<B>;
export declare var c: <T>(x: T) => A<B>;
export declare var d: <T>(x: T) => A<B>[];
export declare var e: <T extends A<B>>(x: T) => A<B>[];
export declare var x: A<B>;
export declare function f<T extends A<B>>(): void;
export declare var g: A<B>;
export declare class h extends A<B> {
export declare var a: C.A<C.B>;
export declare var b: <T>(x: T) => C.A<C.B>;
export declare var c: <T>(x: T) => C.A<C.B>;
export declare var d: <T>(x: T) => C.A<C.B>[];
export declare var e: <T extends C.A<C.B>>(x: T) => C.A<C.B>[];
export declare var x: C.A<C.B>;
export declare function f<T extends C.A<C.B>>(): void;
export declare var g: C.A<C.B>;
export declare class h extends C.A<C.B> {
}
export interface i extends A<B> {
export interface i extends C.A<C.B> {
}
export declare var j: <T extends A<B>>(x: T) => T;
export declare var j: <T extends C.A<C.B>>(x: T) => T;

Просмотреть файл

@ -99,17 +99,17 @@ declare module templa.mvc {
declare module templa.mvc.composite {
}
declare module templa.dom.mvc {
interface IElementController<ModelType extends IModel> extends IController<ModelType> {
interface IElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.IController<ModelType> {
}
}
declare module templa.dom.mvc {
class AbstractElementController<ModelType extends IModel> extends AbstractController<ModelType> implments IElementController<ModelType> {
class AbstractElementController<ModelType extends templa.mvc.IModel> extends templa.mvc.AbstractController<ModelType> implments IElementController<ModelType> {
constructor();
}
}
declare module templa.dom.mvc.composite {
class AbstractCompositeElementController<ModelType extends ICompositeControllerModel> extends AbstractElementController<ModelType> {
_controllers: IController<IModel>[];
class AbstractCompositeElementController<ModelType extends templa.mvc.composite.ICompositeControllerModel> extends AbstractElementController<ModelType> {
_controllers: templa.mvc.IController<templa.mvc.IModel>[];
constructor();
}
}

Просмотреть файл

@ -46,14 +46,14 @@ declare module m2 {
}
}
declare var m2: {
(): connectExport;
test1: connectModule;
test2(): connectModule;
(): m2.connectExport;
test1: m2.connectModule;
test2(): m2.connectModule;
};
export = m2;
//// [declFileImportModuleWithExportAssignment_1.d.ts]
export declare var a: {
(): connectExport;
test1: connectModule;
test2(): connectModule;
(): a1.connectExport;
test1: a1.connectModule;
test2(): a1.connectModule;
};

Просмотреть файл

@ -27,5 +27,5 @@ declare class List<T> {
declare module 'mod1' {
}
declare module 'moo' {
var p: List<Foo>;
var p: List<x.Foo>;
}

Просмотреть файл

@ -40,9 +40,9 @@ declare module m {
}
}
declare module m1 {
var d: c;
var d: x;
}
declare module m2 {
export import x = m.c;
var d: c;
var d: x;
}

Просмотреть файл

@ -35,6 +35,6 @@ declare var d: {
m: typeof m1;
};
m2: {
c: typeof c;
c: typeof m1.c;
};
};

Просмотреть файл

@ -33,6 +33,6 @@ declare module A.C {
}
}
declare module A.B.C {
class W implments Z {
class W implments A.C.Z {
}
}

Просмотреть файл

@ -63,10 +63,10 @@ declare module m1 {
}
}
declare var a: {
c: c;
c: m1.c;
};
declare var b: {
c: typeof c;
c: typeof m1.c;
m1: typeof m1;
};
declare var c: {
@ -77,10 +77,10 @@ declare var d: {
mod: typeof m1;
};
mc: {
cl: typeof c;
cl: typeof m1.c;
};
me: {
en: typeof e;
en: typeof m1.e;
};
mh: e;
mh: m1.e;
};

Просмотреть файл

@ -73,12 +73,12 @@ declare module A.B.Base {
}
}
declare module X.Y.base {
class W extends W {
class W extends A.B.Base.W {
name: string;
}
}
declare module X.Y.base.Z {
class W<TValue> extends W {
class W<TValue> extends base.W {
value: boolean;
}
}

Просмотреть файл

@ -38,6 +38,6 @@ declare module X.A.C {
}
}
declare module X.A.B.C {
class W implments Z {
class W implments X.A.C.Z {
}
}

Просмотреть файл

@ -41,7 +41,7 @@ declare module X.A.C {
}
}
declare module X.A.B.C {
class W implments Z {
class W implments A.C.Z {
}
}
declare module X.A.B.C {

Просмотреть файл

@ -41,7 +41,7 @@ declare module X.A.C {
}
}
declare module X.A.B.C {
class W implments Z {
class W implments X.A.C.Z {
}
}
declare module X.A.B.C {

Просмотреть файл

@ -1,53 +0,0 @@
==== tests/cases/compiler/declarationEmit_nameConflicts_0.ts (1 errors) ====
import im = require('declarationEmit_nameConflicts_1');
export module M {
export function f() { }
export class C { }
export module N {
export function g() { };
export interface I { }
}
export import a = M.f;
export import b = M.C;
export import c = N;
export import d = im;
~~~~~~~~~~~~~~~~~~~~~
!!! Cannot find name 'im'.
}
export module M.P {
export function f() { }
export class C { }
export module N {
export function g() { };
export interface I { }
}
export import im = M.P.f;
// Bug 887180: Invalid .d.ts when an aliased entity is referenced, and a different entity is closer in scope
export var a = M.a; // emitted incorrectly as typeof f
export var b = M.b; // ok
export var c = M.c; // ok
export var g = M.c.g; // ok
export var d = M.d; // emitted incorrectly as typeof im
}
export module M.Q {
export function f() { }
export class C { }
export module N {
export function g() { };
export interface I { }
}
export interface b extends M.b { } // ok
export interface I extends M.c.I { } // ok
export module c {
export interface I extends M.c.I { } // ok
}
}
==== tests/cases/compiler/declarationEmit_nameConflicts_1.ts (1 errors) ====
function f() { }
export = f;
~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.

Просмотреть файл

@ -1,7 +1,7 @@
//// [tests/cases/compiler/declarationEmit_nameConflicts.ts] ////
//// [declarationEmit_nameConflicts_1.ts]
function f() { }
module f { export class c { } }
export = f;
//// [declarationEmit_nameConflicts_0.ts]
@ -51,10 +51,18 @@ export module M.Q {
}
//// [declarationEmit_nameConflicts_1.js]
function f() {
}
var f;
(function (f) {
var c = (function () {
function c() {
}
return c;
})();
f.c = c;
})(f || (f = {}));
module.exports = f;
//// [declarationEmit_nameConflicts_0.js]
var im = require('declarationEmit_nameConflicts_1');
(function (M) {
function f() {
}
@ -75,6 +83,7 @@ module.exports = f;
M.a = M.f;
M.b = M.C;
M.c = N;
M.d = im;
})(exports.M || (exports.M = {}));
var M = exports.M;
(function (M) {
@ -127,3 +136,60 @@ var M = exports.M;
var Q = M.Q;
})(exports.M || (exports.M = {}));
var M = exports.M;
//// [declarationEmit_nameConflicts_1.d.ts]
declare module f {
class c {
}
}
export = f;
//// [declarationEmit_nameConflicts_0.d.ts]
export declare module M {
function f(): void;
class C {
}
module N {
function g(): void;
interface I {
}
}
export import a = M.f;
export import b = M.C;
export import c = N;
export import d = im;
}
export declare module M.P {
function f(): void;
class C {
}
module N {
function g(): void;
interface I {
}
}
export import im = M.P.f;
var a: () => void;
var b: typeof M.C;
var c: typeof M.N;
var g: () => void;
var d: typeof M.d;
}
export declare module M.Q {
function f(): void;
class C {
}
module N {
function g(): void;
interface I {
}
}
interface b extends M.C {
}
interface I extends M.N.I {
}
module c {
interface I extends M.N.I {
}
}
}

Просмотреть файл

@ -73,7 +73,7 @@ declare module X.Y.base {
}
declare module X.Y.base.Z {
var f: () => void;
var C: typeof C;
var M: typeof M;
var E: typeof E;
var C: typeof base.C;
var M: typeof base.M;
var E: typeof base.E;
}

Просмотреть файл

@ -110,7 +110,7 @@ declare module M.P {
enum D {
f = 0,
}
var v: D;
var v: M.D;
var w: () => void;
var x: () => void;
var x: () => void;

Просмотреть файл

@ -1,10 +0,0 @@
==== tests/cases/compiler/declarationEmit_nameConflictsWithAlias.ts (1 errors) ====
// Bug 887180
export module C { export interface I { } }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
export import v = C;
export module M {
export module C { export interface I { } }
export var w: v.I; // Gets emitted as C.I, which is the wrong interface
}

Просмотреть файл

@ -12,3 +12,18 @@ export module M {
M.w;
})(exports.M || (exports.M = {}));
var M = exports.M;
//// [declarationEmit_nameConflictsWithAlias.d.ts]
export declare module C {
interface I {
}
}
export import v = C;
export declare module M {
module C {
interface I {
}
}
var w: v.I;
}

Просмотреть файл

@ -34,8 +34,8 @@ declare module m2 {
}
}
declare var m2: {
(): connectExport;
test1: connectModule;
test2(): connectModule;
(): m2.connectExport;
test1: m2.connectModule;
test2(): m2.connectModule;
};
export = m2;

Просмотреть файл

@ -34,8 +34,8 @@ declare module m2 {
}
}
declare var m2: {
(): connectExport;
test1: connectModule;
test2(): connectModule;
(): m2.connectExport;
test1: m2.connectModule;
test2(): m2.connectModule;
};
export = m2;

Просмотреть файл

@ -1,45 +1,19 @@
==== tests/cases/compiler/es6ClassTest3.ts (15 errors) ====
==== tests/cases/compiler/es6ClassTest3.ts (2 errors) ====
module M {
class Visibility {
public foo() { };
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
private bar() { };
~~~~~~~
!!! Declaration or statement expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'bar'.
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
private x: number;
~~~~~~~
!!! Declaration or statement expected.
~~~~~~
!!! Cannot find name 'number'.
public y: number;
~~~~~~
!!! Declaration or statement expected.
~~~~~~
!!! Cannot find name 'number'.
public z: number;
~~~~~~
!!! Declaration or statement expected.
~~~~~~
!!! Cannot find name 'number'.
constructor() {
~
!!! ';' expected.
~~~~~~~~~~~
!!! Cannot find name 'constructor'.
this.x = 1;
~~~~
!!! 'this' cannot be referenced in a module body.
this.y = 2;
~~~~
!!! 'this' cannot be referenced in a module body.
}
}
}
~
!!! Declaration or statement expected.
}

Просмотреть файл

@ -1,4 +1,4 @@
==== tests/cases/compiler/exportDeclareClass1.ts (9 errors) ====
==== tests/cases/compiler/exportDeclareClass1.ts (4 errors) ====
export declare class eaC {
static tF() { };
~
@ -6,21 +6,11 @@
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
static tsF(param:any) { };
~~~~~~
!!! Declaration or statement expected.
~
!!! ',' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'tsF'.
~~~~~
!!! Cannot find name 'param'.
~~~
!!! Cannot find name 'any'.
!!! A function implementation cannot be declared in an ambient context.
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
};
~
!!! Declaration or statement expected.
export declare class eaC2 {
static tF();

Просмотреть файл

@ -25,6 +25,6 @@ declare module foo {
}
}
declare module bar {
class Foo<T> implments IFoo<T> {
class Foo<T> implments foo.IFoo<T> {
}
}

Просмотреть файл

@ -35,4 +35,4 @@ declare module Foo {
class A {
}
}
declare var a: B<A>;
declare var a: Foo.B<Foo.A>;

Просмотреть файл

@ -28,4 +28,4 @@ export declare class B {
}
//// [importDeclarationUsedAsTypeQuery_1.d.ts]
/// <reference path='importDeclarationUsedAsTypeQuery_require.d.ts' />
export declare var x: typeof "tests/cases/compiler/importDeclarationUsedAsTypeQuery_require";
export declare var x: typeof a;

Просмотреть файл

@ -32,5 +32,5 @@ declare module a {
}
}
declare module c {
var x: c;
var x: b;
}

Просмотреть файл

@ -54,4 +54,4 @@ export declare module m2 {
var cProp: c;
}
}
export declare var d: c;
export declare var d: x.c;

Просмотреть файл

@ -36,4 +36,4 @@ export declare module x {
}
}
export import xc = x.c;
export declare var cProp: c;
export declare var cProp: xc;

Просмотреть файл

@ -35,4 +35,4 @@ export declare module x {
foo(a: number): number;
}
}
export declare var cProp: c;
export declare var cProp: xc;

Просмотреть файл

@ -39,5 +39,5 @@ declare module a {
}
}
declare module c {
var bVal: weekend;
var bVal: b;
}

Просмотреть файл

@ -40,5 +40,5 @@ export declare module a {
}
export declare module c {
export import b = a.weekend;
var bVal: weekend;
var bVal: b;
}

Просмотреть файл

@ -39,5 +39,5 @@ export declare module a {
}
}
export declare module c {
var bVal: weekend;
var bVal: b;
}

Просмотреть файл

@ -36,4 +36,4 @@ export declare module a {
}
}
export import b = a.weekend;
export declare var bVal: weekend;
export declare var bVal: b;

Просмотреть файл

@ -35,4 +35,4 @@ export declare module a {
Sunday = 2,
}
}
export declare var bVal: weekend;
export declare var bVal: b;

Просмотреть файл

@ -39,5 +39,5 @@ declare module a {
}
}
declare module c {
var x: c;
var x: b.c;
}

Просмотреть файл

@ -42,5 +42,5 @@ export declare module a {
}
export declare module c {
export import b = a.b;
var x: c;
var x: b.c;
}

Просмотреть файл

@ -39,5 +39,5 @@ export declare module a {
}
}
export declare module c {
var x: c;
var x: b.c;
}

Просмотреть файл

@ -34,4 +34,4 @@ export declare module a {
}
}
export import b = a.b;
export declare var x: c;
export declare var x: b.c;

Просмотреть файл

@ -35,4 +35,4 @@ export declare module a {
}
}
}
export declare var x: c;
export declare var x: b.c;

Просмотреть файл

@ -23,5 +23,5 @@ declare module a {
}
}
declare module c {
var x: I;
var x: b;
}

Просмотреть файл

@ -26,5 +26,5 @@ export declare module a {
}
export declare module c {
export import b = a.I;
var x: I;
var x: b;
}

Просмотреть файл

@ -25,5 +25,5 @@ export declare module a {
}
}
export declare module c {
var x: I;
var x: b;
}

Просмотреть файл

@ -18,4 +18,4 @@ export declare module a {
}
}
export import b = a.I;
export declare var x: I;
export declare var x: b;

Просмотреть файл

@ -19,4 +19,4 @@ export declare module a {
interface I {
}
}
export declare var x: I;
export declare var x: b;

Просмотреть файл

@ -30,5 +30,5 @@ declare module a {
}
}
declare module c {
var x: I;
var x: b.I;
}

Просмотреть файл

@ -31,5 +31,5 @@ export declare module a {
}
export declare module c {
export import b = a.b;
var x: I;
var x: b.I;
}

Просмотреть файл

@ -30,5 +30,5 @@ export declare module a {
}
}
export declare module c {
var x: I;
var x: b.I;
}

Просмотреть файл

@ -28,4 +28,4 @@ export declare module a {
}
}
export import b = a.b;
export declare var x: I;
export declare var x: b.I;

Просмотреть файл

@ -25,4 +25,4 @@ export declare module a {
}
}
}
export declare var x: I;
export declare var x: b.I;

Просмотреть файл

@ -1,4 +1,4 @@
==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (38 errors) ====
==== tests/cases/conformance/parser/ecmascript5/Fuzz/parser0_004152.ts (34 errors) ====
export class Game {
~~~~~~~~~~~~~~~~~~~
private position = new DisplayPosition([), 3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 0], NoMove, 0);
@ -40,8 +40,7 @@
!!! ';' expected.
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! Cannot compile external modules unless the '--module' flag is provided.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~
!!! Cannot find name 'DisplayPosition'.
~
@ -69,14 +68,9 @@
~
!!! Duplicate identifier '0'.
private prevConfig: SeedCoords[][];
~~~~~~~
!!! Declaration or statement expected.
~
!!! Expression expected.
~
!!! Expression expected.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~
!!! Cannot find name 'SeedCoords'.
}
~
!!! Declaration or statement expected.
!!! Cannot compile external modules unless the '--module' flag is provided.

Просмотреть файл

@ -1,4 +1,4 @@
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (4 errors) ====
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserEqualsGreaterThanAfterFunction2.ts (5 errors) ====
function (a => b;
~
!!! Identifier expected.
@ -6,5 +6,7 @@
!!! ',' expected.
~
!!! ',' expected.
!!! ')' expected.
~~~~~~~~~~~~~~~~~
!!! Function implementation expected.

Просмотреть файл

@ -1,4 +1,4 @@
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts (56 errors) ====
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserErrantSemicolonInClass1.ts (5 errors) ====
class a {
//constructor ();
constructor (n: number);
@ -12,137 +12,35 @@
!!! Unexpected token. A constructor, method, accessor, or property was expected.
public pv;
~~~~~~
!!! Declaration or statement expected.
~~
!!! Cannot find name 'pv'.
public get d() {
~~~~~~
!!! Declaration or statement expected.
~
!!! ';' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'get'.
~
!!! Cannot find name 'd'.
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return 30;
~~~~~~~~~~
!!! 'return' statement has no containing function.
}
public set d() {
~~~~~~
!!! Declaration or statement expected.
~
!!! ';' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'set'.
~
!!! Cannot find name 'd'.
!!! Accessors are only available when targeting ECMAScript 5 and higher.
}
public static get p2() {
~~~~~~
!!! Declaration or statement expected.
~~~~~~
!!! Declaration or statement expected.
~~
!!! ';' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'get'.
~~
!!! Cannot find name 'p2'.
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return { x: 30, y: 40 };
~~~~~~~~~~~~~~~~~~~~~~~~
!!! 'return' statement has no containing function.
}
private static d2() {
~~~~~~~
!!! Declaration or statement expected.
~~~~~~
!!! Declaration or statement expected.
~
!!! ';' expected.
~~
!!! Cannot find name 'd2'.
}
private static get p3() {
~~~~~~~
!!! Declaration or statement expected.
~~~~~~
!!! Declaration or statement expected.
~~
!!! ';' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'get'.
~~
!!! Cannot find name 'p3'.
!!! Accessors are only available when targeting ECMAScript 5 and higher.
return "string";
~~~~~~~~~~~~~~~~
!!! 'return' statement has no containing function.
}
private pv3;
~~~~~~~
!!! Declaration or statement expected.
~~~
!!! Cannot find name 'pv3'.
private foo(n: number): string;
~~~~~~~
!!! Declaration or statement expected.
~
!!! ',' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'foo'.
~
!!! Cannot find name 'n'.
~~~~~~
!!! Cannot find name 'number'.
~~~~~~
!!! Cannot find name 'string'.
private foo(s: string): string;
~~~~~~~
!!! Declaration or statement expected.
~
!!! ',' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'foo'.
~
!!! Cannot find name 's'.
~~~~~~
!!! Cannot find name 'string'.
~~~~~~
!!! Cannot find name 'string'.
private foo(ns: any) {
~~~~~~~
!!! Declaration or statement expected.
~
!!! ',' expected.
~
!!! ';' expected.
~~~
!!! Cannot find name 'foo'.
~~
!!! Cannot find name 'ns'.
~~~
!!! Cannot find name 'any'.
return ns.toString();
~~~~~~~~~~~~~~~~~~~~~
!!! 'return' statement has no containing function.
}
}
~
!!! Declaration or statement expected.

Просмотреть файл

@ -1,4 +1,4 @@
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserMissingLambdaOpenBrace1.ts (10 errors) ====
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserMissingLambdaOpenBrace1.ts (9 errors) ====
class C {
where(filter: Iterator<T, boolean>): Query<T> {
~~~~~~~~~~~~~~~~~~~~
@ -22,8 +22,6 @@
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
}
~
!!! Declaration or statement expected.
}
~
!!! Declaration or statement expected.

Просмотреть файл

@ -0,0 +1,8 @@
==== tests/cases/compiler/parsingClassRecoversWhenHittingUnexpectedSemicolon.ts (1 errors) ====
class C {
public f() { };
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
private m;
}

Просмотреть файл

@ -1,4 +1,4 @@
==== tests/cases/compiler/primitiveMembers.ts (6 errors) ====
==== tests/cases/compiler/primitiveMembers.ts (4 errors) ====
var x = 5;
var r = /yo/;
r.source;
@ -29,13 +29,9 @@
class baz { public bar(): void { }; }
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! Declaration or statement expected.
class foo extends baz { public bar(){ return undefined}; }
~
!!! Unexpected token. A constructor, method, accessor, or property was expected.
~
!!! Declaration or statement expected.

Просмотреть файл

@ -1,8 +1,8 @@
declare module "quotedm1" {
class v {
c: d;
c: m4.d;
}
}
declare module "quotedm2" {
var c: v;
var c: m1.v;
}

Просмотреть файл

@ -1,8 +1,8 @@
declare module "quotedm1" {
class v {
c: d;
c: m4.d;
}
}
declare module "quotedm2" {
var c: v;
var c: m1.v;
}

Просмотреть файл

@ -1,3 +1,3 @@
export declare var useGlo_m4_x4: d;
export declare var useGlo_m4_d4: typeof d;
export declare var useGlo_m4_f4: d;
export declare var useGlo_m4_x4: glo_m4.d;
export declare var useGlo_m4_d4: typeof glo_m4.d;
export declare var useGlo_m4_f4: glo_m4.d;

Просмотреть файл

@ -1,3 +1,3 @@
export declare var useGlo_m4_x4: d;
export declare var useGlo_m4_d4: typeof d;
export declare var useGlo_m4_f4: d;
export declare var useGlo_m4_x4: glo_m4.d;
export declare var useGlo_m4_d4: typeof glo_m4.d;
export declare var useGlo_m4_f4: glo_m4.d;

Просмотреть файл

@ -1 +1 @@
export declare var useFncOnly_m4_f4: d;
export declare var useFncOnly_m4_f4: fncOnly_m4.d;

Просмотреть файл

@ -1 +1 @@
export declare var useFncOnly_m4_f4: d;
export declare var useFncOnly_m4_f4: fncOnly_m4.d;

Просмотреть файл

@ -1,11 +1,11 @@
export declare var x4: d;
export declare var d4: typeof d;
export declare var f4: d;
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: d;
var d2: typeof d;
var f2: d;
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}
export declare var useMultiImport_m4_x4: d;
export declare var useMultiImport_m4_d4: typeof d;
export declare var useMultiImport_m4_f4: d;
export declare var useMultiImport_m4_x4: m4.d;
export declare var useMultiImport_m4_d4: typeof m4.d;
export declare var useMultiImport_m4_f4: m4.d;

Просмотреть файл

@ -1,11 +1,11 @@
export declare var x4: d;
export declare var d4: typeof d;
export declare var f4: d;
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: d;
var d2: typeof d;
var f2: d;
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}
export declare var useMultiImport_m4_x4: d;
export declare var useMultiImport_m4_d4: typeof d;
export declare var useMultiImport_m4_f4: d;
export declare var useMultiImport_m4_x4: m4.d;
export declare var useMultiImport_m4_d4: typeof m4.d;
export declare var useMultiImport_m4_f4: m4.d;

Просмотреть файл

@ -1 +1 @@
export declare function foo2(): d;
export declare function foo2(): m4.d;

Просмотреть файл

@ -1,9 +1,9 @@
export declare var x4: d;
export declare var d4: typeof d;
export declare var f4: d;
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: d;
var d2: typeof d;
var f2: d;
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}
export declare var d: d;
export declare var d: m4.d;

Просмотреть файл

@ -1 +1 @@
export declare function foo2(): d;
export declare function foo2(): m4.d;

Просмотреть файл

@ -1,9 +1,9 @@
export declare var x4: d;
export declare var d4: typeof d;
export declare var f4: d;
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: d;
var d2: typeof d;
var f2: d;
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}
export declare var d: d;
export declare var d: m4.d;

Просмотреть файл

@ -1,8 +1,8 @@
export declare var x4: d;
export declare var d4: typeof d;
export declare var f4: d;
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: d;
var d2: typeof d;
var f2: d;
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}

Просмотреть файл

@ -1,8 +1,8 @@
export declare var x4: d;
export declare var d4: typeof d;
export declare var f4: d;
export declare var x4: m4.d;
export declare var d4: typeof m4.d;
export declare var f4: m4.d;
export declare module m1 {
var x2: d;
var d2: typeof d;
var f2: d;
var x2: m4.d;
var d2: typeof m4.d;
var f2: m4.d;
}

Просмотреть файл

@ -4,5 +4,5 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a3: typeof m2_c1;
export declare var a2: typeof m1.m1_c1;
export declare var a3: typeof m2.m2_c1;

Просмотреть файл

@ -4,5 +4,5 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a3: typeof m2_c1;
export declare var a2: typeof m1.m1_c1;
export declare var a3: typeof m2.m2_c1;

Просмотреть файл

@ -4,5 +4,5 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a3: typeof m2_c1;
export declare var a2: typeof m1.m1_c1;
export declare var a3: typeof m2.m2_c1;

Просмотреть файл

@ -4,5 +4,5 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a3: typeof m2_c1;
export declare var a2: typeof m1.m1_c1;
export declare var a3: typeof m2.m2_c1;

Просмотреть файл

@ -4,5 +4,5 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a3: typeof m2_c1;
export declare var a2: typeof m1.m1_c1;
export declare var a3: typeof m2.m2_c1;

Просмотреть файл

@ -4,5 +4,5 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a3: typeof m2_c1;
export declare var a2: typeof m1.m1_c1;
export declare var a3: typeof m2.m2_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Просмотреть файл

@ -4,4 +4,4 @@ export declare class c1 {
}
export declare var instance1: c1;
export declare function f1(): c1;
export declare var a2: typeof m1_c1;
export declare var a2: typeof m1.m1_c1;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше