Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add type registery (and register constructor and interface)
- Loading branch information
1 parent
0071ce9
commit 6612b46
Showing
4 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef AZ_CFA2_DEBUG_COMPLETER_H_ | ||
#define AZ_CFA2_DEBUG_COMPLETER_H_ | ||
#include <az/ast_fwd.h> | ||
#include <az/cfa2/completer.h> | ||
namespace az { | ||
namespace cfa2 { | ||
|
||
class DebugCompleter : public Completer { | ||
public: | ||
typedef std::unordered_map<Symbol, AVal> Properties; | ||
|
||
DebugCompleter() | ||
: Completer(), | ||
properties_() { | ||
} | ||
|
||
void Output() const { | ||
assert(heap()); | ||
} | ||
|
||
|
||
void Notify(Symbol name, const AVal& target) { | ||
if (properties_.find(name) == properties_.end()) { | ||
properties_.insert(std::make_pair(name, target)); | ||
} else { | ||
properties_[name].Join(target); | ||
} | ||
} | ||
|
||
private: | ||
Heap* heap_; | ||
Properties properties_; | ||
}; | ||
|
||
} } // namespace az::cfa2 | ||
#endif // AZ_CFA2_DEBUG_COMPLETER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters