forked from sorbet/sorbet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDelegate.h
34 lines (29 loc) · 771 Bytes
/
Delegate.h
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
#ifndef SORBET_REWRITER_DELEGATE_H
#define SORBET_REWRITER_DELEGATE_H
#include "ast/ast.h"
namespace sorbet::rewriter {
/**
* This class implements Module#delegate from ActiveSupport
* by desugaring things of the form
*
* class MyClass
* delegate :foo, :bar, to: 'thing'
* end
*
* into
*
* class MyClass
* sig {params(arg0: T.untyped, blk: T.nilable(Proc)).returns(T.untyped)}
* def foo(*arg0, &blk); end
*
* sig {params(arg0: T.untyped, blk: T.nilable(Proc)).returns(T.untyped)}
* def bar(*arg0, &blk); end
* end
*/
class Delegate final {
public:
static std::vector<ast::ExpressionPtr> run(core::MutableContext ctx, const ast::Send *send);
Delegate() = delete;
};
} // namespace sorbet::rewriter
#endif