| 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 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1863 } | 1863 } |
| 1864 '''); | 1864 '''); |
| 1865 _updateAndValidate(r''' | 1865 _updateAndValidate(r''' |
| 1866 main() { | 1866 main() { |
| 1867 int v = 42; | 1867 int v = 42; |
| 1868 print(v); | 1868 print(v); |
| 1869 } | 1869 } |
| 1870 '''); | 1870 '''); |
| 1871 } | 1871 } |
| 1872 | 1872 |
| 1873 void test_twice() { | 1873 void test_multiple_emptyLine() { |
| 1874 _resolveUnit(r''' |
| 1875 class A { |
| 1876 m() { |
| 1877 return true; |
| 1878 } |
| 1879 }'''); |
| 1880 for (int i = 0; i < 6; i++) { |
| 1881 if (i.isEven) { |
| 1882 _updateAndValidate(r''' |
| 1883 class A { |
| 1884 m() { |
| 1885 return true; |
| 1886 |
| 1887 } |
| 1888 }''', false); |
| 1889 } else { |
| 1890 _updateAndValidate(r''' |
| 1891 class A { |
| 1892 m() { |
| 1893 return true; |
| 1894 } |
| 1895 }''', false); |
| 1896 } |
| 1897 } |
| 1898 } |
| 1899 |
| 1900 void test_multiple_expression() { |
| 1874 _resolveUnit(r''' | 1901 _resolveUnit(r''' |
| 1875 main() { | 1902 main() { |
| 1876 print(1); | 1903 print(1); |
| 1877 }'''); | 1904 }'''); |
| 1878 _updateAndValidate(r''' | 1905 for (int i = 0; i < 6; i++) { |
| 1906 if (i.isEven) { |
| 1907 _updateAndValidate(r''' |
| 1879 main() { | 1908 main() { |
| 1880 print(12); | 1909 print(12); |
| 1881 }''', false); | 1910 }''', false); |
| 1882 _updateAndValidate(r''' | 1911 } else { |
| 1912 _updateAndValidate(r''' |
| 1883 main() { | 1913 main() { |
| 1884 print(1); | 1914 print(1); |
| 1885 }''', false); | 1915 }''', false); |
| 1886 } | 1916 } |
| 1887 | 1917 } |
| 1888 void test_twice2() { | |
| 1889 _resolveUnit(r''' | |
| 1890 class A { | |
| 1891 m() { | |
| 1892 int vvvvvvvv = 42; | |
| 1893 print(vvvvvvvv); | |
| 1894 } | |
| 1895 }'''); | |
| 1896 _updateAndValidate(r''' | |
| 1897 class A { | |
| 1898 m() { | |
| 1899 int vvvvvvvv2 = 42; | |
| 1900 print(vvvvvvvv2); | |
| 1901 } | |
| 1902 }''', false); | |
| 1903 _updateAndValidate(r''' | |
| 1904 class A { | |
| 1905 m() { | |
| 1906 int vvvvvvvv = 42; | |
| 1907 print(vvvvvvvv); | |
| 1908 } | |
| 1909 }''', false); | |
| 1910 } | 1918 } |
| 1911 | 1919 |
| 1912 void test_updateErrors_addNew_hints() { | 1920 void test_updateErrors_addNew_hints() { |
| 1913 _resolveUnit(r''' | 1921 _resolveUnit(r''' |
| 1914 main() { | 1922 main() { |
| 1915 int v = 0; | 1923 int v = 0; |
| 1916 print(v); | 1924 print(v); |
| 1917 print(42); | |
| 1918 } | 1925 } |
| 1919 '''); | 1926 '''); |
| 1920 // TODO(scheglov) "print(42)" is here because it seems we have bug with | |
| 1921 // incremental analysis and the end of a function body. | |
| 1922 _updateAndValidate(r''' | 1927 _updateAndValidate(r''' |
| 1923 main() { | 1928 main() { |
| 1924 int v = 0; | 1929 int v = 0; |
| 1925 print(42); | |
| 1926 } | 1930 } |
| 1927 '''); | 1931 '''); |
| 1928 } | 1932 } |
| 1929 | 1933 |
| 1930 void test_updateErrors_addNew_parse() { | 1934 void test_updateErrors_addNew_parse() { |
| 1931 _resolveUnit(r''' | 1935 _resolveUnit(r''' |
| 1932 main() { | 1936 main() { |
| 1933 print(42); | 1937 print(42); |
| 1934 } | 1938 } |
| 1935 '''); | 1939 '''); |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3198 _visitList(node.metadata, other.metadata); | 3202 _visitList(node.metadata, other.metadata); |
| 3199 _visitNode(node.identifier, other.identifier); | 3203 _visitNode(node.identifier, other.identifier); |
| 3200 } | 3204 } |
| 3201 | 3205 |
| 3202 static void assertSameResolution(CompilationUnit actual, | 3206 static void assertSameResolution(CompilationUnit actual, |
| 3203 CompilationUnit expected) { | 3207 CompilationUnit expected) { |
| 3204 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 3208 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 3205 actual.accept(validator); | 3209 actual.accept(validator); |
| 3206 } | 3210 } |
| 3207 } | 3211 } |
| OLD | NEW |