Spicy
visitors.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <iostream>
6 #include <utility>
7 #include <vector>
8 
9 #include <hilti/ast/ctor.h>
10 #include <hilti/ast/node.h>
11 #include <hilti/ast/type.h>
12 #include <hilti/base/result.h>
13 
14 namespace hilti {
15 class Unit;
16 } // namespace hilti
17 namespace hilti::printer {
18 class Stream;
19 } // namespace hilti::printer
20 namespace spicy {
21 using hilti::Result;
22 // namespace spicy
23 } // namespace spicy
24 
25 namespace spicy::detail {
26 
28 void buildScopes(const std::vector<std::pair<ID, NodeRef>>& modules, hilti::Unit* unit);
29 
31 bool resolveIDs(hilti::Node* root, hilti::Unit* unit);
32 
34 bool applyCoercions(hilti::Node* root, hilti::Unit* unit);
35 
37 void preTransformValidateAST(hilti::Node* root, hilti::Unit* unit, bool* found_errors);
38 
40 void postTransformValidateAST(hilti::Node* root, hilti::Unit* unit);
41 
43 void preservedValidateAST(std::vector<hilti::Node>* nodes, hilti::Unit* unit);
44 
46 bool printAST(const hilti::Node& root, hilti::printer::Stream& out); // NOLINT
47 
49 std::optional<hilti::Ctor> coerceCtor(hilti::Ctor c, const hilti::Type& dst, bitmask<hilti::CoercionStyle> style);
50 
52 std::optional<hilti::Type> coerceType(hilti::Type t, const hilti::Type& dst, bitmask<hilti::CoercionStyle> style);
53 
54 } // namespace spicy::detail
Definition: visitors.h:23
Definition: printer.h:15
Definition: engine.h:16
Definition: unit.h:43
Definition: node.h:97
Definition: result.h:67