aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/analysis/rust-resolution.h
blob: 9eb4b95a6fcf31c5cb3ffd487639308938740831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include "rust-system.h"
#include "rust-ast-full.h"
#include "rust-ast-visitor.h"
#include "rust-scan.h"
#include "scope.h"

namespace Rust {
namespace Analysis {

class Resolution : public AST::ASTVisitor
{
public:
  virtual ~Resolution ()
  {
    scope.Pop ();
    valueScope.Pop ();
    macroScope.Pop ();
    typeScope.Pop ();
  };

private:
  virtual bool go () = 0;

protected:
  Resolution (AST::Crate &crate, TopLevelScan &toplevel)
    : crate (crate), toplevel (toplevel)
  {
    scope.Push ();
    valueScope.Push ();
    macroScope.Push ();
    typeScope.Push ();
  };

  Scope<AST::Type *> scope;
  Scope<AST::Type *> valueScope;
  Scope<AST::Type *> macroScope;
  Scope<AST::Type *> typeScope;

  AST::Crate &crate;
  TopLevelScan &toplevel;

  std::vector<AST::IdentifierPattern> letPatternBuffer;
  std::vector<AST::Type *> typeBuffer;
  std::vector<std::string> typeComparisonBuffer;
  std::vector<AST::Function *> functionLookup;
};

} // namespace Analysis
} // namespace Rust