Skip to content

Instances call should not be wrapped in select_many when iterating over it with foreach. #457

Description

@doczir

If the instances call is part of a foreach, it is not necessary to call select_many on it, as it will only wrap the elements in a set and then get thrown away without making a significant difference in semantics, since the instances list is already unique (but not sorted!). The following code shows an example of this:

rALF:

for(FallBackTimer __timer in FallBackTimer::instances()) {
  FallBackTimer timer = __timer;
}

generated C++:

for(::eatf::ComponentsLibrary::EATF::eatfImplPkg::FallBackTimer* __ralf__0____timer : ::xumlrt::select_many(::eatf::ComponentsLibrary::EATF::eatfImplPkg::FallBackTimer::_instances)) {
  ::eatf::ComponentsLibrary::EATF::eatfImplPkg::FallBackTimer* __ralf__1__0__timer = __ralf__0____timer;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions