mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-08 02:46:15 -05:00
Short-circuit semantic operations within with blocks
This commit is contained in:
16
tests/cases/fourslash/findAllRefsInsideWithBlock.ts
Normal file
16
tests/cases/fourslash/findAllRefsInsideWithBlock.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var x = 0;
|
||||
////
|
||||
////with ({}) {
|
||||
//// var y = x; // Reference of x here should not be picked
|
||||
//// /*2*/y++; // also reference for y should be ignored
|
||||
////}
|
||||
////
|
||||
////x = /*1*/x + 1;
|
||||
|
||||
goTo.marker('1');
|
||||
verify.referencesCountIs(3);
|
||||
|
||||
goTo.marker('2');
|
||||
verify.referencesCountIs(1);
|
||||
@@ -15,8 +15,10 @@ goTo.marker('1');
|
||||
verify.memberListIsEmpty();
|
||||
|
||||
goTo.marker('2');
|
||||
// Only keywords should show in completion, no members or types
|
||||
verify.not.completionListContains("foo");
|
||||
verify.not.completionListContains("f");
|
||||
verify.not.completionListContains("c");
|
||||
verify.not.completionListContains("d");
|
||||
verify.not.completionListContains("x");
|
||||
verify.not.completionListContains("Object");
|
||||
|
||||
12
tests/cases/fourslash/memberListInWithBlock2.ts
Normal file
12
tests/cases/fourslash/memberListInWithBlock2.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface IFoo {
|
||||
//// a: number;
|
||||
////}
|
||||
////
|
||||
////with (x) {
|
||||
//// var y: IFoo = { /*1*/ };
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
verify.memberListIsEmpty();
|
||||
7
tests/cases/fourslash/memberListInWithBlock3.ts
Normal file
7
tests/cases/fourslash/memberListInWithBlock3.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var x = { a: 0 };
|
||||
////with(x./*1*/
|
||||
|
||||
goTo.marker('1');
|
||||
verify.memberListContains("a");
|
||||
Reference in New Issue
Block a user