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:
Sheetal Nandi
2015-01-30 13:02:11 -08:00
parent d85581ba0e
commit 62ed6183d9
2 changed files with 9 additions and 9 deletions

View File

@@ -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();
}

View File

@@ -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;
}