Conversation
added 6 commits
August 8, 2016 11:55
…tructuring of array
| : Diagnostics.Duplicate_identifier_0; | ||
|
|
||
| // If the current node has NodeFlags.Default (e.g. if the node is class declaration or function declaration) | ||
| // and there is already another default export (i.e. symbol.declarations is not empty), we need to report such error |
Member
There was a problem hiding this comment.
It took me a while to tie this together. How about
// If the current node is a default export of some sort, then check if
// there are any other default exports that we need to error on.
// We'll know whether we have other default exports depending on if `symbol` already has a declaration list set.
added 4 commits
August 11, 2016 10:04
# Conflicts: # src/compiler/binder.ts
Contributor
Author
| } | ||
| else { | ||
| // This is to properly report an error in the case "export default { }" is after export default of class declaration or function declaration. | ||
| forEach(symbol.declarations, declaration => { |
Contributor
There was a problem hiding this comment.
use for..of and beak on the first matching entry.
|
|
||
| forEach(symbol.declarations, declaration => { | ||
| if (declaration.flags & NodeFlags.Default) { | ||
| if (symbol.declarations && symbol.declarations.length) { |
Contributor
There was a problem hiding this comment.
Do we need to do this loop? what if we just do something like:
if (symbol.declarations && symbol.declarations.length &&
(isDefaultExport || (node.kind === SyntaxKind.ExportAssignment && !(<ExportAssignment>node).isExportEquals)) {
message = Diagnostics.A_module_cannot_have_multiple_default_exports;
}
Contributor
|
@yuit what is the status of this PR? |
Contributor
Author
|
@mhegazy the pr slip my attention 😅 with all 2.0 bugs. gonna update now |
mhegazy
approved these changes
Oct 6, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #10193