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.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; | 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; |
9 import 'package:analyzer/dart/constant/value.dart'; | 9 import 'package:analyzer/dart/constant/value.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 5102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5113 const bool vAnd = true && false; | 5113 const bool vAnd = true && false; |
5114 const bool vOr = false || true; | 5114 const bool vOr = false || true; |
5115 const int vBitXor = 1 ^ 2; | 5115 const int vBitXor = 1 ^ 2; |
5116 const int vBitAnd = 1 & 2; | 5116 const int vBitAnd = 1 & 2; |
5117 const int vBitOr = 1 | 2; | 5117 const int vBitOr = 1 | 2; |
5118 const int vBitShiftLeft = 1 << 2; | 5118 const int vBitShiftLeft = 1 << 2; |
5119 const int vBitShiftRight = 1 >> 2; | 5119 const int vBitShiftRight = 1 >> 2; |
5120 const int vAdd = 1 + 2; | 5120 const int vAdd = 1 + 2; |
5121 const int vSubtract = 1 - 2; | 5121 const int vSubtract = 1 - 2; |
5122 const int vMiltiply = 1 * 2; | 5122 const int vMiltiply = 1 * 2; |
5123 const num vDivide = 1 / 2; | 5123 const double vDivide = 1 / 2; |
5124 const int vFloorDivide = 1 ~/ 2; | 5124 const int vFloorDivide = 1 ~/ 2; |
5125 const int vModulo = 1 % 2; | 5125 const int vModulo = 1 % 2; |
5126 const bool vGreater = 1 > 2; | 5126 const bool vGreater = 1 > 2; |
5127 const bool vGreaterEqual = 1 >= 2; | 5127 const bool vGreaterEqual = 1 >= 2; |
5128 const bool vLess = 1 < 2; | 5128 const bool vLess = 1 < 2; |
5129 const bool vLessEqual = 1 <= 2; | 5129 const bool vLessEqual = 1 <= 2; |
5130 '''); | 5130 '''); |
5131 } else { | 5131 } else { |
5132 checkElementText( | 5132 checkElementText( |
5133 library, | 5133 library, |
(...skipping 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7858 import "a.dart"; | 7858 import "a.dart"; |
7859 class C { | 7859 class C { |
7860 final b = a / 2; | 7860 final b = a / 2; |
7861 }'''); | 7861 }'''); |
7862 if (isStrongMode) { | 7862 if (isStrongMode) { |
7863 checkElementText( | 7863 checkElementText( |
7864 library, | 7864 library, |
7865 r''' | 7865 r''' |
7866 import 'a.dart'; | 7866 import 'a.dart'; |
7867 class C { | 7867 class C { |
7868 final num b = | 7868 final double b = |
7869 a/*location: a.dart;a?*/ / 2; | 7869 a/*location: a.dart;a?*/ / 2; |
7870 } | 7870 } |
7871 '''); | 7871 '''); |
7872 } else { | 7872 } else { |
7873 checkElementText( | 7873 checkElementText( |
7874 library, | 7874 library, |
7875 r''' | 7875 r''' |
7876 import 'a.dart'; | 7876 import 'a.dart'; |
7877 class C { | 7877 class C { |
7878 final dynamic b = | 7878 final dynamic b = |
(...skipping 11 matching lines...) Expand all Loading... |
7890 class C { | 7890 class C { |
7891 final b = a / 2; | 7891 final b = a / 2; |
7892 }'''); | 7892 }'''); |
7893 if (isStrongMode) { | 7893 if (isStrongMode) { |
7894 checkElementText( | 7894 checkElementText( |
7895 library, | 7895 library, |
7896 r''' | 7896 r''' |
7897 library lib; | 7897 library lib; |
7898 part 'a.dart'; | 7898 part 'a.dart'; |
7899 class C { | 7899 class C { |
7900 final num b = | 7900 final double b = |
7901 a/*location: test.dart;a.dart;a?*/ / 2; | 7901 a/*location: test.dart;a.dart;a?*/ / 2; |
7902 } | 7902 } |
7903 -------------------- | 7903 -------------------- |
7904 unit: a.dart | 7904 unit: a.dart |
7905 | 7905 |
7906 final int a; | 7906 final int a; |
7907 '''); | 7907 '''); |
7908 } else { | 7908 } else { |
7909 checkElementText( | 7909 checkElementText( |
7910 library, | 7910 library, |
(...skipping 7184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15095 } | 15095 } |
15096 | 15096 |
15097 test_variable_propagatedType_final_dep_inLib() { | 15097 test_variable_propagatedType_final_dep_inLib() { |
15098 addLibrarySource('/a.dart', 'final a = 1;'); | 15098 addLibrarySource('/a.dart', 'final a = 1;'); |
15099 var library = checkLibrary('import "a.dart"; final b = a / 2;'); | 15099 var library = checkLibrary('import "a.dart"; final b = a / 2;'); |
15100 if (isStrongMode) { | 15100 if (isStrongMode) { |
15101 checkElementText( | 15101 checkElementText( |
15102 library, | 15102 library, |
15103 r''' | 15103 r''' |
15104 import 'a.dart'; | 15104 import 'a.dart'; |
15105 final num b; | 15105 final double b; |
15106 '''); | 15106 '''); |
15107 } else { | 15107 } else { |
15108 checkElementText( | 15108 checkElementText( |
15109 library, | 15109 library, |
15110 r''' | 15110 r''' |
15111 import 'a.dart'; | 15111 import 'a.dart'; |
15112 final dynamic b; | 15112 final dynamic b; |
15113 '''); | 15113 '''); |
15114 } | 15114 } |
15115 } | 15115 } |
15116 | 15116 |
15117 test_variable_propagatedType_final_dep_inPart() { | 15117 test_variable_propagatedType_final_dep_inPart() { |
15118 addSource('/a.dart', 'part of lib; final a = 1;'); | 15118 addSource('/a.dart', 'part of lib; final a = 1;'); |
15119 var library = checkLibrary('library lib; part "a.dart"; final b = a / 2;'); | 15119 var library = checkLibrary('library lib; part "a.dart"; final b = a / 2;'); |
15120 if (isStrongMode) { | 15120 if (isStrongMode) { |
15121 checkElementText( | 15121 checkElementText( |
15122 library, | 15122 library, |
15123 r''' | 15123 r''' |
15124 library lib; | 15124 library lib; |
15125 part 'a.dart'; | 15125 part 'a.dart'; |
15126 final num b; | 15126 final double b; |
15127 -------------------- | 15127 -------------------- |
15128 unit: a.dart | 15128 unit: a.dart |
15129 | 15129 |
15130 final int a; | 15130 final int a; |
15131 '''); | 15131 '''); |
15132 } else { | 15132 } else { |
15133 checkElementText( | 15133 checkElementText( |
15134 library, | 15134 library, |
15135 r''' | 15135 r''' |
15136 library lib; | 15136 library lib; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15304 fail('Unexpectedly tried to get unlinked summary for $uri'); | 15304 fail('Unexpectedly tried to get unlinked summary for $uri'); |
15305 } | 15305 } |
15306 return serializedUnit; | 15306 return serializedUnit; |
15307 } | 15307 } |
15308 | 15308 |
15309 @override | 15309 @override |
15310 bool hasLibrarySummary(String uri) { | 15310 bool hasLibrarySummary(String uri) { |
15311 return true; | 15311 return true; |
15312 } | 15312 } |
15313 } | 15313 } |
OLD | NEW |