로딩중...
검색중...
일치하는것 없음
printFunc.hpp
이 파일의 문서화 페이지로 가기
1
2#pragma once
3
5#include "core/ast/params.hpp"
6#include "core/ast/args.hpp"
7
8namespace by {
9
14 template <typename T> class _nout printFunc: public baseFunc {
16
17 public:
18 const ntype& getType() const override {
19 static mgdType inner("print", ttype<me>::get(), params(*new param("msg", new T())), false, new T());
20 return inner;
21 }
22
23 const baseObj& getOrigin() const override {
24 static obj inner(scope{
25 {"print", new me()}
26 });
27 return inner;
28 }
29
30 str eval(const args& a) override {
31 const params& ps = getParams();
32 WHEN(a.len() != ps.len())
33 .err("length of args(%d) and typs(%d) doesn't match.", a.len(), ps.len()).ret(nullptr);
34
35 const node& org = ps[0].getOrigin();
36 tstr<T> evaluated = a[0].asImpli(*org.as<T>());
37 WHEN(!evaluated) .err("evaluation of arg[%s] -> param[%s] has been failed.", a[0], org).ret(str());
38
39 std::cout << evaluated->get();
40 return evaluated;
41 }
42 };
43}
Function or object evaluation arguments
Definition args.hpp:22
Base class for all function types
Definition baseFunc.hpp:41
Base class for representing byeol objects
Definition baseObj.hpp:73
Script type for byeol objects
Definition mgdType.hpp:18
Base class for all AST nodes in the byeol language
Definition node.hpp:195
represents native c++ type system for byeol language
Definition ntype.hpp:33
Byeol runtime environment object
Definition obj.hpp:62
Function parameter
Definition param.hpp:14
Function parameter list container
Definition params.hpp:16
Template print function for output operations
Definition printFunc.hpp:14
Definition tnarr.hpp:9
to Top