forked from PuqiAR/Fig-TreeWalker
[VER] 0.3.3-alpha
[FEAT] interface + impl 支持! Duck Typing + 严格的检查让语言健壮 [FEAT][IMPL] 增加辅助函数 isTypeMatch等 [IMPL] TypeInfo构造函数FString 现在 explicit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
#include <Ast/functionParameters.hpp>
|
||||
#include <Ast/Statements/FunctionDefSt.hpp>
|
||||
#include <Ast/astBase.hpp>
|
||||
|
||||
namespace Fig::Ast
|
||||
{
|
||||
/*
|
||||
|
||||
impl Readable for File
|
||||
{
|
||||
read() -> String
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
*/
|
||||
struct ImplementMethod
|
||||
{
|
||||
FString name;
|
||||
FunctionParameters paras;
|
||||
BlockStatement body;
|
||||
};
|
||||
|
||||
class ImplementAst final : public StatementAst
|
||||
{
|
||||
public:
|
||||
FString interfaceName;
|
||||
FString structName;
|
||||
|
||||
std::vector<ImplementMethod> methods;
|
||||
|
||||
ImplementAst()
|
||||
{
|
||||
type = AstType::ImplementSt;
|
||||
}
|
||||
|
||||
ImplementAst(FString _interfaceName, FString _structName, std::vector<ImplementMethod> _methods) :
|
||||
interfaceName(std::move(_interfaceName)), structName(std::move(_structName)), methods(std::move(_methods))
|
||||
{
|
||||
type = AstType::ImplementSt;
|
||||
}
|
||||
};
|
||||
|
||||
using Implement = std::shared_ptr<ImplementAst>;
|
||||
};
|
||||
Reference in New Issue
Block a user