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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
| | From 989da057a7b68bd9edcc72b6c15473df71490339 Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Sat, 21 Nov 2020 21:29:19 +0100
Subject: [PATCH] Make it compile with older dart version
---
build/config/compiler/BUILD.gn | 6 +-
build/config/gcc/BUILD.gn | 2 +-
build/dart/dart_action.gni | 6 +-
.../lib/src/analyzer/code_generator.dart | 64 +++----
.../lib/src/analyzer/property_model.dart | 18 +-
.../lib/src/analyzer/type_utilities.dart | 4 +-
.../lib/src/compiler/js_metalet.dart | 8 +-
.../lib/src/compiler/js_names.dart | 2 +-
.../lib/src/compiler/module_builder.dart | 14 +-
.../lib/src/compiler/shared_compiler.dart | 10 +-
pkg/dev_compiler/lib/src/js_ast/builder.dart | 158 +++++++++---------
pkg/dev_compiler/lib/src/js_ast/nodes.dart | 16 +-
pkg/dev_compiler/lib/src/js_ast/printer.dart | 14 +-
pkg/dev_compiler/lib/src/js_ast/template.dart | 118 ++++++-------
pkg/dev_compiler/lib/src/kernel/compiler.dart | 122 +++++++-------
.../lib/src/kernel/constants.dart | 12 +-
.../lib/src/kernel/native_types.dart | 6 +-
.../lib/src/kernel/nullable_inference.dart | 8 +-
.../lib/src/kernel/property_model.dart | 10 +-
pkg/dev_compiler/lib/src/kernel/target.dart | 20 +--
.../lib/src/kernel/type_table.dart | 4 +-
pkg/dev_compiler/tool/kernel_sdk.dart | 16 +-
pkg/dev_compiler/tool/patch_sdk.dart | 36 ++--
pkg/front_end/tool/fasta | 2 +-
pkg/js_ast/lib/src/builder.dart | 2 +-
runtime/BUILD.gn | 6 +-
sdk/BUILD.gn | 68 ++++----
tools/observatory_tool.py | 2 +-
utils/application_snapshot.gni | 6 +-
utils/dartdevc/BUILD.gn | 8 +-
30 files changed, 385 insertions(+), 383 deletions(-)
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 8154e4e9a2..ec56ca353e 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -578,9 +578,9 @@ config("chromium_code") {
cflags = []
} else {
cflags = [
- "-Wall",
- "-Wextra",
- "-Werror",
+ # "-Wall",
+ # "-Wextra",
+ # -Werror,
]
defines = []
diff --git a/build/config/gcc/BUILD.gn b/build/config/gcc/BUILD.gn
index 110f1cceb5..93517f0496 100644
--- a/build/config/gcc/BUILD.gn
+++ b/build/config/gcc/BUILD.gn
@@ -35,7 +35,7 @@ config("executable_ldconfig") {
# Newer binutils don't set DT_RPATH unless you disable "new" dtags
# and the new DT_RUNPATH doesn't work without --no-as-needed flag.
- "-Wl,--disable-new-dtags",
+ "-Wl,--enable-new-dtags",
]
}
}
diff --git a/build/dart/dart_action.gni b/build/dart/dart_action.gni
index 91f5e293f8..f7e81ac593 100644
--- a/build/dart/dart_action.gni
+++ b/build/dart/dart_action.gni
@@ -224,12 +224,12 @@ template("prebuilt_dart_action") {
forward_variables_from(invoker, "*")
if (_is_fuchsia) {
binary = prebuilt_dart
- dfe = "$prebuilt_dart_sdk/bin/snapshots/kernel-service.dart.snapshot"
+ # dfe = "$prebuilt_dart_sdk/bin/snapshots/kernel-service.dart.snapshot"
} else {
binary =
"$_dart_root/tools/sdks/$host_os/dart-sdk/bin/dart$executable_suffix"
- dfe =
- "$_dart_root/tools/sdks/$host_os/dart-sdk/bin/snapshots/kernel-service.dart.snapshot"
+ # dfe =
+ # "$_dart_root/tools/sdks/$host_os/dart-sdk/bin/snapshots/kernel-service.dart.snapshot"
}
target = "$_dart_root/runtime/bin:dart_bootstrap"
}
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index fdda18f780..6b545ef850 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -91,10 +91,10 @@ class CodeGenerator extends Object
///
/// We sometimes special case codegen for a single library, as it simplifies
/// name scoping requirements.
- final _libraries = Map<LibraryElement, JS.Identifier>();
+ final _libraries = new Map<LibraryElement, JS.Identifier>();
/// Imported libraries, and the temporaries used to refer to them.
- final _imports = Map<LibraryElement, JS.TemporaryId>();
+ final _imports = new Map<LibraryElement, JS.TemporaryId>();
/// The list of dart:_runtime SDK functions; these are assumed by other code
/// in the SDK to be generated before anything else.
@@ -118,10 +118,10 @@ class CodeGenerator extends Object
/// In an async* function, this represents the stream controller parameter.
JS.TemporaryId _asyncStarController;
- final _initializingFormalTemps = HashMap<ParameterElement, JS.TemporaryId>();
+ final _initializingFormalTemps = new HashMap<ParameterElement, JS.TemporaryId>();
JS.Identifier _extensionSymbolsModule;
- final _extensionSymbols = Map<String, JS.TemporaryId>();
+ final _extensionSymbols = new Map<String, JS.TemporaryId>();
/// The type provider from the current Analysis [context].
final TypeProvider types;
@@ -200,9 +200,9 @@ class CodeGenerator extends Object
/// Information about virtual fields for all libraries in the current build
/// unit.
- final virtualFields = VirtualFieldModel();
+ final virtualFields = new VirtualFieldModel();
- final _usedCovariantPrivateMembers = HashSet<ExecutableElement>();
+ final _usedCovariantPrivateMembers = new HashSet<ExecutableElement>();
CodeGenerator(
AnalysisContext c, this.summaryData, this.options, this._extensionTypes)
@@ -326,8 +326,8 @@ class CodeGenerator extends Object
_extensionSymbolsModule = JS.Identifier('dartx');
} else {
// Otherwise allow these to be renamed so users can write them.
- runtimeModule = JS.TemporaryId('dart');
- _extensionSymbolsModule = JS.TemporaryId('dartx');
+ runtimeModule = new JS.TemporaryId('dart');
+ _extensionSymbolsModule = new JS.TemporaryId('dartx');
}
_typeTable = TypeTable(runtimeModule);
@@ -1147,7 +1147,7 @@ class CodeGenerator extends Object
if (isClassSymbol == null) {
// TODO(jmesserly): we could export these symbols, if we want to mark
// implemented interfaces for user-defined classes.
- var id = JS.TemporaryId("_is_${classElem.name}_default");
+ var id = new JS.TemporaryId("_is_${classElem.name}_default");
moduleItems.add(
js.statement('const # = Symbol(#);', [id, js.string(id.name, "'")]));
isClassSymbol = id;
@@ -1250,7 +1250,7 @@ class CodeGenerator extends Object
.toStatement();
}
var classExpr = JS.ClassExpression(
- JS.TemporaryId(classElem.name), heritage, methods,
+ new JS.TemporaryId(classElem.name), heritage, methods,
typeParams: typeParams, fields: jsFields);
return js.statement('# = #;', [className, classExpr]);
}
@@ -1378,8 +1378,8 @@ class CodeGenerator extends Object
// mixinMembers(C, class C$ extends M { <methods> });
mixinBody.add(runtimeStatement('mixinMembers(#, #)', [
classExpr,
- JS.ClassExpression(
- JS.TemporaryId(classElem.name), mixinClass, methods)
+ new JS.ClassExpression(
+ new JS.TemporaryId(classElem.name), mixinClass, methods)
]));
}
@@ -1391,10 +1391,10 @@ class CodeGenerator extends Object
var m = classElem.mixins[i];
var mixinString = classElem.supertype.name + '_' + m.name;
- var mixinClassName = JS.TemporaryId(mixinString);
- var mixinId = JS.TemporaryId(mixinString + '\$');
+ var mixinClassName = new JS.TemporaryId(mixinString);
+ var mixinId = new JS.TemporaryId(mixinString + '\$');
var mixinClassExpression =
- JS.ClassExpression(mixinClassName, baseClass, []);
+ new JS.ClassExpression(mixinClassName, baseClass, []);
// Bind the mixin class to a name to workaround a V8 bug with es6 classes
// and anonymous function names.
// TODO(leafp:) Eliminate this once the bug is fixed:
@@ -1447,10 +1447,10 @@ class CodeGenerator extends Object
// Generate setter
if (!decl.isFinal) {
- var value = JS.TemporaryId('value');
- fn = JS.Fun([value], js.block('{ this.# = #; }', [name, value]));
+ var value = new JS.TemporaryId('value');
+ fn = new JS.Fun([value], js.block('{ this.# = #; }', [name, value]));
method =
- JS.Method(_declareMemberName(field.setter), fn, isSetter: true);
+ new JS.Method(_declareMemberName(field.setter), fn, isSetter: true);
jsMethods.add(method);
}
}
@@ -2864,8 +2864,8 @@ class CodeGenerator extends Object
var name = element.name;
JS.Expression gen = genFn;
if (name.isNotEmpty) {
- gen = JS.NamedFunction(
- JS.TemporaryId(JS.friendlyNameForDartOperator[name] ?? name),
+ gen = new JS.NamedFunction(
+ new JS.TemporaryId(JS.friendlyNameForDartOperator[name] ?? name),
genFn);
}
gen.sourceInformation = _functionEnd(body);
@@ -2916,7 +2916,7 @@ class CodeGenerator extends Object
// `await` is generated as `yield`.
//
// _AsyncStarImpl has an example of the generated code.
- var asyncStarParam = JS.TemporaryId('stream');
+ var asyncStarParam = new JS.TemporaryId('stream');
var gen = emitGeneratorFn([asyncStarParam], asyncStarParam);
var asyncStarImpl = asyncStarImplType.instantiate([returnType]);
@@ -3132,11 +3132,11 @@ class CodeGenerator extends Object
/// The renamer would handle this, but it would prefer to rename the
/// temporary used for the private symbol. Instead rename the parameter.
return _initializingFormalTemps.putIfAbsent(
- element, () => JS.TemporaryId(element.name.substring(1)));
+ element, () => new JS.TemporaryId(element.name.substring(1)));
}
var type = declaration ? emitTypeRef(element.type) : null;
- return JS.Identifier(element.name, type: type);
+ return new JS.Identifier(element.name, type: type);
}
List<Annotation> _parameterMetadata(FormalParameter p) =>
@@ -3699,7 +3699,7 @@ class CodeGenerator extends Object
? 'function(x) { super[#] = x; }'
: 'function() { return super[#]; }',
[jsName]);
- return JS.Method(JS.TemporaryId(member.variable.name), fn,
+ return new JS.Method(new JS.TemporaryId(member.variable.name), fn,
isGetter: !isSetter, isSetter: isSetter);
} else {
var method = member as MethodElement;
@@ -3710,17 +3710,17 @@ class CodeGenerator extends Object
params.add(namedArgumentTemp);
break;
}
- params.add(JS.Identifier(param.name));
+ params.add(new JS.Identifier(param.name));
}
var fn = js.fun(
'function(#) { return super[#](#); }', [params, jsName, params]);
var name = method.name;
name = JS.friendlyNameForDartOperator[name] ?? name;
- return JS.Method(JS.TemporaryId(name), fn);
+ return new JS.Method(new JS.TemporaryId(name), fn);
}
});
- return JS.PropertyAccess(JS.This(), jsMethod.name);
+ return new JS.PropertyAccess(new JS.This(), jsMethod.name);
}
JS.Expression _emitMethodCall(Expression target, MethodInvocation node) {
@@ -4900,7 +4900,7 @@ class CodeGenerator extends Object
var id = astFactory
.simpleIdentifier(StringToken(TokenType.IDENTIFIER, name, -1));
- variable ??= JS.TemporaryId(name);
+ variable ??= new JS.TemporaryId(name);
var idElement = TemporaryVariableElement.forNode(id, variable)
..enclosingElement = _currentElement;
@@ -4925,7 +4925,7 @@ class CodeGenerator extends Object
// params are available.
if (_currentFunction == null || usesTypeParams) return jsExpr;
- var temp = JS.TemporaryId('const');
+ var temp = new JS.TemporaryId('const');
moduleItems.add(js.statement('let #;', [temp]));
return js.call('# || (# = #)', [temp, temp, jsExpr]);
}
@@ -5462,7 +5462,7 @@ class CodeGenerator extends Object
streamIterator.element.unnamedConstructor,
streamIterator,
() => [_visitExpression(node.iterable)]);
- var iter = JS.TemporaryId('iter');
+ var iter = new JS.TemporaryId('iter');
var variable = node.identifier ?? node.loopVariable.identifier;
var init = _visitExpression(node.identifier);
if (init == null) {
@@ -6068,7 +6068,7 @@ class CodeGenerator extends Object
JS.TemporaryId _getExtensionSymbolInternal(String name) {
return _extensionSymbols.putIfAbsent(
name,
- () => JS.TemporaryId(
+ () => new JS.TemporaryId(
'\$${JS.friendlyNameForDartOperator[name] ?? name}'));
}
@@ -6141,7 +6141,7 @@ class CodeGenerator extends Object
// It's either one of the libraries in this module, or it's an import.
return _libraries[library] ??
_imports.putIfAbsent(library,
- () => JS.TemporaryId(jsLibraryName(_libraryRoot, library)));
+ () => new JS.TemporaryId(jsLibraryName(_libraryRoot, library)));
}
T closureAnnotate<T extends JS.Node>(
diff --git a/pkg/dev_compiler/lib/src/analyzer/property_model.dart b/pkg/dev_compiler/lib/src/analyzer/property_model.dart
index b625554e1c..2f6b38fc46 100644
--- a/pkg/dev_compiler/lib/src/analyzer/property_model.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/property_model.dart
@@ -22,11 +22,11 @@ import 'extension_types.dart';
/// which members are private and thus, could not be overridden outside of the
/// current library.
class VirtualFieldModel {
- final _modelForLibrary = HashMap<LibraryElement, _LibraryVirtualFieldModel>();
+ final _modelForLibrary = new HashMap<LibraryElement, _LibraryVirtualFieldModel>();
_LibraryVirtualFieldModel _getModel(LibraryElement library) =>
_modelForLibrary.putIfAbsent(
- library, () => _LibraryVirtualFieldModel.build(library));
+ library, () => new _LibraryVirtualFieldModel.build(library));
/// Returns true if a field is virtual.
bool isVirtual(FieldElement field) =>
@@ -41,7 +41,7 @@ class _LibraryVirtualFieldModel {
///
/// This means we must generate them as virtual fields using a property pair
/// in JavaScript.
- final _overriddenPrivateFields = HashSet<FieldElement>();
+ final _overriddenPrivateFields = new HashSet<FieldElement>();
/// Private classes that can be extended outside of this library.
///
@@ -55,7 +55,7 @@ class _LibraryVirtualFieldModel {
/// class C extends _A {}
///
/// The class _A must treat is "x" as virtual, however _B does not.
- final _extensiblePrivateClasses = HashSet<ClassElement>();
+ final _extensiblePrivateClasses = new HashSet<ClassElement>();
_LibraryVirtualFieldModel.build(LibraryElement library) {
var allTypes = library.units.expand((u) => u.types).toList();
@@ -176,18 +176,18 @@ class ClassPropertyModel {
/// The set of inherited getters, used because JS getters/setters are paired,
/// so if we're generating a setter we may need to emit a getter that calls
/// super.
- final inheritedGetters = HashSet<String>();
+ final inheritedGetters = new HashSet<String>();
/// The set of inherited setters, used because JS getters/setters are paired,
/// so if we're generating a getter we may need to emit a setter that calls
/// super.
- final inheritedSetters = HashSet<String>();
+ final inheritedSetters = new HashSet<String>();
final mockMembers = <String, ExecutableElement>{};
- final extensionMethods = Set<String>();
+ final extensionMethods = new Set<String>();
- final extensionAccessors = Set<String>();
+ final extensionAccessors = new Set<String>();
/// Parameters that are covariant due to covariant generics.
final Set<Element> covariantParameters;
@@ -245,7 +245,7 @@ class ClassPropertyModel {
covariantParameters != null &&
covariantParameters.contains(setter.parameters[0]) &&
covariantPrivateMembers.contains(setter)) {
- virtualFields[field] = JS.TemporaryId(name);
+ virtualFields[field] = new JS.TemporaryId(name);
}
}
}
diff --git a/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart b/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart
index f1bef3c158..4695e421a1 100644
--- a/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart
@@ -43,7 +43,7 @@ class _CacheTable {
// Use a LinkedHashMap to maintain key insertion order so the generated code
// is stable under slight perturbation. (If this is not good enough we could
// sort by name to canonicalize order.)
- final _names = LinkedHashMap<DartType, JS.TemporaryId>(
+ final _names = new LinkedHashMap<DartType, JS.TemporaryId>(
equals: typesAreEqual, hashCode: typeHashCode);
Iterable<DartType> get keys => _names.keys.toList();
@@ -109,7 +109,7 @@ class _CacheTable {
/// Heuristically choose a good name for the cache and generator
/// variables.
JS.TemporaryId chooseTypeName(DartType type) {
- return JS.TemporaryId(_typeString(type));
+ return new JS.TemporaryId(_typeString(type));
}
}
diff --git a/pkg/dev_compiler/lib/src/compiler/js_metalet.dart b/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
index 65cfe52ca0..57f143d062 100644
--- a/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
+++ b/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
@@ -213,9 +213,9 @@ class MetaLet extends Expression {
substitutions[variable] = init;
} else {
// Otherwise replace it with a temp, which will be assigned once.
- var temp = TemporaryId(variable.displayName);
+ var temp = new TemporaryId(variable.displayName);
substitutions[variable] = temp;
- initializers.add(VariableInitialization(temp, init));
+ initializers.add(new VariableInitialization(temp, init));
}
});
@@ -223,10 +223,10 @@ class MetaLet extends Expression {
node = _substitute(node, substitutions);
if (initializers.isNotEmpty) {
var first = initializers[0];
- node = Block([
+ node = new Block([
initializers.length == 1
? first.value.toVariableDeclaration(first.declaration)
- : VariableDeclarationList('let', initializers).toStatement(),
+ : new VariableDeclarationList('let', initializers).toStatement(),
node
]);
}
diff --git a/pkg/dev_compiler/lib/src/compiler/js_names.dart b/pkg/dev_compiler/lib/src/compiler/js_names.dart
index 7de9cf9293..958eb51e74 100644
--- a/pkg/dev_compiler/lib/src/compiler/js_names.dart
+++ b/pkg/dev_compiler/lib/src/compiler/js_names.dart
@@ -34,7 +34,7 @@ class MaybeQualifiedId extends Expression {
/// Helper to create an [Identifier] from something that starts as a property.
static Identifier identifier(LiteralString propertyName) =>
- Identifier(propertyName.valueWithoutQuotes);
+ new Identifier(propertyName.valueWithoutQuotes);
void setQualified(bool qualified) {
var name = this.name;
diff --git a/pkg/dev_compiler/lib/src/compiler/module_builder.dart b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
index a3f41e05a7..88745ae71d 100644
--- a/pkg/dev_compiler/lib/src/compiler/module_builder.dart
+++ b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
@@ -150,7 +150,7 @@ class LegacyModuleBuilder extends _ModuleBuilder {
visitProgram(module);
// Build import parameters.
- var exportsVar = TemporaryId('exports');
+ var exportsVar = new TemporaryId('exports');
var parameters = <TemporaryId>[exportsVar];
var importNames = <Expression>[];
var importStatements = <Statement>[];
@@ -158,7 +158,7 @@ class LegacyModuleBuilder extends _ModuleBuilder {
importNames.add(import.from);
// TODO(jmesserly): we could use destructuring here.
var moduleVar =
- TemporaryId(pathToJSIdentifier(import.from.valueWithoutQuotes));
+ new TemporaryId(pathToJSIdentifier(import.from.valueWithoutQuotes));
parameters.add(moduleVar);
for (var importName in import.namedImports) {
assert(!importName.isStar); // import * not supported in legacy modules.
@@ -195,8 +195,8 @@ class LegacyModuleBuilder extends _ModuleBuilder {
var functionName =
'load__' + pathToJSIdentifier(module.name.replaceAll('.', '_'));
- var resultModule = NamedFunction(
- Identifier(functionName),
+ var resultModule = new NamedFunction(
+ new Identifier(functionName),
js.fun("function(#) { 'use strict'; #; }", [parameters, statements]),
true);
@@ -224,7 +224,7 @@ class CommonJSModuleBuilder extends _ModuleBuilder {
for (var import in imports) {
// TODO(jmesserly): we could use destructuring here.
var moduleVar =
- TemporaryId(pathToJSIdentifier(import.from.valueWithoutQuotes));
+ new TemporaryId(pathToJSIdentifier(import.from.valueWithoutQuotes));
importStatements
.add(js.statement('const # = require(#);', [moduleVar, import.from]));
@@ -240,7 +240,7 @@ class CommonJSModuleBuilder extends _ModuleBuilder {
statements.insertAll(0, importStatements);
if (exports.isNotEmpty) {
- var exportsVar = Identifier('exports');
+ var exportsVar = new Identifier('exports');
statements.add(js.comment('Exports:'));
for (var export in exports) {
var names = export.exportedNames;
@@ -274,7 +274,7 @@ class AmdModuleBuilder extends _ModuleBuilder {
for (var import in imports) {
// TODO(jmesserly): we could use destructuring once Atom supports it.
var moduleVar =
- TemporaryId(pathToJSIdentifier(import.from.valueWithoutQuotes));
+ new TemporaryId(pathToJSIdentifier(import.from.valueWithoutQuotes));
fnParams.add(moduleVar);
dependencies.add(import.from);
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart b/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
index f716813f98..fce7213524 100644
--- a/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
+++ b/pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
@@ -21,9 +21,9 @@ abstract class SharedCompiler<Library> {
final List<JS.Identifier> _operatorSetResultStack = [];
JS.Identifier runtimeModule;
- final namedArgumentTemp = JS.TemporaryId('opts');
+ final namedArgumentTemp = new JS.TemporaryId('opts');
- final _privateNames = HashMap<Library, HashMap<String, JS.TemporaryId>>();
+ final _privateNames = new HashMap<Library, HashMap<String, JS.TemporaryId>>();
/// The list of output module items, in the order they need to be emitted in.
final moduleItems = <JS.ModuleItem>[];
@@ -43,7 +43,7 @@ abstract class SharedCompiler<Library> {
bool Function() isLastParamMutated) {
if (name == '[]=') {
_operatorSetResultStack.add(isLastParamMutated()
- ? JS.TemporaryId((formals.last as JS.Identifier).name)
+ ? new JS.TemporaryId((formals.last as JS.Identifier).name)
: formals.last);
} else {
_operatorSetResultStack.add(null);
@@ -128,13 +128,13 @@ abstract class SharedCompiler<Library> {
}
JS.TemporaryId emitPrivateNameSymbol(Library library, String name) {
- return _privateNames.putIfAbsent(library, () => HashMap()).putIfAbsent(name,
+ return _privateNames.putIfAbsent(library, () => new HashMap()).putIfAbsent(name,
() {
var idName = name;
if (idName.endsWith('=')) {
idName = idName.replaceAll('=', '_');
}
- var id = JS.TemporaryId(idName);
+ var id = new JS.TemporaryId(idName);
moduleItems.add(
js.statement('const # = Symbol(#);', [id, js.string(name, "'")]));
return id;
diff --git a/pkg/dev_compiler/lib/src/js_ast/builder.dart b/pkg/dev_compiler/lib/src/js_ast/builder.dart
index 117f447785..052fb15d66 100644
--- a/pkg/dev_compiler/lib/src/js_ast/builder.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/builder.dart
@@ -15,7 +15,7 @@ part of js_ast;
* TODO(sra): Find the remaining places where js('xxx') used to parse an
* unbounded number of expression, or institute a cache policy.
*/
-TemplateManager templateManager = TemplateManager();
+TemplateManager templateManager = new TemplateManager();
/**
@@ -188,7 +188,7 @@ What is not implemented:
var # = 1;
*/
-const JsBuilder js = JsBuilder();
+JsBuilder js = new JsBuilder();
class JsBuilder {
const JsBuilder();
@@ -307,7 +307,7 @@ class JsBuilder {
// > closing quote code points, U+005C (REVERSE SOLIDUS),
// > U+000D (CARRIAGE RETURN), U+2028 (LINE SEPARATOR),
// > U+2029 (PARAGRAPH SEPARATOR), and U+000A (LINE FEED).
- var re = RegExp('[\n\r$quoteReplace\b\f\t\v\u2028\u2029]');
+ var re = new RegExp('[\n\r$quoteReplace\b\f\t\v\u2028\u2029]');
escaped = escaped.replaceAllMapped(re, (m) {
switch (m.group(0)) {
case "\n":
@@ -412,7 +412,7 @@ class MiniJsParserError {
// Replace non-tabs with spaces, giving a print indent that matches the text
// for tabbing.
- String spaces = prefix.replaceAll(RegExp(r'[^\t]'), ' ');
+ String spaces = prefix.replaceAll(new RegExp(r'[^\t]'), ' ');
return 'Error in MiniJsParser:\n${src}\n$spaces^\n$spaces$message\n';
}
}
@@ -822,28 +822,28 @@ class MiniJsParser {
String last = lastToken;
if (acceptCategory(ALPHA)) {
if (last == "true") {
- return LiteralBool(true);
+ return new LiteralBool(true);
} else if (last == "false") {
- return LiteralBool(false);
+ return new LiteralBool(false);
} else if (last == "null") {
- return LiteralNull();
+ return new LiteralNull();
} else if (last == "function") {
return parseFunctionExpression();
} else if (last == "this") {
- return This();
+ return new This();
} else if (last == "super") {
- return Super();
+ return new Super();
} else if (last == "class") {
return parseClass();
} else {
- return Identifier(last);
+ return new Identifier(last);
}
} else if (acceptCategory(LPAREN)) {
return parseExpressionOrArrowFunction();
} else if (acceptCategory(STRING)) {
- return LiteralString(last);
+ return new LiteralString(last);
} else if (acceptCategory(NUMERIC)) {
- return LiteralNumber(last);
+ return new LiteralNumber(last);
} else if (acceptCategory(LBRACE)) {
return parseObjectInitializer();
} else if (acceptCategory(LSQUARE)) {
@@ -851,7 +851,7 @@ class MiniJsParser {
while (true) {
if (acceptCategory(COMMA)) {
- values.add(ArrayHole());
+ values.add(new ArrayHole());
continue;
}
if (acceptCategory(RSQUARE)) break;
@@ -865,7 +865,7 @@ class MiniJsParser {
getToken();
String flags = lastToken;
if (!acceptCategory(ALPHA)) flags = "";
- Expression expression = RegExpLiteral(regexp + flags);
+ Expression expression = new RegExpLiteral(regexp + flags);
return expression;
} else if (acceptCategory(HASH)) {
return parseInterpolatedExpression();
@@ -876,13 +876,13 @@ class MiniJsParser {
}
InterpolatedExpression parseInterpolatedExpression() {
- var expression = InterpolatedExpression(parseHash());
+ var expression = new InterpolatedExpression(parseHash());
interpolatedValues.add(expression);
return expression;
}
InterpolatedIdentifier parseInterpolatedIdentifier() {
- var id = InterpolatedIdentifier(parseHash());
+ var id = new InterpolatedIdentifier(parseHash());
interpolatedValues.add(id);
return id;
}
@@ -891,7 +891,7 @@ class MiniJsParser {
if (acceptCategory(HASH)) {
return parseInterpolatedIdentifier();
} else {
- var id = Identifier(lastToken);
+ var id = new Identifier(lastToken);
expectCategory(ALPHA);
return id;
}
@@ -920,13 +920,13 @@ class MiniJsParser {
if (acceptCategory(ELLIPSIS)) {
var params = <Parameter>[];
_expressionToParameterList(expression, params);
- params.add(RestParameter(parseParameter()));
+ params.add(new RestParameter(parseParameter()));
expectCategory(RPAREN);
expectCategory(ARROW);
return parseArrowFunctionBody(params);
}
Expression right = parseAssignment();
- expression = Binary(',', expression, right);
+ expression = new Binary(',', expression, right);
}
expectCategory(RPAREN);
if (acceptCategory(ARROW)) {
@@ -952,7 +952,7 @@ class MiniJsParser {
_expressionToParameterList(node.left, params);
_expressionToParameterList(node.right, params);
} else if (node is InterpolatedExpression) {
- params.add(InterpolatedParameter(node.nameOrPosition));
+ params.add(new InterpolatedParameter(node.nameOrPosition));
} else {
error("Expected arrow function parameter list");
}
@@ -965,14 +965,14 @@ class MiniJsParser {
} else {
body = parseAssignment();
}
- return ArrowFun(params, body);
+ return new ArrowFun(params, body);
}
Expression parseFunctionExpression() {
String last = lastToken;
if (acceptCategory(ALPHA)) {
String functionName = last;
- return NamedFunction(Identifier(functionName), parseFun());
+ return new NamedFunction(new Identifier(functionName), parseFun());
}
return parseFun();
}
@@ -984,7 +984,7 @@ class MiniJsParser {
if (!acceptCategory(RPAREN)) {
for (;;) {
if (acceptCategory(ELLIPSIS)) {
- params.add(RestParameter(parseParameter()));
+ params.add(new RestParameter(parseParameter()));
expectCategory(RPAREN);
break;
}
@@ -1018,14 +1018,14 @@ class MiniJsParser {
Identifier parseParameter() {
if (acceptCategory(HASH)) {
var nameOrPosition = parseHash();
- var parameter = InterpolatedParameter(nameOrPosition);
+ var parameter = new InterpolatedParameter(nameOrPosition);
interpolatedValues.add(parameter);
return parameter;
} else {
// TODO(jmesserly): validate this is not a keyword
String argumentName = lastToken;
expectCategory(ALPHA);
- return Identifier(argumentName);
+ return new Identifier(argumentName);
}
}
@@ -1043,7 +1043,7 @@ class MiniJsParser {
if (acceptCategory(RBRACE)) break;
expectCategory(COMMA);
}
- return ObjectInitializer(properties);
+ return new ObjectInitializer(properties);
}
Expression parseMember() {
@@ -1054,7 +1054,7 @@ class MiniJsParser {
} else if (acceptCategory(LSQUARE)) {
Expression inBraces = parseExpression();
expectCategory(RSQUARE);
- receiver = PropertyAccess(receiver, inBraces);
+ receiver = new PropertyAccess(receiver, inBraces);
} else {
break;
}
@@ -1071,7 +1071,7 @@ class MiniJsParser {
if (!acceptCategory(RPAREN)) {
while (true) {
if (acceptCategory(ELLIPSIS)) {
- arguments.add(Spread(parseAssignment()));
+ arguments.add(new Spread(parseAssignment()));
expectCategory(RPAREN);
break;
}
@@ -1081,12 +1081,12 @@ class MiniJsParser {
}
}
receiver =
- constructor ? New(receiver, arguments) : Call(receiver, arguments);
+ constructor ? new New(receiver, arguments) : new Call(receiver, arguments);
constructor = false;
} else if (!constructor && acceptCategory(LSQUARE)) {
Expression inBraces = parseExpression();
expectCategory(RSQUARE);
- receiver = PropertyAccess(receiver, inBraces);
+ receiver = new PropertyAccess(receiver, inBraces);
} else if (!constructor && acceptCategory(DOT)) {
receiver = getDotRhs(receiver);
} else {
@@ -1101,9 +1101,9 @@ class MiniJsParser {
Expression getDotRhs(Expression receiver) {
if (acceptCategory(HASH)) {
var nameOrPosition = parseHash();
- InterpolatedSelector property = InterpolatedSelector(nameOrPosition);
+ InterpolatedSelector property = new InterpolatedSelector(nameOrPosition);
interpolatedValues.add(property);
- return PropertyAccess(receiver, property);
+ return new PropertyAccess(receiver, property);
}
String identifier = lastToken;
// In ES5 keywords like delete and continue are allowed as property
@@ -1139,8 +1139,8 @@ class MiniJsParser {
if (lastCategory == SYMBOL &&
UNARY_OPERATORS.contains(operator) &&
(acceptString("++") || acceptString("--") || acceptString('await'))) {
- if (operator == "await") return Await(parsePostfix());
- return Prefix(operator, parsePostfix());
+ if (operator == "await") return new Await(parsePostfix());
+ return new Prefix(operator, parsePostfix());
}
return parsePostfix();
}
@@ -1152,8 +1152,8 @@ class MiniJsParser {
operator != "++" &&
operator != "--") {
expectCategory(SYMBOL);
- if (operator == "await") return Await(parsePostfix());
- return Prefix(operator, parseUnaryLow());
+ if (operator == "await") return new Await(parsePostfix());
+ return new Prefix(operator, parseUnaryLow());
}
return parseUnaryHigh();
}
@@ -1172,17 +1172,17 @@ class MiniJsParser {
}
expectCategory(SYMBOL);
if (rhs == null || BINARY_PRECEDENCE[symbol] >= minPrecedence) {
- if (rhs != null) lhs = Binary(lastSymbol, lhs, rhs);
+ if (rhs != null) lhs = new Binary(lastSymbol, lhs, rhs);
minPrecedence = BINARY_PRECEDENCE[symbol];
rhs = parseUnaryLow();
lastSymbol = symbol;
} else {
Expression higher = parseBinary(BINARY_PRECEDENCE[symbol]);
- rhs = Binary(symbol, rhs, higher);
+ rhs = new Binary(symbol, rhs, higher);
}
}
if (rhs == null) return lhs;
- return Binary(lastSymbol, lhs, rhs);
+ return new Binary(lastSymbol, lhs, rhs);
}
Expression parseConditional() {
@@ -1191,7 +1191,7 @@ class MiniJsParser {
Expression ifTrue = parseAssignment();
expectCategory(COLON);
Expression ifFalse = parseAssignment();
- return Conditional(lhs, ifTrue, ifFalse);
+ return new Conditional(lhs, ifTrue, ifFalse);
}
Expression parseLeftHandSide() => parseConditional();
@@ -1202,7 +1202,7 @@ class MiniJsParser {
if (acceptCategory(ASSIGNMENT)) {
Expression rhs = parseAssignment();
if (assignmentOperator == "=") {
- return Assignment(lhs, rhs);
+ return new Assignment(lhs, rhs);
} else {
// Handle +=, -=, etc.
String operator =
@@ -1217,7 +1217,7 @@ class MiniJsParser {
Expression expression = parseAssignment();
while (acceptCategory(COMMA)) {
Expression right = parseAssignment();
- expression = Binary(',', expression, right);
+ expression = new Binary(',', expression, right);
}
return expression;
}
@@ -1230,17 +1230,17 @@ class MiniJsParser {
do {
VariableBinding declarator;
if (firstIdentifier != null) {
- declarator = Identifier(firstIdentifier);
+ declarator = new Identifier(firstIdentifier);
firstIdentifier = null;
} else {
declarator = parseVariableBinding();
}
var initializer = acceptString("=") ? parseAssignment() : null;
- initialization.add(VariableInitialization(declarator, initializer));
+ initialization.add(new VariableInitialization(declarator, initializer));
} while (acceptCategory(COMMA));
- return VariableDeclarationList(keyword, initialization);
+ return new VariableDeclarationList(keyword, initialization);
}
VariableBinding parseVariableBinding() {
@@ -1291,12 +1291,12 @@ class MiniJsParser {
if (acceptString("=")) {
defaultValue = parseExpression();
}
- variables.add(DestructuredVariable(
+ variables.add(new DestructuredVariable(
name: name, structure: structure, defaultValue: defaultValue));
} while (acceptCategory(COMMA));
expectCategory(RSQUARE);
- return ArrayBindingPattern(variables);
+ return new ArrayBindingPattern(variables);
}
ObjectBindingPattern parseObjectBindingPattern() {
@@ -1311,12 +1311,12 @@ class MiniJsParser {
} else if (acceptString("=")) {
defaultValue = parseExpression();
}
- variables.add(DestructuredVariable(
+ variables.add(new DestructuredVariable(
name: name, structure: structure, defaultValue: defaultValue));
} while (acceptCategory(COMMA));
expectCategory(RBRACE);
- return ObjectBindingPattern(variables);
+ return new ObjectBindingPattern(variables);
}
Expression parseVarDeclarationOrExpression() {
@@ -1360,13 +1360,13 @@ class MiniJsParser {
Statement statement = parseStatement();
statements.add(statement);
}
- return Block(statements);
+ return new Block(statements);
}
Statement parseStatement() {
if (acceptCategory(LBRACE)) return parseBlock();
- if (acceptCategory(SEMICOLON)) return EmptyStatement();
+ if (acceptCategory(SEMICOLON)) return new EmptyStatement();
if (lastCategory == ALPHA) {
if (acceptString('return')) return parseReturn();
@@ -1374,16 +1374,16 @@ class MiniJsParser {
if (acceptString('throw')) return parseThrow();
if (acceptString('break')) {
- return parseBreakOrContinue((label) => Break(label));
+ return parseBreakOrContinue((label) => new Break(label));
}
if (acceptString('continue')) {
- return parseBreakOrContinue((label) => Continue(label));
+ return parseBreakOrContinue((label) => new Continue(label));
}
if (acceptString('debugger')) {
expectSemicolon();
- return DebuggerStatement();
+ return new DebuggerStatement();
}
if (acceptString('if')) return parseIfThenElse();
@@ -1392,7 +1392,7 @@ class MiniJsParser {
if (acceptString('function')) return parseFunctionDeclaration();
- if (acceptString('class')) return ClassDeclaration(parseClass());
+ if (acceptString('class')) return new ClassDeclaration(parseClass());
if (acceptString('try')) return parseTry();
@@ -1425,7 +1425,7 @@ class MiniJsParser {
Expression expression = parseExpression();
if (expression is Identifier && acceptCategory(COLON)) {
- return LabeledStatement(expression.name, parseStatement());
+ return new LabeledStatement(expression.name, parseStatement());
}
expectSemicolon();
@@ -1436,17 +1436,17 @@ class MiniJsParser {
if (expression is InterpolatedExpression) {
assert(identical(interpolatedValues.last, expression));
InterpolatedStatement statement =
- InterpolatedStatement(expression.nameOrPosition);
+ new InterpolatedStatement(expression.nameOrPosition);
interpolatedValues[interpolatedValues.length - 1] = statement;
return statement;
}
}
- return ExpressionStatement(expression);
+ return new ExpressionStatement(expression);
}
Statement parseReturn() {
- if (acceptSemicolon()) return Return();
+ if (acceptSemicolon()) return new Return();
Expression expression = parseExpression();
expectSemicolon();
return Return(expression);
@@ -1456,14 +1456,14 @@ class MiniJsParser {
bool hasStar = acceptString('*');
Expression expression = parseExpression();
expectSemicolon();
- return DartYield(expression, hasStar);
+ return new DartYield(expression, hasStar);
}
Statement parseThrow() {
if (skippedNewline) error('throw expression must be on same line');
Expression expression = parseExpression();
expectSemicolon();
- return Throw(expression);
+ return new Throw(expression);
}
Statement parseBreakOrContinue(Statement Function(String) constructor) {
@@ -1484,7 +1484,7 @@ class MiniJsParser {
if (acceptString('else')) {
// Resolves dangling else by binding 'else' to closest 'if'.
Statement elseStatement = parseStatement();
- return If(condition, thenStatement, elseStatement);
+ return new If(condition, thenStatement, elseStatement);
} else {
return If.noElse(condition, thenStatement);
}
@@ -1551,15 +1551,15 @@ class MiniJsParser {
static VariableDeclarationList _createVariableDeclarationList(
String keyword, String identifier) {
- return VariableDeclarationList(
- keyword, [VariableInitialization(Identifier(identifier), null)]);
+ return new VariableDeclarationList(
+ keyword, [new VariableInitialization(new Identifier(identifier), null)]);
}
Statement parseFunctionDeclaration() {
String name = lastToken;
expectCategory(ALPHA);
var fun = parseFun();
- return FunctionDeclaration(Identifier(name), fun);
+ return new FunctionDeclaration(new Identifier(name), fun);
}
Statement parseTry() {
@@ -1574,7 +1574,7 @@ class MiniJsParser {
} else {
if (catchPart == null) error("expected 'finally'");
}
- return Try(body, catchPart, finallyPart);
+ return new Try(body, catchPart, finallyPart);
}
SwitchCase parseSwitchClause() {
@@ -1594,7 +1594,7 @@ class MiniJsParser {
lastToken != 'default') {
statements.add(parseStatement());
}
- return SwitchCase(expression, Block(statements));
+ return new SwitchCase(expression, new Block(statements));
}
Statement parseWhile() {
@@ -1602,7 +1602,7 @@ class MiniJsParser {
Expression condition = parseExpression();
expectCategory(RPAREN);
Statement body = parseStatement();
- return While(condition, body);
+ return new While(condition, body);
}
Statement parseDo() {
@@ -1613,7 +1613,7 @@ class MiniJsParser {
Expression condition = parseExpression();
expectCategory(RPAREN);
expectSemicolon();
- return Do(body, condition);
+ return new Do(body, condition);
}
Statement parseSwitch() {
@@ -1626,7 +1626,7 @@ class MiniJsParser {
clauses.add(parseSwitchClause());
}
expectCategory(RBRACE);
- return Switch(key, clauses);
+ return new Switch(key, clauses);
}
Catch parseCatch() {
@@ -1636,7 +1636,7 @@ class MiniJsParser {
expectCategory(RPAREN);
expectCategory(LBRACE);
Block body = parseBlock();
- return Catch(Identifier(identifier), body);
+ return new Catch(new Identifier(identifier), body);
}
ClassExpression parseClass() {
@@ -1646,12 +1646,12 @@ class MiniJsParser {
heritage = parseConditional();
}
expectCategory(LBRACE);
- var methods = List<Method>();
+ var methods = new List<Method>();
while (lastCategory != RBRACE) {
methods.add(parseMethodOrProperty(onlyMethods: true) as Method);
}
expectCategory(RBRACE);
- return ClassExpression(name, heritage, methods);
+ return new ClassExpression(name, heritage, methods);
}
/**
@@ -1677,13 +1677,13 @@ class MiniJsParser {
if (lastCategory == COLON) {
// That wasn't a accessor but the 'get' or 'set' property: retropedal.
isGetter = isSetter = false;
- name = LiteralString('"$token"');
+ name = new LiteralString('"$token"');
}
}
if (acceptCategory(HASH)) {
if (lastCategory != LPAREN && (onlyMethods || lastCategory != COLON)) {
// Interpolated method
- var member = InterpolatedMethod(parseHash());
+ var member = new InterpolatedMethod(parseHash());
interpolatedValues.add(member);
return member;
}
@@ -1694,10 +1694,10 @@ class MiniJsParser {
if (!onlyMethods && acceptCategory(COLON)) {
Expression value = parseAssignment();
- return Property(name, value);
+ return new Property(name, value);
} else {
var fun = parseFun();
- return Method(name, fun,
+ return new Method(name, fun,
isGetter: isGetter, isSetter: isSetter, isStatic: isStatic);
}
}
@@ -1705,10 +1705,10 @@ class MiniJsParser {
Expression parsePropertyName() {
String identifier = lastToken;
if (acceptCategory(STRING)) {
- return LiteralString(identifier);
+ return new LiteralString(identifier);
} else if (acceptCategory(ALPHA) || acceptCategory(SYMBOL)) {
// ALPHA or a SYMBOL, e.g. void
- return LiteralString('"$identifier"');
+ return new LiteralString('"$identifier"');
} else if (acceptCategory(LSQUARE)) {
var expr = parseAssignment();
expectCategory(RSQUARE);
diff --git a/pkg/dev_compiler/lib/src/js_ast/nodes.dart b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
index 2af42b14ac..e0a7572b04 100644
--- a/pkg/dev_compiler/lib/src/js_ast/nodes.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/nodes.dart
@@ -1191,11 +1191,11 @@ class Identifier extends Expression implements Parameter {
throw ArgumentError.value(name, "name", "not a valid identifier");
}
}
- static RegExp _identifierRE = RegExp(r'^[A-Za-z_$][A-Za-z_$0-9]*$');
+ static RegExp _identifierRE = new RegExp(r'^[A-Za-z_$][A-Za-z_$0-9]*$');
bool shadows(Set<String> names) => names.contains(name);
- Identifier _clone() => Identifier(name, allowRename: allowRename);
+ Identifier _clone() => new Identifier(name, allowRename: allowRename);
T accept<T>(NodeVisitor<T> visitor) => visitor.visitIdentifier(this);
int get precedenceLevel => PRIMARY;
void visitChildren(NodeVisitor visitor) {}
@@ -1806,7 +1806,7 @@ class InterpolatedIdentifier extends Expression
T accept<T>(NodeVisitor<T> visitor) =>
visitor.visitInterpolatedIdentifier(this);
void visitChildren(NodeVisitor visitor) {}
- InterpolatedIdentifier _clone() => InterpolatedIdentifier(nameOrPosition);
+ InterpolatedIdentifier _clone() => new InterpolatedIdentifier(nameOrPosition);
int get precedenceLevel => PRIMARY;
String get name => throw '$runtimeType does not support this member.';
@@ -1826,7 +1826,7 @@ class RegExpLiteral extends Expression {
T accept<T>(NodeVisitor<T> visitor) => visitor.visitRegExpLiteral(this);
void visitChildren(NodeVisitor visitor) {}
- RegExpLiteral _clone() => RegExpLiteral(pattern);
+ RegExpLiteral _clone() => new RegExpLiteral(pattern);
int get precedenceLevel => PRIMARY;
}
@@ -1846,7 +1846,7 @@ class Await extends Expression {
int get precedenceLevel => UNARY;
T accept<T>(NodeVisitor<T> visitor) => visitor.visitAwait(this);
void visitChildren(NodeVisitor visitor) => expression.accept(visitor);
- Await _clone() => Await(expression);
+ Await _clone() => new Await(expression);
}
/**
@@ -1861,7 +1861,7 @@ class Comment extends Statement {
Comment(this.comment);
T accept<T>(NodeVisitor<T> visitor) => visitor.visitComment(this);
- Comment _clone() => Comment(comment);
+ Comment _clone() => new Comment(comment);
void visitChildren(NodeVisitor visitor) {}
}
@@ -1880,14 +1880,14 @@ class CommentExpression extends Expression {
int get precedenceLevel => PRIMARY;
T accept<T>(NodeVisitor<T> visitor) => visitor.visitCommentExpression(this);
- CommentExpression _clone() => CommentExpression(comment, expression);
+ CommentExpression _clone() => new CommentExpression(comment, expression);
void visitChildren(NodeVisitor visitor) => expression.accept(visitor);
}
class DebuggerStatement extends Statement {
T accept<T>(NodeVisitor<T> visitor) => visitor.visitDebuggerStatement(this);
- DebuggerStatement _clone() => DebuggerStatement();
+ DebuggerStatement _clone() => new DebuggerStatement();
void visitChildren(NodeVisitor visitor) {}
}
diff --git a/pkg/dev_compiler/lib/src/js_ast/printer.dart b/pkg/dev_compiler/lib/src/js_ast/printer.dart
index da7274518a..f8a055666c 100644
--- a/pkg/dev_compiler/lib/src/js_ast/printer.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/printer.dart
@@ -79,15 +79,15 @@ class Printer extends TypeScriptTypePrinter implements NodeVisitor {
/// Whether the next call to [indent] should just be a no-op.
bool _skipNextIndent = false;
- static final identifierCharacterRegExp = RegExp(r'^[a-zA-Z_0-9$]');
- static final expressionContinuationRegExp = RegExp(r'^[-+([]');
+ static final identifierCharacterRegExp = new RegExp(r'^[a-zA-Z_0-9$]');
+ static final expressionContinuationRegExp = new RegExp(r'^[-+([]');
Printer(JavaScriptPrintingOptions options, JavaScriptPrintingContext context,
{LocalNamer localNamer})
: options = options,
context = context,
shouldCompressOutput = options.shouldCompressOutput,
- danglingElseVisitor = DanglingElseVisitor(context),
+ danglingElseVisitor = new DanglingElseVisitor(context),
localNamer = determineRenamer(localNamer, options) {
context.printer = this;
}
@@ -96,8 +96,8 @@ class Printer extends TypeScriptTypePrinter implements NodeVisitor {
LocalNamer localNamer, JavaScriptPrintingOptions options) {
if (localNamer != null) return localNamer;
return (options.shouldCompressOutput && options.minifyLocalVariables)
- ? MinifyRenamer()
- : IdentityNamer();
+ ? new MinifyRenamer()
+ : new IdentityNamer();
}
// The current indentation string.
@@ -1671,9 +1671,9 @@ class MinifyRenamer implements LocalNamer {
codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS));
}
codes.add(charCodes.$0 + digit);
- newName = String.fromCharCodes(codes);
+ newName = new String.fromCharCodes(codes);
}
- assert(RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
+ assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
maps.last[oldName] = newName;
return newName;
}
diff --git a/pkg/dev_compiler/lib/src/js_ast/template.dart b/pkg/dev_compiler/lib/src/js_ast/template.dart
index 6475446fbf..cffb11da50 100644
--- a/pkg/dev_compiler/lib/src/js_ast/template.dart
+++ b/pkg/dev_compiler/lib/src/js_ast/template.dart
@@ -182,8 +182,8 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
return (arguments) {
var value = arguments[nameOrPosition];
if (value is Expression) return value;
- if (value is String) return Identifier(value);
- throw StateError(
+ if (value is String) return new Identifier(value);
+ throw new StateError(
'Interpolated value #$nameOrPosition is not an Expression: $value');
};
}
@@ -195,7 +195,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
var value = arguments[nameOrPosition];
Expression toExpression(item) {
if (item is Expression) return item;
- if (item is String) return Identifier(item);
+ if (item is String) return new Identifier(item);
throw StateError('Interpolated value #$nameOrPosition is not '
'an Expression or List of Expressions: $value');
}
@@ -237,8 +237,8 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Parameter toIdentifier(item) {
if (item is Parameter) return item;
- if (item is String) return Identifier(item);
- throw StateError(
+ if (item is String) return new Identifier(item);
+ throw new StateError(
'Interpolated value #$nameOrPosition is not an Identifier'
' or List of Identifiers: $value');
}
@@ -295,7 +295,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
return (arguments) {
var item = arguments[nameOrPosition];
if (item is Identifier) return item;
- if (item is String) return Identifier(item);
+ if (item is String) return new Identifier(item);
throw StateError('Interpolated value #$nameOrPosition is not a '
'Identifier or String: $item');
};
@@ -322,7 +322,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Program> visitProgram(Program node) {
var instantiators = node.body.map(visitSplayableStatement).toList();
- return (a) => Program(splayStatements(instantiators, a));
+ return (a) => new Program(splayStatements(instantiators, a));
}
List<Statement> splayStatements(List<Instantiator> instantiators, arguments) {
@@ -343,7 +343,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Block> visitBlock(Block node) {
var instantiators = node.statements.map(visitSplayableStatement).toList();
- return (a) => Block(splayStatements(instantiators, a));
+ return (a) => new Block(splayStatements(instantiators, a));
}
Instantiator<Statement> visitExpressionStatement(ExpressionStatement node) {
@@ -377,7 +377,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
if (value is bool) {
return value ? makeThen(arguments) : makeOtherwise(arguments);
}
- var cond = value is String ? Identifier(value) : value as Expression;
+ var cond = value is String ? new Identifier(value) : value as Expression;
return If(cond, makeThen(arguments), makeOtherwise(arguments));
};
}
@@ -386,7 +386,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Expression> makeCondition = visit(node.condition);
Instantiator<Statement> makeThen = visit(node.then);
Instantiator<Statement> makeOtherwise = visit(node.otherwise);
- return (a) => If(makeCondition(a), makeThen(a), makeOtherwise(a));
+ return (a) => new If(makeCondition(a), makeThen(a), makeOtherwise(a));
}
Instantiator<Statement> visitFor(For node) {
@@ -394,7 +394,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Expression> makeCondition = visitNullable(node.condition);
Instantiator<Expression> makeUpdate = visitNullable(node.update);
Instantiator<Statement> makeBody = visit(node.body);
- return (a) => For(makeInit(a), makeCondition(a),
+ return (a) => new For(makeInit(a), makeCondition(a),
makeUpdate(a)?.toVoidExpression(), makeBody(a));
}
@@ -402,26 +402,26 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Expression> makeLeftHandSide = visit(node.leftHandSide);
Instantiator<Expression> makeObject = visit(node.object);
Instantiator<Statement> makeBody = visit(node.body);
- return (a) => ForIn(makeLeftHandSide(a), makeObject(a), makeBody(a));
+ return (a) => new ForIn(makeLeftHandSide(a), makeObject(a), makeBody(a));
}
Instantiator<ForOf> visitForOf(ForOf node) {
Instantiator<Expression> makeLeftHandSide = visit(node.leftHandSide);
Instantiator<Expression> makeObject = visit(node.iterable);
Instantiator<Statement> makeBody = visit(node.body);
- return (a) => ForOf(makeLeftHandSide(a), makeObject(a), makeBody(a));
+ return (a) => new ForOf(makeLeftHandSide(a), makeObject(a), makeBody(a));
}
Instantiator<While> visitWhile(While node) {
Instantiator<Expression> makeCondition = visit(node.condition);
Instantiator<Statement> makeBody = visit(node.body);
- return (a) => While(makeCondition(a), makeBody(a));
+ return (a) => new While(makeCondition(a), makeBody(a));
}
Instantiator<Do> visitDo(Do node) {
Instantiator<Statement> makeBody = visit(node.body);
Instantiator<Expression> makeCondition = visit(node.condition);
- return (a) => Do(makeBody(a), makeCondition(a));
+ return (a) => new Do(makeBody(a), makeCondition(a));
}
Instantiator<Continue> visitContinue(Continue node) =>
@@ -432,36 +432,36 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Statement> visitReturn(Return node) {
if (node.value == null) return (args) => Return();
Instantiator<Expression> makeExpression = visit(node.value);
- return (a) => makeExpression(a).toReturn();
+ return (a) => new makeExpression(a).toReturn();
}
Instantiator<DartYield> visitDartYield(DartYield node) {
Instantiator<Expression> makeExpression = visit(node.expression);
- return (a) => DartYield(makeExpression(a), node.hasStar);
+ return (a) => new DartYield(makeExpression(a), node.hasStar);
}
Instantiator<Throw> visitThrow(Throw node) {
Instantiator<Expression> makeExpression = visit(node.expression);
- return (a) => Throw(makeExpression(a));
+ return (a) => new Throw(makeExpression(a));
}
Instantiator<Try> visitTry(Try node) {
Instantiator<Block> makeBody = visit(node.body);
Instantiator<Catch> makeCatch = visitNullable(node.catchPart);
Instantiator<Block> makeFinally = visitNullable(node.finallyPart);
- return (a) => Try(makeBody(a), makeCatch(a), makeFinally(a));
+ return (a) => new Try(makeBody(a), makeCatch(a), makeFinally(a));
}
Instantiator<Catch> visitCatch(Catch node) {
Instantiator<Identifier> makeDeclaration = visit(node.declaration);
Instantiator<Block> makeBody = visit(node.body);
- return (a) => Catch(makeDeclaration(a), makeBody(a));
+ return (a) => new Catch(makeDeclaration(a), makeBody(a));
}
Instantiator<Switch> visitSwitch(Switch node) {
Instantiator<Expression> makeKey = visit(node.key);
var makeCases = node.cases.map(visitSwitchCase).toList();
- return (a) => Switch(makeKey(a), makeCases.map((m) => m(a)).toList());
+ return (a) => new Switch(makeKey(a), makeCases.map((m) => m(a)).toList());
}
Instantiator<SwitchCase> visitSwitchCase(SwitchCase node) {
@@ -476,12 +476,12 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
FunctionDeclaration node) {
Instantiator<Identifier> makeName = visit(node.name);
Instantiator<Fun> makeFunction = visit(node.function);
- return (a) => FunctionDeclaration(makeName(a), makeFunction(a));
+ return (a) => new FunctionDeclaration(makeName(a), makeFunction(a));
}
Instantiator<LabeledStatement> visitLabeledStatement(LabeledStatement node) {
Instantiator<Statement> makeBody = visit(node.body);
- return (a) => LabeledStatement(node.label, makeBody(a));
+ return (a) => new LabeledStatement(node.label, makeBody(a));
}
Instantiator visitLiteralStatement(LiteralStatement node) => visitNode(node);
@@ -492,7 +492,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
VariableDeclarationList node) {
var declarationMakers =
node.declarations.map(visitVariableInitialization).toList();
- return (a) => VariableDeclarationList(
+ return (a) => new VariableDeclarationList(
node.keyword, declarationMakers.map((m) => m(a)).toList());
}
@@ -510,14 +510,14 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
VariableInitialization node) {
Instantiator<VariableBinding> makeDeclaration = visit(node.declaration);
Instantiator<Expression> makeValue = visitNullable(node.value);
- return (a) => VariableInitialization(makeDeclaration(a), makeValue(a));
+ return (a) => new VariableInitialization(makeDeclaration(a), makeValue(a));
}
Instantiator<Conditional> visitConditional(Conditional cond) {
Instantiator<Expression> makeCondition = visit(cond.condition);
Instantiator<Expression> makeThen = visit(cond.then);
Instantiator<Expression> makeOtherwise = visit(cond.otherwise);
- return (a) => Conditional(makeCondition(a), makeThen(a), makeOtherwise(a));
+ return (a) => new Conditional(makeCondition(a), makeThen(a), makeOtherwise(a));
}
Instantiator<Call> visitNew(New node) => handleCallOrNew(node, true);
@@ -533,7 +533,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
return (a) {
var target = makeTarget(a);
var callArgs = splayNodes<Expression>(argumentMakers, a);
- return isNew ? New(target, callArgs) : Call(target, callArgs);
+ return isNew ? new New(target, callArgs) : new Call(target, callArgs);
};
}
@@ -541,117 +541,117 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Expression> makeLeft = visit(node.left);
Instantiator<Expression> makeRight = visit(node.right);
String op = node.op;
- return (a) => Binary(op, makeLeft(a), makeRight(a));
+ return (a) => new Binary(op, makeLeft(a), makeRight(a));
}
Instantiator<Prefix> visitPrefix(Prefix node) {
Instantiator<Expression> makeOperand = visit(node.argument);
String op = node.op;
- return (a) => Prefix(op, makeOperand(a));
+ return (a) => new Prefix(op, makeOperand(a));
}
Instantiator<Postfix> visitPostfix(Postfix node) {
Instantiator<Expression> makeOperand = visit(node.argument);
String op = node.op;
- return (a) => Postfix(op, makeOperand(a));
+ return (a) => new Postfix(op, makeOperand(a));
}
Instantiator<This> visitThis(This node) => (a) => This();
Instantiator<Super> visitSuper(Super node) => (a) => Super();
Instantiator<Identifier> visitIdentifier(Identifier node) =>
- (a) => Identifier(node.name);
+ (a) => new Identifier(node.name);
Instantiator<Spread> visitSpread(Spread node) {
var maker = visit(node.argument);
- return (a) => Spread(maker(a) as Expression);
+ return (a) => new Spread(maker(a) as Expression);
}
Instantiator<Yield> visitYield(Yield node) {
var maker = visitNullable(node.value);
- return (a) => Yield(maker(a) as Expression, star: node.star);
+ return (a) => new Yield(maker(a) as Expression, star: node.star);
}
Instantiator<RestParameter> visitRestParameter(RestParameter node) {
var maker = visit(node.parameter);
- return (a) => RestParameter(maker(a) as Identifier);
+ return (a) => new RestParameter(maker(a) as Identifier);
}
Instantiator<PropertyAccess> visitAccess(PropertyAccess node) {
Instantiator<Expression> makeReceiver = visit(node.receiver);
Instantiator<Expression> makeSelector = visit(node.selector);
- return (a) => PropertyAccess(makeReceiver(a), makeSelector(a));
+ return (a) => new PropertyAccess(makeReceiver(a), makeSelector(a));
}
Instantiator<NamedFunction> visitNamedFunction(NamedFunction node) {
Instantiator<Identifier> makeDeclaration = visit(node.name);
Instantiator<Fun> makeFunction = visit(node.function);
- return (a) => NamedFunction(makeDeclaration(a), makeFunction(a));
+ return (a) => new NamedFunction(makeDeclaration(a), makeFunction(a));
}
Instantiator<Fun> visitFun(Fun node) {
var paramMakers = node.params.map(visitSplayable).toList();
Instantiator<Block> makeBody = visit(node.body);
- return (a) => Fun(splayNodes(paramMakers, a), makeBody(a),
+ return (a) => new Fun(splayNodes(paramMakers, a), makeBody(a),
isGenerator: node.isGenerator, asyncModifier: node.asyncModifier);
}
Instantiator<ArrowFun> visitArrowFun(ArrowFun node) {
var paramMakers = node.params.map(visitSplayable).toList();
Instantiator makeBody = visit(node.body as Node);
- return (a) => ArrowFun(splayNodes(paramMakers, a), makeBody(a));
+ return (a) => new ArrowFun(splayNodes(paramMakers, a), makeBody(a));
}
Instantiator<LiteralBool> visitLiteralBool(LiteralBool node) =>
- (a) => LiteralBool(node.value);
+ (a) => new LiteralBool(node.value);
Instantiator<LiteralString> visitLiteralString(LiteralString node) =>
- (a) => LiteralString(node.value);
+ (a) => new LiteralString(node.value);
Instantiator<LiteralNumber> visitLiteralNumber(LiteralNumber node) =>
- (a) => LiteralNumber(node.value);
+ (a) => new LiteralNumber(node.value);
Instantiator<LiteralNull> visitLiteralNull(LiteralNull node) =>
- (a) => LiteralNull();
+ (a) => new LiteralNull();
Instantiator<ArrayInitializer> visitArrayInitializer(ArrayInitializer node) {
var makers = node.elements.map(visitSplayableExpression).toList();
- return (a) => ArrayInitializer(splayNodes(makers, a));
+ return (a) => new ArrayInitializer(splayNodes(makers, a));
}
Instantiator visitArrayHole(ArrayHole node) {
- return (arguments) => ArrayHole();
+ return (arguments) => new ArrayHole();
}
Instantiator<ObjectInitializer> visitObjectInitializer(
ObjectInitializer node) {
var propertyMakers = node.properties.map(visitSplayable).toList();
- return (a) => ObjectInitializer(splayNodes(propertyMakers, a));
+ return (a) => new ObjectInitializer(splayNodes(propertyMakers, a));
}
Instantiator<Property> visitProperty(Property node) {
Instantiator<Expression> makeName = visit(node.name);
Instantiator<Expression> makeValue = visit(node.value);
- return (a) => Property(makeName(a), makeValue(a));
+ return (a) => new Property(makeName(a), makeValue(a));
}
Instantiator<RegExpLiteral> visitRegExpLiteral(RegExpLiteral node) =>
- (a) => RegExpLiteral(node.pattern);
+ (a) => new RegExpLiteral(node.pattern);
Instantiator<TemplateString> visitTemplateString(TemplateString node) {
var makeElements = node.interpolations.map(visit).toList();
- return (a) => TemplateString(node.strings, splayNodes(makeElements, a));
+ return (a) => new TemplateString(node.strings, splayNodes(makeElements, a));
}
Instantiator<TaggedTemplate> visitTaggedTemplate(TaggedTemplate node) {
Instantiator<Expression> makeTag = visit(node.tag);
var makeTemplate = visitTemplateString(node.template);
- return (a) => TaggedTemplate(makeTag(a), makeTemplate(a));
+ return (a) => new TaggedTemplate(makeTag(a), makeTemplate(a));
}
Instantiator visitClassDeclaration(ClassDeclaration node) {
var makeClass = visitClassExpression(node.classExpr);
- return (a) => ClassDeclaration(makeClass(a));
+ return (a) => new ClassDeclaration(makeClass(a));
}
Instantiator<ClassExpression> visitClassExpression(ClassExpression node) {
@@ -659,31 +659,31 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<Identifier> makeName = visit(node.name);
Instantiator<Expression> makeHeritage = visit(node.heritage);
- return (a) => ClassExpression(
+ return (a) => new ClassExpression(
makeName(a), makeHeritage(a), splayNodes(makeMethods, a));
}
Instantiator<Method> visitMethod(Method node) {
Instantiator<Expression> makeName = visit(node.name);
Instantiator<Fun> makeFunction = visit(node.function);
- return (a) => Method(makeName(a), makeFunction(a),
+ return (a) => new Method(makeName(a), makeFunction(a),
isGetter: node.isGetter,
isSetter: node.isSetter,
isStatic: node.isStatic);
}
Instantiator<Comment> visitComment(Comment node) =>
- (a) => Comment(node.comment);
+ (a) => new Comment(node.comment);
Instantiator<CommentExpression> visitCommentExpression(
CommentExpression node) {
Instantiator<Expression> makeExpr = visit(node.expression);
- return (a) => CommentExpression(node.comment, makeExpr(a));
+ return (a) => new CommentExpression(node.comment, makeExpr(a));
}
Instantiator<Await> visitAwait(Await node) {
Instantiator<Expression> makeExpr = visit(node.expression);
- return (a) => Await(makeExpr(a));
+ return (a) => new Await(makeExpr(a));
}
// Note: these are not supported yet in the interpolation grammar.
@@ -734,7 +734,7 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<BindingPattern> makeStructure = visitNullable(node.structure);
Instantiator<Expression> makeDefaultValue =
visitNullable(node.defaultValue);
- return (a) => DestructuredVariable(
+ return (a) => new DestructuredVariable(
name: makeName(a),
property: makeProperty(a),
structure: makeStructure(a),
@@ -745,18 +745,18 @@ class InstantiatorGeneratorVisitor implements NodeVisitor<Instantiator> {
Instantiator<ArrayBindingPattern> visitArrayBindingPattern(
ArrayBindingPattern node) {
List<Instantiator> makeVars = node.variables.map(this.visit).toList();
- return (a) => ArrayBindingPattern(splayNodes(makeVars, a));
+ return (a) => new ArrayBindingPattern(splayNodes(makeVars, a));
}
@override
Instantiator visitObjectBindingPattern(ObjectBindingPattern node) {
List<Instantiator> makeVars = node.variables.map(this.visit).toList();
- return (a) => ObjectBindingPattern(splayNodes(makeVars, a));
+ return (a) => new ObjectBindingPattern(splayNodes(makeVars, a));
}
@override
Instantiator visitSimpleBindingPattern(SimpleBindingPattern node) =>
- (a) => SimpleBindingPattern(Identifier(node.name.name));
+ (a) => new SimpleBindingPattern(Identifier(node.name.name));
}
/**
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 3d6f202cd7..cd587b1ad4 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -42,17 +42,17 @@ class ProgramCompiler extends Object
///
/// We sometimes special case codegen for a single library, as it simplifies
/// name scoping requirements.
- final _libraries = Map<Library, JS.Identifier>.identity();
+ final _libraries = new Map<Library, JS.Identifier>.identity();
/// Maps a library URI import, that is not in [_libraries], to the
/// corresponding Kernel summary module we imported it with.
- final _importToSummary = Map<Library, Component>.identity();
+ final _importToSummary = new Map<Library, Component>.identity();
/// Maps a summary to the file URI we used to load it from disk.
- final _summaryToUri = Map<Component, Uri>.identity();
+ final _summaryToUri = new Map<Component, Uri>.identity();
/// Imported libraries, and the temporaries used to refer to them.
- final _imports = Map<Library, JS.TemporaryId>();
+ final _imports = new Map<Library, JS.TemporaryId>();
/// The variable for the current catch clause
VariableDeclaration _catchParameter;
@@ -61,7 +61,7 @@ class ProgramCompiler extends Object
JS.TemporaryId _asyncStarController;
JS.Identifier _extensionSymbolsModule;
- final _extensionSymbols = Map<String, JS.TemporaryId>();
+ final _extensionSymbols = new Map<String, JS.TemporaryId>();
Set<Class> _pendingClasses;
@@ -119,13 +119,13 @@ class ProgramCompiler extends Object
/// Information about virtual fields for all libraries in the current build
/// unit.
- final virtualFields = VirtualFieldModel();
+ final virtualFields = new VirtualFieldModel();
final JSTypeRep _typeRep;
bool _superAllowed = true;
- final _superHelpers = Map<String, JS.Method>();
+ final _superHelpers = new Map<String, JS.Method>();
final bool emitMetadata;
final bool enableAsserts;
@@ -171,14 +171,14 @@ class ProgramCompiler extends Object
/// statement that is not a loop body is the outermost non-labeled statement
/// that it encloses. A [BreakStatement] targeting this statement can be
/// compiled to `break` either with or without a label.
- final _effectiveTargets = HashMap<LabeledStatement, Statement>.identity();
+ final _effectiveTargets = new HashMap<LabeledStatement, Statement>.identity();
/// A map from effective targets to their label names.
///
/// If the target needs to be labeled when compiled to JS, because it was
/// targeted by a break or continue with a label, then this map contains the
/// label name that was assigned to it.
- final _labelNames = HashMap<Statement, String>.identity();
+ final _labelNames = new HashMap<Statement, String>.identity();
final Class _jsArrayClass;
final Class privateSymbolClass;
@@ -201,14 +201,14 @@ class ProgramCompiler extends Object
bool replCompile = false,
bool enableAsserts = true,
Map<String, String> declaredVariables = const {}}) {
- var coreTypes = CoreTypes(component);
+ var coreTypes = new CoreTypes(component);
var types =
- TypeSchemaEnvironment(coreTypes, ClassHierarchy(component), true);
- var constants = DevCompilerConstants(types, declaredVariables);
- var nativeTypes = NativeTypeSet(coreTypes, constants);
- var jsTypeRep = JSTypeRep(types);
- return ProgramCompiler._(coreTypes, coreTypes.index, nativeTypes, constants,
- types, jsTypeRep, NullableInference(jsTypeRep),
+ new TypeSchemaEnvironment(coreTypes, new ClassHierarchy(component), true);
+ var constants = new DevCompilerConstants(types, declaredVariables);
+ var nativeTypes = new NativeTypeSet(coreTypes, constants);
+ var jsTypeRep = new JSTypeRep(types);
+ return new ProgramCompiler._(coreTypes, coreTypes.index, nativeTypes, constants,
+ types, jsTypeRep, new NullableInference(jsTypeRep),
emitMetadata: emitMetadata,
enableAsserts: enableAsserts,
replCompile: replCompile);
@@ -237,7 +237,7 @@ class ProgramCompiler extends Object
JS.Program emitModule(
Component buildUnit, List<Component> summaries, List<Uri> summaryUris) {
if (moduleItems.isNotEmpty) {
- throw StateError('Can only call emitModule once.');
+ throw new StateError('Can only call emitModule once.');
}
_component = buildUnit;
@@ -257,33 +257,33 @@ class ProgramCompiler extends Object
if (ddcRuntime != null) {
// Don't allow these to be renamed when we're building the SDK.
// There is JS code in dart:* that depends on their names.
- runtimeModule = JS.Identifier('dart');
- _extensionSymbolsModule = JS.Identifier('dartx');
+ runtimeModule = new JS.Identifier('dart');
+ _extensionSymbolsModule = new JS.Identifier('dartx');
_nullableInference.allowNotNullDeclarations = true;
} else {
// Otherwise allow these to be renamed so users can write them.
- runtimeModule = JS.TemporaryId('dart');
- _extensionSymbolsModule = JS.TemporaryId('dartx');
+ runtimeModule = new JS.TemporaryId('dart');
+ _extensionSymbolsModule = new JS.TemporaryId('dartx');
}
- _typeTable = TypeTable(runtimeModule);
+ _typeTable = new TypeTable(runtimeModule);
// Initialize our library variables.
var items = <JS.ModuleItem>[];
var exports = <JS.NameSpecifier>[];
// TODO(jmesserly): this is a performance optimization for V8 to prevent it
// from treating our Dart library objects as JS Maps.
- var root = JS.Identifier('_root');
+ var root = new JS.Identifier('_root');
items.add(js.statement('const # = Object.create(null)', [root]));
void emitLibrary(JS.Identifier id) {
items.add(js.statement('const # = Object.create(#)', [id, root]));
- exports.add(JS.NameSpecifier(id));
+ exports.add(new JS.NameSpecifier(id));
}
for (var library in libraries) {
var libraryTemp = library == ddcRuntime
? runtimeModule
- : JS.TemporaryId(jsLibraryName(library));
+ : new JS.TemporaryId(jsLibraryName(library));
_libraries[library] = libraryTemp;
emitLibrary(libraryTemp);
}
@@ -292,7 +292,7 @@ class ProgramCompiler extends Object
// TODO(jmesserly): find a cleaner design for this.
if (ddcRuntime != null) emitLibrary(_extensionSymbolsModule);
- items.add(JS.ExportDeclaration(JS.ExportClause(exports)));
+ items.add(new JS.ExportDeclaration(new JS.ExportClause(exports)));
// Collect all class/type Element -> Node mappings
// in case we need to forward declare any classes.
@@ -319,7 +319,7 @@ class ProgramCompiler extends Object
// Initialize extension symbols
_extensionSymbols.forEach((name, id) {
JS.Expression value =
- JS.PropertyAccess(_extensionSymbolsModule, _propertyName(name));
+ new JS.PropertyAccess(_extensionSymbolsModule, _propertyName(name));
if (ddcRuntime != null) {
value = js.call('# = Symbol(#)', [value, js.string("dartx.$name")]);
}
@@ -334,7 +334,7 @@ class ProgramCompiler extends Object
_copyAndFlattenBlocks(items, moduleItems);
// Build the module.
- return JS.Program(items, name: buildUnit.root.name);
+ return new JS.Program(items, name: buildUnit.root.name);
}
/// Flattens blocks in [items] to a single list.
@@ -356,7 +356,7 @@ class ProgramCompiler extends Object
// It's either one of the libraries in this module, or it's an import.
return _libraries[library] ??
_imports.putIfAbsent(
- library, () => JS.TemporaryId(jsLibraryName(library)));
+ library, () => new JS.TemporaryId(jsLibraryName(library)));
}
String _libraryToModule(Library library) {
@@ -381,7 +381,7 @@ class ProgramCompiler extends Object
}
void _finishImports(List<JS.ModuleItem> items) {
- var modules = Map<String, List<Library>>();
+ var modules = new Map<String, List<Library>>();
for (var import in _imports.keys) {
modules.putIfAbsent(_libraryToModule(import), () => []).add(import);
@@ -402,13 +402,13 @@ class ProgramCompiler extends Object
// import {foo as foo$} from 'foo'; // if rename was needed
//
var imports =
- libraries.map((l) => JS.NameSpecifier(_imports[l])).toList();
+ libraries.map((l) => new JS.NameSpecifier(_imports[l])).toList();
if (module == coreModuleName) {
- imports.add(JS.NameSpecifier(runtimeModule));
- imports.add(JS.NameSpecifier(_extensionSymbolsModule));
+ imports.add(new JS.NameSpecifier(runtimeModule));
+ imports.add(new JS.NameSpecifier(_extensionSymbolsModule));
}
- items.add(JS.ImportDeclaration(
+ items.add(new JS.ImportDeclaration(
namedImports: imports, from: js.string(module, "'")));
});
}
@@ -531,8 +531,8 @@ class ProgramCompiler extends Object
// https://github.com/dart-lang/sdk/issues/31003
var className = c.typeParameters.isNotEmpty
? (c == _jsArrayClass
- ? JS.Identifier(c.name)
- : JS.TemporaryId(getLocalClassName(c)))
+ ? new JS.Identifier(c.name)
+ : new JS.TemporaryId(getLocalClassName(c)))
: _emitTopLevelName(c);
var savedClassProperties = _classProperties;
@@ -566,7 +566,7 @@ class ProgramCompiler extends Object
_defineExtensionMembers(className, body);
_emitClassMetadata(c.annotations, className, body);
- var classDef = JS.Statement.from(body);
+ var classDef = new JS.Statement.from(body);
var typeFormals = c.typeParameters;
if (typeFormals.isNotEmpty) {
classDef = _defineClassTypeArguments(
@@ -615,11 +615,11 @@ class ProgramCompiler extends Object
JS.Statement _emitClassStatement(Class c, JS.Expression className,
JS.Expression heritage, List<JS.Method> methods) {
if (c.typeParameters.isNotEmpty) {
- return JS.ClassExpression(className as JS.Identifier, heritage, methods)
+ return new JS.ClassExpression(className as JS.Identifier, heritage, methods)
.toStatement();
}
- var classExpr = JS.ClassExpression(
- JS.TemporaryId(getLocalClassName(c)), heritage, methods);
+ var classExpr = new JS.ClassExpression(
+ new JS.TemporaryId(getLocalClassName(c)), heritage, methods);
return js.statement('# = #;', [className, classExpr]);
}
@@ -718,7 +718,7 @@ class ProgramCompiler extends Object
ctorBody.add(_emitSuperConstructorCall(className, name, jsParams));
}
body.add(_addConstructorToClass(
- className, name, JS.Fun(jsParams, JS.Block(ctorBody))));
+ className, name, new JS.Fun(jsParams, new JS.Block(ctorBody))));
}
}
@@ -761,8 +761,8 @@ class ProgramCompiler extends Object
// mixinMembers(C, class C$ extends M { <methods> });
mixinBody.add(runtimeStatement('mixinMembers(#, #)', [
classExpr,
- JS.ClassExpression(
- JS.TemporaryId(getLocalClassName(c)), mixinClass, methods)
+ new JS.ClassExpression(
+ new JS.TemporaryId(getLocalClassName(c)), mixinClass, methods)
]));
}
@@ -780,14 +780,14 @@ class ProgramCompiler extends Object
var m = mixins[i];
var mixinName =
getLocalClassName(superclass) + '_' + getLocalClassName(m.classNode);
- var mixinId = JS.TemporaryId(mixinName + '\$');
+ var mixinId = new JS.TemporaryId(mixinName + '\$');
// Bind the mixin class to a name to workaround a V8 bug with es6 classes
// and anonymous function names.
// TODO(leafp:) Eliminate this once the bug is fixed:
// https://bugs.chromium.org/p/v8/issues/detail?id=7069
body.add(js.statement("const # = #", [
mixinId,
- JS.ClassExpression(JS.TemporaryId(mixinName), baseClass, [])
+ JS.ClassExpression(new JS.TemporaryId(mixinName), baseClass, [])
]));
emitMixinConstructors(mixinId, m);
@@ -1035,7 +1035,7 @@ class ProgramCompiler extends Object
if (isClassSymbol == null) {
// TODO(jmesserly): we could export these symbols, if we want to mark
// implemented interfaces for user-defined classes.
- var id = JS.TemporaryId("_is_${getLocalClassName(c)}_default");
+ var id = new JS.TemporaryId("_is_${getLocalClassName(c)}_default");
moduleItems.add(
js.statement('const # = Symbol(#);', [id, js.string(id.name, "'")]));
isClassSymbol = id;
@@ -1583,8 +1583,8 @@ class ProgramCompiler extends Object
}
}
- var getters = Map<String, Procedure>();
- var setters = Map<String, Procedure>();
+ var getters = new Map<String, Procedure>();
+ var setters = new Map<String, Procedure>();
for (var m in c.procedures) {
if (m.isAbstract) continue;
if (m.isGetter) {
@@ -1845,13 +1845,13 @@ class ProgramCompiler extends Object
var name = getAnnotationName(field, isJSName) ?? field.name.name;
// Generate getter
- var fn = JS.Fun([], js.block('{ return this.#; }', [name]));
- var method = JS.Method(_declareMemberName(field), fn, isGetter: true);
+ var fn = new JS.Fun([], js.block('{ return this.#; }', [name]));
+ var method = new JS.Method(_declareMemberName(field), fn, isGetter: true);
jsMethods.add(method);
// Generate setter
if (!field.isFinal) {
- var value = JS.TemporaryId('value');
+ var value = new JS.TemporaryId('value');
fn = JS.Fun([value], js.block('{ this.# = #; }', [name, value]));
method = JS.Method(_declareMemberName(field), fn, isSetter: true);
jsMethods.add(method);
@@ -2156,7 +2156,7 @@ class ProgramCompiler extends Object
JS.TemporaryId _getExtensionSymbolInternal(String name) {
return _extensionSymbols.putIfAbsent(
name,
- () => JS.TemporaryId(
+ () => new JS.TemporaryId(
'\$${JS.friendlyNameForDartOperator[name] ?? name}'));
}
@@ -2192,7 +2192,7 @@ class ProgramCompiler extends Object
return _extensionTypes.isNativeInterface(c);
}
- var _forwardingCache = HashMap<Class, Map<String, Member>>();
+ var _forwardingCache = new HashMap<Class, Map<String, Member>>();
Member _lookupForwardedMember(Class c, String name) {
// We only care about public methods.
@@ -2681,7 +2681,7 @@ class ProgramCompiler extends Object
emitGeneratorFn(List<JS.Parameter> getParameters(JS.Block jsBody)) {
var savedController = _asyncStarController;
_asyncStarController = function.asyncMarker == AsyncMarker.AsyncStar
- ? JS.TemporaryId('stream')
+ ? new JS.TemporaryId('stream')
: null;
JS.Expression gen;
@@ -2696,8 +2696,8 @@ class ProgramCompiler extends Object
// Name the function if possible, to get better stack traces.
gen = genFn;
if (name != null) {
- gen = JS.NamedFunction(
- JS.TemporaryId(JS.friendlyNameForDartOperator[name] ?? name),
+ gen = new JS.NamedFunction(
+ new JS.TemporaryId(JS.friendlyNameForDartOperator[name] ?? name),
genFn);
}
@@ -3310,7 +3310,7 @@ class ProgramCompiler extends Object
.firstWhere((p) => p.isFactory && p.name.name == '')),
[_visitExpression(node.iterable)]);
- var iter = JS.TemporaryId('iter');
+ var iter = new JS.TemporaryId('iter');
return js.statement(
'{'
' let # = #;'
@@ -3573,7 +3573,7 @@ class ProgramCompiler extends Object
var name = v.name;
if (name == null || name.startsWith('#')) {
name = name == null ? 't${_tempVariables.length}' : name.substring(1);
- return _tempVariables.putIfAbsent(v, () => JS.TemporaryId(name));
+ return _tempVariables.putIfAbsent(v, () => new JS.TemporaryId(name));
}
return JS.Identifier(name);
}
@@ -4209,7 +4209,7 @@ class ProgramCompiler extends Object
: 'function() { return super[#]; }',
[jsName]);
- return JS.Method(JS.TemporaryId(name), fn,
+ return new JS.Method(new JS.TemporaryId(name), fn,
isGetter: !setter, isSetter: setter);
} else {
var function = member.function;
@@ -4224,7 +4224,7 @@ class ProgramCompiler extends Object
var fn = js.fun(
'function(#) { return super[#](#); }', [params, jsName, params]);
name = JS.friendlyNameForDartOperator[name] ?? name;
- return JS.Method(JS.TemporaryId(name), fn);
+ return new JS.Method(new JS.TemporaryId(name), fn);
}
});
return JS.PropertyAccess(JS.This(), jsMethod.name);
@@ -4728,7 +4728,7 @@ class ProgramCompiler extends Object
// params are available.
if (_currentFunction == null || usesTypeParams) return jsExpr;
- var temp = JS.TemporaryId('const');
+ var temp = new JS.TemporaryId('const');
moduleItems.add(js.statement('let #;', [temp]));
return js.call('# || (# = #)', [temp, temp, jsExpr]);
}
diff --git a/pkg/dev_compiler/lib/src/kernel/constants.dart b/pkg/dev_compiler/lib/src/kernel/constants.dart
index 79448fc565..295de9d9d8 100644
--- a/pkg/dev_compiler/lib/src/kernel/constants.dart
+++ b/pkg/dev_compiler/lib/src/kernel/constants.dart
@@ -18,8 +18,8 @@ class DevCompilerConstants {
DevCompilerConstants(
TypeEnvironment types, Map<String, String> declaredVariables)
- : _visitor = _ConstantVisitor(types.coreTypes),
- _evaluator = _ConstantEvaluator(types, declaredVariables);
+ : _visitor = new _ConstantVisitor(types.coreTypes),
+ _evaluator = new _ConstantEvaluator(types, declaredVariables);
/// Determines if an expression is constant.
bool isConstant(Expression e) => _visitor.isConstant(e);
@@ -181,15 +181,15 @@ class _ConstantEvaluator extends ConstantEvaluator {
_ConstantEvaluator(TypeEnvironment types, this.declaredVariables,
{bool enableAsserts})
- : unavailableConstant = InstanceConstant(
+ : unavailableConstant = new InstanceConstant(
types.coreTypes.index
.getClass('dart:core', '_ConstantExpressionError')
.reference,
[],
{}),
- super(_ConstantsBackend(types.coreTypes), types, types.coreTypes, true,
+ super(new _ConstantsBackend(types.coreTypes), types, types.coreTypes, true,
enableAsserts, const _ErrorReporter()) {
- env = EvaluationEnvironment();
+ env = new EvaluationEnvironment();
}
@override
@@ -305,7 +305,7 @@ class _ConstantsBackend implements ConstantsBackend {
@override
buildSymbolConstant(StringConstant value) {
- return InstanceConstant(
+ return new InstanceConstant(
coreTypes.internalSymbolClass.reference,
const <DartType>[],
<Reference, Constant>{symbolNameField.reference: value});
diff --git a/pkg/dev_compiler/lib/src/kernel/native_types.dart b/pkg/dev_compiler/lib/src/kernel/native_types.dart
index 1daac64285..cde8c08f45 100644
--- a/pkg/dev_compiler/lib/src/kernel/native_types.dart
+++ b/pkg/dev_compiler/lib/src/kernel/native_types.dart
@@ -30,11 +30,11 @@ class NativeTypeSet {
// Abstract types that may be implemented by both native and non-native
// classes.
- final _extensibleTypes = HashSet<Class>.identity();
+ final _extensibleTypes = new HashSet<Class>.identity();
// Concrete native types.
- final _nativeTypes = HashSet<Class>.identity();
- final _pendingLibraries = HashSet<Library>.identity();
+ final _nativeTypes = new HashSet<Class>.identity();
+ final _pendingLibraries = new HashSet<Library>.identity();
NativeTypeSet(this.coreTypes, this.constants) {
// First, core types:
diff --git a/pkg/dev_compiler/lib/src/kernel/nullable_inference.dart b/pkg/dev_compiler/lib/src/kernel/nullable_inference.dart
index 8e212cfb1b..edf71afc72 100644
--- a/pkg/dev_compiler/lib/src/kernel/nullable_inference.dart
+++ b/pkg/dev_compiler/lib/src/kernel/nullable_inference.dart
@@ -36,7 +36,7 @@ class NullableInference extends ExpressionVisitor<bool> {
/// [allowNotNullDeclarations].
bool allowPackageMetaAnnotations = false;
- final _variableInference = _NullableVariableInference();
+ final _variableInference = new _NullableVariableInference();
NullableInference(this.jsTypeRep)
: types = jsTypeRep.types,
@@ -276,19 +276,19 @@ class _NullableVariableInference extends RecursiveVisitor<void> {
NullableInference _nullInference;
/// Variables that are currently believed to be not-null.
- final _notNullLocals = HashSet<VariableDeclaration>.identity();
+ final _notNullLocals = new HashSet<VariableDeclaration>.identity();
/// For each variable currently believed to be not-null ([_notNullLocals]),
/// this collects variables that it is assigned to, so we update them if we
/// later determine that the variable can be null.
final _assignedTo =
- HashMap<VariableDeclaration, List<VariableDeclaration>>.identity();
+ new HashMap<VariableDeclaration, List<VariableDeclaration>>.identity();
/// All functions that have been analyzed with [analyzeFunction].
///
/// In practice this will include the outermost function (typically a
/// [Procedure]) as well as an local functions it contains.
- final _functions = HashSet<FunctionNode>.identity();
+ final _functions = new HashSet<FunctionNode>.identity();
/// The current variable we are setting/initializing, so we can track if it
/// is [_assignedTo] from another variable.
diff --git a/pkg/dev_compiler/lib/src/kernel/property_model.dart b/pkg/dev_compiler/lib/src/kernel/property_model.dart
index 4242554bf6..85bc267822 100644
--- a/pkg/dev_compiler/lib/src/kernel/property_model.dart
+++ b/pkg/dev_compiler/lib/src/kernel/property_model.dart
@@ -21,10 +21,10 @@ import 'native_types.dart';
/// which members are private and thus, could not be overridden outside of the
/// current library.
class VirtualFieldModel {
- final _modelForLibrary = HashMap<Library, _LibraryVirtualFieldModel>();
+ final _modelForLibrary = new HashMap<Library, _LibraryVirtualFieldModel>();
_LibraryVirtualFieldModel _getModel(Library library) => _modelForLibrary
- .putIfAbsent(library, () => _LibraryVirtualFieldModel.build(library));
+ .putIfAbsent(library, () => new _LibraryVirtualFieldModel.build(library));
/// Returns true if a field is virtual.
bool isVirtual(Field field) =>
@@ -39,7 +39,7 @@ class _LibraryVirtualFieldModel {
///
/// This means we must generate them as virtual fields using a property pair
/// in JavaScript.
- final _overriddenPrivateFields = HashSet<Field>();
+ final _overriddenPrivateFields = new HashSet<Field>();
/// Private classes that can be extended outside of this library.
///
@@ -53,7 +53,7 @@ class _LibraryVirtualFieldModel {
/// class C extends _A {}
///
/// The class _A must treat is "x" as virtual, however _B does not.
- final _extensiblePrivateClasses = HashSet<Class>();
+ final _extensiblePrivateClasses = new HashSet<Class>();
_LibraryVirtualFieldModel.build(Library library) {
var allClasses = library.classes;
@@ -247,7 +247,7 @@ class ClassPropertyModel {
fieldModel.isVirtual(field) ||
field.isCovariant ||
field.isGenericCovariantImpl) {
- virtualFields[field] = JS.TemporaryId(name);
+ virtualFields[field] = new JS.TemporaryId(name);
}
}
}
diff --git a/pkg/dev_compiler/lib/src/kernel/target.dart b/pkg/dev_compiler/lib/src/kernel/target.dart
index 56f5b5f188..3e3ae26b3b 100644
--- a/pkg/dev_compiler/lib/src/kernel/target.dart
+++ b/pkg/dev_compiler/lib/src/kernel/target.dart
@@ -88,31 +88,31 @@ class DevCompilerTarget extends Target {
.getClass('dart:core', '_Invocation')
.constructors
.firstWhere((c) => c.name.name == name);
- return ConstructorInvocation(ctor, Arguments(positional));
+ return new ConstructorInvocation(ctor, new Arguments(positional));
}
if (name.startsWith('get:')) {
- return createInvocation('getter', [SymbolLiteral(name.substring(4))]);
+ return createInvocation('getter', [new SymbolLiteral(name.substring(4))]);
}
if (name.startsWith('set:')) {
return createInvocation('setter', [
- SymbolLiteral(name.substring(4) + '='),
+ new SymbolLiteral(name.substring(4) + '='),
arguments.positional.single
]);
}
- var ctorArgs = <Expression>[SymbolLiteral(name)];
+ var ctorArgs = <Expression>[new SymbolLiteral(name)];
bool isGeneric = arguments.types.isNotEmpty;
if (isGeneric) {
ctorArgs.add(
- ListLiteral(arguments.types.map((t) => TypeLiteral(t)).toList()));
+ new ListLiteral(arguments.types.map((t) => new TypeLiteral(t)).toList()));
} else {
- ctorArgs.add(NullLiteral());
+ ctorArgs.add(new NullLiteral());
}
- ctorArgs.add(ListLiteral(arguments.positional));
+ ctorArgs.add(new ListLiteral(arguments.positional));
if (arguments.named.isNotEmpty) {
- ctorArgs.add(MapLiteral(
+ ctorArgs.add(new MapLiteral(
arguments.named
- .map((n) => MapEntry(SymbolLiteral(n.name), n.value))
+ .map((n) => new MapEntry(new SymbolLiteral(n.name), n.value))
.toList(),
keyType: coreTypes.symbolClass.rawType));
}
@@ -133,6 +133,6 @@ class DevCompilerTarget extends Target {
bool isConstructor = false,
bool isTopLevel = false}) {
// TODO(sigmund): implement;
- return InvalidExpression(null);
+ return new InvalidExpression(null);
}
}
diff --git a/pkg/dev_compiler/lib/src/kernel/type_table.dart b/pkg/dev_compiler/lib/src/kernel/type_table.dart
index 313e8c946a..d2d72537a4 100644
--- a/pkg/dev_compiler/lib/src/kernel/type_table.dart
+++ b/pkg/dev_compiler/lib/src/kernel/type_table.dart
@@ -103,7 +103,7 @@ class _CacheTable {
/// Heuristically choose a good name for the cache and generator
/// variables.
JS.TemporaryId chooseTypeName(DartType type) {
- return JS.TemporaryId(_typeString(type));
+ return new JS.TemporaryId(_typeString(type));
}
}
@@ -150,7 +150,7 @@ class TypeTable {
/// parameter.
final _scopeDependencies = <TypeParameter, List<DartType>>{};
- TypeTable(JS.Identifier runtime) : _generators = _GeneratorTable(runtime);
+ TypeTable(JS.Identifier runtime) : _generators = new _GeneratorTable(runtime);
/// Emit a list of statements declaring the cache variables and generator
/// definitions tracked by the table. If [formals] is present, only
diff --git a/pkg/dev_compiler/tool/kernel_sdk.dart b/pkg/dev_compiler/tool/kernel_sdk.dart
index 6be14ed63e..ae5273a52b 100755
--- a/pkg/dev_compiler/tool/kernel_sdk.dart
+++ b/pkg/dev_compiler/tool/kernel_sdk.dart
@@ -18,7 +18,7 @@ import 'package:path/path.dart' as path;
Future main(List<String> args) async {
// Parse flags.
- var parser = ArgParser();
+ var parser = new ArgParser();
var parserOptions = parser.parse(args);
var rest = parserOptions.rest;
@@ -36,8 +36,8 @@ Future main(List<String> args) async {
}
var inputPath = path.absolute('tool/input_sdk');
- var target = DevCompilerTarget();
- var options = CompilerOptions()
+ var target = new DevCompilerTarget();
+ var options = new CompilerOptions()
..compileSdk = true
..packagesFileUri = path.toUri(path.absolute('../../.packages'))
..sdkRoot = path.toUri(inputPath)
@@ -47,10 +47,10 @@ Future main(List<String> args) async {
var component = await kernelForComponent(inputs, options);
var outputDir = path.dirname(outputPath);
- await Directory(outputDir).create(recursive: true);
+ await new Directory(outputDir).create(recursive: true);
await writeComponentToBinary(component, outputPath);
- var jsModule = ProgramCompiler(component, declaredVariables: {})
+ var jsModule = new ProgramCompiler(component, declaredVariables: {})
.emitModule(component, [], []);
var moduleFormats = {
'amd': ModuleFormat.amd,
@@ -63,9 +63,9 @@ Future main(List<String> args) async {
var format = moduleFormats[name];
var jsDir = path.join(outputDir, name);
var jsPath = path.join(jsDir, 'dart_sdk.js');
- await Directory(jsDir).create();
+ await new Directory(jsDir).create();
var jsCode = jsProgramToCode(jsModule, format);
- await File(jsPath).writeAsString(jsCode.code);
- await File('$jsPath.map').writeAsString(json.encode(jsCode.sourceMap));
+ await new File(jsPath).writeAsString(jsCode.code);
+ await new File('$jsPath.map').writeAsString(json.encode(jsCode.sourceMap));
}
}
diff --git a/pkg/dev_compiler/tool/patch_sdk.dart b/pkg/dev_compiler/tool/patch_sdk.dart
index 85060f0315..c8119aba69 100755
--- a/pkg/dev_compiler/tool/patch_sdk.dart
+++ b/pkg/dev_compiler/tool/patch_sdk.dart
@@ -30,7 +30,7 @@ void main(List<String> argv) {
exit(1);
}
- var selfModifyTime = File(self).lastModifiedSync().millisecondsSinceEpoch;
+ var selfModifyTime = new File(self).lastModifiedSync().millisecondsSinceEpoch;
var repoDir = argv[0];
var patchDir = argv[1];
@@ -43,17 +43,17 @@ void main(List<String> argv) {
// Copy libraries.dart, libraries.json and version
var librariesDart = path.join(patchDir, 'libraries.dart');
- var libContents = File(librariesDart).readAsStringSync();
+ var libContents = new File(librariesDart).readAsStringSync();
// TODO(jmesserly): can we remove this?
_writeSync(path.join(sdkOut, '_internal', 'libraries.dart'), libContents);
_writeSync(path.join(sdkOut, 'libraries.json'),
- File(path.join(patchDir, 'libraries.json')).readAsStringSync());
+ new File(path.join(patchDir, 'libraries.json')).readAsStringSync());
_writeSync(
path.join(
sdkOut, '_internal', 'sdk_library_metadata', 'lib', 'libraries.dart'),
libContents);
_writeSync(path.join(sdkOut, '..', 'version'),
- File(path.join(repoDir, 'tools', 'VERSION')).readAsStringSync());
+ new File(path.join(repoDir, 'tools', 'VERSION')).readAsStringSync());
// Parse libraries.dart
var sdkLibraries = _getSdkLibraries(libContents);
@@ -71,13 +71,13 @@ void main(List<String> argv) {
if (library.path.contains(INTERNAL_PATH)) {
libraryIn =
path.join(privateIn, library.path.replaceAll(INTERNAL_PATH, ''));
- } else if (File(libraryOverride).existsSync()) {
+ } else if (new File(libraryOverride).existsSync()) {
libraryIn = libraryOverride;
} else {
libraryIn = libraryOut;
}
- var libraryFile = File(libraryIn);
+ var libraryFile = new File(libraryIn);
if (libraryFile.existsSync()) {
var outPaths = <String>[libraryOut];
var libraryContents = libraryFile.readAsStringSync();
@@ -90,7 +90,7 @@ void main(List<String> argv) {
var partPath = part.uri.stringValue;
outPaths.add(path.join(path.dirname(libraryOut), partPath));
- var partFile = File(path.join(path.dirname(libraryIn), partPath));
+ var partFile = new File(path.join(path.dirname(libraryIn), partPath));
partFiles.add(partFile);
inputModifyTime = math.max(inputModifyTime,
partFile.lastModifiedSync().millisecondsSinceEpoch);
@@ -101,7 +101,7 @@ void main(List<String> argv) {
var patchPath = path.join(
patchIn, path.basenameWithoutExtension(libraryIn) + '_patch.dart');
- var patchFile = File(patchPath);
+ var patchFile = new File(patchPath);
bool patchExists = patchFile.existsSync();
if (patchExists) {
inputModifyTime = math.max(inputModifyTime,
@@ -116,7 +116,7 @@ void main(List<String> argv) {
// Compare output modify time with input modify time.
bool needsUpdate = false;
for (var outPath in outPaths) {
- var outFile = File(outPath);
+ var outFile = new File(outPath);
if (!outFile.existsSync() ||
outFile.lastModifiedSync().millisecondsSinceEpoch <
inputModifyTime) {
@@ -147,10 +147,10 @@ void main(List<String> argv) {
/// Writes a file, creating the directory if needed.
void _writeSync(String filePath, String contents) {
- var outDir = Directory(path.dirname(filePath));
+ var outDir = new Directory(path.dirname(filePath));
if (!outDir.existsSync()) outDir.createSync(recursive: true);
- File(filePath).writeAsStringSync(contents);
+ new File(filePath).writeAsStringSync(contents);
}
/// Merges dart:* library code with code from *_patch.dart file.
@@ -177,20 +177,20 @@ List<String> _patchLibrary(List<String> partsContents, String patchContents) {
// Parse the patch first. We'll need to extract bits of this as we go through
// the other files.
- var patchFinder = PatchFinder.parseAndVisit(patchContents);
+ var patchFinder = new PatchFinder.parseAndVisit(patchContents);
// Merge `external` declarations with the corresponding `@patch` code.
bool failed = false;
for (var partContent in partsContents) {
- var partEdits = StringEditBuffer(partContent);
+ var partEdits = new StringEditBuffer(partContent);
var partUnit = parseCompilationUnit(partContent);
- var patcher = PatchApplier(partEdits, patchFinder);
+ var patcher = new PatchApplier(partEdits, patchFinder);
partUnit.accept(patcher);
if (!failed) failed = patcher.patchWasMissing;
results.add(partEdits);
}
if (failed) return null;
- return List<String>.from(results.map((e) => e.toString()));
+ return results.map((e) => e.toString()).toList();
}
/// Merge `@patch` declarations into `external` declarations.
@@ -395,7 +395,7 @@ class StringEditBuffer {
/// Edit the original text, replacing text on the range [begin] and
/// exclusive [end] with the [replacement] string.
void replace(int begin, int end, String replacement) {
- _edits.add(_StringEdit(begin, end, replacement));
+ _edits.add(new _StringEdit(begin, end, replacement));
}
/// Insert [string] at [offset].
@@ -415,7 +415,7 @@ class StringEditBuffer {
/// Throws [UnsupportedError] if the edits were overlapping. If no edits were
/// made, the original string will be returned.
String toString() {
- var sb = StringBuffer();
+ var sb = new StringBuffer();
if (_edits.length == 0) return original;
// Sort edits by start location.
@@ -473,7 +473,7 @@ List<SdkLibrary> _getSdkLibraries(String contents) {
// TODO(jmesserly): fix SdkLibrariesReader_LibraryBuilder in Analyzer.
// It doesn't understand optional new/const in Dart 2. For now, we keep
// redundant `const` in tool/input_sdk/libraries.dart as a workaround.
- var libraryBuilder = SdkLibrariesReader_LibraryBuilder(true);
+ var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(true);
parseCompilationUnit(contents).accept(libraryBuilder);
return libraryBuilder.librariesMap.sdkLibraries;
}
diff --git a/pkg/front_end/tool/fasta b/pkg/front_end/tool/fasta
index 32485f4344..c9928da490 100755
--- a/pkg/front_end/tool/fasta
+++ b/pkg/front_end/tool/fasta
@@ -54,7 +54,7 @@ case "${1//_/-}" in
PATCHED_SDK_DIR=$(
ls -d {xcodebuild,out}/${DART_CONFIGURATION} 2>/dev/null \
| head -1)
- exec "${DART_VM}" --preview_dart_2 -DDFE_VERBOSE=true "$@"
+ exec "${DART_VM}" -DDFE_VERBOSE=true "$@"
;;
testing)
SCRIPT="${REPO_DIR}/pkg/testing/bin/testing.dart"
diff --git a/pkg/js_ast/lib/src/builder.dart b/pkg/js_ast/lib/src/builder.dart
index 1de3981b7d..c5909472b1 100644
--- a/pkg/js_ast/lib/src/builder.dart
+++ b/pkg/js_ast/lib/src/builder.dart
@@ -183,7 +183,7 @@ What is not implemented:
should be splice or is intended as a single value.
*/
-const JsBuilder js = const JsBuilder();
+JsBuilder js = new JsBuilder();
class JsBuilder {
const JsBuilder();
diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
index 29f6545010..4aef72ce91 100644
--- a/runtime/BUILD.gn
+++ b/runtime/BUILD.gn
@@ -161,9 +161,9 @@ config("dart_config") {
if (!is_win) {
cflags = [
- "-Werror",
- "-Wall",
- "-Wextra", # Also known as -W.
+ # -Werror,
+ # -Wall,
+ # -Wextra, # Also known as -W.
"-Wno-unused-parameter",
"-Wnon-virtual-dtor",
"-Wvla",
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 226f9595f8..676bfb0d1c 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -710,48 +710,48 @@ copy("copy_dev_compiler_js_legacy_kernel") {
}
# Copies all of the JS artifacts needed by DDC.
-group("copy_dev_compiler_js") {
- visibility = [
- ":copy_dev_compiler_sdk",
- ":copy_dev_compiler_tools",
- ]
- public_deps = [
- ":copy_dev_compiler_js_amd",
- ":copy_dev_compiler_js_amd_kernel",
- ":copy_dev_compiler_js_common",
- ":copy_dev_compiler_js_common_kernel",
- ":copy_dev_compiler_js_es6",
- ":copy_dev_compiler_js_es6_kernel",
- ":copy_dev_compiler_js_legacy",
- ":copy_dev_compiler_js_legacy_kernel",
- ]
-}
+# group("copy_dev_compiler_js") {
+# visibility = [
+# ":copy_dev_compiler_sdk",
+# ":copy_dev_compiler_tools",
+# ]
+# public_deps = [
+# ":copy_dev_compiler_js_amd",
+# ":copy_dev_compiler_js_amd_kernel",
+# ":copy_dev_compiler_js_common",
+# ":copy_dev_compiler_js_common_kernel",
+# ":copy_dev_compiler_js_es6",
+# ":copy_dev_compiler_js_es6_kernel",
+# ":copy_dev_compiler_js_legacy",
+# ":copy_dev_compiler_js_legacy_kernel",
+# ]
+# }
# This rule copies tools to go along with ddc.
-copy("copy_dev_compiler_tools") {
- visibility = [ ":copy_dev_compiler_sdk" ]
- deps = [
- ":copy_dev_compiler_js",
- "../utils/dartdevc:dartdevc_web",
- "../utils/dartdevc:stack_trace_mapper",
- ]
- dart_out = get_label_info("../utils/dartdevc:dartdevc_web", "root_out_dir")
- sources = [
- "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js",
- "$dart_out/dev_compiler/build/web/ddc_web_compiler.js",
- ]
- outputs = [
- "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}",
- ]
-}
+#copy("copy_dev_compiler_tools") {
+# visibility = [ ":copy_dev_compiler_sdk" ]
+# deps = [
+# ":copy_dev_compiler_js",
+# "../utils/dartdevc:dartdevc_web",
+# "../utils/dartdevc:stack_trace_mapper",
+# ]
+# dart_out = get_label_info("../utils/dartdevc:dartdevc_web", "root_out_dir")
+# sources = [
+# "$dart_out/dev_compiler/build/web/dart_stack_trace_mapper.js",
+# "$dart_out/dev_compiler/build/web/ddc_web_compiler.js",
+# ]
+# outputs = [
+# "$root_out_dir/dart-sdk/lib/dev_compiler/web/{{source_file_part}}",
+# ]
+#}
# This is the main rule for copying ddc's dependencies to lib/
group("copy_dev_compiler_sdk") {
visibility = [ ":create_full_sdk" ]
public_deps = [
- ":copy_dev_compiler_js",
+ # ":copy_dev_compiler_js",
":copy_dev_compiler_summary",
- ":copy_dev_compiler_tools",
+ # ":copy_dev_compiler_tools",
]
}
diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
index 42028b75bf..4bd64645d0 100755
--- a/tools/observatory_tool.py
+++ b/tools/observatory_tool.py
@@ -179,7 +179,7 @@ def Build(dart_executable,
if not silent:
DisplayBootstrapWarning()
command = [dart_executable, DART2JS_PATH]
- command += ['--no-preview-dart-2']
+ command += []
command += ['-DOBS_VER=' + utils.GetVersion(no_git_hash=True)]
command += [script_path, '-o', output_path, '--packages=%s' % packages_path]
# Add the defaults pub used
diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni
index 5ed85b2d38..96cc2fc67b 100644
--- a/utils/application_snapshot.gni
+++ b/utils/application_snapshot.gni
@@ -87,7 +87,7 @@ template("application_snapshot") {
deps = extra_deps
if (dart_version == 1) {
- snapshot_vm_args += [ "--no-preview-dart-2" ]
+ snapshot_vm_args += [ ]
} else {
# HACK: When creating app-jit snapshots for Dart 2 apps, the standalone
# Dart VM binary requires the app-jit snapshot for the kernel service to
@@ -112,6 +112,7 @@ template("application_snapshot") {
vm_args = [
"--deterministic",
+ "--no_preview_dart_2",
"--packages=$dot_packages",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
@@ -177,8 +178,9 @@ template("aot_assembly") {
vm_args = [
# TODO(asiva): For not use --no-preview-dart-2, need to flip this to use
# gen_kernel to generate a kernel file before creating an app snapshot.
- "--no-preview-dart-2",
+
"--deterministic",
+ "--no_preview_dart_2",
"--packages=$dot_packages",
"--snapshot-kind=app-aot",
"--snapshot=$abs_output",
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index ab80bccb5f..b5667bf98f 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -117,10 +117,10 @@ template("dart2js_compile") {
}
}
-dart2js_compile("dartdevc_web") {
- main = rebase_path("../../pkg/dev_compiler/web/main.dart")
- out = "$root_out_dir/dev_compiler/build/web/ddc_web_compiler.js"
-}
+# dart2js_compile("dartdevc_web") {
+# main = rebase_path("../../pkg/dev_compiler/web/main.dart")
+# out = "$root_out_dir/dev_compiler/build/web/ddc_web_compiler.js"
+# }
dart2js_compile("stack_trace_mapper") {
main = rebase_path("../../pkg/dev_compiler/web/stack_trace_mapper.dart")
--
2.29.2
|