Lines Matching full:scope
44 Scope,
47 } from "./scope";
60 scope: Scope; property in Recorder
63 private scopeMap: Map<ts.Node, Scope> = new Map<ts.Node, Scope>();
64 private hoistMap: Map<Scope, Decl[]> = new Map<Scope, Decl[]>();
74 …constructor(node: ts.Node, scope: Scope, compilerDriver: CompilerDriver, recordType: boolean, isTs…
76 this.scope = scope;
87 this.setScopeMap(this.node, this.scope);
88 this.recordInfo(this.node, this.scope);
113 private recordInfo(node: ts.Node, scope: Scope) {
116 checkSyntaxError(childNode, scope);
125 … let functionScope = this.buildVariableScope(scope, <ts.FunctionLikeDeclaration>childNode);
131 … let functionScope = this.buildVariableScope(scope, <ts.FunctionLikeDeclaration>childNode);
137 this.recordEcmaExportInfo(<ts.FunctionDeclaration>childNode, scope);
142 this.recordFuncDecl(<ts.FunctionDeclaration>childNode, scope, isExport);
156 let localScope = new LocalScope(scope);
166 let loopScope: LoopScope = new LoopScope(scope);;
177 this.recordEcmaExportInfo(<ts.ClassDeclaration>childNode, scope);
180 this.recordClassInfo(<ts.ClassLikeDeclaration>childNode, scope, isExport);
187 this.recordClassInfo(<ts.ClassLikeDeclaration>childNode, scope, false);
200 this.recordVariableDecl(<ts.Identifier>childNode, scope);
207 this.recordEcmaImportInfo(<ts.ImportDeclaration>childNode, scope);
219 this.recordEcmaExportInfo(<ts.ExportDeclaration>childNode, scope);
231 this.recordEcmaExportInfo(<ts.ExportAssignment>childNode, scope);
233 this.recordInfo(childNode, scope);
244 this.recordEcmaExportInfo(<ts.VariableStatement>childNode, scope);
249 this.recordInfo(childNode, scope);
253 this.recordInfo(childNode, scope);
258 private recordClassInfo(childNode: ts.ClassLikeDeclaration, scope: Scope, isExport: boolean) {
259 let localScope = new LocalScope(scope);
272 scope.setDecls(classDecl);
276 buildVariableScope(curScope: Scope, node: ts.FunctionLikeDeclaration) {
285 private recordVariableDecl(id: ts.Identifier, scope: Scope) {
296 // collect declaration information to corresponding scope
297 let decl = this.addVariableDeclToScope(scope, id, parent, name, declKind, isExportDecl);
299 let variableScopeParent = <VariableScope>scope.getNearestVariableScope();
303 let declScope = scope.findDeclPos(name);
308 let nearestRefVariableScope = <VariableScope>scope.getNearestVariableScope();
311 let tmp: Scope | undefined = nearestRefVariableScope.getNearestLexicalScope();
332 let varialbeScope = scope.getNearestVariableScope();
337 …private addVariableDeclToScope(scope: Scope, node: ts.Node, parent: ts.Node, name: string, declKin…
357 scope.setDecls(decl);
467 …private recordEcmaNamedBindings(namedBindings: ts.NamedImportBindings, scope: ModuleScope, moduleR…
471 scope.setDecls(new ConstDecl(nameSpace, namedBindings, ModuleVarKind.NOT));
472 scope.module().addStarImportEntry(namedBindings, nameSpace, moduleRequest);
476 scope.module().addEmptyImportEntry(moduleRequest);
482 scope.setDecls(new ConstDecl(localName, element, ModuleVarKind.IMPORTED));
483 scope.module().addImportEntry(element, importName, localName, moduleRequest);
490 …private recordEcmaImportClause(importClause: ts.ImportClause, scope: ModuleScope, moduleRequest: s…
494 scope.setDecls(new ConstDecl(localName, importClause.name, ModuleVarKind.IMPORTED));
495 scope.module().addImportEntry(importClause, "default", localName, moduleRequest);
499 this.recordEcmaNamedBindings(namedBindings, scope, moduleRequest);
503 private recordEcmaImportInfo(node: ts.ImportDeclaration, scope: Scope) {
504 if (!(scope instanceof ModuleScope)) {
512 this.recordEcmaImportClause(importClause, scope, moduleRequest);
515 scope.module().addEmptyImportEntry(moduleRequest);
519 private recordEcmaExportDecl(node: ts.ExportDeclaration, scope: ModuleScope) {
531 scope.module().addEmptyImportEntry(moduleRequest);
538 … scope.module().addIndirectExportEntry(element, importName, exportName, moduleRequest);
543 scope.module().addStarExportEntry(node, moduleRequest);
551 scope.module().addLocalExportEntry(element, exportName, localName);
558 …rtAssignment | ts.VariableStatement | ts.FunctionDeclaration | ts.ClassDeclaration, scope: Scope) {
559 if (!(scope instanceof ModuleScope)) {
565 this.recordEcmaExportDecl(<ts.ExportDeclaration>node, scope);
572 scope.module().addLocalExportEntry(node, "default", "*default*");
573 scope.setDecls(new LetDecl("*default*", node, ModuleVarKind.EXPORTED));
580 scope.module().addLocalExportEntry(decl, name, name);
592 scope.module().addLocalExportEntry(node, "default", localName);
600 scope.module().addLocalExportEntry(node, name, name);
609 private recordFuncDecl(node: ts.FunctionDeclaration, scope: Scope, isExport: boolean) {
621 let hoistScope = scope;
623 if (scope instanceof GlobalScope || scope instanceof ModuleScope) {
625 } else if (scope instanceof LocalScope) {
626 hoistScope = <Scope>scope.getNearestVariableScope();
634 scope.setDecls(funcDecl);
638 …private recordOtherFunc(node: ts.FunctionLikeDeclaration, scope: Scope) { // functionlikedecalrati…
647 scope.setDecls(funcDecl);
758 private collectHoistDecls(node: ts.Node, scope: VariableScope, decl: Decl): boolean {
762 if (scope instanceof FunctionScope) {
775 if (isGlobalIdentifier(declName) && (scope instanceof GlobalScope)) {
779 this.setHoistMap(scope, decl);
783 setScopeMap(node: ts.Node, scope: Scope) {
784 this.scopeMap.set(node, scope);
795 setHoistMap(scope: VariableScope, decl: Decl) {
796 if (!this.hoistMap.has(scope)) {
797 this.hoistMap.set(scope, [decl]);
801 let hoistDecls = <Decl[]>this.hoistMap.get(scope);
817 getHoistDeclsOfScope(scope: VariableScope) {
818 return this.hoistMap.get(scope);