mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 07:29:16 -05:00
Fix crash when getting member completion for an object literal
This commit is contained in:
@@ -2144,9 +2144,16 @@ module ts {
|
||||
}
|
||||
|
||||
// TODO: this is a hack for now, we need a proper walking mechanism to verify that we have the correct node
|
||||
var mappedNode = getTouchingToken(sourceFile, TypeScript.end(node) - 1);
|
||||
if (isPunctuation(mappedNode.kind)) {
|
||||
mappedNode = mappedNode.parent;
|
||||
var precedingToken = findTokenOnLeftOfPosition(sourceFile, TypeScript.end(node));
|
||||
var mappedNode: Node;
|
||||
if (!precedingToken) {
|
||||
mappedNode = sourceFile;
|
||||
}
|
||||
else if (isPunctuation(precedingToken.kind)) {
|
||||
mappedNode = precedingToken.parent;
|
||||
}
|
||||
else {
|
||||
mappedNode = precedingToken;
|
||||
}
|
||||
|
||||
Debug.assert(mappedNode, "Could not map a Fidelity node to an AST node");
|
||||
|
||||
Reference in New Issue
Block a user