| 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 5984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5995 } | 5995 } |
| 5996 | 5996 |
| 5997 test_field_static_final() { | 5997 test_field_static_final() { |
| 5998 UnlinkedVariable variable = | 5998 UnlinkedVariable variable = |
| 5999 serializeClassText('class C { static final int i = 0; }').fields[0]; | 5999 serializeClassText('class C { static final int i = 0; }').fields[0]; |
| 6000 expect(variable.isStatic, isTrue); | 6000 expect(variable.isStatic, isTrue); |
| 6001 expect(variable.isFinal, isTrue); | 6001 expect(variable.isFinal, isTrue); |
| 6002 expect(variable.constExpr, isNull); | 6002 expect(variable.constExpr, isNull); |
| 6003 } | 6003 } |
| 6004 | 6004 |
| 6005 test_field_static_final_untyped() { |
| 6006 if (!checkAstDerivedData) { |
| 6007 // The element model doesn't contain the initializer expressions needed |
| 6008 // for type inference. TODO(paulberry): fix. |
| 6009 return; |
| 6010 } |
| 6011 UnlinkedVariable variable = |
| 6012 serializeClassText('class C { static final x = 0; }').fields[0]; |
| 6013 expect(variable.constExpr, isNotNull); |
| 6014 } |
| 6015 |
| 6016 test_field_untyped() { |
| 6017 if (!checkAstDerivedData) { |
| 6018 // The element model doesn't contain the initializer expressions needed |
| 6019 // for type inference. TODO(paulberry): fix. |
| 6020 return; |
| 6021 } |
| 6022 UnlinkedVariable variable = |
| 6023 serializeClassText('class C { var x = 0; }').fields[0]; |
| 6024 expect(variable.constExpr, isNotNull); |
| 6025 } |
| 6026 |
| 6005 test_fully_linked_references_follow_other_references() { | 6027 test_fully_linked_references_follow_other_references() { |
| 6006 if (skipFullyLinkedData) { | 6028 if (skipFullyLinkedData) { |
| 6007 return; | 6029 return; |
| 6008 } | 6030 } |
| 6009 serializeLibraryText('final x = 0; String y;'); | 6031 serializeLibraryText('final x = 0; String y;'); |
| 6010 checkLinkedTypeSlot(unlinkedUnits[0].variables[0].propagatedTypeSlot, | 6032 checkLinkedTypeSlot(unlinkedUnits[0].variables[0].propagatedTypeSlot, |
| 6011 'dart:core', 'dart:core', 'int'); | 6033 'dart:core', 'dart:core', 'int'); |
| 6012 checkTypeRef( | 6034 checkTypeRef( |
| 6013 unlinkedUnits[0].variables[1].type, 'dart:core', 'dart:core', 'String'); | 6035 unlinkedUnits[0].variables[1].type, 'dart:core', 'dart:core', 'String'); |
| 6014 // Even though the definition of y follows the definition of x, the linked | 6036 // Even though the definition of y follows the definition of x, the linked |
| (...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8000 checkDynamicTypeRef(variable.type); | 8022 checkDynamicTypeRef(variable.type); |
| 8001 } | 8023 } |
| 8002 | 8024 |
| 8003 test_variable_final_top_level() { | 8025 test_variable_final_top_level() { |
| 8004 UnlinkedVariable variable = | 8026 UnlinkedVariable variable = |
| 8005 serializeVariableText('final int i = 0;', variableName: 'i'); | 8027 serializeVariableText('final int i = 0;', variableName: 'i'); |
| 8006 expect(variable.isFinal, isTrue); | 8028 expect(variable.isFinal, isTrue); |
| 8007 expect(variable.constExpr, isNull); | 8029 expect(variable.constExpr, isNull); |
| 8008 } | 8030 } |
| 8009 | 8031 |
| 8032 test_variable_final_top_level_untyped() { |
| 8033 if (!checkAstDerivedData) { |
| 8034 // The element model doesn't contain the initializer expressions needed |
| 8035 // for type inference. TODO(paulberry): fix. |
| 8036 return; |
| 8037 } |
| 8038 UnlinkedVariable variable = serializeVariableText('final v = 0;'); |
| 8039 expect(variable.constExpr, isNotNull); |
| 8040 } |
| 8041 |
| 8010 test_variable_implicit_dynamic() { | 8042 test_variable_implicit_dynamic() { |
| 8011 UnlinkedVariable variable = serializeVariableText('var v;'); | 8043 UnlinkedVariable variable = serializeVariableText('var v;'); |
| 8012 expect(variable.type, isNull); | 8044 expect(variable.type, isNull); |
| 8013 } | 8045 } |
| 8014 | 8046 |
| 8015 test_variable_inferred_type_explicit_initialized() { | 8047 test_variable_inferred_type_explicit_initialized() { |
| 8016 UnlinkedVariable v = serializeVariableText('int v = 0;'); | 8048 UnlinkedVariable v = serializeVariableText('int v = 0;'); |
| 8017 expect(v.inferredTypeSlot, 0); | 8049 expect(v.inferredTypeSlot, 0); |
| 8018 } | 8050 } |
| 8019 | 8051 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8291 class _PrefixExpectation { | 8323 class _PrefixExpectation { |
| 8292 final ReferenceKind kind; | 8324 final ReferenceKind kind; |
| 8293 final String name; | 8325 final String name; |
| 8294 final String absoluteUri; | 8326 final String absoluteUri; |
| 8295 final String relativeUri; | 8327 final String relativeUri; |
| 8296 final int numTypeParameters; | 8328 final int numTypeParameters; |
| 8297 | 8329 |
| 8298 _PrefixExpectation(this.kind, this.name, | 8330 _PrefixExpectation(this.kind, this.name, |
| 8299 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); | 8331 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); |
| 8300 } | 8332 } |
| OLD | NEW |