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

Side by Side Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 759353002: Fix for incremental resolution of top-level and class-member accessors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library engine.incremental_resolver_test; 5 library engine.incremental_resolver_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 } 1671 }
1672 } 1672 }
1673 1673
1674 1674
1675 class IncrementalResolverTest extends ResolverTestCase { 1675 class IncrementalResolverTest extends ResolverTestCase {
1676 Source source; 1676 Source source;
1677 String code; 1677 String code;
1678 LibraryElement library; 1678 LibraryElement library;
1679 CompilationUnit unit; 1679 CompilationUnit unit;
1680 1680
1681 void test_classMemberAccessor_body() {
1682 _resolveUnit(r'''
1683 class A {
1684 int get test {
1685 return 1 + 2;
1686 }
1687 }''');
1688 _resolve(_editString('+', '*'), _isFunctionBody);
1689 }
1690
1681 void test_constructor_body() { 1691 void test_constructor_body() {
1682 _resolveUnit(r''' 1692 _resolveUnit(r'''
1683 class A { 1693 class A {
1684 int f; 1694 int f;
1685 A(int a, int b) { 1695 A(int a, int b) {
1686 f = a + b; 1696 f = a + b;
1687 } 1697 }
1688 }'''); 1698 }''');
1689 _resolve(_editString('+', '*'), _isFunctionBody); 1699 _resolve(_editString('+', '*'), _isFunctionBody);
1690 } 1700 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 foo(p) {} 1808 foo(p) {}
1799 } 1809 }
1800 class B extends A { 1810 class B extends A {
1801 bar() { 1811 bar() {
1802 super.foo(1 + 2); 1812 super.foo(1 + 2);
1803 } 1813 }
1804 }'''); 1814 }''');
1805 _resolve(_editString('+', '*'), _isFunctionBody); 1815 _resolve(_editString('+', '*'), _isFunctionBody);
1806 } 1816 }
1807 1817
1818 void test_topLevelAccessor_body() {
1819 _resolveUnit(r'''
1820 int get test {
1821 return 1 + 2;
1822 }''');
1823 _resolve(_editString('+', '*'), _isFunctionBody);
1824 }
1825
1808 void test_topLevelFunction_label_add() { 1826 void test_topLevelFunction_label_add() {
1809 _resolveUnit(r''' 1827 _resolveUnit(r'''
1810 int main(int a, int b) { 1828 int main(int a, int b) {
1811 return a + b; 1829 return a + b;
1812 } 1830 }
1813 '''); 1831 ''');
1814 _resolve(_editString(' return', 'label: return a + b;'), _isBlock); 1832 _resolve(_editString(' return', 'label: return a + b;'), _isBlock);
1815 } 1833 }
1816 1834
1817 void test_topLevelFunction_label_remove() { 1835 void test_topLevelFunction_label_remove() {
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 _visitList(node.metadata, other.metadata); 3473 _visitList(node.metadata, other.metadata);
3456 _visitNode(node.identifier, other.identifier); 3474 _visitNode(node.identifier, other.identifier);
3457 } 3475 }
3458 3476
3459 static void assertSameResolution(CompilationUnit actual, 3477 static void assertSameResolution(CompilationUnit actual,
3460 CompilationUnit expected) { 3478 CompilationUnit expected) {
3461 _SameResolutionValidator validator = new _SameResolutionValidator(expected); 3479 _SameResolutionValidator validator = new _SameResolutionValidator(expected);
3462 actual.accept(validator); 3480 actual.accept(validator);
3463 } 3481 }
3464 } 3482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698