-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoxClass.hpp
38 lines (32 loc) · 858 Bytes
/
LoxClass.hpp
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
35
36
37
38
// Copyright 2020.2.23 <Copyright hulin>
#ifndef LOXCLASS_HPP_
#define LOXCLASS_HPP_
#include <string>
#include <memory>
#include <vector>
#include <map>
#include "./LoxCallable.hpp"
#include "./Interpreter.hpp"
#include "./LoxFunction.hpp"
#include "./Token.hpp"
using std::string;
using std::shared_ptr;
using std::vector;
using std::map;
class LoxClass: public LoxCallable {
public:
string name;
shared_ptr<LoxClass> superclass;
map<string, shared_ptr<LoxFunction>> methods;
shared_ptr<LoxFunction> findMethod(string name);
explicit LoxClass(
string name_,
shared_ptr<LoxClass> superclass_,
map<string, shared_ptr<LoxFunction>> methods_);
Object call(
shared_ptr<Interpreter> interpreter,
vector<Object> arguments);
int arity();
string toString();
};
#endif // LOXCLASS_HPP_