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 | 8 |
9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 AstFactory.identifier(target, AstFactory.identifier3(propName)); | 1690 AstFactory.identifier(target, AstFactory.identifier3(propName)); |
1691 // resolve | 1691 // resolve |
1692 _resolveNode(identifier); | 1692 _resolveNode(identifier); |
1693 expect(identifier.staticElement, same(getter)); | 1693 expect(identifier.staticElement, same(getter)); |
1694 expect(identifier.identifier.staticElement, same(getter)); | 1694 expect(identifier.identifier.staticElement, same(getter)); |
1695 _listener.assertNoErrors(); | 1695 _listener.assertNoErrors(); |
1696 } | 1696 } |
1697 | 1697 |
1698 void test_visitPrefixedIdentifier_staticClassMember_method() { | 1698 void test_visitPrefixedIdentifier_staticClassMember_method() { |
1699 ClassElementImpl classA = ElementFactory.classElement2("A"); | 1699 ClassElementImpl classA = ElementFactory.classElement2("A"); |
1700 // set accessors | 1700 // set methods |
1701 String propName = "m"; | 1701 String propName = "m"; |
1702 PropertyAccessorElement setter = | |
1703 ElementFactory.setterElement(propName, false, _typeProvider.intType); | |
1704 classA.accessors = <PropertyAccessorElement>[setter]; | |
1705 // set methods | |
1706 MethodElement method = | 1702 MethodElement method = |
1707 ElementFactory.methodElement("m", _typeProvider.intType); | 1703 ElementFactory.methodElement("m", _typeProvider.intType); |
1708 classA.methods = <MethodElement>[method]; | 1704 classA.methods = <MethodElement>[method]; |
1709 // prepare "A.m" | 1705 // prepare "A.m" |
1710 SimpleIdentifier target = AstFactory.identifier3("A"); | 1706 SimpleIdentifier target = AstFactory.identifier3("A"); |
1711 target.staticElement = classA; | 1707 target.staticElement = classA; |
1712 target.staticType = classA.type; | 1708 target.staticType = classA.type; |
1713 PrefixedIdentifier identifier = | 1709 PrefixedIdentifier identifier = |
1714 AstFactory.identifier(target, AstFactory.identifier3(propName)); | 1710 AstFactory.identifier(target, AstFactory.identifier3(propName)); |
1715 AstFactory.assignmentExpression( | 1711 AstFactory.assignmentExpression( |
(...skipping 12075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13791 // check propagated type | 13787 // check propagated type |
13792 FunctionType propagatedType = node.propagatedType as FunctionType; | 13788 FunctionType propagatedType = node.propagatedType as FunctionType; |
13793 expect(propagatedType.returnType, test.typeProvider.stringType); | 13789 expect(propagatedType.returnType, test.typeProvider.stringType); |
13794 } on AnalysisException catch (e, stackTrace) { | 13790 } on AnalysisException catch (e, stackTrace) { |
13795 thrownException[0] = new CaughtException(e, stackTrace); | 13791 thrownException[0] = new CaughtException(e, stackTrace); |
13796 } | 13792 } |
13797 } | 13793 } |
13798 return null; | 13794 return null; |
13799 } | 13795 } |
13800 } | 13796 } |
OLD | NEW |