You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Slice compiler, the base type for all Slice types & definitions is SyntaxTreeBase. SyntaxTreeBase itself inherits from the true base class: GrammarBase. This represents other grammatical objects that aren't types or definitions (metadata, parts of definitions that haven't been fully parsed yet, and tokens for holding string-literals, integer-literals, etc.)
One of the types which inherits from SyntaxTreeBase is Unit (which represents a compilation unit, a.k.a. 1 Slice file).
But, this inheritance is useless and causes problems for us because SyntaxTreeBase holds a UnitPtr _unit;, a cyclic reference.
More importantly though is that this API is useless, and doesn't make sense for Unit to implement:
virtual void destroy(); // Only sets `_unit = nullptr;`
UnitPtr unit() const; // Useless on `Unit`, it already has access to itself.
DefinitionContextPtr definitionContext() const; // Always `nullptr` for `Unit`
virtual void visit(ParserVisitor* visitor); // Only useful function.
We should consider either moving these useless functions down the inheritance tree, or move Unit up the tree, so that it isn't implementing these useless functions.
If that isn't possible without great effort, we should at least fix the cyclic reference issue as suggested by @pepone: #3292 (comment)
The text was updated successfully, but these errors were encountered:
In the Slice compiler, the base type for all Slice types & definitions is
SyntaxTreeBase
.SyntaxTreeBase
itself inherits from the true base class:GrammarBase
. This represents other grammatical objects that aren't types or definitions (metadata, parts of definitions that haven't been fully parsed yet, and tokens for holding string-literals, integer-literals, etc.)One of the types which inherits from
SyntaxTreeBase
isUnit
(which represents a compilation unit, a.k.a. 1 Slice file).But, this inheritance is useless and causes problems for us because
SyntaxTreeBase
holds aUnitPtr _unit;
, a cyclic reference.More importantly though is that this API is useless, and doesn't make sense for
Unit
to implement:We should consider either moving these useless functions down the inheritance tree, or move
Unit
up the tree, so that it isn't implementing these useless functions.If that isn't possible without great effort, we should at least fix the cyclic reference issue as suggested by @pepone:
#3292 (comment)
The text was updated successfully, but these errors were encountered: