| OLD | NEW |
| 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 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 class A { | 1884 class A { |
| 1885 A(int p); | 1885 A(int p); |
| 1886 } | 1886 } |
| 1887 class B extends A { | 1887 class B extends A { |
| 1888 B(int a, int b) : super(a + b); | 1888 B(int a, int b) : super(a + b); |
| 1889 } | 1889 } |
| 1890 '''); | 1890 '''); |
| 1891 _resolve(_editString('+', '*'), _isExpression); | 1891 _resolve(_editString('+', '*'), _isExpression); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 void test_function_localFunction_add() { |
| 1895 _resolveUnit(r''' |
| 1896 int main() { |
| 1897 return 0; |
| 1898 } |
| 1899 callIt(f) {} |
| 1900 '''); |
| 1901 _resolve(_editString('return 0;', 'callIt((p) {});'), _isBlock); |
| 1902 } |
| 1903 |
| 1894 void test_functionBody_body() { | 1904 void test_functionBody_body() { |
| 1895 _resolveUnit(r''' | 1905 _resolveUnit(r''' |
| 1896 main(int a, int b) { | 1906 main(int a, int b) { |
| 1897 return a + b; | 1907 return a + b; |
| 1898 }'''); | 1908 }'''); |
| 1899 _resolve(_editString('+', '*'), _isFunctionBody); | 1909 _resolve(_editString('+', '*'), _isFunctionBody); |
| 1900 } | 1910 } |
| 1901 | 1911 |
| 1902 void test_functionBody_expression() { | 1912 void test_functionBody_expression() { |
| 1903 _resolveUnit(r''' | 1913 _resolveUnit(r''' |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1928 _resolveUnit(r''' | 1938 _resolveUnit(r''' |
| 1929 class A { | 1939 class A { |
| 1930 int m(int a, int b) { | 1940 int m(int a, int b) { |
| 1931 return a + b; | 1941 return a + b; |
| 1932 } | 1942 } |
| 1933 } | 1943 } |
| 1934 '''); | 1944 '''); |
| 1935 _resolve(_editString('return', 'label: return'), _isBlock); | 1945 _resolve(_editString('return', 'label: return'), _isBlock); |
| 1936 } | 1946 } |
| 1937 | 1947 |
| 1948 void test_method_localFunction_add() { |
| 1949 _resolveUnit(r''' |
| 1950 class A { |
| 1951 int m() { |
| 1952 return 0; |
| 1953 } |
| 1954 } |
| 1955 callIt(f) {} |
| 1956 '''); |
| 1957 _resolve(_editString('return 0;', 'callIt((p) {});'), _isBlock); |
| 1958 } |
| 1959 |
| 1938 void test_method_localVariable_add() { | 1960 void test_method_localVariable_add() { |
| 1939 _resolveUnit(r''' | 1961 _resolveUnit(r''' |
| 1940 class A { | 1962 class A { |
| 1941 int m(int a, int b) { | 1963 int m(int a, int b) { |
| 1942 return a + b; | 1964 return a + b; |
| 1943 } | 1965 } |
| 1944 } | 1966 } |
| 1945 '''); | 1967 '''); |
| 1946 _resolve(_editString(' return a + b;', r''' | 1968 _resolve(_editString(' return a + b;', r''' |
| 1947 int res = a + b; | 1969 int res = a + b; |
| (...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3885 _visitList(node.metadata, other.metadata); | 3907 _visitList(node.metadata, other.metadata); |
| 3886 _visitNode(node.identifier, other.identifier); | 3908 _visitNode(node.identifier, other.identifier); |
| 3887 } | 3909 } |
| 3888 | 3910 |
| 3889 static void assertSameResolution(CompilationUnit actual, | 3911 static void assertSameResolution(CompilationUnit actual, |
| 3890 CompilationUnit expected) { | 3912 CompilationUnit expected) { |
| 3891 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 3913 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 3892 actual.accept(validator); | 3914 actual.accept(validator); |
| 3893 } | 3915 } |
| 3894 } | 3916 } |
| OLD | NEW |