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
|
/// <reference path='fourslash.ts'/>
////interface RT_JQueryElement {
//// id: string;
////}
////
////interface RT_JQuery {
//// [n: number]: RT_JQueryElement;
////}
////
////module RT_StaticModule {
//// export class C {
//// x: number;
//// g: any;
//// constructor(public c1: number, public c2: number, c3: number) {
//// this.x = C.y + this.c1 + this.c2 + c3;
//// this.g = (v: number) => C.f(this.x + C.y + v + this.c1 + this.c2 + C.pub);
//// }
////
//// static priv = 2;
//// static pub = 3;
//// static y = C.priv;
//// static f(n: number) {
//// return "wow: " + (n + C.y + C.pub + C.priv);
////
//// }
//// }
//// var c = C.y;
//// export function f() {
//// var result = "";
//// result += (c);
//// result += (new C(0, 1, 2).x);
//// result += (C.f(10));
//// result += (new C(5, 10, 20).g(C.y));
//// return result;
//// }
////}
////
////module RT_SuperCalls {
//// class Base {
//// constructor() {
//// var x: any;
//// }
//// public foo() {
//// return "base";
//// }
////
//// public bar() {
//// return "basebar";
//// }
//// }
////
//// class Sub1 extends Base {
//// public foo() {
//// return "sub1" + super.foo() + super.bar();
//// }
//// }
////
//// class SubSub1 extends Sub1 {
//// public foo() {
//// return "subsub1" + super.foo();
//// }
//// }
////
//// var s = new Sub1();
//// var ss = new SubSub1();
//// export var result = s.foo() + ss.foo();
////}
////
////module RT_SuperCalls2 {
//// // Case 5
//// class Base5 {
//// public x() {
//// return "BaseX";
//// }
////
//// public y() {
//// return "BaseY";
//// }
//// }
////
//// class Sub5 extends Base5 {
//// public x() {
//// return "SubX";
//// }
//// }
////
//// class SubSub5 extends Sub5 {
//// public x() {
//// return super.x();
//// }
//// public y() {
//// return super.y();
//// }
//// }
////
//// // Case 6
//// class Base6 {
//// public x() {
//// return "BaseX";
//// }
//// }
////
//// class Sub6 extends Base6 {
//// public y() {
//// return "SubY";
//// }
//// }
////
//// class SubSub6 extends Sub6 {
//// public y() {
//// return super.y();
//// }
//// }
////
//// var results1 = new SubSub5();
//// var results2 = new SubSub6();
//// export var result = results1.x() + results1.y() + results2.y();
////}
////
////module RT_VarArgs {
//// module M {
//// export class C {
//// public f(x: string, ...rest: number[]) {
//// var sum = 0;
//// for (var i = 0; i < rest.length; i++) {
//// sum += rest[i];
//// }
//// result += (x + ": " + sum);
//// return result;
//// }
////
//// public fnope(x: string, ...rest: number[]) {
////
//// }
////
//// public fonly(...rest: string[]) {
//// var builder = "";
//// for (var i = 0; i < rest.length; i++) {
//// builder += rest[i];
//// }
//// return builder;
//// }
//// }
//// }
////
//// var x = new M.C();
//// export var result = "";
//// result += x.f("hello", 3, 3, 3, 3, 3); // ok
//// result += x.f("hello"); // ok varargs length 0
//// result += x.fonly("a"); // ok
//// result += x.fonly("a", "b", "c", "d"); //ok
////}
////
////
////var jq: RT_JQuery = { 0: { id: "a" }, 1: { id: "b" } };
////var r1 = jq[0].id
////
////var r2 = RT_StaticModule.f();
////
////var a = {
//// "foo": function () { },
//// "bar": 5
////};
////var r3 = a.bar.toString();
////
////var r4 = RT_SuperCalls.result;
////var r5 = RT_SuperCalls2.result;
////var r6 = false;
////var r7 = RT_VarArgs.result;
// Indexes propertly
verify.eval('r1', 'a');
// Calls static methods properly
verify.eval('r2', '25wow: 17wow: 66');
// Generates string indicies propertly
verify.eval('r3', '5');
// Calls super methods correctly (#1)
verify.eval('r4', 'sub1basebasebarsubsub1sub1basebasebar');
// Calls super methods correctly (#2)
verify.eval('r5', 'SubXBaseYSubY');
// Calls methods on primitives correctly
verify.eval('true.toString()', 'true');
verify.eval('r6.toString()', 'false');
verify.eval('1..toString()', '1');
// Copies vararg arrays correctly
verify.eval('r7', 'hello: 15hello: 15hello: 0aabcd');
|