mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
ca5772086f
commit
fb5220a925
@ -36,7 +36,9 @@ struct Expr{
|
|||||||
struct CodeEmitContext{
|
struct CodeEmitContext{
|
||||||
VM* vm;
|
VM* vm;
|
||||||
CodeObject_ co;
|
CodeObject_ co;
|
||||||
stack<Expr_> s_expr;
|
// some bugs on MSVC (error C2280) when using std::vector<Expr_>
|
||||||
|
// so we use stack_no_copy instead
|
||||||
|
stack_no_copy<Expr_> s_expr;
|
||||||
int level;
|
int level;
|
||||||
std::set<Str> global_names;
|
std::set<Str> global_names;
|
||||||
CodeEmitContext(VM* vm, CodeObject_ co, int level): vm(vm), co(co), level(level) {}
|
CodeEmitContext(VM* vm, CodeObject_ co, int level): vm(vm), co(co), level(level) {}
|
||||||
|
10
src/vector.h
10
src/vector.h
@ -141,4 +141,14 @@ public:
|
|||||||
Container& data() { return vec; }
|
Container& data() { return vec; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T, typename Container=std::vector<T>>
|
||||||
|
class stack_no_copy: public stack<T, Container>{
|
||||||
|
public:
|
||||||
|
stack_no_copy() = default;
|
||||||
|
stack_no_copy(const stack_no_copy& other) = delete;
|
||||||
|
stack_no_copy& operator=(const stack_no_copy& other) = delete;
|
||||||
|
stack_no_copy(stack_no_copy&& other) noexcept = default;
|
||||||
|
stack_no_copy& operator=(stack_no_copy&& other) noexcept = default;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace pkpy
|
} // namespace pkpy
|
Loading…
x
Reference in New Issue
Block a user