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 test.src.task.dart_test; | 5 library test.src.task.dart_test; |
6 | 6 |
7 import 'package:analyzer/src/context/cache.dart'; | 7 import 'package:analyzer/src/context/cache.dart'; |
8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
9 import 'package:analyzer/src/generated/constant.dart'; | 9 import 'package:analyzer/src/generated/constant.dart'; |
10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue( | 1375 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue( |
1376 'x', ''' | 1376 'x', ''' |
1377 const x = y + 1; | 1377 const x = y + 1; |
1378 const y = 1; | 1378 const y = 1; |
1379 '''); | 1379 '''); |
1380 expect(evaluationResult, isNotNull); | 1380 expect(evaluationResult, isNotNull); |
1381 expect(evaluationResult.value, isNotNull); | 1381 expect(evaluationResult.value, isNotNull); |
1382 expect(evaluationResult.value.intValue, 2); | 1382 expect(evaluationResult.value.intValue, 2); |
1383 } | 1383 } |
1384 | 1384 |
| 1385 test_external_const_factory() { |
| 1386 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue( |
| 1387 'x', ''' |
| 1388 const x = const C.foo(); |
| 1389 |
| 1390 class C extends B { |
| 1391 external const factory C.foo(); |
| 1392 } |
| 1393 |
| 1394 class B {} |
| 1395 '''); |
| 1396 expect(evaluationResult, isNotNull); |
| 1397 } |
| 1398 |
1385 test_simple_constant() { | 1399 test_simple_constant() { |
1386 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue( | 1400 EvaluationResultImpl evaluationResult = _computeTopLevelVariableConstValue( |
1387 'x', ''' | 1401 'x', ''' |
1388 const x = 1; | 1402 const x = 1; |
1389 '''); | 1403 '''); |
1390 expect(evaluationResult, isNotNull); | 1404 expect(evaluationResult, isNotNull); |
1391 expect(evaluationResult.value, isNotNull); | 1405 expect(evaluationResult.value, isNotNull); |
1392 expect(evaluationResult.value.intValue, 1); | 1406 expect(evaluationResult.value.intValue, 1); |
1393 } | 1407 } |
1394 | 1408 |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 /** | 2413 /** |
2400 * Fill [errorListener] with [result] errors in the current [task]. | 2414 * Fill [errorListener] with [result] errors in the current [task]. |
2401 */ | 2415 */ |
2402 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 2416 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
2403 List<AnalysisError> errors = task.outputs[result]; | 2417 List<AnalysisError> errors = task.outputs[result]; |
2404 expect(errors, isNotNull, reason: result.name); | 2418 expect(errors, isNotNull, reason: result.name); |
2405 errorListener = new GatheringErrorListener(); | 2419 errorListener = new GatheringErrorListener(); |
2406 errorListener.addAll(errors); | 2420 errorListener.addAll(errors); |
2407 } | 2421 } |
2408 } | 2422 } |
OLD | NEW |