mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Re-added fourslash tests, corrected failures.
This commit is contained in:
parent
144eb8dc0d
commit
f948f5d3f7
@ -11,6 +11,18 @@ module ts {
|
||||
var nextNodeId = 1;
|
||||
var nextMergeId = 1;
|
||||
|
||||
export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration {
|
||||
var declarations = symbol.declarations;
|
||||
for (var i = 0; i < declarations.length; i++) {
|
||||
var declaration = declarations[i];
|
||||
if (declaration.kind === kind) {
|
||||
return declaration;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/// fullTypeCheck denotes if this instance of the typechecker will be used to get semantic diagnostics.
|
||||
/// If fullTypeCheck === true - then typechecker should do every possible check to produce all errors
|
||||
/// If fullTypeCheck === false - typechecker can shortcut and skip checks that only produce errors.
|
||||
@ -570,18 +582,6 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration {
|
||||
var declarations = symbol.declarations;
|
||||
for (var i = 0; i < declarations.length; i++) {
|
||||
var declaration = declarations[i];
|
||||
if (declaration.kind === kind) {
|
||||
return declaration;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function findConstructorDeclaration(node: ClassDeclaration): ConstructorDeclaration {
|
||||
var members = node.members;
|
||||
for (var i = 0; i < members.length; i++) {
|
||||
|
||||
@ -607,7 +607,7 @@ module FourSlash {
|
||||
|
||||
for (var i = 0; i < references.length; i++) {
|
||||
var reference = references[i];
|
||||
if (reference && reference.fileName === fileName && reference.minChar === start && reference.limChar === end) {
|
||||
if (reference && reference.fileName === fileName && reference.textSpan.start() === start && reference.textSpan.end() === end) {
|
||||
if (typeof isWriteAccess !== "undefined" && reference.isWriteAccess !== isWriteAccess) {
|
||||
throw new Error('verifyReferencesAtPositionListContains failed - item isWriteAccess value doe not match, actual: ' + reference.isWriteAccess + ', expected: ' + isWriteAccess + '.');
|
||||
}
|
||||
|
||||
@ -2224,7 +2224,7 @@ module ts {
|
||||
var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), symbol.getDeclarations());
|
||||
|
||||
// Get the text to search for, we need to normalize it as external module names will have quote
|
||||
var symbolName = getNormalizedSymbolName(symbol.getName());
|
||||
var symbolName = getNormalizedSymbolName(symbol);
|
||||
|
||||
var scope = getSymbolScope(symbol);
|
||||
|
||||
@ -2245,7 +2245,17 @@ module ts {
|
||||
|
||||
return result;
|
||||
|
||||
function getNormalizedSymbolName(name: string): string {
|
||||
function getNormalizedSymbolName(symbol: Symbol): string {
|
||||
// Special case for function expressions, whose names are solely local to their bodies.
|
||||
var functionExpression = getDeclarationOfKind(symbol, SyntaxKind.FunctionExpression);
|
||||
|
||||
if (functionExpression && functionExpression.name) {
|
||||
var name = functionExpression.name.text;
|
||||
}
|
||||
else {
|
||||
var name = symbol.name;
|
||||
}
|
||||
|
||||
var length = name.length;
|
||||
if (length >= 2 && name.charCodeAt(0) === CharacterCodes.doubleQuote && name.charCodeAt(length - 1) === CharacterCodes.doubleQuote) {
|
||||
return name.substring(1, length - 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user