| 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.static_warning_code_test; | 5 library engine.static_warning_code_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/error.dart'; | 7 import 'package:analyzer/src/generated/error.dart'; |
| 8 import 'package:analyzer/src/generated/source_io.dart'; | 8 import 'package:analyzer/src/generated/source_io.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3364 resolve(source); | 3364 resolve(source); |
| 3365 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3365 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 3366 } | 3366 } |
| 3367 | 3367 |
| 3368 void test_undefinedIdentifier_function() { | 3368 void test_undefinedIdentifier_function() { |
| 3369 Source source = addSource("int a() => b;"); | 3369 Source source = addSource("int a() => b;"); |
| 3370 resolve(source); | 3370 resolve(source); |
| 3371 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3371 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 3372 } | 3372 } |
| 3373 | 3373 |
| 3374 void test_undefinedIdentifier_function_prefix() { | |
| 3375 addNamedSource("/lib.dart", r''' | |
| 3376 library lib; | |
| 3377 class C {}'''); | |
| 3378 Source source = addSource(r''' | |
| 3379 import 'lib.dart' as b; | |
| 3380 | |
| 3381 int a() => b; | |
| 3382 b.C c;'''); | |
| 3383 resolve(source); | |
| 3384 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | |
| 3385 verify([source]); | |
| 3386 } | |
| 3387 | |
| 3388 void test_undefinedIdentifier_initializer() { | 3374 void test_undefinedIdentifier_initializer() { |
| 3389 Source source = addSource("var a = b;"); | 3375 Source source = addSource("var a = b;"); |
| 3390 resolve(source); | 3376 resolve(source); |
| 3391 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3377 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 3392 } | 3378 } |
| 3393 | 3379 |
| 3394 void test_undefinedIdentifier_initializer_prefix() { | |
| 3395 addNamedSource("/lib.dart", r''' | |
| 3396 library lib; | |
| 3397 class C {}'''); | |
| 3398 Source source = addSource(r''' | |
| 3399 import 'lib.dart' as b; | |
| 3400 | |
| 3401 var a = b; | |
| 3402 b.C c;'''); | |
| 3403 resolve(source); | |
| 3404 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | |
| 3405 } | |
| 3406 | |
| 3407 void test_undefinedIdentifier_methodInvocation() { | 3380 void test_undefinedIdentifier_methodInvocation() { |
| 3408 Source source = addSource("f() { C.m(); }"); | 3381 Source source = addSource("f() { C.m(); }"); |
| 3409 resolve(source); | 3382 resolve(source); |
| 3410 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3383 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 3411 } | 3384 } |
| 3412 | 3385 |
| 3413 void test_undefinedIdentifier_private_getter() { | 3386 void test_undefinedIdentifier_private_getter() { |
| 3414 addNamedSource("/lib.dart", r''' | 3387 addNamedSource("/lib.dart", r''' |
| 3415 library lib; | 3388 library lib; |
| 3416 class A { | 3389 class A { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3528 | 3501 |
| 3529 void test_voidReturnForGetter() { | 3502 void test_voidReturnForGetter() { |
| 3530 Source source = addSource(r''' | 3503 Source source = addSource(r''' |
| 3531 class S { | 3504 class S { |
| 3532 void get value {} | 3505 void get value {} |
| 3533 }'''); | 3506 }'''); |
| 3534 resolve(source); | 3507 resolve(source); |
| 3535 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); | 3508 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); |
| 3536 } | 3509 } |
| 3537 } | 3510 } |
| OLD | NEW |