Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_common.dart

Issue 2989243003: Resynthesize values of final fields of classes with const constructors. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/kernel/resynthesize.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 test.src.serialization.elements_test; 5 library test.src.serialization.elements_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 library lib; 2447 library lib;
2448 part 'a.dart'; 2448 part 'a.dart';
2449 -------------------- 2449 --------------------
2450 unit: a.dart 2450 unit: a.dart
2451 2451
2452 final dynamic f; 2452 final dynamic f;
2453 '''); 2453 ''');
2454 } 2454 }
2455 } 2455 }
2456 2456
2457 test_const_finalField_hasConstConstructor() async {
2458 var library = await checkLibrary(r'''
2459 class C {
2460 final int f = 42;
2461 const C();
2462 }
2463 ''');
2464 checkElementText(library, r'''
2465 class C {
2466 final int f = 42;
2467 const C();
2468 }
2469 ''');
2470 }
2471
2457 test_const_invalid_field_const() async { 2472 test_const_invalid_field_const() async {
2458 variablesWithNotConstInitializers.add('f'); 2473 variablesWithNotConstInitializers.add('f');
2459 var library = await checkLibrary(r''' 2474 var library = await checkLibrary(r'''
2460 class C { 2475 class C {
2461 static const f = 1 + foo(); 2476 static const f = 1 + foo();
2462 } 2477 }
2463 int foo() => 42; 2478 int foo() => 42;
2464 ''', allowErrors: true); 2479 ''', allowErrors: true);
2465 if (isStrongMode) { 2480 if (isStrongMode) {
2466 checkElementText(library, r''' 2481 checkElementText(library, r'''
(...skipping 7602 matching lines...) Expand 10 before | Expand all | Expand 10 after
10069 fail('Unexpectedly tried to get unlinked summary for $uri'); 10084 fail('Unexpectedly tried to get unlinked summary for $uri');
10070 } 10085 }
10071 return serializedUnit; 10086 return serializedUnit;
10072 } 10087 }
10073 10088
10074 @override 10089 @override
10075 bool hasLibrarySummary(String uri) { 10090 bool hasLibrarySummary(String uri) {
10076 return true; 10091 return true;
10077 } 10092 }
10078 } 10093 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/kernel/resynthesize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698