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

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2441483002: In DeclarationResolver, handle generic function-typed parameters. (Closed)
Patch Set: Created 4 years, 2 months 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/declaration_resolver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analyzer.test.src.context.context_test; 5 library analyzer.test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 resourceResolver, 2417 resourceResolver,
2418 new PackageMapUriResolver(resourceProvider, { 2418 new PackageMapUriResolver(resourceProvider, {
2419 'crypto': [resourceProvider.getFolder('/pkgs/crypto-2/lib')] 2419 'crypto': [resourceProvider.getFolder('/pkgs/crypto-2/lib')]
2420 }) 2420 })
2421 ]); 2421 ]);
2422 _analyzeAll_assertFinished(); 2422 _analyzeAll_assertFinished();
2423 _assertNoExceptions(); 2423 _assertNoExceptions();
2424 } 2424 }
2425 2425
2426 void test_resolveCompilationUnit_existingElementModel() { 2426 void test_resolveCompilationUnit_existingElementModel() {
2427 prepareAnalysisContext(new AnalysisOptionsImpl()
2428 ..enableGenericMethods = true
2429 ..strongMode = true);
2427 Source source = addSource( 2430 Source source = addSource(
2428 '/test.dart', 2431 '/test.dart',
2429 r''' 2432 r'''
2430 library test; 2433 library test;
2431 2434
2432 String topLevelVariable; 2435 String topLevelVariable;
2433 int get topLevelGetter => 0; 2436 int get topLevelGetter => 0;
2434 void set topLevelSetter(int value) {} 2437 void set topLevelSetter(int value) {}
2435 String topLevelFunction(int i) => ''; 2438 String topLevelFunction(int i) => '';
2436 2439
(...skipping 26 matching lines...) Expand all
2463 static String staticMethod(int first, {int second: 0}) => ''; 2466 static String staticMethod(int first, {int second: 0}) => '';
2464 } 2467 }
2465 2468
2466 class ClassTwo { 2469 class ClassTwo {
2467 // Implicit no-argument constructor 2470 // Implicit no-argument constructor
2468 } 2471 }
2469 2472
2470 void topLevelFunctionWithLocalFunction() { 2473 void topLevelFunctionWithLocalFunction() {
2471 void localFunction({bool b: false}) {} 2474 void localFunction({bool b: false}) {}
2472 } 2475 }
2476
2477 void functionWithGenericFunctionTypedParam/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {}
2473 '''); 2478 ''');
2474 context.resolveCompilationUnit2(source, source); 2479 context.resolveCompilationUnit2(source, source);
2475 LibraryElement firstElement = context.computeLibraryElement(source); 2480 LibraryElement firstElement = context.computeLibraryElement(source);
2476 _ElementGatherer gatherer = new _ElementGatherer(); 2481 _ElementGatherer gatherer = new _ElementGatherer();
2477 firstElement.accept(gatherer); 2482 firstElement.accept(gatherer);
2478 2483
2479 CacheEntry entry = 2484 CacheEntry entry =
2480 context.analysisCache.get(new LibrarySpecificUnit(source, source)); 2485 context.analysisCache.get(new LibrarySpecificUnit(source, source));
2481 entry.setState(RESOLVED_UNIT1, CacheState.FLUSHED); 2486 entry.setState(RESOLVED_UNIT1, CacheState.FLUSHED);
2482 entry.setState(RESOLVED_UNIT2, CacheState.FLUSHED); 2487 entry.setState(RESOLVED_UNIT2, CacheState.FLUSHED);
(...skipping 2800 matching lines...) Expand 10 before | Expand all | Expand 10 after
5283 * Initialize the visitor. 5288 * Initialize the visitor.
5284 */ 5289 */
5285 _ElementGatherer(); 5290 _ElementGatherer();
5286 5291
5287 @override 5292 @override
5288 void visitElement(Element element) { 5293 void visitElement(Element element) {
5289 elements[element] = element; 5294 elements[element] = element;
5290 super.visitElement(element); 5295 super.visitElement(element);
5291 } 5296 }
5292 } 5297 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/declaration_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698