| 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_test; | 5 library analyzer.test.src.summary.summary_test; |
| 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/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 _assertUnlinkedConst(variable.constExpr, operators: [ | 1468 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 1469 UnlinkedConstOperation.pushInt, | 1469 UnlinkedConstOperation.pushInt, |
| 1470 UnlinkedConstOperation.pushNull, | 1470 UnlinkedConstOperation.pushNull, |
| 1471 UnlinkedConstOperation.identical | 1471 UnlinkedConstOperation.identical |
| 1472 ], ints: [ | 1472 ], ints: [ |
| 1473 42 | 1473 42 |
| 1474 ]); | 1474 ]); |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 test_constExpr_invokeConstructor_named() { | 1477 test_constExpr_invokeConstructor_named() { |
| 1478 if (checkAstDerivedData) { |
| 1479 // TODO(scheglov) at the moment we cannot link class member references |
| 1480 return; |
| 1481 } |
| 1478 UnlinkedVariable variable = serializeVariableText(''' | 1482 UnlinkedVariable variable = serializeVariableText(''' |
| 1479 class C { | 1483 class C { |
| 1480 const C.named(); | 1484 const C.named(); |
| 1481 } | 1485 } |
| 1482 const v = const C.named(); | 1486 const v = const C.named(); |
| 1483 '''); | 1487 '''); |
| 1484 _assertUnlinkedConst(variable.constExpr, operators: [ | 1488 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 1485 UnlinkedConstOperation.invokeConstructor, | 1489 UnlinkedConstOperation.invokeConstructor, |
| 1486 ], ints: [ | 1490 ], ints: [ |
| 1487 0 | 1491 0 |
| 1488 ], strings: [ | 1492 ], strings: [ |
| 1489 'named' | 1493 'named' |
| 1490 ], referenceValidators: [ | 1494 ], referenceValidators: [ |
| 1491 (UnlinkedTypeRef r) => checkTypeRef(r, null, null, 'C', | 1495 (UnlinkedTypeRef r) => checkTypeRef(r, null, null, 'C', |
| 1492 expectedKind: ReferenceKind.classOrEnum) | 1496 expectedKind: ReferenceKind.classOrEnum) |
| 1493 ]); | 1497 ]); |
| 1494 } | 1498 } |
| 1495 | 1499 |
| 1496 test_constExpr_invokeConstructor_named_imported() { | 1500 test_constExpr_invokeConstructor_named_imported() { |
| 1501 if (checkAstDerivedData) { |
| 1502 // TODO(scheglov) at the moment we cannot link class member references |
| 1503 return; |
| 1504 } |
| 1497 addNamedSource( | 1505 addNamedSource( |
| 1498 '/a.dart', | 1506 '/a.dart', |
| 1499 ''' | 1507 ''' |
| 1500 class C { | 1508 class C { |
| 1501 const C.named(); | 1509 const C.named(); |
| 1502 } | 1510 } |
| 1503 '''); | 1511 '''); |
| 1504 UnlinkedVariable variable = serializeVariableText(''' | 1512 UnlinkedVariable variable = serializeVariableText(''' |
| 1505 import 'a.dart'; | 1513 import 'a.dart'; |
| 1506 const v = const C.named(); | 1514 const v = const C.named(); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 | 1813 |
| 1806 test_constExpr_pushReference_topLevelVariable_imported_withPrefix() { | 1814 test_constExpr_pushReference_topLevelVariable_imported_withPrefix() { |
| 1807 addNamedSource('/a.dart', 'const int a = 1;'); | 1815 addNamedSource('/a.dart', 'const int a = 1;'); |
| 1808 UnlinkedVariable variable = serializeVariableText(''' | 1816 UnlinkedVariable variable = serializeVariableText(''' |
| 1809 import 'a.dart' as p; | 1817 import 'a.dart' as p; |
| 1810 const v = p.a; | 1818 const v = p.a; |
| 1811 '''); | 1819 '''); |
| 1812 _assertUnlinkedConst(variable.constExpr, operators: [ | 1820 _assertUnlinkedConst(variable.constExpr, operators: [ |
| 1813 UnlinkedConstOperation.pushReference | 1821 UnlinkedConstOperation.pushReference |
| 1814 ], referenceValidators: [ | 1822 ], referenceValidators: [ |
| 1815 (UnlinkedTypeRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a', | 1823 (UnlinkedTypeRef r) { |
| 1816 expectedKind: ReferenceKind.topLevelPropertyAccessor, | 1824 return checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a', |
| 1817 expectedPrefix: 'p') | 1825 expectedKind: ReferenceKind.topLevelPropertyAccessor, |
| 1826 expectedPrefix: 'p'); |
| 1827 } |
| 1818 ]); | 1828 ]); |
| 1819 } | 1829 } |
| 1820 | 1830 |
| 1821 test_constExpr_pushReference_topLevelVariable_local() { | 1831 test_constExpr_pushReference_topLevelVariable_local() { |
| 1822 // TODO(scheglov) use `a + b` | 1832 // TODO(scheglov) use `a + b` |
| 1823 UnlinkedVariable variable = serializeVariableText(''' | 1833 UnlinkedVariable variable = serializeVariableText(''' |
| 1824 const int a = 1; | 1834 const int a = 1; |
| 1825 const v = a; | 1835 const v = a; |
| 1826 '''); | 1836 '''); |
| 1827 _assertUnlinkedConst(variable.constExpr, operators: [ | 1837 _assertUnlinkedConst(variable.constExpr, operators: [ |
| (...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4109 if (unit == null) { | 4119 if (unit == null) { |
| 4110 if (!allowMissingFiles) { | 4120 if (!allowMissingFiles) { |
| 4111 fail('Test referred to unknown unit $relativeUri'); | 4121 fail('Test referred to unknown unit $relativeUri'); |
| 4112 } | 4122 } |
| 4113 } else { | 4123 } else { |
| 4114 unlinkedUnits.add(unit); | 4124 unlinkedUnits.add(unit); |
| 4115 } | 4125 } |
| 4116 } | 4126 } |
| 4117 } | 4127 } |
| 4118 | 4128 |
| 4119 @override | |
| 4120 void test_constExpr_invokeConstructor_named() { | |
| 4121 // TODO(scheglov) remove this method to enable the test | |
| 4122 } | |
| 4123 | |
| 4124 @override | |
| 4125 void test_constExpr_invokeConstructor_named_imported() { | |
| 4126 // TODO(scheglov) remove this method to enable the test | |
| 4127 } | |
| 4128 | |
| 4129 @override | |
| 4130 void test_constExpr_invokeConstructor_named_imported_withPrefix() { | |
| 4131 // TODO(scheglov) remove this method to enable the test | |
| 4132 } | |
| 4133 | |
| 4134 @override | |
| 4135 void test_constExpr_invokeConstructor_unnamed() { | |
| 4136 // TODO(scheglov) remove this method to enable the test | |
| 4137 } | |
| 4138 | |
| 4139 @override | |
| 4140 void test_constExpr_makeList_typed() { | |
| 4141 // TODO(scheglov) remove this method to enable the test | |
| 4142 } | |
| 4143 | |
| 4144 @override | |
| 4145 void test_constExpr_makeList_untyped() { | |
| 4146 // TODO(scheglov) remove this method to enable the test | |
| 4147 } | |
| 4148 | |
| 4149 @override | |
| 4150 void test_constExpr_makeMap_typed() { | |
| 4151 // TODO(scheglov) remove this method to enable the test | |
| 4152 } | |
| 4153 | |
| 4154 @override | |
| 4155 void test_constExpr_makeMap_untyped() { | |
| 4156 // TODO(scheglov) remove this method to enable the test | |
| 4157 } | |
| 4158 | |
| 4159 @override | |
| 4160 void test_constExpr_pushReference_class() { | |
| 4161 // TODO(scheglov) remove this method to enable the test | |
| 4162 } | |
| 4163 | |
| 4164 @override | |
| 4165 void test_constExpr_pushReference_enum() { | |
| 4166 // TODO(scheglov) remove this method to enable the test | |
| 4167 } | |
| 4168 | |
| 4169 @override | |
| 4170 void test_constExpr_pushReference_topLevelVariable_imported() { | |
| 4171 // TODO(scheglov) remove this method to enable the test | |
| 4172 } | |
| 4173 | |
| 4174 @override | |
| 4175 void test_constExpr_pushReference_topLevelVariable_imported_withPrefix() { | |
| 4176 // TODO(scheglov) remove this method to enable the test | |
| 4177 } | |
| 4178 | |
| 4179 @override | |
| 4180 void test_constExpr_pushReference_topLevelVariable_local() { | |
| 4181 // TODO(scheglov) remove this method to enable the test | |
| 4182 } | |
| 4183 | |
| 4184 CompilationUnit _parseText(String text) { | 4129 CompilationUnit _parseText(String text) { |
| 4185 CharSequenceReader reader = new CharSequenceReader(text); | 4130 CharSequenceReader reader = new CharSequenceReader(text); |
| 4186 Scanner scanner = | 4131 Scanner scanner = |
| 4187 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER); | 4132 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER); |
| 4188 Token token = scanner.tokenize(); | 4133 Token token = scanner.tokenize(); |
| 4189 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER); | 4134 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER); |
| 4190 parser.parseGenericMethods = true; | 4135 parser.parseGenericMethods = true; |
| 4191 return parser.parseCompilationUnit(token); | 4136 return parser.parseCompilationUnit(token); |
| 4192 } | 4137 } |
| 4193 } | 4138 } |
| OLD | NEW |