Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: pkg/analyzer/test/generated/non_error_resolver_test.dart

Issue 688253004: Prevent conflict between parameter names and local function names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.non_error_resolver_test; 5 library engine.non_error_resolver_test;
6 6
7 import 'package:analyzer/src/generated/source_io.dart'; 7 import 'package:analyzer/src/generated/source_io.dart';
8 import 'package:analyzer/src/generated/error.dart'; 8 import 'package:analyzer/src/generated/error.dart';
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; 10 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 void test_optionalParameterInOperator_required() { 3378 void test_optionalParameterInOperator_required() {
3379 Source source = addSource(r''' 3379 Source source = addSource(r'''
3380 class A { 3380 class A {
3381 operator +(p) {} 3381 operator +(p) {}
3382 }'''); 3382 }''');
3383 resolve(source); 3383 resolve(source);
3384 assertNoErrors(source); 3384 assertNoErrors(source);
3385 verify([source]); 3385 verify([source]);
3386 } 3386 }
3387 3387
3388 void test_parameterScope_local() {
3389 // Parameter names shouldn't conflict with the name of the function they
3390 // are enclosed in.
3391 Source source = addSource(r'''
3392 f() {
3393 g(g) {
3394 h(g);
3395 }
3396 }
3397 h(x) {}
3398 ''');
3399 resolve(source);
3400 assertNoErrors(source);
3401 verify([source]);
3402 }
3403
3404 void test_parameterScope_method() {
3405 // Parameter names shouldn't conflict with the name of the function they
3406 // are enclosed in.
3407 Source source = addSource(r'''
3408 class C {
3409 g(g) {
3410 h(g);
3411 }
3412 }
3413 h(x) {}
3414 ''');
3415 resolve(source);
3416 assertNoErrors(source);
3417 verify([source]);
3418 }
3419
3420 void test_parameterScope_toplevel() {
3421 // Parameter names shouldn't conflict with the name of the function they
3422 // are enclosed in.
3423 Source source = addSource(r'''
3424 g(g) {
3425 h(g);
3426 }
3427 h(x) {}
3428 ''');
3429 resolve(source);
3430 assertNoErrors(source);
3431 verify([source]);
3432 }
3433
3388 void test_prefixCollidesWithTopLevelMembers() { 3434 void test_prefixCollidesWithTopLevelMembers() {
3389 addNamedSource("/lib.dart", r''' 3435 addNamedSource("/lib.dart", r'''
3390 library lib; 3436 library lib;
3391 class A {}'''); 3437 class A {}''');
3392 Source source = addSource(r''' 3438 Source source = addSource(r'''
3393 import 'lib.dart' as p; 3439 import 'lib.dart' as p;
3394 typedef P(); 3440 typedef P();
3395 p2() {} 3441 p2() {}
3396 var p3; 3442 var p3;
3397 class p4 {} 3443 class p4 {}
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
4694 4740
4695 void _check_wrongNumberOfParametersForOperator1(String name) { 4741 void _check_wrongNumberOfParametersForOperator1(String name) {
4696 _check_wrongNumberOfParametersForOperator(name, "a"); 4742 _check_wrongNumberOfParametersForOperator(name, "a");
4697 } 4743 }
4698 } 4744 }
4699 4745
4700 main() { 4746 main() {
4701 _ut.groupSep = ' | '; 4747 _ut.groupSep = ' | ';
4702 runReflectiveTests(NonErrorResolverTest); 4748 runReflectiveTests(NonErrorResolverTest);
4703 } 4749 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/compile_time_error_code_test.dart ('k') | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698