Skip to content

Commit

Permalink
Dyno: Generate function bodies for init=, deinit, and (de)serializers (
Browse files Browse the repository at this point in the history
…chapel-lang#26322)

This PR generates uAST for ``init=``, ``deinit``, and
``(de)serializers)``, and cleans up some of the relevant implementations
while we're at it. This PR also includes a couple of minor changes to
either avoid crashes or fix bugs.

[reviewed-by @arezaii]
  • Loading branch information
benharsh authored Dec 10, 2024
2 parents 2dc5333 + fdf882d commit 0160973
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 158 deletions.
11 changes: 11 additions & 0 deletions frontend/lib/resolution/Resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2704,6 +2704,17 @@ QualifiedType Resolver::typeForId(const ID& id, bool localGenericToUnknown) {
}
}

if (auto tup = rt->toTupleType()) {
auto field = parsing::idToAst(context, id)->toNamedDecl();
if (field && field->name() == USTR("size")) {
// Tuples don't store a 'size' in their substitutions map, so
// manually take care of things here.
auto intType = IntType::get(context, 0);
auto val = IntParam::get(context, tup->numElements());
return QualifiedType(QualifiedType::PARAM, intType, val);
}
}

if (auto comprt = rt->getCompositeType()) {
if (comprt->id() == parentId) {
ct = comprt; // handle record, class with field
Expand Down
Loading

0 comments on commit 0160973

Please sign in to comment.