Skip to content

Commit 4763e78

Browse files
committed
Use smart pointers instead of Ptr for AptNode
... and number of other updates to the implementation.
1 parent ca77e53 commit 4763e78

36 files changed

+3070
-2965
lines changed

bootstrap/annotate.cpp

+72-73
Large diffs are not rendered by default.

bootstrap/annotate.h

+48-48
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace herschel
6464

6565
class Scope;
6666

67-
using NodeList = std::vector<Ptr<AptNode>>;
67+
using NodeList = std::vector<std::shared_ptr<AptNode>>;
6868

6969
//------------------------------------------------------------------------------
7070

@@ -83,56 +83,56 @@ namespace herschel
8383

8484
Annotator(std::shared_ptr<Scope> scope, Compiler& compiler);
8585

86-
void annotateRecursively(AptNode* node);
87-
88-
void annotateNode(AptNode* node);
89-
90-
void annotate(CompileUnitNode* node);
91-
92-
void annotate(SymbolNode* node);
93-
94-
void annotate(DefNode* node);
95-
void annotate(LetNode* node);
96-
void annotate(BlockNode* node);
97-
98-
void annotate(ParamNode* node);
99-
100-
void annotate(ApplyNode* node);
101-
void annotate(ArrayNode* node);
102-
void annotate(ArrayTypeNode* node);
103-
void annotate(AssignNode* node);
104-
void annotate(BinaryNode* node);
105-
void annotate(BoolNode* node);
106-
void annotate(CastNode* node);
107-
void annotate(CharNode* node);
108-
void annotate(DictNode* node);
109-
void annotate(FunctionNode* node);
110-
void annotate(IfNode* node);
111-
void annotate(IntNode* node);
112-
void annotate(KeyargNode* node);
113-
void annotate(KeywordNode* node);
114-
void annotate(MatchNode* node);
115-
void annotate(UnaryNode* node);
116-
void annotate(OnNode* node);
117-
void annotate(RangeNode* node);
118-
void annotate(RationalNode* node);
119-
void annotate(RealNode* node);
120-
void annotate(SelectNode* node);
121-
void annotate(SlotdefNode* node);
122-
void annotate(SlotRefNode* node);
123-
void annotate(StringNode* node);
124-
void annotate(TypeDefNode* node);
125-
void annotate(TypeNode* node);
126-
void annotate(UnitConstNode* node);
127-
void annotate(VectorNode* node);
128-
void annotate(WhileNode* node);
129-
void annotate(UndefNode* node);
86+
void annotateRecursively(std::shared_ptr<AptNode> node);
87+
88+
void annotateNode(std::shared_ptr<AptNode> node);
89+
90+
void annotate(std::shared_ptr<CompileUnitNode> node);
91+
92+
void annotate(std::shared_ptr<SymbolNode> node);
93+
94+
void annotate(std::shared_ptr<DefNode> node);
95+
void annotate(std::shared_ptr<LetNode> node);
96+
void annotate(std::shared_ptr<BlockNode> node);
97+
98+
void annotate(std::shared_ptr<ParamNode> node);
99+
100+
void annotate(std::shared_ptr<ApplyNode> node);
101+
void annotate(std::shared_ptr<ArrayNode> node);
102+
void annotate(std::shared_ptr<ArrayTypeNode> node);
103+
void annotate(std::shared_ptr<AssignNode> node);
104+
void annotate(std::shared_ptr<BinaryNode> node);
105+
void annotate(std::shared_ptr<BoolNode> node);
106+
void annotate(std::shared_ptr<CastNode> node);
107+
void annotate(std::shared_ptr<CharNode> node);
108+
void annotate(std::shared_ptr<DictNode> node);
109+
void annotate(std::shared_ptr<FunctionNode> node);
110+
void annotate(std::shared_ptr<IfNode> node);
111+
void annotate(std::shared_ptr<IntNode> node);
112+
void annotate(std::shared_ptr<KeyargNode> node);
113+
void annotate(std::shared_ptr<KeywordNode> node);
114+
void annotate(std::shared_ptr<MatchNode> node);
115+
void annotate(std::shared_ptr<UnaryNode> node);
116+
void annotate(std::shared_ptr<OnNode> node);
117+
void annotate(std::shared_ptr<RangeNode> node);
118+
void annotate(std::shared_ptr<RationalNode> node);
119+
void annotate(std::shared_ptr<RealNode> node);
120+
void annotate(std::shared_ptr<SelectNode> node);
121+
void annotate(std::shared_ptr<SlotdefNode> node);
122+
void annotate(std::shared_ptr<SlotRefNode> node);
123+
void annotate(std::shared_ptr<StringNode> node);
124+
void annotate(std::shared_ptr<TypeDefNode> node);
125+
void annotate(std::shared_ptr<TypeNode> node);
126+
void annotate(std::shared_ptr<UnitConstNode> node);
127+
void annotate(std::shared_ptr<VectorNode> node);
128+
void annotate(std::shared_ptr<WhileNode> node);
129+
void annotate(std::shared_ptr<UndefNode> node);
130130

131131
private:
132132
void annotateNodeList(NodeList& nl, bool marktailpos, bool marksingletype);
133133

134-
void annotate(VardefNode* node, bool isLocal);
135-
void annotate(FuncDefNode* node, bool isLocal);
134+
void annotate(std::shared_ptr<VardefNode> node, bool isLocal);
135+
void annotate(std::shared_ptr<FuncDefNode> node, bool isLocal);
136136

137137
void takeFullNameFromNode(SymbolNode* node, const AptNode* otherNode);
138138
bool updateAllocType(SymbolNode* usingNode, const AptNode* referedNode);
@@ -155,7 +155,7 @@ namespace herschel
155155
{
156156
public:
157157
AnnotatePass(int level, std::shared_ptr<Scope> scope, Compiler& compiler);
158-
virtual AptNode* doApply(AptNode* src);
158+
virtual std::shared_ptr<AptNode> doApply(std::shared_ptr<AptNode> src);
159159

160160
private:
161161
std::shared_ptr<Scope> fScope;

0 commit comments

Comments
 (0)