Skip to content
This repository was archived by the owner on Jan 8, 2023. It is now read-only.

Commit 8a78e3c

Browse files
author
ApsarasX
committed
update
1 parent 926526f commit 8a78e3c

File tree

4 files changed

+21
-29
lines changed

4 files changed

+21
-29
lines changed

include/AST/Base.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
#ifndef STATICSCRIPT_AST_BASE_H
22
#define STATICSCRIPT_AST_BASE_H
33

4-
#include <memory>
5-
#include <vector>
6-
7-
template <typename T>
8-
using SharedPtr = std::shared_ptr<T>;
9-
10-
template <typename T>
11-
using SharedPtrVector = std::vector<SharedPtr<T>>;
12-
13-
template <typename T, typename ...Args>
14-
SharedPtr<T> makeShared(Args&& ...args) {
15-
return std::make_shared<T>(std::forward<Args>(args)...);
16-
}
4+
#include "Util/Alias.h"
175

186
class ASTNode {
197
public:

include/AST/Type.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "AST/Base.h"
55

66
enum class TypeKind {
7-
Unknown, Boolean, Integer, String, Reference
7+
Unknown, Boolean, Integer, String
88
};
99

1010
class Type : public ASTNode {
@@ -31,14 +31,4 @@ class BuiltinType : public Type {
3131
static inline const SharedPtr<BuiltinType> UNKNOWN_TYPE = makeShared<BuiltinType>(TypeKind::Unknown);
3232
};
3333

34-
// 引用类型
35-
class ReferenceType : public Type {
36-
public:
37-
explicit ReferenceType();
38-
39-
~ReferenceType() override = default;
40-
41-
void codegen() override;
42-
};
43-
4434
#endif //STATICSCRIPT_AST_TYPE_H

include/Util/Alias.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef STATICSCRIPT_UTIL_ALIAS_H
2+
#define STATICSCRIPT_UTIL_ALIAS_H
3+
4+
#include <memory>
5+
#include <vector>
6+
7+
template <typename T>
8+
using SharedPtr = std::shared_ptr<T>;
9+
10+
template <typename T>
11+
using SharedPtrVector = std::vector<SharedPtr<T>>;
12+
13+
template <typename T, typename ...Args>
14+
SharedPtr<T> makeShared(Args&& ...args) {
15+
return std::make_shared<T>(std::forward<Args>(args)...);
16+
}
17+
18+
#endif // STATICSCRIPT_UTIL_ALIAS_H

lib/AST/Type.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,4 @@ Type::Type(TypeKind kind) : kind(kind) {}
44

55
BuiltinType::BuiltinType(TypeKind kind) : Type(kind) {}
66

7-
void BuiltinType::codegen() {}
8-
9-
ReferenceType::ReferenceType() : Type(TypeKind::Reference) {}
10-
11-
void ReferenceType::codegen() {}
7+
void BuiltinType::codegen() {}

0 commit comments

Comments
 (0)