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

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

Issue 1670403002: Resynthesize top-level function references. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/summary/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 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/dart/element/type.dart'; 9 import 'package:analyzer/dart/element/type.dart';
10 import 'package:analyzer/src/dart/element/element.dart'; 10 import 'package:analyzer/src/dart/element/element.dart';
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 class C { 1406 class C {
1407 static int m(int a, String b) => 42; 1407 static int m(int a, String b) => 42;
1408 } 1408 }
1409 '''); 1409 ''');
1410 checkLibrary(r''' 1410 checkLibrary(r'''
1411 import 'a.dart' as p; 1411 import 'a.dart' as p;
1412 const V = p.C.m; 1412 const V = p.C.m;
1413 '''); 1413 ''');
1414 } 1414 }
1415 1415
1416 test_const_reference_topLevelFunction() {
1417 shouldCompareConstValues = true;
1418 checkLibrary(r'''
1419 foo() {}
1420 const V = foo;
1421 ''');
1422 }
1423
1424 test_const_reference_topLevelFunction_imported() {
1425 shouldCompareConstValues = true;
1426 addLibrarySource(
1427 '/a.dart',
1428 r'''
1429 foo() {}
1430 ''');
1431 checkLibrary(r'''
1432 import 'a.dart';
1433 const V = foo;
1434 ''');
1435 }
1436
1437 test_const_reference_topLevelFunction_imported_withPrefix() {
1438 shouldCompareConstValues = true;
1439 addLibrarySource(
1440 '/a.dart',
1441 r'''
1442 foo() {}
1443 ''');
1444 checkLibrary(r'''
1445 import 'a.dart' as p;
1446 const V = p.foo;
1447 ''');
1448 }
1449
1416 test_const_reference_topLevelVariable() { 1450 test_const_reference_topLevelVariable() {
1417 shouldCompareConstValues = true; 1451 shouldCompareConstValues = true;
1418 checkLibrary(r''' 1452 checkLibrary(r'''
1419 const A = 1; 1453 const A = 1;
1420 const B = A + 2; 1454 const B = A + 2;
1421 '''); 1455 ''');
1422 } 1456 }
1423 1457
1424 test_const_reference_topLevelVariable_imported() { 1458 test_const_reference_topLevelVariable_imported() {
1425 shouldCompareConstValues = true; 1459 shouldCompareConstValues = true;
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 fail('Unexpectedly tried to get unlinked summary for $uri'); 2619 fail('Unexpectedly tried to get unlinked summary for $uri');
2586 } 2620 }
2587 return serializedUnit; 2621 return serializedUnit;
2588 } 2622 }
2589 2623
2590 @override 2624 @override
2591 bool hasLibrarySummary(String uri) { 2625 bool hasLibrarySummary(String uri) {
2592 return true; 2626 return true;
2593 } 2627 }
2594 } 2628 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698