| 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/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 3836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3847 ReferenceKind.topLevelPropertyAccessor); | 3847 ReferenceKind.topLevelPropertyAccessor); |
| 3848 } | 3848 } |
| 3849 | 3849 |
| 3850 test_field() { | 3850 test_field() { |
| 3851 UnlinkedClass cls = serializeClassText('class C { int i; }'); | 3851 UnlinkedClass cls = serializeClassText('class C { int i; }'); |
| 3852 UnlinkedVariable variable = findVariable('i', variables: cls.fields); | 3852 UnlinkedVariable variable = findVariable('i', variables: cls.fields); |
| 3853 expect(variable, isNotNull); | 3853 expect(variable, isNotNull); |
| 3854 expect(variable.isConst, isFalse); | 3854 expect(variable.isConst, isFalse); |
| 3855 expect(variable.isStatic, isFalse); | 3855 expect(variable.isStatic, isFalse); |
| 3856 expect(variable.isFinal, isFalse); | 3856 expect(variable.isFinal, isFalse); |
| 3857 expect(variable.constExpr, isNull); |
| 3857 expect(findExecutable('i', executables: cls.executables), isNull); | 3858 expect(findExecutable('i', executables: cls.executables), isNull); |
| 3858 expect(findExecutable('i=', executables: cls.executables), isNull); | 3859 expect(findExecutable('i=', executables: cls.executables), isNull); |
| 3859 } | 3860 } |
| 3860 | 3861 |
| 3861 test_field_const() { | 3862 test_field_const() { |
| 3862 UnlinkedVariable variable = | 3863 UnlinkedVariable variable = |
| 3863 serializeClassText('class C { static const int i = 0; }').fields[0]; | 3864 serializeClassText('class C { static const int i = 0; }').fields[0]; |
| 3864 expect(variable.isConst, isTrue); | 3865 expect(variable.isConst, isTrue); |
| 3865 _assertUnlinkedConst(variable.constExpr, | 3866 _assertUnlinkedConst(variable.constExpr, |
| 3866 operators: [UnlinkedConstOperation.pushInt], ints: [0]); | 3867 operators: [UnlinkedConstOperation.pushInt], ints: [0]); |
| 3867 } | 3868 } |
| 3868 | 3869 |
| 3869 test_field_documented() { | 3870 test_field_documented() { |
| 3870 String text = ''' | 3871 String text = ''' |
| 3871 class C { | 3872 class C { |
| 3872 /** | 3873 /** |
| 3873 * Docs | 3874 * Docs |
| 3874 */ | 3875 */ |
| 3875 var v; | 3876 var v; |
| 3876 }'''; | 3877 }'''; |
| 3877 UnlinkedVariable variable = serializeClassText(text).fields[0]; | 3878 UnlinkedVariable variable = serializeClassText(text).fields[0]; |
| 3878 expect(variable.documentationComment, isNotNull); | 3879 expect(variable.documentationComment, isNotNull); |
| 3879 checkDocumentationComment(variable.documentationComment, text); | 3880 checkDocumentationComment(variable.documentationComment, text); |
| 3880 } | 3881 } |
| 3881 | 3882 |
| 3882 test_field_final() { | 3883 test_field_final() { |
| 3883 UnlinkedVariable variable = | 3884 UnlinkedVariable variable = |
| 3884 serializeClassText('class C { final int i = 0; }').fields[0]; | 3885 serializeClassText('class C { final int i = 0; }').fields[0]; |
| 3885 expect(variable.isFinal, isTrue); | 3886 expect(variable.isFinal, isTrue); |
| 3887 _assertUnlinkedConst(variable.constExpr, |
| 3888 operators: [UnlinkedConstOperation.pushInt], ints: [0]); |
| 3886 } | 3889 } |
| 3887 | 3890 |
| 3888 test_field_formal_param_inferred_type_explicit() { | 3891 test_field_formal_param_inferred_type_explicit() { |
| 3889 UnlinkedClass cls = serializeClassText( | 3892 UnlinkedClass cls = serializeClassText( |
| 3890 'class C extends D { var v; C(int this.v); }' | 3893 'class C extends D { var v; C(int this.v); }' |
| 3891 ' abstract class D { num get v; }', | 3894 ' abstract class D { num get v; }', |
| 3892 className: 'C'); | 3895 className: 'C'); |
| 3893 checkInferredTypeSlot( | 3896 checkInferredTypeSlot( |
| 3894 cls.fields[0].inferredTypeSlot, 'dart:core', 'dart:core', 'num'); | 3897 cls.fields[0].inferredTypeSlot, 'dart:core', 'dart:core', 'num'); |
| 3895 expect(cls.executables[0].kind, UnlinkedExecutableKind.constructor); | 3898 expect(cls.executables[0].kind, UnlinkedExecutableKind.constructor); |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5246 | 5249 |
| 5247 test_variable_explicit_dynamic() { | 5250 test_variable_explicit_dynamic() { |
| 5248 UnlinkedVariable variable = serializeVariableText('dynamic v;'); | 5251 UnlinkedVariable variable = serializeVariableText('dynamic v;'); |
| 5249 checkDynamicTypeRef(variable.type); | 5252 checkDynamicTypeRef(variable.type); |
| 5250 } | 5253 } |
| 5251 | 5254 |
| 5252 test_variable_final_top_level() { | 5255 test_variable_final_top_level() { |
| 5253 UnlinkedVariable variable = | 5256 UnlinkedVariable variable = |
| 5254 serializeVariableText('final int i = 0;', variableName: 'i'); | 5257 serializeVariableText('final int i = 0;', variableName: 'i'); |
| 5255 expect(variable.isFinal, isTrue); | 5258 expect(variable.isFinal, isTrue); |
| 5259 expect(variable.constExpr, isNull); |
| 5256 } | 5260 } |
| 5257 | 5261 |
| 5258 test_variable_implicit_dynamic() { | 5262 test_variable_implicit_dynamic() { |
| 5259 UnlinkedVariable variable = serializeVariableText('var v;'); | 5263 UnlinkedVariable variable = serializeVariableText('var v;'); |
| 5260 expect(variable.type, isNull); | 5264 expect(variable.type, isNull); |
| 5261 } | 5265 } |
| 5262 | 5266 |
| 5263 test_variable_inferred_type_explicit_initialized() { | 5267 test_variable_inferred_type_explicit_initialized() { |
| 5264 UnlinkedVariable v = serializeVariableText('int v = 0;'); | 5268 UnlinkedVariable v = serializeVariableText('int v = 0;'); |
| 5265 expect(v.inferredTypeSlot, 0); | 5269 expect(v.inferredTypeSlot, 0); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5449 final String absoluteUri; | 5453 final String absoluteUri; |
| 5450 final String relativeUri; | 5454 final String relativeUri; |
| 5451 final int numTypeParameters; | 5455 final int numTypeParameters; |
| 5452 | 5456 |
| 5453 _PrefixExpectation(this.kind, this.name, | 5457 _PrefixExpectation(this.kind, this.name, |
| 5454 {this.inLibraryDefiningUnit: false, | 5458 {this.inLibraryDefiningUnit: false, |
| 5455 this.absoluteUri, | 5459 this.absoluteUri, |
| 5456 this.relativeUri, | 5460 this.relativeUri, |
| 5457 this.numTypeParameters: 0}); | 5461 this.numTypeParameters: 0}); |
| 5458 } | 5462 } |
| OLD | NEW |