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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/builder.dart

Issue 2758123002: Create a new element for generic function types (Closed)
Patch Set: Created 3 years, 9 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
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.src.dart.element.builder; 5 library analyzer.src.dart.element.builder;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 _currentHolder.addTypeAlias(element); 423 _currentHolder.addTypeAlias(element);
424 aliasName.staticElement = element; 424 aliasName.staticElement = element;
425 holder.validate(); 425 holder.validate();
426 return null; 426 return null;
427 } 427 }
428 428
429 @override 429 @override
430 Object visitGenericFunctionType(GenericFunctionType node) { 430 Object visitGenericFunctionType(GenericFunctionType node) {
431 ElementHolder holder = new ElementHolder(); 431 ElementHolder holder = new ElementHolder();
432 _visitChildren(holder, node); 432 _visitChildren(holder, node);
433 FunctionElementImpl element = 433 GenericFunctionTypeElementImpl element =
434 new FunctionElementImpl.forOffset(node.beginToken.offset); 434 new GenericFunctionTypeElementImpl.forOffset(node.beginToken.offset);
435 _setCodeRange(element, node); 435 _setCodeRange(element, node);
436 element.parameters = holder.parameters; 436 element.parameters = holder.parameters;
437 element.typeParameters = holder.typeParameters; 437 element.typeParameters = holder.typeParameters;
438 FunctionType type = new FunctionTypeImpl(element); 438 FunctionType type = new FunctionTypeImpl(element);
439 element.type = type; 439 element.type = type;
440 if (node.returnType == null) {
441 element.hasImplicitReturnType = true;
442 }
443 _currentHolder.addFunction(element);
444 (node as GenericFunctionTypeImpl).type = type; 440 (node as GenericFunctionTypeImpl).type = type;
445 holder.validate(); 441 holder.validate();
446 return null; 442 return null;
447 } 443 }
448 444
449 @override 445 @override
450 Object visitGenericTypeAlias(GenericTypeAlias node) { 446 Object visitGenericTypeAlias(GenericTypeAlias node) {
451 ElementHolder holder = new ElementHolder(); 447 ElementHolder holder = new ElementHolder();
452 _visitChildren(holder, node); 448 _visitChildren(holder, node);
453 SimpleIdentifier aliasName = node.name; 449 SimpleIdentifier aliasName = node.name;
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 return null; 1668 return null;
1673 } 1669 }
1674 1670
1675 /** 1671 /**
1676 * Return the lexical identifiers associated with the given [identifiers]. 1672 * Return the lexical identifiers associated with the given [identifiers].
1677 */ 1673 */
1678 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { 1674 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) {
1679 return identifiers.map((identifier) => identifier.name).toList(); 1675 return identifiers.map((identifier) => identifier.name).toList();
1680 } 1676 }
1681 } 1677 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/dart/element/visitor.dart ('k') | pkg/analyzer/lib/src/dart/element/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698