@@ -44,9 +44,8 @@ auto dump_symbol(Symbol* symbol) -> std::string {
4444}
4545
4646struct  Source  {
47-   Control control;
4847  DiagnosticsClient diagnosticsClient;
49-   TranslationUnit unit{&control, & diagnosticsClient};
48+   TranslationUnit unit{&diagnosticsClient};
5049
5150  explicit  Source (std::string_view source) {
5251    unit.setSource (std::string (source), " <test>" 
@@ -58,12 +57,13 @@ struct Source {
5857    });
5958  }
6059
60+   auto  control () -> Control* { return  unit.control (); }
6161  auto  ast () -> UnitAST* { return  unit.ast (); }
6262  auto  scope () -> Scope* { return  unit.globalScope (); }
6363
6464  auto  get (std::string_view name) -> Symbol* {
6565    Symbol* symbol = nullptr ;
66-     auto  id = control. getIdentifier (name);
66+     auto  id = unit. control ()-> getIdentifier (name);
6767    for  (auto  candidate : scope ()->get (id)) {
6868      if  (symbol) return  nullptr ;
6969      symbol = candidate;
@@ -74,7 +74,7 @@ struct Source {
7474  auto  instantiate (std::string_view name,
7575                   const  std::vector<TemplateArgument>& arguments) -> Symbol* {
7676    auto  symbol = get (name);
77-     return  control. instantiate (&unit, symbol, arguments);
77+     return  control ()-> instantiate (&unit, symbol, arguments);
7878  }
7979};
8080
@@ -86,7 +86,7 @@ struct LookupMember {
8686  Source& source;
8787
8888  auto  operator ()(Scope* scope, std::string_view name) -> Symbol* {
89-     auto  id = source.control . getIdentifier (name);
89+     auto  id = source.control ()-> getIdentifier (name);
9090    for  (auto  candidate : scope->get (id)) {
9191      return  candidate;
9292    }
@@ -110,7 +110,7 @@ TEST(Substitution, TypeAlias) {
110110    using F = T (*)(T const, U*, ...); 
111111  )"  _cxx;
112112
113-   auto  control = & source.control ;
113+   auto  control = source.control () ;
114114
115115  {
116116    auto  instance = source.instantiate (" Ptr" getCharType ()});
@@ -142,7 +142,7 @@ TEST(Substitution, Variable) {
142142    constexpr T value = T{}; 
143143  )"  _cxx;
144144
145-   auto  control = & source.control ;
145+   auto  control = source.control () ;
146146
147147  {
148148    auto  instance = source.instantiate (" value" getIntType ()});
@@ -180,7 +180,7 @@ TEST(Substitution, Class) {
180180
181181  LookupMember getMember{source};
182182
183-   auto  control = & source.control ;
183+   auto  control = source.control () ;
184184
185185  {
186186    auto  instance = source.instantiate (" S" getIntType ()});
0 commit comments