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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 2008353002: Add ElementImpl.typeParameterContext getter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweaks Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index 424d81a70142d72f8dcb1967e7220d789fb46669..160f6769986986df62813ec5f80fdd93c696fa9e 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -299,12 +299,9 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
*/
class _ConstExprBuilder {
final _UnitResynthesizer resynthesizer;
- final Element context;
+ final ElementImpl context;
final UnlinkedConst uc;
- bool _typeParameterContextReady = false;
- TypeParameterizedElementMixin _typeParameterContext;
-
int intPtr = 0;
int doublePtr = 0;
int stringPtr = 0;
@@ -313,19 +310,6 @@ class _ConstExprBuilder {
_ConstExprBuilder(this.resynthesizer, this.context, this.uc);
- TypeParameterizedElementMixin get typeParameterContext {
- if (!_typeParameterContextReady) {
- for (Element e = context; e != null; e = e.enclosingElement) {
- if (e is TypeParameterizedElementMixin) {
- _typeParameterContext = e;
- break;
- }
- }
- _typeParameterContextReady = true;
- }
- return _typeParameterContext;
- }
-
Expression build() {
if (!uc.isValidConst) {
return AstFactory.identifier3(r'$$invalidConstExpr$$');
@@ -636,7 +620,7 @@ class _ConstExprBuilder {
'${info.element?.runtimeType}');
}
InterfaceType definingType = resynthesizer._createConstructorDefiningType(
- typeParameterContext, info, ref.typeArguments);
+ context?.typeParameterContext, info, ref.typeArguments);
constructorElement =
resynthesizer._createConstructorElement(definingType, info);
typeNode = _buildTypeAst(definingType);
@@ -1537,12 +1521,12 @@ class _ResynthesizerContext implements ResynthesizerContext {
_ResynthesizerContext(this._unitResynthesizer);
@override
- ElementAnnotationImpl buildAnnotation(Element context, UnlinkedConst uc) {
+ ElementAnnotationImpl buildAnnotation(ElementImpl context, UnlinkedConst uc) {
return _unitResynthesizer.buildAnnotation(context, uc);
}
@override
- Expression buildExpression(Element context, UnlinkedConst uc) {
+ Expression buildExpression(ElementImpl context, UnlinkedConst uc) {
return _unitResynthesizer._buildConstExpression(context, uc);
}
@@ -1697,7 +1681,7 @@ class _UnitResynthesizer {
/**
* Build [ElementAnnotationImpl] for the given [UnlinkedConst].
*/
- ElementAnnotationImpl buildAnnotation(Element context, UnlinkedConst uc) {
+ ElementAnnotationImpl buildAnnotation(ElementImpl context, UnlinkedConst uc) {
ElementAnnotationImpl elementAnnotation = new ElementAnnotationImpl(unit);
Expression constExpr = _buildConstExpression(context, uc);
if (constExpr is Identifier) {
@@ -2934,7 +2918,7 @@ class _UnitResynthesizer {
}
}
- Expression _buildConstExpression(Element context, UnlinkedConst uc) {
+ Expression _buildConstExpression(ElementImpl context, UnlinkedConst uc) {
return new _ConstExprBuilder(this, context, uc).build();
}
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/element.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698