mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Merging
This commit is contained in:
commit
86e5773c65
@ -780,6 +780,8 @@ module ts {
|
||||
return node === (<TemplateSpan>parent).expression;
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
return node === (<ComputedPropertyName>parent).expression;
|
||||
case SyntaxKind.Decorator:
|
||||
return true;
|
||||
default:
|
||||
if (isExpression(parent)) {
|
||||
return true;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ declare function dec<T>(target: T): T;
|
||||
>T : T
|
||||
|
||||
@dec
|
||||
>dec : unknown
|
||||
>dec : <T>(target: T) => T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@ -7,7 +7,7 @@ declare function dec<T>(target: T): T;
|
||||
>T : T
|
||||
|
||||
@dec
|
||||
>dec : unknown
|
||||
>dec : <T>(target: T) => T
|
||||
|
||||
export class C {
|
||||
>C : C
|
||||
|
||||
@ -14,6 +14,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec get accessor() { return 1; }
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>accessor : number
|
||||
}
|
||||
|
||||
@ -14,6 +14,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec public get accessor() { return 1; }
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>accessor : number
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec set accessor(value: number) { }
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>accessor : number
|
||||
>value : number
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec public set accessor(value: number) { }
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>accessor : number
|
||||
>value : number
|
||||
}
|
||||
|
||||
@ -10,6 +10,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
constructor(@dec p: number) {}
|
||||
>dec : unknown
|
||||
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
|
||||
>p : number
|
||||
}
|
||||
|
||||
@ -14,6 +14,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec method() {}
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>method : () => void
|
||||
}
|
||||
|
||||
@ -14,6 +14,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec public method() {}
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>method : () => void
|
||||
}
|
||||
|
||||
@ -14,5 +14,5 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec ["method"]() {}
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
}
|
||||
|
||||
@ -14,5 +14,5 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec ["method"]() {}
|
||||
>dec : unknown
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
}
|
||||
|
||||
@ -14,5 +14,5 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec public ["method"]() {}
|
||||
>dec : unknown
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
}
|
||||
|
||||
@ -10,6 +10,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec method() {}
|
||||
>dec : unknown
|
||||
>dec : <T>(target: T) => T
|
||||
>method : () => void
|
||||
}
|
||||
|
||||
@ -11,6 +11,6 @@ class C {
|
||||
|
||||
method(@dec p: number) {}
|
||||
>method : (p: number) => void
|
||||
>dec : unknown
|
||||
>dec : (target: Function, propertyKey: string | symbol, parameterIndex: number) => void
|
||||
>p : number
|
||||
}
|
||||
|
||||
@ -8,6 +8,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec prop;
|
||||
>dec : unknown
|
||||
>dec : (target: any, propertyKey: string) => void
|
||||
>prop : any
|
||||
}
|
||||
|
||||
@ -9,6 +9,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec prop;
|
||||
>dec : unknown
|
||||
>dec : () => <T>(target: any, propertyKey: string) => void
|
||||
>prop : any
|
||||
}
|
||||
|
||||
@ -8,6 +8,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec public prop;
|
||||
>dec : unknown
|
||||
>dec : (target: any, propertyKey: string) => void
|
||||
>prop : any
|
||||
}
|
||||
|
||||
@ -8,6 +8,6 @@ class C {
|
||||
>C : C
|
||||
|
||||
@dec prop;
|
||||
>dec : unknown
|
||||
>dec : (target: Function) => void
|
||||
>prop : any
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ declare function ParameterDecorator2(x: number): (target: Function, key: string
|
||||
>paramIndex : number
|
||||
|
||||
@ClassDecorator1
|
||||
>ClassDecorator1 : unknown
|
||||
>ClassDecorator1 : (target: Function) => void
|
||||
|
||||
@ClassDecorator2(10)
|
||||
>ClassDecorator2(10) : (target: Function) => void
|
||||
@ -54,7 +54,7 @@ class Greeter {
|
||||
|
||||
constructor(
|
||||
@ParameterDecorator1
|
||||
>ParameterDecorator1 : unknown
|
||||
>ParameterDecorator1 : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
|
||||
@ParameterDecorator2(20)
|
||||
>ParameterDecorator2(20) : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
@ -64,7 +64,7 @@ class Greeter {
|
||||
>greeting : string
|
||||
|
||||
@ParameterDecorator1
|
||||
>ParameterDecorator1 : unknown
|
||||
>ParameterDecorator1 : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
|
||||
@ParameterDecorator2(30)
|
||||
>ParameterDecorator2(30) : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
@ -75,7 +75,7 @@ class Greeter {
|
||||
}
|
||||
|
||||
@PropertyDecorator1
|
||||
>PropertyDecorator1 : unknown
|
||||
>PropertyDecorator1 : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
|
||||
@PropertyDecorator2(40)
|
||||
>PropertyDecorator2(40) : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
@ -93,7 +93,7 @@ class Greeter {
|
||||
}
|
||||
|
||||
@PropertyDecorator1
|
||||
>PropertyDecorator1 : unknown
|
||||
>PropertyDecorator1 : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
|
||||
@PropertyDecorator2(50)
|
||||
>PropertyDecorator2(50) : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
@ -103,7 +103,7 @@ class Greeter {
|
||||
>x : string
|
||||
|
||||
@PropertyDecorator1
|
||||
>PropertyDecorator1 : unknown
|
||||
>PropertyDecorator1 : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
|
||||
@PropertyDecorator2(60)
|
||||
>PropertyDecorator2(60) : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
@ -116,7 +116,7 @@ class Greeter {
|
||||
>fn : (x: number) => string
|
||||
|
||||
@ParameterDecorator1
|
||||
>ParameterDecorator1 : unknown
|
||||
>ParameterDecorator1 : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
|
||||
@ParameterDecorator2(70)
|
||||
>ParameterDecorator2(70) : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
@ -132,7 +132,7 @@ class Greeter {
|
||||
}
|
||||
|
||||
@PropertyDecorator1
|
||||
>PropertyDecorator1 : unknown
|
||||
>PropertyDecorator1 : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
|
||||
@PropertyDecorator2(80)
|
||||
>PropertyDecorator2(80) : (target: Object, key: string | symbol, descriptor?: PropertyDescriptor) => void
|
||||
@ -151,7 +151,7 @@ class Greeter {
|
||||
>greetings : string
|
||||
|
||||
@ParameterDecorator1
|
||||
>ParameterDecorator1 : unknown
|
||||
>ParameterDecorator1 : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
|
||||
@ParameterDecorator2(90)
|
||||
>ParameterDecorator2(90) : (target: Function, key: string | symbol, paramIndex: number) => void
|
||||
|
||||
19
tests/cases/fourslash/findAllRefsOnDecorators.ts
Normal file
19
tests/cases/fourslash/findAllRefsOnDecorators.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: a.ts
|
||||
////function decorator(target) {
|
||||
//// return target;
|
||||
////}
|
||||
////decorator();
|
||||
|
||||
// @Filename: b.ts
|
||||
////@deco/*1*/rator @decorator("again")
|
||||
////class C {
|
||||
//// @decorator
|
||||
//// method() {}
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
goTo.marker("1");
|
||||
|
||||
verify.referencesCountIs(5);
|
||||
14
tests/cases/fourslash/getOccurrencesOfDecorators.ts
Normal file
14
tests/cases/fourslash/getOccurrencesOfDecorators.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////@/*1*/decorator
|
||||
////class C {
|
||||
//// @decorator
|
||||
//// method() {}
|
||||
////}
|
||||
////function decorator(target) {
|
||||
//// return target;
|
||||
////}
|
||||
|
||||
goTo.marker("1");
|
||||
verify.occurrencesAtPositionCount(3);
|
||||
26
tests/cases/fourslash/goToDefinitionDecorator.ts
Normal file
26
tests/cases/fourslash/goToDefinitionDecorator.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////@/*decoratorUse*/decorator
|
||||
////class C {
|
||||
//// @decora/*decoratorFactoryUse*/torFactory(a, "22", true)
|
||||
//// method() {}
|
||||
////}
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
/////*decoratorDefinition*/function decorator(target) {
|
||||
//// return target;
|
||||
////}
|
||||
/////*decoratorFactoryDefinition*/function decoratorFactory(...args) {
|
||||
//// return target => target;
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker('decoratorUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorDefinition');
|
||||
|
||||
goTo.marker('decoratorFactoryUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorFactoryDefinition');
|
||||
11
tests/cases/fourslash/quickInfoForDecorators.ts
Normal file
11
tests/cases/fourslash/quickInfoForDecorators.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////@/*1*/decorator
|
||||
////class C {
|
||||
|
||||
////}
|
||||
/////** decorator documentation*/
|
||||
////var decorator = t=> t;
|
||||
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs("var decorator: (t: any) => any", "decorator documentation");
|
||||
Loading…
x
Reference in New Issue
Block a user