mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Change the name of defaultBinding to name and make ImportClause as Declaration
This helps binder to use it directly to bind the default binding
This commit is contained in:
@@ -4569,12 +4569,12 @@ module ts {
|
||||
if (identifier) {
|
||||
// ImportedDefaultBinding:
|
||||
// ImportedBinding
|
||||
importClause.defaultBinding = identifier;
|
||||
importClause.name = identifier;
|
||||
}
|
||||
|
||||
// If there was no default import or if there is comma token after default import
|
||||
// parse namespace or named imports
|
||||
if (!importClause.defaultBinding ||
|
||||
if (!importClause.name ||
|
||||
parseOptional(SyntaxKind.CommaToken)) {
|
||||
importClause.namedBindings = token === SyntaxKind.AsteriskToken ? parseNamespaceImport() : parseNamedImports();
|
||||
}
|
||||
|
||||
@@ -878,13 +878,13 @@ module ts {
|
||||
}
|
||||
|
||||
// In case of:
|
||||
// import d from "mod" => defaultBinding = d, namedBinding = undefined
|
||||
// import * as ns from "mod" => defaultBinding = undefined, namedBinding: NamespaceImport = { name: ns }
|
||||
// import d, * as ns from "mod" => defaultBinding = d, namedBinding: NamespaceImport = { name: ns }
|
||||
// import { a, b as x } from "mod" => defaultBinding = undefined, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]}
|
||||
// import d, { a, b as x } from "mod" => defaultBinding = d, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]}
|
||||
export interface ImportClause extends Node {
|
||||
defaultBinding?: Identifier;
|
||||
// import d from "mod" => name = d, namedBinding = undefined
|
||||
// import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns }
|
||||
// import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns }
|
||||
// import { a, b as x } from "mod" => name = undefined, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]}
|
||||
// import d, { a, b as x } from "mod" => name = d, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]}
|
||||
export interface ImportClause extends Declaration {
|
||||
name?: Identifier; // Default binding
|
||||
namedBindings?: NamespaceImport | NamedImports;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user