mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into constLet
This commit is contained in:
+14
-2
@@ -82,6 +82,7 @@ module ts {
|
||||
isUndefinedSymbol: symbol => symbol === undefinedSymbol,
|
||||
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
|
||||
getDiagnostics,
|
||||
getDeclarationDiagnostics,
|
||||
getGlobalDiagnostics,
|
||||
checkProgram,
|
||||
invokeEmitter,
|
||||
@@ -999,6 +1000,7 @@ module ts {
|
||||
// Type Reference or TypeAlias entity = Identifier
|
||||
meaning = SymbolFlags.Type;
|
||||
}
|
||||
|
||||
var firstIdentifier = getFirstIdentifier(entityName);
|
||||
var symbol = resolveName(enclosingDeclaration, (<Identifier>firstIdentifier).text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined);
|
||||
|
||||
@@ -8544,6 +8546,12 @@ module ts {
|
||||
return getSortedDiagnostics();
|
||||
}
|
||||
|
||||
function getDeclarationDiagnostics(targetSourceFile: SourceFile): Diagnostic[] {
|
||||
var resolver = createResolver();
|
||||
checkSourceFile(targetSourceFile);
|
||||
return ts.getDeclarationDiagnostics(program, resolver, targetSourceFile);
|
||||
}
|
||||
|
||||
function getGlobalDiagnostics(): Diagnostic[] {
|
||||
return filter(getSortedDiagnostics(), d => !d.file);
|
||||
}
|
||||
@@ -9137,8 +9145,8 @@ module ts {
|
||||
getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags);
|
||||
}
|
||||
|
||||
function invokeEmitter(targetSourceFile?: SourceFile) {
|
||||
var resolver: EmitResolver = {
|
||||
function createResolver(): EmitResolver {
|
||||
return {
|
||||
getProgram: () => program,
|
||||
getLocalNameOfContainer,
|
||||
getExpressionNamePrefix,
|
||||
@@ -9157,6 +9165,10 @@ module ts {
|
||||
isEntityNameVisible,
|
||||
getConstantValue,
|
||||
};
|
||||
}
|
||||
|
||||
function invokeEmitter(targetSourceFile?: SourceFile) {
|
||||
var resolver = createResolver();
|
||||
checkProgram();
|
||||
return emitFiles(resolver, targetSourceFile);
|
||||
}
|
||||
|
||||
+1434
-1399
File diff suppressed because it is too large
Load Diff
@@ -48,13 +48,17 @@ module ts {
|
||||
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
|
||||
}
|
||||
|
||||
export function getSourceTextOfNodeFromSourceFile(sourceFile: SourceFile, node: Node): string {
|
||||
var text = sourceFile.text;
|
||||
return text.substring(skipTrivia(text, node.pos), node.end);
|
||||
}
|
||||
|
||||
export function getTextOfNodeFromSourceText(sourceText: string, node: Node): string {
|
||||
return sourceText.substring(skipTrivia(sourceText, node.pos), node.end);
|
||||
}
|
||||
|
||||
export function getTextOfNode(node: Node): string {
|
||||
var text = getSourceFileOfNode(node).text;
|
||||
return text.substring(skipTrivia(text, node.pos), node.end);
|
||||
return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node);
|
||||
}
|
||||
|
||||
// Add an extra underscore to identifiers that start with two underscores to avoid issues with magic names like '__proto__'
|
||||
@@ -122,7 +126,7 @@ module ts {
|
||||
}
|
||||
|
||||
export function isConstEnumDeclaration(node: Declaration): boolean {
|
||||
return node.kind === SyntaxKind.EnumDeclaration && !!(node.flags & NodeFlags.Const);
|
||||
return node.kind === SyntaxKind.EnumDeclaration && isConst(node);
|
||||
}
|
||||
|
||||
export function isConst(node: Declaration): boolean {
|
||||
|
||||
@@ -731,6 +731,7 @@ module ts {
|
||||
export interface TypeChecker {
|
||||
getProgram(): Program;
|
||||
getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[];
|
||||
getGlobalDiagnostics(): Diagnostic[];
|
||||
getNodeCount(): number;
|
||||
getIdentifierCount(): number;
|
||||
|
||||
Reference in New Issue
Block a user