| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 class A { | 5 class A { |
| 6 A() { NamingTest.count++; } | 6 A() { NamingTest.count++; } |
| 7 foo(a, b) { | 7 foo(a, b) { |
| 8 Expect.equals(1, a); | 8 Expect.equals(1, a); |
| 9 Expect.equals(2, b); | 9 Expect.equals(2, b); |
| 10 } | 10 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 factory debugger$C$C.F() { | 46 factory debugger$C$C.F() { |
| 47 return new debugger$C$C(1); | 47 return new debugger$C$C(1); |
| 48 } | 48 } |
| 49 debugger$C$C(x) : this.x = x + 9 { } | 49 debugger$C$C(x) : this.x = x + 9 { } |
| 50 debugger$C$C.C(x) : this.x = x + 10 { } | 50 debugger$C$C.C(x) : this.x = x + 10 { } |
| 51 debugger$C$C.C$C(x) : this.x = x + 11 { } | 51 debugger$C$C.C$C(x) : this.x = x + 11 { } |
| 52 debugger$C$C.C$I(x) : this.x = x + 12 { } | 52 debugger$C$C.C$I(x) : this.x = x + 12 { } |
| 53 } | 53 } |
| 54 | 54 |
| 55 class with extends debugger$C { | |
| 56 int y; | |
| 57 | |
| 58 factory with.F() { | |
| 59 return new with(1, 2); | |
| 60 } | |
| 61 with(x, y) : super(x), this.y = y + 1 { } | |
| 62 with.I(x, y) : super.C(x), this.y = y + 2 { } | |
| 63 with.C(x, y) : super.C$C(x), this.y = y + 3 { } | |
| 64 with.I$C(x, y) : super.C$I(x), this.y = y + 4 { } | |
| 65 with.C$C(x, y) : super(x), this.y = y + 5 { } | |
| 66 with.C$C$C(x, y) : super.C(x), this.y = y + 6 { } | |
| 67 with.$C$I(x, y) : super.C$C(x), this.y = y + 7 { } | |
| 68 with.$$I$C(x, y) : super.C$I(x), this.y = y + 8 { } | |
| 69 with.$(x, y) : super(x), this.y = y + 9 { } | |
| 70 with.$$(x, y) : super.C(x), this.y = y + 10 { } | |
| 71 } | |
| 72 | |
| 73 class with$I extends debugger$C { | 55 class with$I extends debugger$C { |
| 74 int y; | 56 int y; |
| 75 | 57 |
| 76 factory with$I.F() { | 58 factory with$I.F() { |
| 77 return new with$I(1, 2); | 59 return new with$I(1, 2); |
| 78 } | 60 } |
| 79 with$I(x, y) : super(x), this.y = y + 11 { } | 61 with$I(x, y) : super(x), this.y = y + 11 { } |
| 80 with$I.I(x, y) : super.C(x), this.y = y + 12 { } | 62 with$I.I(x, y) : super.C(x), this.y = y + 12 { } |
| 81 with$I.C(x, y) : super.C$C(x), this.y = y + 13 { } | 63 with$I.C(x, y) : super.C$C(x), this.y = y + 13 { } |
| 82 with$I.I$C(x, y) : super.C$I(x), this.y = y + 14 { } | 64 with$I.I$C(x, y) : super.C$I(x), this.y = y + 14 { } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 x = new debugger$C.C$I(0); | 242 x = new debugger$C.C$I(0); |
| 261 Expect.equals(8, x.x); | 243 Expect.equals(8, x.x); |
| 262 x = new debugger$C$C(0); | 244 x = new debugger$C$C(0); |
| 263 Expect.equals(9, x.x); | 245 Expect.equals(9, x.x); |
| 264 x = new debugger$C$C.C(0); | 246 x = new debugger$C$C.C(0); |
| 265 Expect.equals(10, x.x); | 247 Expect.equals(10, x.x); |
| 266 x = new debugger$C$C.C$C(0); | 248 x = new debugger$C$C.C$C(0); |
| 267 Expect.equals(11, x.x); | 249 Expect.equals(11, x.x); |
| 268 x = new debugger$C$C.C$I(0); | 250 x = new debugger$C$C.C$I(0); |
| 269 Expect.equals(12, x.x); | 251 Expect.equals(12, x.x); |
| 270 x = new with(0, 0); | |
| 271 Expect.equals(5, x.x); | |
| 272 Expect.equals(1, x.y); | |
| 273 x = new with.I(0, 0); | |
| 274 Expect.equals(6, x.x); | |
| 275 Expect.equals(2, x.y); | |
| 276 x = new with.C(0, 0); | |
| 277 Expect.equals(7, x.x); | |
| 278 Expect.equals(3, x.y); | |
| 279 x = new with.I$C(0, 0); | |
| 280 Expect.equals(8, x.x); | |
| 281 Expect.equals(4, x.y); | |
| 282 x = new with.C$C(0, 0); | |
| 283 Expect.equals(5, x.x); | |
| 284 Expect.equals(5, x.y); | |
| 285 x = new with.C$C$C(0, 0); | |
| 286 Expect.equals(6, x.x); | |
| 287 Expect.equals(6, x.y); | |
| 288 x = new with.$C$I(0, 0); | |
| 289 Expect.equals(7, x.x); | |
| 290 Expect.equals(7, x.y); | |
| 291 x = new with.$$I$C(0, 0); | |
| 292 Expect.equals(8, x.x); | |
| 293 Expect.equals(8, x.y); | |
| 294 x = new with.$(0, 0); | |
| 295 Expect.equals(5, x.x); | |
| 296 Expect.equals(9, x.y); | |
| 297 x = new with.$$(0, 0); | |
| 298 Expect.equals(6, x.x); | |
| 299 Expect.equals(10, x.y); | |
| 300 x = new with$I(0, 0); | 252 x = new with$I(0, 0); |
| 301 Expect.equals(5, x.x); | 253 Expect.equals(5, x.x); |
| 302 Expect.equals(11, x.y); | 254 Expect.equals(11, x.y); |
| 303 x = new with$I.I(0, 0); | 255 x = new with$I.I(0, 0); |
| 304 Expect.equals(6, x.x); | 256 Expect.equals(6, x.x); |
| 305 Expect.equals(12, x.y); | 257 Expect.equals(12, x.y); |
| 306 x = new with$I.C(0, 0); | 258 x = new with$I.C(0, 0); |
| 307 Expect.equals(7, x.x); | 259 Expect.equals(7, x.x); |
| 308 Expect.equals(13, x.y); | 260 Expect.equals(13, x.y); |
| 309 x = new with$I.I$C(0, 0); | 261 x = new with$I.I$C(0, 0); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 Expect.equals(37, x.y); | 332 Expect.equals(37, x.y); |
| 381 x = new with$I$C.$$I$C(0, 0); | 333 x = new with$I$C.$$I$C(0, 0); |
| 382 Expect.equals(12, x.x); | 334 Expect.equals(12, x.x); |
| 383 Expect.equals(38, x.y); | 335 Expect.equals(38, x.y); |
| 384 x = new with$I$C.$(0, 0); | 336 x = new with$I$C.$(0, 0); |
| 385 Expect.equals(9, x.x); | 337 Expect.equals(9, x.x); |
| 386 Expect.equals(39, x.y); | 338 Expect.equals(39, x.y); |
| 387 x = new with$I$C.$$(0, 0); | 339 x = new with$I$C.$$(0, 0); |
| 388 Expect.equals(10, x.x); | 340 Expect.equals(10, x.x); |
| 389 Expect.equals(40, x.y); | 341 Expect.equals(40, x.y); |
| 390 var wasCaught = false; | |
| 391 try { | |
| 392 throw new with(0, 0); | |
| 393 } on with catch (e) { | |
| 394 wasCaught = true; | |
| 395 Expect.equals(5, e.x); | |
| 396 } | |
| 397 Expect.equals(true, wasCaught); | |
| 398 } | 342 } |
| 399 | 343 |
| 400 static void testMemberMangling() { | 344 static void testMemberMangling() { |
| 401 Expect.equals(5, debugger.__PROTO__); | 345 Expect.equals(5, debugger.__PROTO__); |
| 402 new Toto().titi(); | 346 new Toto().titi(); |
| 403 } | 347 } |
| 404 | 348 |
| 405 static void testFactoryMangling() { | 349 static void testFactoryMangling() { |
| 406 var o = new debugger.F(); | 350 var o = new debugger.F(); |
| 407 Expect.equals(2, o.x); | 351 Expect.equals(2, o.x); |
| 408 o = new debugger$C.F(); | 352 o = new debugger$C.F(); |
| 409 Expect.equals(6, o.x); | 353 Expect.equals(6, o.x); |
| 410 o = new debugger$C$C.F(); | 354 o = new debugger$C$C.F(); |
| 411 Expect.equals(10, o.x); | 355 Expect.equals(10, o.x); |
| 412 o = new with.F(); | |
| 413 Expect.equals(6, o.x); | |
| 414 Expect.equals(3, o.y); | |
| 415 o = new with$I.F(); | 356 o = new with$I.F(); |
| 416 Expect.equals(6, o.x); | 357 Expect.equals(6, o.x); |
| 417 Expect.equals(13, o.y); | 358 Expect.equals(13, o.y); |
| 418 o = new with$C.F(); | 359 o = new with$C.F(); |
| 419 Expect.equals(10, o.x); | 360 Expect.equals(10, o.x); |
| 420 Expect.equals(23, o.y); | 361 Expect.equals(23, o.y); |
| 421 o = new with$I$C.F(); | 362 o = new with$I$C.F(); |
| 422 Expect.equals(10, o.x); | 363 Expect.equals(10, o.x); |
| 423 Expect.equals(33, o.y); | 364 Expect.equals(33, o.y); |
| 424 } | 365 } |
| 425 | 366 |
| 426 static testFunctionParameters() { | 367 static testFunctionParameters() { |
| 427 a(with) { | 368 a(eval) { |
| 428 return with; | |
| 429 } | |
| 430 | |
| 431 b(eval) { | |
| 432 return eval; | 369 return eval; |
| 433 } | 370 } |
| 434 | 371 |
| 435 c(arguments) { | 372 b(arguments) { |
| 436 return arguments; | 373 return arguments; |
| 437 } | 374 } |
| 438 | 375 |
| 439 Expect.equals(10, a(10)); | 376 Expect.equals(10, a(10)); |
| 440 Expect.equals(10, b(10)); | 377 Expect.equals(10, b(10)); |
| 441 Expect.equals(10, c(10)); | |
| 442 } | 378 } |
| 443 | 379 |
| 444 static testPseudoTokens() { | 380 static testPseudoTokens() { |
| 445 var EOS = 400; | 381 var EOS = 400; |
| 446 var ILLEGAL = 99; | 382 var ILLEGAL = 99; |
| 447 Expect.equals(499, EOS + ILLEGAL); | 383 Expect.equals(499, EOS + ILLEGAL); |
| 448 } | 384 } |
| 449 | 385 |
| 450 static testDollar() { | 386 static testDollar() { |
| 451 Expect.equals(123, $(123).wrapped); | 387 Expect.equals(123, $(123).wrapped); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // We check for both exceptions because the exact exception to | 438 // We check for both exceptions because the exact exception to |
| 503 // throw is hard to compute on some browsers. | 439 // throw is hard to compute on some browsers. |
| 504 (e) => e is NoSuchMethodError); | 440 (e) => e is NoSuchMethodError); |
| 505 } | 441 } |
| 506 } | 442 } |
| 507 | 443 |
| 508 main() { | 444 main() { |
| 509 NamingTest.testMain(); | 445 NamingTest.testMain(); |
| 510 Naming2Test.main(null); | 446 Naming2Test.main(null); |
| 511 } | 447 } |
| OLD | NEW |