Skip to content

Assert exportingModuleSymbol is defined#21340

Merged
3 commits merged into
masterfrom
assertExportingModuleSymbolDefined
Feb 2, 2018
Merged

Assert exportingModuleSymbol is defined#21340
3 commits merged into
masterfrom
assertExportingModuleSymbolDefined

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Jan 22, 2018

First stab at #20793
At each definition of exportingModuleSymbol, asserts that it's defined.
Uses a helper function from #21339.

Comment thread src/services/findAllReferences.ts Outdated
if (node.kind === SyntaxKind.DefaultKeyword) {
addReference(node, symbol, node, state);
searchForImportsOfExport(node, symbol, { exportingModuleSymbol: symbol.parent, exportKind: ExportKind.Default }, state);
searchForImportsOfExport(node, symbol, { exportingModuleSymbol: Debug.assertDefined(symbol.parent), exportKind: ExportKind.Default }, state);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a message to the assert.

Comment thread src/services/importTracker.ts Outdated
// Get the symbol for the `export =` node; its parent is the module it's the export of.
const exportingModuleSymbol = ex.symbol.parent;
Debug.assert(!!exportingModuleSymbol);
const exportingModuleSymbol = Debug.assertDefined(ex.symbol.parent);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this one too

@ghost ghost merged commit 78f217b into master Feb 2, 2018
@ghost ghost deleted the assertExportingModuleSymbolDefined branch February 2, 2018 18:49
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant