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

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

Issue 2787513003: Expose function contained in GenericTypeAliasImpl. (Closed)
Patch Set: Created 3 years, 8 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.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after
5022 } 5022 }
5023 5023
5024 /** 5024 /**
5025 * A function type alias of the form 5025 * A function type alias of the form
5026 * `typedef` identifier typeParameters = genericFunctionType; 5026 * `typedef` identifier typeParameters = genericFunctionType;
5027 * 5027 *
5028 * Clients may not extend, implement or mix-in this class. 5028 * Clients may not extend, implement or mix-in this class.
5029 */ 5029 */
5030 class GenericTypeAliasElementImpl extends ElementImpl 5030 class GenericTypeAliasElementImpl extends ElementImpl
5031 with TypeParameterizedElementMixin 5031 with TypeParameterizedElementMixin
5032 implements FunctionTypeAliasElement { 5032 implements GenericTypeAliasElement {
5033 /** 5033 /**
5034 * The unlinked representation of the type in the summary. 5034 * The unlinked representation of the type in the summary.
5035 */ 5035 */
5036 final UnlinkedTypedef _unlinkedTypedef; 5036 final UnlinkedTypedef _unlinkedTypedef;
5037 5037
5038 /** 5038 /**
5039 * The element representing the generic function type. 5039 * The element representing the generic function type.
5040 */ 5040 */
5041 GenericFunctionTypeElement _function; 5041 GenericFunctionTypeElement _function;
5042 5042
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5090 CompilationUnitElement get enclosingElement => 5090 CompilationUnitElement get enclosingElement =>
5091 super.enclosingElement as CompilationUnitElement; 5091 super.enclosingElement as CompilationUnitElement;
5092 5092
5093 @override 5093 @override
5094 TypeParameterizedElementMixin get enclosingTypeParameterContext => null; 5094 TypeParameterizedElementMixin get enclosingTypeParameterContext => null;
5095 5095
5096 @override 5096 @override
5097 CompilationUnitElementImpl get enclosingUnit => 5097 CompilationUnitElementImpl get enclosingUnit =>
5098 _enclosingElement as CompilationUnitElementImpl; 5098 _enclosingElement as CompilationUnitElementImpl;
5099 5099
5100 /** 5100 @override
5101 * Return the generic function type element representing the generic function
5102 * type on the right side of the equals.
5103 */
5104 GenericFunctionTypeElement get function { 5101 GenericFunctionTypeElement get function {
5105 if (_function == null && _unlinkedTypedef != null) { 5102 if (_function == null && _unlinkedTypedef != null) {
5106 DartType type = enclosingUnit.resynthesizerContext.resolveTypeRef( 5103 DartType type = enclosingUnit.resynthesizerContext.resolveTypeRef(
5107 _unlinkedTypedef.returnType, this, 5104 _unlinkedTypedef.returnType, this,
5108 declaredType: true); 5105 declaredType: true);
5109 if (type is FunctionType) { 5106 if (type is FunctionType) {
5110 Element element = type.element; 5107 Element element = type.element;
5111 if (element is GenericFunctionTypeElement) { 5108 if (element is GenericFunctionTypeElement) {
5112 (element as GenericFunctionTypeElementImpl).enclosingElement = this; 5109 (element as GenericFunctionTypeElementImpl).enclosingElement = this;
5113 _function = element; 5110 _function = element;
(...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after
9094 9091
9095 @override 9092 @override
9096 void visitElement(Element element) { 9093 void visitElement(Element element) {
9097 int offset = element.nameOffset; 9094 int offset = element.nameOffset;
9098 if (offset != -1) { 9095 if (offset != -1) {
9099 map[offset] = element; 9096 map[offset] = element;
9100 } 9097 }
9101 super.visitElement(element); 9098 super.visitElement(element);
9102 } 9099 }
9103 } 9100 }
OLDNEW
« pkg/analyzer/lib/dart/element/element.dart ('K') | « pkg/analyzer/lib/dart/element/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698