| 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 5723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5734 test_field_final_invalidConstExpr() { | 5734 test_field_final_invalidConstExpr() { |
| 5735 UnlinkedVariable variable = serializeClassText(r''' | 5735 UnlinkedVariable variable = serializeClassText(r''' |
| 5736 class C { | 5736 class C { |
| 5737 final int f = 1 + m(); | 5737 final int f = 1 + m(); |
| 5738 static int m() => 42; | 5738 static int m() => 42; |
| 5739 }''').fields[0]; | 5739 }''').fields[0]; |
| 5740 expect(variable.isFinal, isTrue); | 5740 expect(variable.isFinal, isTrue); |
| 5741 _assertUnlinkedConst(variable.constExpr, isInvalid: true); | 5741 _assertUnlinkedConst(variable.constExpr, isInvalid: true); |
| 5742 } | 5742 } |
| 5743 | 5743 |
| 5744 test_field_final_typeParameter() { |
| 5745 UnlinkedVariable variable = serializeClassText(r''' |
| 5746 class C<T> { |
| 5747 final f = <T>[]; |
| 5748 }''').fields[0]; |
| 5749 expect(variable.isFinal, isTrue); |
| 5750 _assertUnlinkedConst(variable.constExpr, |
| 5751 operators: [UnlinkedConstOperation.makeTypedList], |
| 5752 ints: [0], |
| 5753 referenceValidators: [(EntityRef r) => checkParamTypeRef(r, 1)]); |
| 5754 } |
| 5755 |
| 5744 test_field_formal_param_inferred_type_explicit() { | 5756 test_field_formal_param_inferred_type_explicit() { |
| 5745 UnlinkedClass cls = serializeClassText( | 5757 UnlinkedClass cls = serializeClassText( |
| 5746 'class C extends D { var v; C(int this.v); }' | 5758 'class C extends D { var v; C(int this.v); }' |
| 5747 ' abstract class D { num get v; }', | 5759 ' abstract class D { num get v; }', |
| 5748 className: 'C'); | 5760 className: 'C'); |
| 5749 checkInferredTypeSlot( | 5761 checkInferredTypeSlot( |
| 5750 cls.fields[0].inferredTypeSlot, 'dart:core', 'dart:core', 'num'); | 5762 cls.fields[0].inferredTypeSlot, 'dart:core', 'dart:core', 'num'); |
| 5751 expect(cls.executables[0].kind, UnlinkedExecutableKind.constructor); | 5763 expect(cls.executables[0].kind, UnlinkedExecutableKind.constructor); |
| 5752 expect(cls.executables[0].parameters[0].inferredTypeSlot, 0); | 5764 expect(cls.executables[0].parameters[0].inferredTypeSlot, 0); |
| 5753 } | 5765 } |
| (...skipping 2369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8123 class _PrefixExpectation { | 8135 class _PrefixExpectation { |
| 8124 final ReferenceKind kind; | 8136 final ReferenceKind kind; |
| 8125 final String name; | 8137 final String name; |
| 8126 final String absoluteUri; | 8138 final String absoluteUri; |
| 8127 final String relativeUri; | 8139 final String relativeUri; |
| 8128 final int numTypeParameters; | 8140 final int numTypeParameters; |
| 8129 | 8141 |
| 8130 _PrefixExpectation(this.kind, this.name, | 8142 _PrefixExpectation(this.kind, this.name, |
| 8131 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); | 8143 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); |
| 8132 } | 8144 } |
| OLD | NEW |