Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.test.src.summary.summary_common; | 5 library analyzer.test.src.summary.summary_common; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/dart/ast/ast.dart'; | 8 import 'package:analyzer/dart/ast/ast.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/dart/scanner/reader.dart'; | 10 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| (...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1962 ], referenceValidators: [ | 1962 ], referenceValidators: [ |
| 1963 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', | 1963 (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'C', |
| 1964 expectedKind: ReferenceKind.classOrEnum, | 1964 expectedKind: ReferenceKind.classOrEnum, |
| 1965 prefixExpectations: [ | 1965 prefixExpectations: [ |
| 1966 new _PrefixExpectation(ReferenceKind.prefix, 'p', | 1966 new _PrefixExpectation(ReferenceKind.prefix, 'p', |
| 1967 inLibraryDefiningUnit: true) | 1967 inLibraryDefiningUnit: true) |
| 1968 ]) | 1968 ]) |
| 1969 ]); | 1969 ]); |
| 1970 } | 1970 } |
| 1971 | 1971 |
| 1972 test_constExpr_invokeConstructor_unresolved_named() { | |
|
Paul Berry
2016/02/16 20:44:10
Also make a version of this test where class C is
scheglov
2016/02/16 21:48:44
Done.
| |
| 1973 UnlinkedVariable variable = serializeVariableText( | |
| 1974 ''' | |
| 1975 class C {} | |
| 1976 const v = const C.foo(); | |
| 1977 ''', | |
| 1978 allowErrors: true); | |
| 1979 _assertUnlinkedConst(variable.constExpr, operators: [ | |
| 1980 UnlinkedConstOperation.invokeConstructor, | |
| 1981 ], ints: [ | |
| 1982 0, | |
| 1983 0 | |
| 1984 ], referenceValidators: [ | |
| 1985 (EntityRef r) => checkTypeRef(r, null, null, 'foo', | |
| 1986 expectedKind: ReferenceKind.unresolved, | |
| 1987 checkAstDerivedDataOverride: true, | |
| 1988 prefixExpectations: [ | |
| 1989 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C') | |
| 1990 ]) | |
| 1991 ]); | |
| 1992 } | |
| 1993 | |
| 1994 test_constExpr_invokeConstructor_unresolved_named_prefixed() { | |
|
Paul Berry
2016/02/16 20:44:10
Also make a version of this test where class C is
scheglov
2016/02/16 21:48:44
Done.
| |
| 1995 addNamedSource( | |
| 1996 '/a.dart', | |
| 1997 ''' | |
| 1998 class C { | |
| 1999 } | |
| 2000 '''); | |
| 2001 UnlinkedVariable variable = serializeVariableText( | |
| 2002 ''' | |
| 2003 import 'a.dart' as p; | |
| 2004 const v = const p.C.foo(); | |
| 2005 ''', | |
| 2006 allowErrors: true); | |
| 2007 _assertUnlinkedConst(variable.constExpr, operators: [ | |
| 2008 UnlinkedConstOperation.invokeConstructor, | |
| 2009 ], ints: [ | |
| 2010 0, | |
| 2011 0 | |
| 2012 ], referenceValidators: [ | |
| 2013 (EntityRef r) => checkTypeRef(r, null, null, 'foo', | |
| 2014 expectedKind: ReferenceKind.unresolved, | |
| 2015 checkAstDerivedDataOverride: true, | |
| 2016 prefixExpectations: [ | |
| 2017 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C', | |
| 2018 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), | |
| 2019 new _PrefixExpectation(ReferenceKind.prefix, 'p', | |
| 2020 inLibraryDefiningUnit: true) | |
| 2021 ]) | |
| 2022 ]); | |
| 2023 } | |
| 2024 | |
| 2025 test_constExpr_invokeConstructor_unresolved_unnamed() { | |
| 2026 UnlinkedVariable variable = serializeVariableText( | |
| 2027 ''' | |
| 2028 const v = const Foo(); | |
| 2029 ''', | |
| 2030 allowErrors: true); | |
| 2031 _assertUnlinkedConst(variable.constExpr, operators: [ | |
| 2032 UnlinkedConstOperation.invokeConstructor, | |
| 2033 ], ints: [ | |
| 2034 0, | |
| 2035 0 | |
| 2036 ], referenceValidators: [ | |
| 2037 (EntityRef r) => checkTypeRef(r, null, null, 'Foo', | |
| 2038 expectedKind: ReferenceKind.unresolved, | |
| 2039 checkAstDerivedDataOverride: true) | |
| 2040 ]); | |
| 2041 } | |
| 2042 | |
| 1972 test_constExpr_length_classConstField() { | 2043 test_constExpr_length_classConstField() { |
| 1973 UnlinkedVariable variable = serializeVariableText(''' | 2044 UnlinkedVariable variable = serializeVariableText(''' |
| 1974 class C { | 2045 class C { |
| 1975 static const int length = 0; | 2046 static const int length = 0; |
| 1976 } | 2047 } |
| 1977 const int v = C.length; | 2048 const int v = C.length; |
| 1978 '''); | 2049 '''); |
| 1979 _assertUnlinkedConst(variable.constExpr, operators: [ | 2050 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 1980 UnlinkedConstOperation.pushReference | 2051 UnlinkedConstOperation.pushReference |
| 1981 ], referenceValidators: [ | 2052 ], referenceValidators: [ |
| (...skipping 4805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6787 final String absoluteUri; | 6858 final String absoluteUri; |
| 6788 final String relativeUri; | 6859 final String relativeUri; |
| 6789 final int numTypeParameters; | 6860 final int numTypeParameters; |
| 6790 | 6861 |
| 6791 _PrefixExpectation(this.kind, this.name, | 6862 _PrefixExpectation(this.kind, this.name, |
| 6792 {this.inLibraryDefiningUnit: false, | 6863 {this.inLibraryDefiningUnit: false, |
| 6793 this.absoluteUri, | 6864 this.absoluteUri, |
| 6794 this.relativeUri, | 6865 this.relativeUri, |
| 6795 this.numTypeParameters: 0}); | 6866 this.numTypeParameters: 0}); |
| 6796 } | 6867 } |
| OLD | NEW |