OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library dart2js.semantics_visitor; | 5 library dart2js.semantics_visitor; |
6 | 6 |
7 import '../constants/expressions.dart'; | 7 import '../constants/expressions.dart'; |
8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
9 import '../diagnostics/spannable.dart' show | 9 import '../diagnostics/spannable.dart' show |
10 Spannable, | 10 Spannable, |
(...skipping 2171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 /// m(rhs) => super.field += rhs; | 2182 /// m(rhs) => super.field += rhs; |
2183 /// } | 2183 /// } |
2184 /// | 2184 /// |
2185 R visitFinalSuperFieldCompound( | 2185 R visitFinalSuperFieldCompound( |
2186 Send node, | 2186 Send node, |
2187 FieldElement field, | 2187 FieldElement field, |
2188 AssignmentOperator operator, | 2188 AssignmentOperator operator, |
2189 Node rhs, | 2189 Node rhs, |
2190 A arg); | 2190 A arg); |
2191 | 2191 |
| 2192 /// If-null assignment expression of [rhs] to the [name] property on |
| 2193 /// [receiver]. That is, [rhs] is only evaluated and assigned, if the value |
| 2194 /// of [name] on [receiver] is `null`. |
| 2195 /// |
| 2196 /// For instance: |
| 2197 /// |
| 2198 /// m(receiver, rhs) => receiver.foo ??= rhs; |
| 2199 /// |
| 2200 R visitDynamicPropertySetIfNull( |
| 2201 Send node, |
| 2202 Node receiver, |
| 2203 Name name, |
| 2204 Node rhs, |
| 2205 A arg); |
| 2206 |
| 2207 /// If-null assignment expression of [rhs] to the [name] property on |
| 2208 /// [receiver] if not null. That is, [rhs] is only evaluated and assigned, |
| 2209 /// if the value of [receiver] is _not_ `null` and the value of [name] on |
| 2210 /// [receiver] is `null`. |
| 2211 /// |
| 2212 /// For instance: |
| 2213 /// |
| 2214 /// m(receiver, rhs) => receiver?.foo ??= rhs; |
| 2215 /// |
| 2216 R visitIfNotNullDynamicPropertySetIfNull( |
| 2217 Send node, |
| 2218 Node receiver, |
| 2219 Name name, |
| 2220 Node rhs, |
| 2221 A arg); |
| 2222 |
| 2223 /// If-null assignment expression of [rhs] to the [name] property on `this`. |
| 2224 /// That is, [rhs] is only evaluated and assigned, if the value of [name] on |
| 2225 /// `this` is `null`. |
| 2226 /// |
| 2227 /// For instance: |
| 2228 /// |
| 2229 /// class C { |
| 2230 /// m(rhs) => this.foo ??= rhs; |
| 2231 /// } |
| 2232 /// |
| 2233 /// or |
| 2234 /// |
| 2235 /// class C { |
| 2236 /// m(rhs) => foo ??= rhs; |
| 2237 /// } |
| 2238 /// |
| 2239 R visitThisPropertySetIfNull( |
| 2240 Send node, |
| 2241 Name name, |
| 2242 Node rhs, |
| 2243 A arg); |
| 2244 |
| 2245 /// If-null assignment expression of [rhs] to [parameter]. That is, [rhs] is |
| 2246 /// only evaluated and assigned, if the value of the [parameter] is `null`. |
| 2247 /// |
| 2248 /// For instance: |
| 2249 /// |
| 2250 /// m(parameter, rhs) => parameter ??= rhs; |
| 2251 /// |
| 2252 R visitParameterSetIfNull( |
| 2253 Send node, |
| 2254 ParameterElement parameter, |
| 2255 Node rhs, |
| 2256 A arg); |
| 2257 |
| 2258 /// If-null assignment expression of [rhs] to the final [parameter]. That is, |
| 2259 /// [rhs] is only evaluated and assigned, if the value of the [parameter] is |
| 2260 /// `null`. |
| 2261 /// |
| 2262 /// For instance: |
| 2263 /// |
| 2264 /// m(final parameter, rhs) => parameter ??= rhs; |
| 2265 /// |
| 2266 R visitFinalParameterSetIfNull( |
| 2267 Send node, |
| 2268 ParameterElement parameter, |
| 2269 Node rhs, |
| 2270 A arg); |
| 2271 |
| 2272 /// If-null assignment expression of [rhs] to the local [variable]. That is, |
| 2273 /// [rhs] is only evaluated and assigned, if the value of the [variable] is |
| 2274 /// `null`. |
| 2275 /// |
| 2276 /// For instance: |
| 2277 /// |
| 2278 /// m(rhs) { |
| 2279 /// var variable; |
| 2280 /// variable ??= rhs; |
| 2281 /// } |
| 2282 /// |
| 2283 R visitLocalVariableSetIfNull( |
| 2284 Send node, |
| 2285 LocalVariableElement variable, |
| 2286 Node rhs, |
| 2287 A arg); |
| 2288 |
| 2289 /// If-null assignment expression of [rhs] to the final local [variable]. That |
| 2290 /// is, [rhs] is only evaluated and assigned, if the value of the [variable] |
| 2291 /// is `null`. |
| 2292 /// |
| 2293 /// For instance: |
| 2294 /// |
| 2295 /// m(rhs) { |
| 2296 /// final variable = 0; |
| 2297 /// variable ??= rhs; |
| 2298 /// } |
| 2299 /// |
| 2300 R visitFinalLocalVariableSetIfNull( |
| 2301 Send node, |
| 2302 LocalVariableElement variable, |
| 2303 Node rhs, |
| 2304 A arg); |
| 2305 |
| 2306 /// If-null assignment expression of [rhs] to the local [function]. That is, |
| 2307 /// [rhs] is only evaluated and assigned, if the value of the [function] is |
| 2308 /// `null`. The behavior is thus equivalent to a closurization of [function]. |
| 2309 /// |
| 2310 /// For instance: |
| 2311 /// |
| 2312 /// m(rhs) { |
| 2313 /// function() {} |
| 2314 /// function ??= rhs; |
| 2315 /// } |
| 2316 /// |
| 2317 R visitLocalFunctionSetIfNull( |
| 2318 Send node, |
| 2319 LocalFunctionElement function, |
| 2320 Node rhs, |
| 2321 A arg); |
| 2322 |
| 2323 /// If-null assignment expression of [rhs] to the static [field]. That is, |
| 2324 /// [rhs] is only evaluated and assigned, if the value of the [field] is |
| 2325 /// `null`. |
| 2326 /// |
| 2327 /// For instance: |
| 2328 /// |
| 2329 /// class C { |
| 2330 /// static var field; |
| 2331 /// m(rhs) => field ??= rhs; |
| 2332 /// } |
| 2333 /// |
| 2334 R visitStaticFieldSetIfNull( |
| 2335 Send node, |
| 2336 FieldElement field, |
| 2337 Node rhs, |
| 2338 A arg); |
| 2339 |
| 2340 /// If-null assignment expression of [rhs] to the final static [field]. That |
| 2341 /// is, [rhs] is only evaluated and assigned, if the value of the [field] is |
| 2342 /// `null`. |
| 2343 /// |
| 2344 /// For instance: |
| 2345 /// |
| 2346 /// class C { |
| 2347 /// static final field = 0; |
| 2348 /// m(rhs) => field ??= rhs; |
| 2349 /// } |
| 2350 /// |
| 2351 R visitFinalStaticFieldSetIfNull( |
| 2352 Send node, |
| 2353 FieldElement field, |
| 2354 Node rhs, |
| 2355 A arg); |
| 2356 |
| 2357 /// If-null assignment expression of [rhs] to the static property defined by |
| 2358 /// [getter] and [setter]. That is, [rhs] is only evaluated and assigned to |
| 2359 /// the [setter], if the value of the [getter] is `null`. |
| 2360 /// |
| 2361 /// For instance: |
| 2362 /// |
| 2363 /// class C { |
| 2364 /// static get o => 0; |
| 2365 /// static set o(_) {} |
| 2366 /// m(rhs) => o ??= rhs; |
| 2367 /// } |
| 2368 /// |
| 2369 R visitStaticGetterSetterSetIfNull( |
| 2370 Send node, |
| 2371 FunctionElement getter, |
| 2372 FunctionElement setter, |
| 2373 Node rhs, |
| 2374 A arg); |
| 2375 |
| 2376 /// If-null assignment expression of [rhs] to the static property defined by |
| 2377 /// [method] and [setter]. That is, [rhs] is only evaluated and assigned to |
| 2378 /// the [setter], if the value of the [method] is `null`. The behavior is thus |
| 2379 /// equivalent to a closurization of [method]. |
| 2380 /// |
| 2381 /// For instance: |
| 2382 /// |
| 2383 /// class C { |
| 2384 /// static o() {} |
| 2385 /// static set o(_) {} |
| 2386 /// m(rhs) => o ??= rhs; |
| 2387 /// } |
| 2388 /// |
| 2389 R visitStaticMethodSetterSetIfNull( |
| 2390 Send node, |
| 2391 MethodElement method, |
| 2392 MethodElement setter, |
| 2393 Node rhs, |
| 2394 A arg); |
| 2395 |
| 2396 /// If-null assignment expression of [rhs] to the static [method]. That is, |
| 2397 /// [rhs] is only evaluated and assigned, if the value of the [method] is |
| 2398 /// `null`. The behavior is thus equivalent to a closurization of [method]. |
| 2399 /// |
| 2400 /// For instance: |
| 2401 /// |
| 2402 /// o() {} |
| 2403 /// m(rhs) => o ??= rhs; |
| 2404 /// |
| 2405 R visitStaticMethodSetIfNull( |
| 2406 Send node, |
| 2407 FunctionElement method, |
| 2408 Node rhs, |
| 2409 A arg); |
| 2410 |
| 2411 /// If-null assignment expression of [rhs] to the top level [field]. That is, |
| 2412 /// [rhs] is only evaluated and assigned, if the value of the [field] is |
| 2413 /// `null`. |
| 2414 /// |
| 2415 /// For instance: |
| 2416 /// |
| 2417 /// var field; |
| 2418 /// m(rhs) => field ??= rhs; |
| 2419 /// |
| 2420 R visitTopLevelFieldSetIfNull( |
| 2421 Send node, |
| 2422 FieldElement field, |
| 2423 Node rhs, |
| 2424 A arg); |
| 2425 |
| 2426 /// If-null assignment expression of [rhs] to the final top level [field]. |
| 2427 /// That is, [rhs] is only evaluated and assigned, if the value of the [field] |
| 2428 /// is `null`. |
| 2429 /// |
| 2430 /// For instance: |
| 2431 /// |
| 2432 /// final field = 0; |
| 2433 /// m(rhs) => field ??= rhs; |
| 2434 /// |
| 2435 R visitFinalTopLevelFieldSetIfNull( |
| 2436 Send node, |
| 2437 FieldElement field, |
| 2438 Node rhs, |
| 2439 A arg); |
| 2440 |
| 2441 /// If-null assignment expression of [rhs] to the top level property defined |
| 2442 /// by [getter] and [setter]. That is, [rhs] is only evaluated and assigned to |
| 2443 /// the [setter], if the value of the [getter] is `null`. |
| 2444 /// |
| 2445 /// For instance: |
| 2446 /// |
| 2447 /// get o => 0; |
| 2448 /// set o(_) {} |
| 2449 /// m(rhs) => o ??= rhs; |
| 2450 /// |
| 2451 R visitTopLevelGetterSetterSetIfNull( |
| 2452 Send node, |
| 2453 FunctionElement getter, |
| 2454 FunctionElement setter, |
| 2455 Node rhs, |
| 2456 A arg); |
| 2457 |
| 2458 /// If-null assignment expression of [rhs] to the top level property defined |
| 2459 /// by [method] and [setter]. That is, [rhs] is only evaluated and assigned to |
| 2460 /// the [setter], if the value of the [method] is `null`. The behavior is thus |
| 2461 /// equivalent to a closurization of [method]. |
| 2462 /// |
| 2463 /// For instance: |
| 2464 /// |
| 2465 /// o() {} |
| 2466 /// set o(_) {} |
| 2467 /// m(rhs) => o ??= rhs; |
| 2468 /// |
| 2469 R visitTopLevelMethodSetterSetIfNull( |
| 2470 Send node, |
| 2471 FunctionElement method, |
| 2472 FunctionElement setter, |
| 2473 Node rhs, |
| 2474 A arg); |
| 2475 |
| 2476 /// If-null assignment expression of [rhs] to the top level [method]. That is, |
| 2477 /// [rhs] is only evaluated and assigned, if the value of the [method] is |
| 2478 /// `null`. The behavior is thus equivalent to a closurization of [method]. |
| 2479 /// |
| 2480 /// For instance: |
| 2481 /// |
| 2482 /// o() {} |
| 2483 /// m(rhs) => o ??= rhs; |
| 2484 /// |
| 2485 R visitTopLevelMethodSetIfNull( |
| 2486 Send node, |
| 2487 FunctionElement method, |
| 2488 Node rhs, |
| 2489 A arg); |
| 2490 |
| 2491 /// If-null assignment expression of [rhs] to the super [field]. That is, |
| 2492 /// [rhs] is only evaluated and assigned, if the value of the [field] is |
| 2493 /// `null`. |
| 2494 /// |
| 2495 /// For instance: |
| 2496 /// |
| 2497 /// class B { |
| 2498 /// var field; |
| 2499 /// } |
| 2500 /// class C extends B { |
| 2501 /// m(rhs) => super.field ??= rhs; |
| 2502 /// } |
| 2503 /// |
| 2504 R visitSuperFieldSetIfNull( |
| 2505 Send node, |
| 2506 FieldElement field, |
| 2507 Node rhs, |
| 2508 A arg); |
| 2509 |
| 2510 /// If-null assignment expression of [rhs] to the final super [field]. That |
| 2511 /// is, [rhs] is only evaluated and assigned, if the value of the [field] is |
| 2512 /// `null`. |
| 2513 /// |
| 2514 /// For instance: |
| 2515 /// |
| 2516 /// class B { |
| 2517 /// final field = 42; |
| 2518 /// } |
| 2519 /// class C extends B { |
| 2520 /// m(rhs) => super.field ??= rhs; |
| 2521 /// } |
| 2522 /// |
| 2523 R visitFinalSuperFieldSetIfNull( |
| 2524 Send node, |
| 2525 FieldElement field, |
| 2526 Node rhs, |
| 2527 A arg); |
| 2528 |
| 2529 /// If-null assignment expression of [rhs] to the super property defined |
| 2530 /// by [readField] and [writtenField]. That is, [rhs] is only evaluated and |
| 2531 /// assigned to the [writtenField], if the value of the [readField] is `null`. |
| 2532 /// |
| 2533 /// For instance: |
| 2534 /// |
| 2535 /// class A { |
| 2536 /// var field; |
| 2537 /// } |
| 2538 /// class B extends A { |
| 2539 /// final field; |
| 2540 /// } |
| 2541 /// class C extends B { |
| 2542 /// m() => super.field ??= rhs; |
| 2543 /// } |
| 2544 /// |
| 2545 R visitSuperFieldFieldSetIfNull( |
| 2546 Send node, |
| 2547 FieldElement readField, |
| 2548 FieldElement writtenField, |
| 2549 Node rhs, |
| 2550 A arg); |
| 2551 |
| 2552 /// If-null assignment expression of [rhs] to the super property defined |
| 2553 /// by [getter] and [setter]. That is, [rhs] is only evaluated and assigned to |
| 2554 /// the [setter], if the value of the [getter] is `null`. |
| 2555 /// |
| 2556 /// For instance: |
| 2557 /// |
| 2558 /// class B { |
| 2559 /// get o => 0; |
| 2560 /// set o(_) {} |
| 2561 /// } |
| 2562 /// class C extends B { |
| 2563 /// m(rhs) => super.o ??= rhs; |
| 2564 /// } |
| 2565 /// |
| 2566 R visitSuperGetterSetterSetIfNull( |
| 2567 Send node, |
| 2568 FunctionElement getter, |
| 2569 FunctionElement setter, |
| 2570 Node rhs, |
| 2571 A arg); |
| 2572 |
| 2573 /// If-null assignment expression of [rhs] to the super property defined |
| 2574 /// by [method] and [setter]. That is, [rhs] is only evaluated and assigned to |
| 2575 /// the [setter], if the value of the [method] is `null`. The behavior is thus |
| 2576 /// equivalent to a closurization of [method]. |
| 2577 /// |
| 2578 /// For instance: |
| 2579 /// |
| 2580 /// class B { |
| 2581 /// o() {} |
| 2582 /// set o(_) {} |
| 2583 /// } |
| 2584 /// class C extends B { |
| 2585 /// m(rhs) => super.o ??= rhs; |
| 2586 /// } |
| 2587 /// |
| 2588 R visitSuperMethodSetterSetIfNull( |
| 2589 Send node, |
| 2590 FunctionElement method, |
| 2591 FunctionElement setter, |
| 2592 Node rhs, |
| 2593 A arg); |
| 2594 |
| 2595 /// If-null assignment expression of [rhs] to the super [method]. |
| 2596 /// That is, [rhs] is only evaluated and assigned, if the value of |
| 2597 /// the [method] is `null`. The behavior is thus equivalent to a closurization |
| 2598 /// of [method]. |
| 2599 /// |
| 2600 /// For instance: |
| 2601 /// |
| 2602 /// class B { |
| 2603 /// o() {} |
| 2604 /// } |
| 2605 /// class C extends B { |
| 2606 /// m(rhs) => super.o ??= rhs; |
| 2607 /// } |
| 2608 /// |
| 2609 R visitSuperMethodSetIfNull( |
| 2610 Send node, |
| 2611 FunctionElement method, |
| 2612 Node rhs, |
| 2613 A arg); |
| 2614 |
| 2615 /// If-null assignment expression of [rhs] to the super property defined |
| 2616 /// by [setter] with no corresponding getter. That is, [rhs] is only evaluated |
| 2617 /// and assigned to the [setter], if the value of the unresolved getter is |
| 2618 /// `null`. The behavior is thus equivalent to a no such method error. |
| 2619 /// |
| 2620 /// For instance: |
| 2621 /// |
| 2622 /// class B { |
| 2623 /// set o(_) {} |
| 2624 /// } |
| 2625 /// class C extends B { |
| 2626 /// m(rhs) => super.o ??= rhs; |
| 2627 /// } |
| 2628 /// |
| 2629 R visitUnresolvedSuperGetterSetIfNull( |
| 2630 Send node, |
| 2631 Element element, |
| 2632 MethodElement setter, |
| 2633 Node rhs, |
| 2634 A arg); |
| 2635 |
| 2636 /// If-null assignment expression of [rhs] to the super property defined |
| 2637 /// by [getter] with no corresponding setter. That is, [rhs] is only evaluated |
| 2638 /// and assigned to the unresolved setter, if the value of the [getter] is |
| 2639 /// `null`. |
| 2640 /// |
| 2641 /// For instance: |
| 2642 /// |
| 2643 /// class B { |
| 2644 /// get o => 42; |
| 2645 /// } |
| 2646 /// class C extends B { |
| 2647 /// m(rhs) => super.o ??= rhs; |
| 2648 /// } |
| 2649 /// |
| 2650 R visitUnresolvedSuperSetterSetIfNull( |
| 2651 Send node, |
| 2652 MethodElement getter, |
| 2653 Element element, |
| 2654 Node rhs, |
| 2655 A arg); |
| 2656 |
| 2657 /// If-null assignment expression of [rhs] to the top level property defined |
| 2658 /// by [field] and [setter]. That is, [rhs] is only evaluated and assigned to |
| 2659 /// the [setter], if the value of the [field] is `null`. |
| 2660 /// |
| 2661 /// For instance: |
| 2662 /// |
| 2663 /// class A { |
| 2664 /// var o; |
| 2665 /// } |
| 2666 /// class B extends A { |
| 2667 /// set o(_) {} |
| 2668 /// } |
| 2669 /// class C extends B { |
| 2670 /// m(rhs) => super.o ??= rhs; |
| 2671 /// } |
| 2672 /// |
| 2673 R visitSuperFieldSetterSetIfNull( |
| 2674 Send node, |
| 2675 FieldElement field, |
| 2676 FunctionElement setter, |
| 2677 Node rhs, |
| 2678 A arg); |
| 2679 |
| 2680 /// If-null assignment expression of [rhs] to the top level property defined |
| 2681 /// by [getter] and [field]. That is, [rhs] is only evaluated and assigned to |
| 2682 /// the [field], if the value of the [getter] is `null`. |
| 2683 /// |
| 2684 /// For instance: |
| 2685 /// |
| 2686 /// class A { |
| 2687 /// var o; |
| 2688 /// } |
| 2689 /// class B extends A { |
| 2690 /// get o => 0; |
| 2691 /// } |
| 2692 /// class C extends B { |
| 2693 /// m(rhs) => super.o ??= rhs; |
| 2694 /// } |
| 2695 /// |
| 2696 R visitSuperGetterFieldSetIfNull( |
| 2697 Send node, |
| 2698 FunctionElement getter, |
| 2699 FieldElement field, |
| 2700 Node rhs, |
| 2701 A arg); |
| 2702 |
| 2703 /// If-null assignment expression of [rhs] to an unresolved super property. |
| 2704 /// That is, [rhs] is only evaluated and assigned, if the value of the |
| 2705 /// unresolved property is `null`. The behavior is thus equivalent to a no |
| 2706 /// such method error. |
| 2707 /// |
| 2708 /// For instance: |
| 2709 /// |
| 2710 /// class B { |
| 2711 /// } |
| 2712 /// class C extends B { |
| 2713 /// m(rhs) => super.unresolved ??= rhs; |
| 2714 /// } |
| 2715 /// |
| 2716 R visitUnresolvedSuperSetIfNull( |
| 2717 Send node, |
| 2718 Element element, |
| 2719 Node rhs, |
| 2720 A arg); |
| 2721 |
| 2722 /// If-null assignment expression of [rhs] to the static property defined |
| 2723 /// by [setter] with no corresponding getter. That is, [rhs] is only evaluated |
| 2724 /// and assigned to the [setter], if the value of the unresolved |
| 2725 /// getter is `null`. The behavior is thus equivalent to a no such method |
| 2726 /// error. |
| 2727 /// |
| 2728 /// For instance: |
| 2729 /// |
| 2730 /// class C { |
| 2731 /// set foo(_) {} |
| 2732 /// } |
| 2733 /// m1() => C.foo ??= 42; |
| 2734 /// |
| 2735 R visitUnresolvedStaticGetterSetIfNull( |
| 2736 Send node, |
| 2737 Element element, |
| 2738 MethodElement setter, |
| 2739 Node rhs, |
| 2740 A arg); |
| 2741 |
| 2742 /// If-null assignment expression of [rhs] to the top level property defined |
| 2743 /// by [setter] with no corresponding getter. That is, [rhs] is only evaluated |
| 2744 /// and assigned to the [setter], if the value of the unresolved getter is |
| 2745 /// `null`. The behavior is thus equivalent to a no such method error. |
| 2746 /// |
| 2747 /// For instance: |
| 2748 /// |
| 2749 /// set foo(_) {} |
| 2750 /// m1() => foo ??= 42; |
| 2751 /// |
| 2752 R visitUnresolvedTopLevelGetterSetIfNull( |
| 2753 Send node, |
| 2754 Element element, |
| 2755 MethodElement setter, |
| 2756 Node rhs, |
| 2757 A arg); |
| 2758 |
| 2759 /// If-null assignment expression of [rhs] to the static property defined |
| 2760 /// by [getter] with no corresponding setter. That is, [rhs] is only evaluated |
| 2761 /// and assigned to the unresolved setter, if the value of the [getter] is |
| 2762 /// `null`. |
| 2763 /// |
| 2764 /// For instance: |
| 2765 /// |
| 2766 /// class C { |
| 2767 /// get foo => 42; |
| 2768 /// } |
| 2769 /// m1() => C.foo ??= 42; |
| 2770 /// |
| 2771 R visitUnresolvedStaticSetterSetIfNull( |
| 2772 Send node, |
| 2773 MethodElement getter, |
| 2774 Element element, |
| 2775 Node rhs, |
| 2776 A arg); |
| 2777 |
| 2778 /// If-null assignment expression of [rhs] to the top level property defined |
| 2779 /// by [getter] with no corresponding setter. That is, [rhs] is only evaluated |
| 2780 /// and assigned to the unresolved setter, if the value of the [getter] is |
| 2781 /// `null`. |
| 2782 /// |
| 2783 /// For instance: |
| 2784 /// |
| 2785 /// get foo => 42; |
| 2786 /// m1() => foo ??= 42; |
| 2787 /// |
| 2788 R visitUnresolvedTopLevelSetterSetIfNull( |
| 2789 Send node, |
| 2790 MethodElement getter, |
| 2791 Element element, |
| 2792 Node rhs, |
| 2793 A arg); |
| 2794 |
| 2795 /// If-null assignment expression of [rhs] to an unresolved property. |
| 2796 /// That is, [rhs] is only evaluated and assigned, if the value of the |
| 2797 /// unresolved property is `null`. The behavior is thus equivalent to a no |
| 2798 /// such method error. |
| 2799 /// |
| 2800 /// For instance: |
| 2801 /// |
| 2802 /// class C {} |
| 2803 /// m1() => unresolved ??= 42; |
| 2804 /// m2() => C.unresolved ??= 42; |
| 2805 /// |
| 2806 // TODO(johnniwinther): Split the cases in which a prefix is resolved. |
| 2807 R visitUnresolvedSetIfNull( |
| 2808 Send node, |
| 2809 Element element, |
| 2810 Node rhs, |
| 2811 A arg); |
| 2812 |
| 2813 /// If-null assignment expression of [rhs] to an invalid expression. |
| 2814 /// |
| 2815 /// For instance: |
| 2816 /// |
| 2817 /// import 'foo.dart' as p; |
| 2818 /// |
| 2819 /// m() => p ??= 42; |
| 2820 /// |
| 2821 R errorInvalidSetIfNull( |
| 2822 Send node, |
| 2823 ErroneousElement error, |
| 2824 Node rhs, |
| 2825 A arg); |
| 2826 |
| 2827 /// If-null assignment expression of [rhs] to the class type literal |
| 2828 /// [contant]. That is, [rhs] is only evaluated and assigned, if the value |
| 2829 /// is of the [constant] is `null`. The behavior is thus equivalent to a type |
| 2830 /// literal access. |
| 2831 /// |
| 2832 /// For instance: |
| 2833 /// |
| 2834 /// class C {} |
| 2835 /// m(rhs) => C ??= rhs; |
| 2836 /// |
| 2837 R visitClassTypeLiteralSetIfNull( |
| 2838 Send node, |
| 2839 ConstantExpression constant, |
| 2840 Node rhs, |
| 2841 A arg); |
| 2842 |
| 2843 /// If-null assignment expression of [rhs] to the typedef type literal |
| 2844 /// [constant]. That is, [rhs] is only evaluated and assigned, if the value |
| 2845 /// is of the [constant] is `null`. The behavior is thus equivalent to a type |
| 2846 /// literal access. |
| 2847 /// |
| 2848 /// For instance: |
| 2849 /// |
| 2850 /// typedef F(); |
| 2851 /// m(rhs) => F ??= rhs; |
| 2852 /// |
| 2853 R visitTypedefTypeLiteralSetIfNull( |
| 2854 Send node, |
| 2855 ConstantExpression constant, |
| 2856 Node rhs, |
| 2857 A arg); |
| 2858 |
| 2859 /// If-null assignment expression of [rhs] to the type literal for the type |
| 2860 /// variable [element]. That is, [rhs] is only evaluated and assigned, if |
| 2861 /// the value is of the [element] is `null`. The behavior is thus equivalent t
o |
| 2862 /// a type literal access. |
| 2863 /// |
| 2864 /// For instance: |
| 2865 /// |
| 2866 /// class C<T> { |
| 2867 /// m(rhs) => T ??= rhs; |
| 2868 /// } |
| 2869 /// |
| 2870 R visitTypeVariableTypeLiteralSetIfNull( |
| 2871 Send node, |
| 2872 TypeVariableElement element, |
| 2873 Node rhs, |
| 2874 A arg); |
| 2875 |
| 2876 /// If-null assignment expression of [rhs] to the dynamic type literal |
| 2877 /// [constant]. That is, [rhs] is only evaluated and assigned, if the value |
| 2878 /// is of the [constant] is `null`. The behavior is thus equivalent to a type |
| 2879 /// literal access. |
| 2880 /// |
| 2881 /// For instance: |
| 2882 /// |
| 2883 /// m(rhs) => dynamic ??= rhs; |
| 2884 /// |
| 2885 R visitDynamicTypeLiteralSetIfNull( |
| 2886 Send node, |
| 2887 ConstantExpression constant, |
| 2888 Node rhs, |
| 2889 A arg); |
| 2890 |
2192 /// Prefix expression with [operator] on a final super [field]. | 2891 /// Prefix expression with [operator] on a final super [field]. |
2193 /// | 2892 /// |
2194 /// For instance: | 2893 /// For instance: |
2195 /// | 2894 /// |
2196 /// class B { | 2895 /// class B { |
2197 /// final field = 42; | 2896 /// final field = 42; |
2198 /// } | 2897 /// } |
2199 /// class C extends B { | 2898 /// class C extends B { |
2200 /// m(rhs) => ++super.field; | 2899 /// m(rhs) => ++super.field; |
2201 /// } | 2900 /// } |
(...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5146 /// C() : this._(42); | 5845 /// C() : this._(42); |
5147 /// } | 5846 /// } |
5148 /// | 5847 /// |
5149 R errorUnresolvedThisConstructorInvoke( | 5848 R errorUnresolvedThisConstructorInvoke( |
5150 Send node, | 5849 Send node, |
5151 Element element, | 5850 Element element, |
5152 NodeList arguments, | 5851 NodeList arguments, |
5153 Selector selector, | 5852 Selector selector, |
5154 A arg); | 5853 A arg); |
5155 } | 5854 } |
OLD | NEW |