Loading...
Searching...
No Matches
tas.hpp
Go to the documentation of this file.
1
2#pragma once
3
6#include "core/ast/node.hpp"
7#include "core/type/ntype.hpp"
8
9namespace by {
10
11 template <typename T, typename Me> struct tas: public aser {
12 typedef tas<T, Me> __me1;
13 BY(ME(__me1, aser))
14
15 public:
16 virtual ~tas() = default;
17
18 public:
19 using super::is;
20
21 str as(const node& me, const type& to) const override {
22 const Me& cast = me.cast<Me>() OR.exErr(CAST_NOT_AVAILABLE, me, to).ret(str());
23 return _onAs(cast, to);
24 }
25
26 nbool is(const type& from, const type& to) const override { return to == ttype<T>::get(); }
27
28 protected:
29 virtual str _onAs(const Me& me, const type& to) const = 0;
30 };
31}
Base type converter.
Definition aser.hpp:11
Base class for all AST nodes in the byeol language.
Definition node.hpp:195
Definition tnarr.hpp:9
Definition tas.hpp:11
to Top