This commit is contained in:
Ahmad Farid 2015-04-09 17:06:25 -07:00
commit 86e5773c65
25 changed files with 99 additions and 6469 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,5 +14,5 @@ class C {
>C : C
@dec ["method"]() {}
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}

View File

@ -14,5 +14,5 @@ class C {
>C : C
@dec ["method"]() {}
>dec : unknown
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}

View File

@ -14,5 +14,5 @@ class C {
>C : C
@dec public ["method"]() {}
>dec : unknown
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
}

View File

@ -10,6 +10,6 @@ class C {
>C : C
@dec method() {}
>dec : unknown
>dec : <T>(target: T) => T
>method : () => void
}

View File

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

View File

@ -8,6 +8,6 @@ class C {
>C : C
@dec prop;
>dec : unknown
>dec : (target: any, propertyKey: string) => void
>prop : any
}

View File

@ -9,6 +9,6 @@ class C {
>C : C
@dec prop;
>dec : unknown
>dec : () => <T>(target: any, propertyKey: string) => void
>prop : any
}

View File

@ -8,6 +8,6 @@ class C {
>C : C
@dec public prop;
>dec : unknown
>dec : (target: any, propertyKey: string) => void
>prop : any
}

View File

@ -8,6 +8,6 @@ class C {
>C : C
@dec prop;
>dec : unknown
>dec : (target: Function) => void
>prop : any
}

View File

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

View 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);

View 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);

View 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');

View 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");