Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions internal/ast/parseoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ func isFileProbablyExternalModule(sourceFile *SourceFile) *Node {
}

func isAnExternalModuleIndicatorNode(node *Node) bool {
if node.Flags&NodeFlagsReparsed != 0 {
return false
}
return HasSyntacticModifier(node, ModifierFlagsExport) ||
IsImportEqualsDeclaration(node) && IsExternalModuleReference(node.AsImportEqualsDeclaration().ModuleReference) ||
IsImportDeclaration(node) || IsExportAssignment(node) || IsExportDeclaration(node)
Expand Down
4 changes: 2 additions & 2 deletions internal/binder/binder.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func GetSymbolNameForPrivateIdentifier(containingClassSymbol *ast.Symbol, descri

func (b *Binder) declareModuleMember(node *ast.Node, symbolFlags ast.SymbolFlags, symbolExcludes ast.SymbolFlags) *ast.Symbol {
container := b.container
if node.Kind == ast.KindCommonJSExport {
if ast.IsCommonJSExport(node) {
container = b.file.AsNode()
}
hasExportModifier := ast.GetCombinedModifierFlags(node)&ast.ModifierFlagsExport != 0 || ast.IsImplicitlyExportedJSTypeAlias(node)
Expand All @@ -402,7 +402,7 @@ func (b *Binder) declareModuleMember(node *ast.Node, symbolFlags ast.SymbolFlags
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
// and this case is specially handled. Module augmentations should only be merged with original module definition
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
if !ast.IsAmbientModule(node) && (hasExportModifier || container.Flags&ast.NodeFlagsExportContext != 0) {
if !ast.IsAmbientModule(node) && (hasExportModifier || ast.IsCommonJSExport(node) || container.Flags&ast.NodeFlagsExportContext != 0) {
if !ast.IsLocalsContainer(container) || (ast.HasSyntacticModifier(node, ast.ModifierFlagsDefault) && b.getDeclarationName(node) == ast.InternalSymbolNameMissing) || ast.IsCommonJSExport(node) {
return b.declareSymbol(ast.GetExports(container.Symbol()), container.Symbol(), node, symbolFlags, symbolExcludes)
// No local symbol for an unnamed default!
Expand Down
5 changes: 1 addition & 4 deletions internal/parser/reparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ func (p *Parser) reparseCommonJS(node *ast.Node, jsdoc []*ast.Node) {
case ast.JSDeclarationKindModuleExports:
export = p.factory.NewJSExportAssignment(nil, p.factory.DeepCloneReparse(bin.Right))
case ast.JSDeclarationKindExportsProperty:
mod := p.factory.NewModifier(ast.KindExportKeyword)
mod.Flags = p.contextFlags | ast.NodeFlagsReparsed
mod.Loc = bin.Loc
// TODO: Name can sometimes be a string literal, so downstream code needs to handle this
export = p.factory.NewCommonJSExport(
p.newModifierList(bin.Loc, p.nodeSlicePool.NewSlice1(mod)),
nil,
p.factory.DeepCloneReparse(ast.GetElementOrPropertyAccessName(bin.Left)),
nil, /*typeNode*/
p.factory.DeepCloneReparse(bin.Right))
Expand Down
Loading