OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library trydart.incremental_compilation_update_test; | 5 library trydart.incremental_compilation_update_test; |
6 | 6 |
7 import 'dart:html' hide | 7 import 'dart:html' hide |
8 Element; | 8 Element; |
9 | 9 |
10 import 'dart:async' show | 10 import 'dart:async' show |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 final String value; | 1390 final String value; |
1391 const C(this.value); | 1391 const C(this.value); |
1392 } | 1392 } |
1393 | 1393 |
1394 main() { | 1394 main() { |
1395 print(const C('v2').value); | 1395 print(const C('v2').value); |
1396 } | 1396 } |
1397 """, | 1397 """, |
1398 const <String>['v2']), | 1398 const <String>['v2']), |
1399 ], | 1399 ], |
| 1400 |
| 1401 // Test that an instance field can be added to a compound declaration. |
| 1402 // TODO(ahe): Test doesn't pass. |
| 1403 const <ProgramResult>[ |
| 1404 const ProgramResult( |
| 1405 r""" |
| 1406 class C { |
| 1407 int x; |
| 1408 } |
| 1409 |
| 1410 var instance; |
| 1411 |
| 1412 main() { |
| 1413 if (instance == null) { |
| 1414 print('[instance] is null'); |
| 1415 instance = new C(); |
| 1416 instance.x = 'v1'; |
| 1417 } else { |
| 1418 instance.y = 'v2'; |
| 1419 } |
| 1420 try { |
| 1421 print(instance.x); |
| 1422 } catch (e) { |
| 1423 print('[instance.x] threw'); |
| 1424 } |
| 1425 try { |
| 1426 print(instance.y); |
| 1427 } catch (e) { |
| 1428 print('[instance.y] threw'); |
| 1429 } |
| 1430 } |
| 1431 """, |
| 1432 const <String>['[instance] is null', 'v1', '[instance.y] threw']), |
| 1433 /* |
| 1434 const ProgramResult( |
| 1435 r""" |
| 1436 class C { |
| 1437 int x, y; |
| 1438 } |
| 1439 |
| 1440 var instance; |
| 1441 |
| 1442 main() { |
| 1443 if (instance == null) { |
| 1444 print('[instance] is null'); |
| 1445 instance = new C(); |
| 1446 instance.x = 'v1'; |
| 1447 } else { |
| 1448 instance.y = 'v2'; |
| 1449 } |
| 1450 try { |
| 1451 print(instance.x); |
| 1452 } catch (e) { |
| 1453 print('[instance.x] threw'); |
| 1454 } |
| 1455 try { |
| 1456 print(instance.y); |
| 1457 } catch (e) { |
| 1458 print('[instance.y] threw'); |
| 1459 } |
| 1460 } |
| 1461 """, |
| 1462 const <String>['v1', 'v2']), |
| 1463 */ |
| 1464 ], |
| 1465 |
| 1466 // Test that an instance field can be removed from a compound declaration. |
| 1467 // TODO(ahe): Test doesn't pass. |
| 1468 const <ProgramResult>[ |
| 1469 const ProgramResult( |
| 1470 r""" |
| 1471 class C { |
| 1472 int x, y; |
| 1473 } |
| 1474 |
| 1475 var instance; |
| 1476 |
| 1477 main() { |
| 1478 if (instance == null) { |
| 1479 print('[instance] is null'); |
| 1480 instance = new C(); |
| 1481 instance.x = 'v1'; |
| 1482 instance.y = 'v2'; |
| 1483 } |
| 1484 try { |
| 1485 print(instance.x); |
| 1486 } catch (e) { |
| 1487 print('[instance.x] threw'); |
| 1488 } |
| 1489 try { |
| 1490 print(instance.y); |
| 1491 } catch (e) { |
| 1492 print('[instance.y] threw'); |
| 1493 } |
| 1494 } |
| 1495 """, |
| 1496 const <String>['[instance] is null', 'v1', 'v2']), |
| 1497 /* |
| 1498 const ProgramResult( |
| 1499 r""" |
| 1500 class C { |
| 1501 int x; |
| 1502 } |
| 1503 |
| 1504 var instance; |
| 1505 |
| 1506 main() { |
| 1507 if (instance == null) { |
| 1508 print('[instance] is null'); |
| 1509 instance = new C(); |
| 1510 instance.x = 'v1'; |
| 1511 instance.y = 'v2'; |
| 1512 } |
| 1513 try { |
| 1514 print(instance.x); |
| 1515 } catch (e) { |
| 1516 print('[instance.x] threw'); |
| 1517 } |
| 1518 try { |
| 1519 print(instance.y); |
| 1520 } catch (e) { |
| 1521 print('[instance.y] threw'); |
| 1522 } |
| 1523 } |
| 1524 """, |
| 1525 const <String>['v1', '[instance.y] threw']), |
| 1526 */ |
| 1527 ], |
| 1528 |
| 1529 // Test that a static field can be made an instance field. |
| 1530 // TODO(ahe): Test doesn't pass. |
| 1531 const <ProgramResult>[ |
| 1532 const ProgramResult( |
| 1533 r""" |
| 1534 class C { |
| 1535 static int x; |
| 1536 } |
| 1537 |
| 1538 var instance; |
| 1539 |
| 1540 main() { |
| 1541 if (instance == null) { |
| 1542 print('[instance] is null'); |
| 1543 instance = new C(); |
| 1544 C.x = 'v1'; |
| 1545 } else { |
| 1546 instance.x = 'v2'; |
| 1547 } |
| 1548 try { |
| 1549 print(C.x); |
| 1550 } catch (e) { |
| 1551 print('[C.x] threw'); |
| 1552 } |
| 1553 try { |
| 1554 print(instance.x); |
| 1555 } catch (e) { |
| 1556 print('[instance.x] threw'); |
| 1557 } |
| 1558 } |
| 1559 """, |
| 1560 const <String>['[instance] is null', 'v1', '[instance.x] threw']), |
| 1561 /* |
| 1562 const ProgramResult( |
| 1563 r""" |
| 1564 class C { |
| 1565 int x; |
| 1566 } |
| 1567 |
| 1568 var instance; |
| 1569 |
| 1570 main() { |
| 1571 if (instance == null) { |
| 1572 print('[instance] is null'); |
| 1573 instance = new C(); |
| 1574 C.x = 'v1'; |
| 1575 } else { |
| 1576 instance.x = 'v2'; |
| 1577 } |
| 1578 try { |
| 1579 print(C.x); |
| 1580 } catch (e) { |
| 1581 print('[C.x] threw'); |
| 1582 } |
| 1583 try { |
| 1584 print(instance.x); |
| 1585 } catch (e) { |
| 1586 print('[instance.x] threw'); |
| 1587 } |
| 1588 } |
| 1589 """, |
| 1590 const <String>['[C.x] threw', 'v2']), |
| 1591 */ |
| 1592 ], |
| 1593 |
| 1594 // Test that instance field can be made static. |
| 1595 // TODO(ahe): Test doesn't pass. |
| 1596 const <ProgramResult>[ |
| 1597 const ProgramResult( |
| 1598 r""" |
| 1599 class C { |
| 1600 int x; |
| 1601 } |
| 1602 |
| 1603 var instance; |
| 1604 |
| 1605 main() { |
| 1606 if (instance == null) { |
| 1607 print('[instance] is null'); |
| 1608 instance = new C(); |
| 1609 instance.x = 'v1'; |
| 1610 } else { |
| 1611 C.x = 'v2'; |
| 1612 } |
| 1613 try { |
| 1614 print(C.x); |
| 1615 } catch (e) { |
| 1616 print('[C.x] threw'); |
| 1617 } |
| 1618 try { |
| 1619 print(instance.x); |
| 1620 } catch (e) { |
| 1621 print('[instance.x] threw'); |
| 1622 } |
| 1623 } |
| 1624 """, |
| 1625 const <String>['[instance] is null', '[C.x] threw', 'v1']), |
| 1626 /* |
| 1627 const ProgramResult( |
| 1628 r""" |
| 1629 class C { |
| 1630 static int x; |
| 1631 } |
| 1632 |
| 1633 var instance; |
| 1634 |
| 1635 main() { |
| 1636 if (instance == null) { |
| 1637 print('[instance] is null'); |
| 1638 instance = new C(); |
| 1639 instance.x = 'v1'; |
| 1640 } else { |
| 1641 C.x = 'v2'; |
| 1642 } |
| 1643 try { |
| 1644 print(C.x); |
| 1645 } catch (e) { |
| 1646 print('[C.x] threw'); |
| 1647 } |
| 1648 try { |
| 1649 print(instance.x); |
| 1650 } catch (e) { |
| 1651 print('[instance.x] threw'); |
| 1652 } |
| 1653 } |
| 1654 """, |
| 1655 const <String>['v2', '[instance.x] threw']), |
| 1656 */ |
| 1657 ], |
1400 ]; | 1658 ]; |
1401 | 1659 |
1402 void main() { | 1660 void main() { |
1403 listener.start(); | 1661 listener.start(); |
1404 | 1662 |
1405 document.head.append(lineNumberStyle()); | 1663 document.head.append(lineNumberStyle()); |
1406 | 1664 |
1407 summary = new SpanElement(); | 1665 summary = new SpanElement(); |
1408 document.body.append(new HeadingElement.h1() | 1666 document.body.append(new HeadingElement.h1() |
1409 ..appendText("Incremental compiler tests") | 1667 ..appendText("Incremental compiler tests") |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 position: absolute; | 1848 position: absolute; |
1591 left: 0px; | 1849 left: 0px; |
1592 width: 3em; | 1850 width: 3em; |
1593 text-align: right; | 1851 text-align: right; |
1594 background-color: lightgoldenrodyellow; | 1852 background-color: lightgoldenrodyellow; |
1595 } | 1853 } |
1596 '''); | 1854 '''); |
1597 style.type = 'text/css'; | 1855 style.type = 'text/css'; |
1598 return style; | 1856 return style; |
1599 } | 1857 } |
OLD | NEW |