| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.incremental_resolver_test; | 5 library engine.incremental_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 void test_false_extendsClause_remove() { | 157 void test_false_extendsClause_remove() { |
| 158 _assertCompilationUnitMatches(false, r''' | 158 _assertCompilationUnitMatches(false, r''' |
| 159 class A {} | 159 class A {} |
| 160 class B extends A{} | 160 class B extends A{} |
| 161 ''', r''' | 161 ''', r''' |
| 162 class A {} | 162 class A {} |
| 163 class B {} | 163 class B {} |
| 164 '''); | 164 '''); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void test_false_field_list_add() { |
| 168 _assertCompilationUnitMatches(false, r''' |
| 169 class T { |
| 170 int A = 1; |
| 171 int C = 3; |
| 172 } |
| 173 ''', r''' |
| 174 class T { |
| 175 int A = 1; |
| 176 int B = 2; |
| 177 int C = 3; |
| 178 } |
| 179 '''); |
| 180 } |
| 181 |
| 182 void test_false_field_list_remove() { |
| 183 _assertCompilationUnitMatches(false, r''' |
| 184 class T { |
| 185 int A = 1; |
| 186 int B = 2; |
| 187 int C = 3; |
| 188 } |
| 189 ''', r''' |
| 190 class T { |
| 191 int A = 1; |
| 192 int C = 3; |
| 193 } |
| 194 '''); |
| 195 } |
| 196 |
| 197 void test_false_field_modifier_isConst() { |
| 198 _assertCompilationUnitMatches(false, r''' |
| 199 class T { |
| 200 static final A = 1; |
| 201 } |
| 202 ''', r''' |
| 203 class T { |
| 204 static const A = 1; |
| 205 } |
| 206 '''); |
| 207 } |
| 208 |
| 209 void test_false_field_modifier_isFinal() { |
| 210 _assertCompilationUnitMatches(false, r''' |
| 211 class T { |
| 212 int A = 1; |
| 213 } |
| 214 ''', r''' |
| 215 class T { |
| 216 final int A = 1; |
| 217 } |
| 218 '''); |
| 219 } |
| 220 |
| 221 void test_false_field_modifier_isStatic() { |
| 222 _assertCompilationUnitMatches(false, r''' |
| 223 class T { |
| 224 int A = 1; |
| 225 } |
| 226 ''', r''' |
| 227 class T { |
| 228 static int A = 1; |
| 229 } |
| 230 '''); |
| 231 } |
| 232 |
| 233 void test_false_field_modifier_wasConst() { |
| 234 _assertCompilationUnitMatches(false, r''' |
| 235 class T { |
| 236 static const A = 1; |
| 237 } |
| 238 ''', r''' |
| 239 class T { |
| 240 static final A = 1; |
| 241 } |
| 242 '''); |
| 243 } |
| 244 |
| 245 void test_false_field_modifier_wasFinal() { |
| 246 _assertCompilationUnitMatches(false, r''' |
| 247 class T { |
| 248 final int A = 1; |
| 249 } |
| 250 ''', r''' |
| 251 class T { |
| 252 int A = 1; |
| 253 } |
| 254 '''); |
| 255 } |
| 256 |
| 257 void test_false_field_modifier_wasStatic() { |
| 258 _assertCompilationUnitMatches(false, r''' |
| 259 class T { |
| 260 static int A = 1; |
| 261 } |
| 262 ''', r''' |
| 263 class T { |
| 264 int A = 1; |
| 265 } |
| 266 '''); |
| 267 } |
| 268 |
| 269 void test_false_field_type_differentArgs() { |
| 270 _assertCompilationUnitMatches(false, r''' |
| 271 class T { |
| 272 List<int> A; |
| 273 } |
| 274 ''', r''' |
| 275 class T { |
| 276 List<String> A; |
| 277 } |
| 278 '''); |
| 279 } |
| 280 |
| 281 void test_false_final_type_different() { |
| 282 _assertCompilationUnitMatches(false, r''' |
| 283 class T { |
| 284 int A; |
| 285 } |
| 286 ''', r''' |
| 287 class T { |
| 288 String A; |
| 289 } |
| 290 '''); |
| 291 } |
| 292 |
| 167 void test_false_implementsClause_add() { | 293 void test_false_implementsClause_add() { |
| 168 _assertCompilationUnitMatches(false, r''' | 294 _assertCompilationUnitMatches(false, r''' |
| 169 class A {} | 295 class A {} |
| 170 class B {} | 296 class B {} |
| 171 ''', r''' | 297 ''', r''' |
| 172 class A {} | 298 class A {} |
| 173 class B implements A {} | 299 class B implements A {} |
| 174 '''); | 300 '''); |
| 175 } | 301 } |
| 176 | 302 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 369 } |
| 244 | 370 |
| 245 void test_false_topLevelVariable_modifier_wasFinal() { | 371 void test_false_topLevelVariable_modifier_wasFinal() { |
| 246 _assertCompilationUnitMatches(false, r''' | 372 _assertCompilationUnitMatches(false, r''' |
| 247 final int A = 1; | 373 final int A = 1; |
| 248 ''', r''' | 374 ''', r''' |
| 249 int A = 1; | 375 int A = 1; |
| 250 '''); | 376 '''); |
| 251 } | 377 } |
| 252 | 378 |
| 379 void test_false_topLevelVariable_synthetic_wasGetter() { |
| 380 _assertCompilationUnitMatches(false, r''' |
| 381 int get A => 1; |
| 382 ''', r''' |
| 383 final int A = 1; |
| 384 '''); |
| 385 } |
| 386 |
| 253 void test_false_topLevelVariable_type_different() { | 387 void test_false_topLevelVariable_type_different() { |
| 254 _assertCompilationUnitMatches(false, r''' | 388 _assertCompilationUnitMatches(false, r''' |
| 255 int A; | 389 int A; |
| 256 ''', r''' | 390 ''', r''' |
| 257 String A; | 391 String A; |
| 258 '''); | 392 '''); |
| 259 } | 393 } |
| 260 | 394 |
| 261 void test_false_topLevelVariable_type_differentArgs() { | 395 void test_false_topLevelVariable_type_differentArgs() { |
| 262 _assertCompilationUnitMatches(false, r''' | 396 _assertCompilationUnitMatches(false, r''' |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 class A { | 503 class A { |
| 370 A(int p); | 504 A(int p); |
| 371 } | 505 } |
| 372 ''', r''' | 506 ''', r''' |
| 373 class A { | 507 class A { |
| 374 A(int p); | 508 A(int p); |
| 375 } | 509 } |
| 376 '''); | 510 '''); |
| 377 } | 511 } |
| 378 | 512 |
| 513 void test_true_executable_same_hasLabel() { |
| 514 _assertCompilationUnitMatches(true, r''' |
| 515 main() { |
| 516 label: return 42; |
| 517 } |
| 518 ''', r''' |
| 519 main() { |
| 520 label: return 42; |
| 521 } |
| 522 '''); |
| 523 } |
| 524 |
| 525 void test_true_executable_same_hasLocalVariable() { |
| 526 _assertCompilationUnitMatches(true, r''' |
| 527 main() { |
| 528 int a = 42; |
| 529 } |
| 530 ''', r''' |
| 531 main() { |
| 532 int a = 42; |
| 533 } |
| 534 '''); |
| 535 } |
| 536 |
| 379 void test_true_extendsClause_same() { | 537 void test_true_extendsClause_same() { |
| 380 _assertCompilationUnitMatches(true, r''' | 538 _assertCompilationUnitMatches(true, r''' |
| 381 class A {} | 539 class A {} |
| 382 class B extends A {} | 540 class B extends A {} |
| 383 ''', r''' | 541 ''', r''' |
| 384 class A {} | 542 class A {} |
| 385 class B extends A {} | 543 class B extends A {} |
| 386 '''); | 544 '''); |
| 387 } | 545 } |
| 388 | 546 |
| 547 void test_true_field_list_reorder() { |
| 548 _assertCompilationUnitMatches(true, r''' |
| 549 class T { |
| 550 int A = 1; |
| 551 int B = 2; |
| 552 int C = 3; |
| 553 } |
| 554 ''', r''' |
| 555 class T { |
| 556 int C = 3; |
| 557 int A = 1; |
| 558 int B = 2; |
| 559 } |
| 560 '''); |
| 561 } |
| 562 |
| 563 void test_true_field_list_same() { |
| 564 _assertCompilationUnitMatches(true, r''' |
| 565 class T { |
| 566 int A = 1; |
| 567 int B = 2; |
| 568 int C = 3; |
| 569 } |
| 570 ''', r''' |
| 571 class T { |
| 572 int A = 1; |
| 573 int B = 2; |
| 574 int C = 3; |
| 575 } |
| 576 '''); |
| 577 } |
| 578 |
| 389 void test_true_implementsClause_same() { | 579 void test_true_implementsClause_same() { |
| 390 _assertCompilationUnitMatches(true, r''' | 580 _assertCompilationUnitMatches(true, r''' |
| 391 class A {} | 581 class A {} |
| 392 class B implements A {} | 582 class B implements A {} |
| 393 ''', r''' | 583 ''', r''' |
| 394 class A {} | 584 class A {} |
| 395 class B implements A {} | 585 class B implements A {} |
| 396 '''); | 586 '''); |
| 397 } | 587 } |
| 398 | 588 |
| (...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 _visitList(node.metadata, other.metadata); | 1875 _visitList(node.metadata, other.metadata); |
| 1686 _visitNode(node.identifier, other.identifier); | 1876 _visitNode(node.identifier, other.identifier); |
| 1687 } | 1877 } |
| 1688 | 1878 |
| 1689 static void assertSameResolution(CompilationUnit actual, | 1879 static void assertSameResolution(CompilationUnit actual, |
| 1690 CompilationUnit expected) { | 1880 CompilationUnit expected) { |
| 1691 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 1881 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 1692 actual.accept(validator); | 1882 actual.accept(validator); |
| 1693 } | 1883 } |
| 1694 } | 1884 } |
| OLD | NEW |