| 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.resolver_test; | 5 library engine.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'package:analyzer/src/generated/java_core.dart'; | 8 import 'package:analyzer/src/generated/java_core.dart'; |
| 9 import 'package:analyzer/src/generated/java_junit.dart'; | 9 import 'package:analyzer/src/generated/java_junit.dart'; |
| 10 import 'package:analyzer/src/generated/java_engine.dart'; | 10 import 'package:analyzer/src/generated/java_engine.dart'; |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 " l: switch (i) {", | 1911 " l: switch (i) {", |
| 1912 " case 0:", | 1912 " case 0:", |
| 1913 " continue l;", | 1913 " continue l;", |
| 1914 " }", | 1914 " }", |
| 1915 " }", | 1915 " }", |
| 1916 "}"])); | 1916 "}"])); |
| 1917 resolve(source); | 1917 resolve(source); |
| 1918 assertErrors(source, [ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH]); | 1918 assertErrors(source, [ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH]); |
| 1919 verify([source]); | 1919 verify([source]); |
| 1920 } | 1920 } |
| 1921 |
| 1922 void test_enclosingElement_invalidLocalFunction() { |
| 1923 Source source = addSource(EngineTestCase.createSource([ |
| 1924 "class C {", |
| 1925 " C() {", |
| 1926 " int get x => 0;", |
| 1927 " }", |
| 1928 "}"])); |
| 1929 LibraryElement library = resolve(source); |
| 1930 JUnitTestCase.assertNotNull(library); |
| 1931 var unit = library.definingCompilationUnit; |
| 1932 JUnitTestCase.assertNotNull(unit); |
| 1933 var types = unit.types; |
| 1934 JUnitTestCase.assertNotNull(types); |
| 1935 EngineTestCase.assertSizeOfList(1, types); |
| 1936 var type = types[0]; |
| 1937 JUnitTestCase.assertNotNull(type); |
| 1938 var constructors = type.constructors; |
| 1939 JUnitTestCase.assertNotNull(constructors); |
| 1940 EngineTestCase.assertSizeOfList(1, constructors); |
| 1941 ConstructorElement constructor = constructors[0]; |
| 1942 JUnitTestCase.assertNotNull(constructor); |
| 1943 List<FunctionElement> functions = constructor.functions; |
| 1944 JUnitTestCase.assertNotNull(functions); |
| 1945 EngineTestCase.assertSizeOfList(1, functions); |
| 1946 JUnitTestCase.assertEquals(constructor, functions[0].enclosingElement); |
| 1947 assertErrors(source, [ParserErrorCode.GETTER_IN_FUNCTION]); |
| 1948 } |
| 1921 } | 1949 } |
| 1922 | 1950 |
| 1923 class HintCodeTest extends ResolverTestCase { | 1951 class HintCodeTest extends ResolverTestCase { |
| 1924 void fail_deadCode_statementAfterRehrow() { | 1952 void fail_deadCode_statementAfterRehrow() { |
| 1925 Source source = addSource(EngineTestCase.createSource([ | 1953 Source source = addSource(EngineTestCase.createSource([ |
| 1926 "f() {", | 1954 "f() {", |
| 1927 " try {", | 1955 " try {", |
| 1928 " var one = 1;", | 1956 " var one = 1;", |
| 1929 " } catch (e) {", | 1957 " } catch (e) {", |
| 1930 " rethrow;", | 1958 " rethrow;", |
| (...skipping 9120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11051 runReflectiveTests(TypeResolverVisitorTest); | 11079 runReflectiveTests(TypeResolverVisitorTest); |
| 11052 runReflectiveTests(CheckedModeCompileTimeErrorCodeTest); | 11080 runReflectiveTests(CheckedModeCompileTimeErrorCodeTest); |
| 11053 runReflectiveTests(ErrorResolverTest); | 11081 runReflectiveTests(ErrorResolverTest); |
| 11054 runReflectiveTests(HintCodeTest); | 11082 runReflectiveTests(HintCodeTest); |
| 11055 runReflectiveTests(MemberMapTest); | 11083 runReflectiveTests(MemberMapTest); |
| 11056 runReflectiveTests(NonHintCodeTest); | 11084 runReflectiveTests(NonHintCodeTest); |
| 11057 runReflectiveTests(SimpleResolverTest); | 11085 runReflectiveTests(SimpleResolverTest); |
| 11058 runReflectiveTests(StrictModeTest); | 11086 runReflectiveTests(StrictModeTest); |
| 11059 runReflectiveTests(TypePropagationTest); | 11087 runReflectiveTests(TypePropagationTest); |
| 11060 } | 11088 } |
| OLD | NEW |