1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906
|
=== tests/cases/conformance/parser/ecmascript5/parserRealSource6.ts ===
// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
// See LICENSE.txt in the project root for complete license information.
///<reference path='typescript.ts' />
module TypeScript {
>TypeScript : typeof TypeScript
export class TypeCollectionContext {
>TypeCollectionContext : TypeCollectionContext
public script: Script = null;
>script : any
>null : null
constructor (public scopeChain: ScopeChain, public checker: TypeChecker) {
>scopeChain : any
>checker : any
}
}
export class MemberScopeContext {
>MemberScopeContext : MemberScopeContext
public type: Type = null;
>type : any
>null : null
public ast: AST = null;
>ast : any
>null : null
public scope: SymbolScope;
>scope : any
public options = new AstWalkOptions();
>options : any
>new AstWalkOptions() : any
>AstWalkOptions : any
constructor (public flow: TypeFlow, public pos: number, public matchFlag: ASTFlags) {
>flow : any
>pos : number
>matchFlag : any
}
}
export class EnclosingScopeContext {
>EnclosingScopeContext : EnclosingScopeContext
public scopeGetter: () => SymbolScope = null;
>scopeGetter : () => any
>null : null
public objectLiteralScopeGetter: () => SymbolScope = null;
>objectLiteralScopeGetter : () => any
>null : null
public scopeStartAST: AST = null;
>scopeStartAST : any
>null : null
public skipNextFuncDeclForClass = false;
>skipNextFuncDeclForClass : boolean
>false : false
public deepestModuleDecl: ModuleDeclaration = null;
>deepestModuleDecl : any
>null : null
public enclosingClassDecl: TypeDeclaration = null;
>enclosingClassDecl : any
>null : null
public enclosingObjectLit: UnaryExpression = null;
>enclosingObjectLit : any
>null : null
public publicsOnly = true;
>publicsOnly : boolean
>true : true
public useFullAst = false;
>useFullAst : boolean
>false : false
private scriptFragment: Script;
>scriptFragment : any
constructor (public logger: ILogger,
>logger : any
public script: Script,
>script : any
public text: ISourceText,
>text : any
public pos: number,
>pos : number
public isMemberCompletion: boolean) {
>isMemberCompletion : boolean
}
public getScope(): SymbolScope {
>getScope : () => any
return this.scopeGetter();
>this.scopeGetter() : any
>this.scopeGetter : () => any
>this : this
>scopeGetter : () => any
}
public getObjectLiteralScope(): SymbolScope {
>getObjectLiteralScope : () => any
return this.objectLiteralScopeGetter();
>this.objectLiteralScopeGetter() : any
>this.objectLiteralScopeGetter : () => any
>this : this
>objectLiteralScopeGetter : () => any
}
public getScopeAST() {
>getScopeAST : () => any
return this.scopeStartAST;
>this.scopeStartAST : any
>this : this
>scopeStartAST : any
}
public getScopePosition() {
>getScopePosition : () => any
return this.scopeStartAST.minChar;
>this.scopeStartAST.minChar : any
>this.scopeStartAST : any
>this : this
>scopeStartAST : any
>minChar : any
}
public getScriptFragmentStartAST(): AST {
>getScriptFragmentStartAST : () => any
return this.scopeStartAST;
>this.scopeStartAST : any
>this : this
>scopeStartAST : any
}
public getScriptFragmentPosition(): number {
>getScriptFragmentPosition : () => number
return this.getScriptFragmentStartAST().minChar;
>this.getScriptFragmentStartAST().minChar : any
>this.getScriptFragmentStartAST() : any
>this.getScriptFragmentStartAST : () => any
>this : this
>getScriptFragmentStartAST : () => any
>minChar : any
}
public getScriptFragment(): Script {
>getScriptFragment : () => any
if (this.scriptFragment == null) {
>this.scriptFragment == null : boolean
>this.scriptFragment : any
>this : this
>scriptFragment : any
>null : null
var ast = this.getScriptFragmentStartAST();
>ast : any
>this.getScriptFragmentStartAST() : any
>this.getScriptFragmentStartAST : () => any
>this : this
>getScriptFragmentStartAST : () => any
var minChar = ast.minChar;
>minChar : any
>ast.minChar : any
>ast : any
>minChar : any
var limChar = (this.isMemberCompletion ? this.pos : this.pos + 1);
>limChar : number
>(this.isMemberCompletion ? this.pos : this.pos + 1) : number
>this.isMemberCompletion ? this.pos : this.pos + 1 : number
>this.isMemberCompletion : boolean
>this : this
>isMemberCompletion : boolean
>this.pos : number
>this : this
>pos : number
>this.pos + 1 : number
>this.pos : number
>this : this
>pos : number
>1 : 1
this.scriptFragment = TypeScript.quickParse(this.logger, ast, this.text, minChar, limChar, null/*errorCapture*/).Script;
>this.scriptFragment = TypeScript.quickParse(this.logger, ast, this.text, minChar, limChar, null/*errorCapture*/).Script : any
>this.scriptFragment : any
>this : this
>scriptFragment : any
>TypeScript.quickParse(this.logger, ast, this.text, minChar, limChar, null/*errorCapture*/).Script : any
>TypeScript.quickParse(this.logger, ast, this.text, minChar, limChar, null/*errorCapture*/) : any
>TypeScript.quickParse : any
>TypeScript : typeof TypeScript
>quickParse : any
>this.logger : any
>this : this
>logger : any
>ast : any
>this.text : any
>this : this
>text : any
>minChar : any
>limChar : number
>null : null
>Script : any
}
return this.scriptFragment;
>this.scriptFragment : any
>this : this
>scriptFragment : any
}
}
export function preFindMemberScope(ast: AST, parent: AST, walker: IAstWalker) {
>preFindMemberScope : (ast: any, parent: any, walker: any) => any
>ast : any
>parent : any
>walker : any
var memScope: MemberScopeContext = walker.state;
>memScope : MemberScopeContext
>walker.state : any
>walker : any
>state : any
if (hasFlag(ast.flags, memScope.matchFlag) && ((memScope.pos < 0) || (memScope.pos == ast.limChar))) {
>hasFlag(ast.flags, memScope.matchFlag) && ((memScope.pos < 0) || (memScope.pos == ast.limChar)) : boolean
>hasFlag(ast.flags, memScope.matchFlag) : any
>hasFlag : any
>ast.flags : any
>ast : any
>flags : any
>memScope.matchFlag : any
>memScope : MemberScopeContext
>matchFlag : any
>((memScope.pos < 0) || (memScope.pos == ast.limChar)) : boolean
>(memScope.pos < 0) || (memScope.pos == ast.limChar) : boolean
>(memScope.pos < 0) : boolean
>memScope.pos < 0 : boolean
>memScope.pos : number
>memScope : MemberScopeContext
>pos : number
>0 : 0
>(memScope.pos == ast.limChar) : boolean
>memScope.pos == ast.limChar : boolean
>memScope.pos : number
>memScope : MemberScopeContext
>pos : number
>ast.limChar : any
>ast : any
>limChar : any
memScope.ast = ast;
>memScope.ast = ast : any
>memScope.ast : any
>memScope : MemberScopeContext
>ast : any
>ast : any
if ((ast.type == null) && (memScope.pos >= 0)) {
>(ast.type == null) && (memScope.pos >= 0) : boolean
>(ast.type == null) : boolean
>ast.type == null : boolean
>ast.type : any
>ast : any
>type : any
>null : null
>(memScope.pos >= 0) : boolean
>memScope.pos >= 0 : boolean
>memScope.pos : number
>memScope : MemberScopeContext
>pos : number
>0 : 0
memScope.flow.inScopeTypeCheck(ast, memScope.scope);
>memScope.flow.inScopeTypeCheck(ast, memScope.scope) : any
>memScope.flow.inScopeTypeCheck : any
>memScope.flow : any
>memScope : MemberScopeContext
>flow : any
>inScopeTypeCheck : any
>ast : any
>memScope.scope : any
>memScope : MemberScopeContext
>scope : any
}
memScope.type = ast.type;
>memScope.type = ast.type : any
>memScope.type : any
>memScope : MemberScopeContext
>type : any
>ast.type : any
>ast : any
>type : any
memScope.options.stopWalk();
>memScope.options.stopWalk() : any
>memScope.options.stopWalk : any
>memScope.options : any
>memScope : MemberScopeContext
>options : any
>stopWalk : any
}
return ast;
>ast : any
}
export function pushTypeCollectionScope(container: Symbol,
>pushTypeCollectionScope : (container: Symbol, valueMembers: any, ambientValueMembers: any, enclosedTypes: any, ambientEnclosedTypes: any, context: TypeCollectionContext, thisType: any, classType: any, moduleDecl: any) => void
>container : Symbol
valueMembers: ScopedMembers,
>valueMembers : any
ambientValueMembers: ScopedMembers,
>ambientValueMembers : any
enclosedTypes: ScopedMembers,
>enclosedTypes : any
ambientEnclosedTypes: ScopedMembers,
>ambientEnclosedTypes : any
context: TypeCollectionContext,
>context : TypeCollectionContext
thisType: Type,
>thisType : any
classType: Type,
>classType : any
moduleDecl: ModuleDeclaration) {
>moduleDecl : any
var builder = new SymbolScopeBuilder(valueMembers, ambientValueMembers, enclosedTypes, ambientEnclosedTypes, null, container);
>builder : any
>new SymbolScopeBuilder(valueMembers, ambientValueMembers, enclosedTypes, ambientEnclosedTypes, null, container) : any
>SymbolScopeBuilder : any
>valueMembers : any
>ambientValueMembers : any
>enclosedTypes : any
>ambientEnclosedTypes : any
>null : null
>container : Symbol
var chain: ScopeChain = new ScopeChain(container, context.scopeChain, builder);
>chain : any
>new ScopeChain(container, context.scopeChain, builder) : any
>ScopeChain : any
>container : Symbol
>context.scopeChain : any
>context : TypeCollectionContext
>scopeChain : any
>builder : any
chain.thisType = thisType;
>chain.thisType = thisType : any
>chain.thisType : any
>chain : any
>thisType : any
>thisType : any
chain.classType = classType;
>chain.classType = classType : any
>chain.classType : any
>chain : any
>classType : any
>classType : any
chain.moduleDecl = moduleDecl;
>chain.moduleDecl = moduleDecl : any
>chain.moduleDecl : any
>chain : any
>moduleDecl : any
>moduleDecl : any
context.scopeChain = chain;
>context.scopeChain = chain : any
>context.scopeChain : any
>context : TypeCollectionContext
>scopeChain : any
>chain : any
}
export function popTypeCollectionScope(context: TypeCollectionContext) {
>popTypeCollectionScope : (context: TypeCollectionContext) => void
>context : TypeCollectionContext
context.scopeChain = context.scopeChain.previous;
>context.scopeChain = context.scopeChain.previous : any
>context.scopeChain : any
>context : TypeCollectionContext
>scopeChain : any
>context.scopeChain.previous : any
>context.scopeChain : any
>context : TypeCollectionContext
>scopeChain : any
>previous : any
}
export function preFindEnclosingScope(ast: AST, parent: AST, walker: IAstWalker) {
>preFindEnclosingScope : (ast: any, parent: any, walker: any) => any
>ast : any
>parent : any
>walker : any
var context: EnclosingScopeContext = walker.state;
>context : EnclosingScopeContext
>walker.state : any
>walker : any
>state : any
var minChar = ast.minChar;
>minChar : any
>ast.minChar : any
>ast : any
>minChar : any
var limChar = ast.limChar;
>limChar : any
>ast.limChar : any
>ast : any
>limChar : any
// Account for the fact completion list may be called at the end of a file which
// is has not been fully re-parsed yet.
if (ast.nodeType == NodeType.Script && context.pos > limChar)
>ast.nodeType == NodeType.Script && context.pos > limChar : boolean
>ast.nodeType == NodeType.Script : boolean
>ast.nodeType : any
>ast : any
>nodeType : any
>NodeType.Script : any
>NodeType : any
>Script : any
>context.pos > limChar : boolean
>context.pos : number
>context : EnclosingScopeContext
>pos : number
>limChar : any
limChar = context.pos;
>limChar = context.pos : number
>limChar : any
>context.pos : number
>context : EnclosingScopeContext
>pos : number
if ((minChar <= context.pos) &&
>(minChar <= context.pos) && (limChar >= context.pos) : boolean
>(minChar <= context.pos) : boolean
>minChar <= context.pos : boolean
>minChar : any
>context.pos : number
>context : EnclosingScopeContext
>pos : number
(limChar >= context.pos)) {
>(limChar >= context.pos) : boolean
>limChar >= context.pos : boolean
>limChar : any
>context.pos : number
>context : EnclosingScopeContext
>pos : number
switch (ast.nodeType) {
>ast.nodeType : any
>ast : any
>nodeType : any
case NodeType.Script:
>NodeType.Script : any
>NodeType : any
>Script : any
var script = <Script>ast;
>script : any
><Script>ast : any
>ast : any
context.scopeGetter = function () {
>context.scopeGetter = function () { return script.bod === null ? null : script.bod.enclosingScope; } : () => any
>context.scopeGetter : () => any
>context : EnclosingScopeContext
>scopeGetter : () => any
>function () { return script.bod === null ? null : script.bod.enclosingScope; } : () => any
return script.bod === null ? null : script.bod.enclosingScope;
>script.bod === null ? null : script.bod.enclosingScope : any
>script.bod === null : boolean
>script.bod : any
>script : any
>bod : any
>null : null
>null : null
>script.bod.enclosingScope : any
>script.bod : any
>script : any
>bod : any
>enclosingScope : any
};
context.scopeStartAST = script;
>context.scopeStartAST = script : any
>context.scopeStartAST : any
>context : EnclosingScopeContext
>scopeStartAST : any
>script : any
break;
case NodeType.ClassDeclaration:
>NodeType.ClassDeclaration : any
>NodeType : any
>ClassDeclaration : any
context.scopeGetter = function () {
>context.scopeGetter = function () { return (ast.type === null || ast.type.instanceType.containedScope === null) ? null : ast.type.instanceType.containedScope; } : () => any
>context.scopeGetter : () => any
>context : EnclosingScopeContext
>scopeGetter : () => any
>function () { return (ast.type === null || ast.type.instanceType.containedScope === null) ? null : ast.type.instanceType.containedScope; } : () => any
return (ast.type === null || ast.type.instanceType.containedScope === null) ? null : ast.type.instanceType.containedScope;
>(ast.type === null || ast.type.instanceType.containedScope === null) ? null : ast.type.instanceType.containedScope : any
>(ast.type === null || ast.type.instanceType.containedScope === null) : boolean
>ast.type === null || ast.type.instanceType.containedScope === null : boolean
>ast.type === null : boolean
>ast.type : any
>ast : any
>type : any
>null : null
>ast.type.instanceType.containedScope === null : boolean
>ast.type.instanceType.containedScope : any
>ast.type.instanceType : any
>ast.type : any
>ast : any
>type : any
>instanceType : any
>containedScope : any
>null : null
>null : null
>ast.type.instanceType.containedScope : any
>ast.type.instanceType : any
>ast.type : any
>ast : any
>type : any
>instanceType : any
>containedScope : any
};
context.scopeStartAST = ast;
>context.scopeStartAST = ast : any
>context.scopeStartAST : any
>context : EnclosingScopeContext
>scopeStartAST : any
>ast : any
context.enclosingClassDecl = <TypeDeclaration>ast;
>context.enclosingClassDecl = <TypeDeclaration>ast : any
>context.enclosingClassDecl : any
>context : EnclosingScopeContext
>enclosingClassDecl : any
><TypeDeclaration>ast : any
>ast : any
break;
case NodeType.ObjectLit:
>NodeType.ObjectLit : any
>NodeType : any
>ObjectLit : any
var objectLit = <UnaryExpression>ast;
>objectLit : any
><UnaryExpression>ast : any
>ast : any
// Only consider target-typed object literals
if (objectLit.targetType) {
>objectLit.targetType : any
>objectLit : any
>targetType : any
context.scopeGetter = function () {
>context.scopeGetter = function () { return objectLit.targetType.containedScope; } : () => any
>context.scopeGetter : () => any
>context : EnclosingScopeContext
>scopeGetter : () => any
>function () { return objectLit.targetType.containedScope; } : () => any
return objectLit.targetType.containedScope;
>objectLit.targetType.containedScope : any
>objectLit.targetType : any
>objectLit : any
>targetType : any
>containedScope : any
};
context.objectLiteralScopeGetter = function () {
>context.objectLiteralScopeGetter = function () { return objectLit.targetType.memberScope; } : () => any
>context.objectLiteralScopeGetter : () => any
>context : EnclosingScopeContext
>objectLiteralScopeGetter : () => any
>function () { return objectLit.targetType.memberScope; } : () => any
return objectLit.targetType.memberScope;
>objectLit.targetType.memberScope : any
>objectLit.targetType : any
>objectLit : any
>targetType : any
>memberScope : any
}
context.enclosingObjectLit = objectLit;
>context.enclosingObjectLit = objectLit : any
>context.enclosingObjectLit : any
>context : EnclosingScopeContext
>enclosingObjectLit : any
>objectLit : any
}
break;
case NodeType.ModuleDeclaration:
>NodeType.ModuleDeclaration : any
>NodeType : any
>ModuleDeclaration : any
context.deepestModuleDecl = <ModuleDeclaration>ast;
>context.deepestModuleDecl = <ModuleDeclaration>ast : any
>context.deepestModuleDecl : any
>context : EnclosingScopeContext
>deepestModuleDecl : any
><ModuleDeclaration>ast : any
>ast : any
context.scopeGetter = function () {
>context.scopeGetter = function () { return ast.type === null ? null : ast.type.containedScope; } : () => any
>context.scopeGetter : () => any
>context : EnclosingScopeContext
>scopeGetter : () => any
>function () { return ast.type === null ? null : ast.type.containedScope; } : () => any
return ast.type === null ? null : ast.type.containedScope;
>ast.type === null ? null : ast.type.containedScope : any
>ast.type === null : boolean
>ast.type : any
>ast : any
>type : any
>null : null
>null : null
>ast.type.containedScope : any
>ast.type : any
>ast : any
>type : any
>containedScope : any
};
context.scopeStartAST = ast;
>context.scopeStartAST = ast : any
>context.scopeStartAST : any
>context : EnclosingScopeContext
>scopeStartAST : any
>ast : any
break;
case NodeType.InterfaceDeclaration:
>NodeType.InterfaceDeclaration : any
>NodeType : any
>InterfaceDeclaration : any
context.scopeGetter = function () {
>context.scopeGetter = function () { return (ast.type === null) ? null : ast.type.containedScope; } : () => any
>context.scopeGetter : () => any
>context : EnclosingScopeContext
>scopeGetter : () => any
>function () { return (ast.type === null) ? null : ast.type.containedScope; } : () => any
return (ast.type === null) ? null : ast.type.containedScope;
>(ast.type === null) ? null : ast.type.containedScope : any
>(ast.type === null) : boolean
>ast.type === null : boolean
>ast.type : any
>ast : any
>type : any
>null : null
>null : null
>ast.type.containedScope : any
>ast.type : any
>ast : any
>type : any
>containedScope : any
};
context.scopeStartAST = ast;
>context.scopeStartAST = ast : any
>context.scopeStartAST : any
>context : EnclosingScopeContext
>scopeStartAST : any
>ast : any
break;
case NodeType.FuncDecl: {
>NodeType.FuncDecl : any
>NodeType : any
>FuncDecl : any
var funcDecl = <FuncDecl>ast;
>funcDecl : any
><FuncDecl>ast : any
>ast : any
if (context.skipNextFuncDeclForClass) {
>context.skipNextFuncDeclForClass : boolean
>context : EnclosingScopeContext
>skipNextFuncDeclForClass : boolean
context.skipNextFuncDeclForClass = false;
>context.skipNextFuncDeclForClass = false : false
>context.skipNextFuncDeclForClass : boolean
>context : EnclosingScopeContext
>skipNextFuncDeclForClass : boolean
>false : false
}
else {
context.scopeGetter = function () {
>context.scopeGetter = function () { // The scope of a class constructor is hidden somewhere we don't expect :-S if (funcDecl.isConstructor && hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) { if (ast.type && ast.type.enclosingType) { return ast.type.enclosingType.constructorScope; } } if (funcDecl.scopeType) { return funcDecl.scopeType.containedScope; } if (funcDecl.type) { return funcDecl.type.containedScope; } return null; } : () => any
>context.scopeGetter : () => any
>context : EnclosingScopeContext
>scopeGetter : () => any
>function () { // The scope of a class constructor is hidden somewhere we don't expect :-S if (funcDecl.isConstructor && hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) { if (ast.type && ast.type.enclosingType) { return ast.type.enclosingType.constructorScope; } } if (funcDecl.scopeType) { return funcDecl.scopeType.containedScope; } if (funcDecl.type) { return funcDecl.type.containedScope; } return null; } : () => any
// The scope of a class constructor is hidden somewhere we don't expect :-S
if (funcDecl.isConstructor && hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) {
>funcDecl.isConstructor && hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod) : any
>funcDecl.isConstructor : any
>funcDecl : any
>isConstructor : any
>hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod) : any
>hasFlag : any
>funcDecl.fncFlags : any
>funcDecl : any
>fncFlags : any
>FncFlags.ClassMethod : any
>FncFlags : any
>ClassMethod : any
if (ast.type && ast.type.enclosingType) {
>ast.type && ast.type.enclosingType : any
>ast.type : any
>ast : any
>type : any
>ast.type.enclosingType : any
>ast.type : any
>ast : any
>type : any
>enclosingType : any
return ast.type.enclosingType.constructorScope;
>ast.type.enclosingType.constructorScope : any
>ast.type.enclosingType : any
>ast.type : any
>ast : any
>type : any
>enclosingType : any
>constructorScope : any
}
}
if (funcDecl.scopeType) {
>funcDecl.scopeType : any
>funcDecl : any
>scopeType : any
return funcDecl.scopeType.containedScope;
>funcDecl.scopeType.containedScope : any
>funcDecl.scopeType : any
>funcDecl : any
>scopeType : any
>containedScope : any
}
if (funcDecl.type) {
>funcDecl.type : any
>funcDecl : any
>type : any
return funcDecl.type.containedScope;
>funcDecl.type.containedScope : any
>funcDecl.type : any
>funcDecl : any
>type : any
>containedScope : any
}
return null;
>null : null
};
context.scopeStartAST = ast;
>context.scopeStartAST = ast : any
>context.scopeStartAST : any
>context : EnclosingScopeContext
>scopeStartAST : any
>ast : any
}
}
break;
}
walker.options.goChildren = true;
>walker.options.goChildren = true : true
>walker.options.goChildren : any
>walker.options : any
>walker : any
>options : any
>goChildren : any
>true : true
}
else {
walker.options.goChildren = false;
>walker.options.goChildren = false : false
>walker.options.goChildren : any
>walker.options : any
>walker : any
>options : any
>goChildren : any
>false : false
}
return ast;
>ast : any
}
//
// Find the enclosing scope context from a position inside a script AST.
// The "scopeStartAST" of the returned scope is always valid.
// Return "null" if the enclosing scope can't be found.
//
export function findEnclosingScopeAt(logger: ILogger, script: Script, text: ISourceText, pos: number, isMemberCompletion: boolean): EnclosingScopeContext {
>findEnclosingScopeAt : (logger: any, script: any, text: any, pos: number, isMemberCompletion: boolean) => EnclosingScopeContext
>logger : any
>script : any
>text : any
>pos : number
>isMemberCompletion : boolean
var context = new EnclosingScopeContext(logger, script, text, pos, isMemberCompletion);
>context : EnclosingScopeContext
>new EnclosingScopeContext(logger, script, text, pos, isMemberCompletion) : EnclosingScopeContext
>EnclosingScopeContext : typeof EnclosingScopeContext
>logger : any
>script : any
>text : any
>pos : number
>isMemberCompletion : boolean
TypeScript.getAstWalkerFactory().walk(script, preFindEnclosingScope, null, null, context);
>TypeScript.getAstWalkerFactory().walk(script, preFindEnclosingScope, null, null, context) : any
>TypeScript.getAstWalkerFactory().walk : any
>TypeScript.getAstWalkerFactory() : any
>TypeScript.getAstWalkerFactory : any
>TypeScript : typeof TypeScript
>getAstWalkerFactory : any
>walk : any
>script : any
>preFindEnclosingScope : (ast: any, parent: any, walker: any) => any
>null : null
>null : null
>context : EnclosingScopeContext
if (context.scopeStartAST === null)
>context.scopeStartAST === null : boolean
>context.scopeStartAST : any
>context : EnclosingScopeContext
>scopeStartAST : any
>null : null
return null;
>null : null
return context;
>context : EnclosingScopeContext
}
}
|