Commit f2365ec7 authored by Marius Wachtler's avatar Marius Wachtler

AST & BST: make enums smaller

parent 9ef680bb
......@@ -65,7 +65,7 @@ public:
// import dis
// print dis.dis(g)
enum class VarScopeType {
enum class VarScopeType : unsigned char {
FAST,
GLOBAL,
CLOSURE,
......
......@@ -146,7 +146,7 @@ namespace AST_TYPE {
#define GENERATE_ENUM(ENUM, N) ENUM = N,
#define GENERATE_STRING(STRING, N) m[N] = #STRING;
enum AST_TYPE { FOREACH_TYPE(GENERATE_ENUM) };
enum AST_TYPE : unsigned char { FOREACH_TYPE(GENERATE_ENUM) };
static const char* stringify(int n) {
static std::map<int, const char*> m;
......@@ -730,7 +730,7 @@ public:
class AST_Num : public AST_expr {
public:
enum NumType {
enum NumType : unsigned char {
// These values must correspond to the values in parse_ast.py
INT = 0x10,
FLOAT = 0x20,
......@@ -852,7 +852,7 @@ public:
class AST_Str : public AST_expr {
public:
enum StrType {
enum StrType : unsigned char {
UNSET = 0x00,
STR = 0x10,
UNICODE = 0x20,
......@@ -1007,7 +1007,7 @@ public:
// These are basically bytecodes, framed as pseudo-AST-nodes.
class AST_LangPrimitive : public AST_expr {
public:
enum Opcodes {
enum Opcodes : unsigned char {
LANDINGPAD, // grabs the info about the last raised exception
LOCALS,
GET_ITER,
......
......@@ -147,7 +147,7 @@ namespace BST_TYPE {
#define GENERATE_ENUM(ENUM, N) ENUM = N,
#define GENERATE_STRING(STRING, N) m[N] = #STRING;
enum BST_TYPE { FOREACH_TYPE(GENERATE_ENUM) };
enum BST_TYPE : unsigned char { FOREACH_TYPE(GENERATE_ENUM) };
static const char* stringify(int n) {
static std::map<int, const char*> m;
......@@ -758,7 +758,7 @@ public:
// These are basically bytecodes, framed as pseudo-BST-nodes.
class BST_LangPrimitive : public BST_expr {
public:
enum Opcodes {
enum Opcodes : unsigned char {
LANDINGPAD, // grabs the info about the last raised exception
LOCALS,
GET_ITER,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment