Skip to content

Commit

Permalink
finish excising implicit future
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollins-g committed Jun 2, 2021
1 parent 6e045ef commit e95dbd4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 38 deletions.
11 changes: 0 additions & 11 deletions lib/src/element_type.dart
Expand Up @@ -124,26 +124,15 @@ class UndefinedElementType extends ElementType {

@override
String get name {
if (isImpliedFuture) return 'Future';
if (type.isVoid) return 'void';
assert({'Never', 'void', 'dynamic'}.contains(type.element.name),
'Unrecognized type for UndefinedElementType: ${type.toString()}');
return type.element.name;
}

/// Returns true if this type is an implied `Future`.
bool get isImpliedFuture => (type.isDynamic &&
returnedFrom != null &&
returnedFrom is DefinedElementType &&
(returnedFrom as DefinedElementType).modelElement.isAsynchronous);

@override
String get nameWithGenerics => '$name$nullabilitySuffix';

@override
String get nullabilitySuffix =>
isImpliedFuture && library.isNullSafety ? '?' : super.nullabilitySuffix;

/// Assume that undefined elements don't have useful bounds.
@override
DartType get instantiatedType => type;
Expand Down
27 changes: 0 additions & 27 deletions lib/src/generator/templates.runtime_renderers.dart
Expand Up @@ -14114,13 +14114,6 @@ class _Renderer_UndefinedElementType
parent: r);
},
),
'isImpliedFuture': Property(
getValue: (CT_ c) => c.isImpliedFuture,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.isImpliedFuture == true,
),
'isPublic': Property(
getValue: (CT_ c) => c.isPublic,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down Expand Up @@ -14187,26 +14180,6 @@ class _Renderer_UndefinedElementType
parent: r);
},
),
'nullabilitySuffix': Property(
getValue: (CT_ c) => c.nullabilitySuffix,
renderVariable:
(CT_ c, Property<CT_> self, List<String> remainingNames) {
if (remainingNames.isEmpty) {
return self.getValue(c).toString();
}
var name = remainingNames.first;
var nextProperty =
_Renderer_String.propertyMap().getValue(name);
return nextProperty.renderVariable(self.getValue(c),
nextProperty, [...remainingNames.skip(1)]);
},
isNullValue: (CT_ c) => c.nullabilitySuffix == null,
renderValue:
(CT_ c, RendererBase<CT_> r, List<MustachioNode> ast) {
return _render_String(c.nullabilitySuffix, ast, r.template,
parent: r);
},
),
'referenceChildren': Property(
getValue: (CT_ c) => c.referenceChildren,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down

0 comments on commit e95dbd4

Please sign in to comment.