Commit 1228d981 authored by Marius Wachtler's avatar Marius Wachtler

BST: remove column field

parent f2365ec7
......@@ -219,8 +219,7 @@ private:
}
if (VERBOSITY() >= 2 && rtn == UNDEF) {
printf("Think %s.%s is undefined, at %d:%d\n", t->debugName().c_str(), node->attr.c_str(), node->lineno,
node->col_offset);
printf("Think %s.%s is undefined, at %d\n", t->debugName().c_str(), node->attr.c_str(), node->lineno);
print_bst(node);
printf("\n");
}
......@@ -231,8 +230,7 @@ private:
CompilerType* t = getType(node->value);
CompilerType* rtn = t->getattrType(node->attr, true);
if (VERBOSITY() >= 2 && rtn == UNDEF) {
printf("Think %s.%s is undefined, at %d:%d\n", t->debugName().c_str(), node->attr.c_str(), node->lineno,
node->col_offset);
printf("Think %s.%s is undefined, at %d\n", t->debugName().c_str(), node->attr.c_str(), node->lineno);
print_bst(node);
printf("\n");
}
......
......@@ -490,7 +490,7 @@ static const LineInfo lineInfoForFrameInfo(FrameInfo* frame_info) {
auto* code = frame_info->code;
assert(code);
return LineInfo(current_stmt->lineno, current_stmt->col_offset, code->filename, code->name);
return LineInfo(current_stmt->lineno, code->filename, code->name);
}
// A class that converts a C stack trace to a Python stack trace.
......
......@@ -171,7 +171,7 @@ public:
virtual ~BST() {}
const BST_TYPE::BST_TYPE type;
uint32_t lineno, col_offset;
uint32_t lineno;
virtual void accept(BSTVisitor* v) = 0;
......@@ -185,10 +185,9 @@ private:
public:
BST(BST_TYPE::BST_TYPE type);
#else
BST(BST_TYPE::BST_TYPE type) : type(type), lineno(0), col_offset(0) {}
BST(BST_TYPE::BST_TYPE type) : type(type), lineno(0) {}
#endif
BST(BST_TYPE::BST_TYPE type, uint32_t lineno, uint32_t col_offset = 0)
: type(type), lineno(lineno), col_offset(col_offset) {}
BST(BST_TYPE::BST_TYPE type, uint32_t lineno) : type(type), lineno(lineno) {}
};
class BST_expr : public BST {
......@@ -196,7 +195,7 @@ public:
virtual void* accept_expr(ExprVisitor* v) = 0;
BST_expr(BST_TYPE::BST_TYPE type) : BST(type) {}
BST_expr(BST_TYPE::BST_TYPE type, uint32_t lineno, uint32_t col_offset = 0) : BST(type, lineno, col_offset) {}
BST_expr(BST_TYPE::BST_TYPE type, uint32_t lineno) : BST(type, lineno) {}
};
class BST_stmt : public BST {
......@@ -212,14 +211,14 @@ class BST_slice : public BST {
public:
virtual void* accept_slice(SliceVisitor* s) = 0;
BST_slice(BST_TYPE::BST_TYPE type) : BST(type) {}
BST_slice(BST_TYPE::BST_TYPE type, uint32_t lineno, uint32_t col_offset = 0) : BST(type, lineno, col_offset) {}
BST_slice(BST_TYPE::BST_TYPE type, uint32_t lineno) : BST(type, lineno) {}
};
class BST_Name;
class BST_arguments : public BST {
public:
// no lineno, col_offset attributes
// no lineno attributes
std::vector<BST_expr*> defaults;
virtual void accept(BSTVisitor* v);
......@@ -445,7 +444,7 @@ public:
class BST_keyword : public BST {
public:
// no lineno, col_offset attributes
// no lineno attributes
BST_expr* value;
InternedString arg;
......@@ -493,8 +492,8 @@ public:
virtual void accept(BSTVisitor* v);
virtual void* accept_expr(ExprVisitor* v);
BST_Name(InternedString id, AST_TYPE::AST_TYPE ctx_type, int lineno, int col_offset = 0)
: BST_expr(BST_TYPE::Name, lineno, col_offset),
BST_Name(InternedString id, AST_TYPE::AST_TYPE ctx_type, int lineno)
: BST_expr(BST_TYPE::Name, lineno),
ctx_type(ctx_type),
id(id),
lookup_type(ScopeInfo::VarScopeType::UNKNOWN),
......@@ -676,8 +675,7 @@ public:
virtual void accept(BSTVisitor* v);
virtual void* accept_expr(ExprVisitor* v);
BST_MakeFunction(BST_FunctionDef* fd)
: BST_expr(BST_TYPE::MakeFunction, fd->lineno, fd->col_offset), function_def(fd) {}
BST_MakeFunction(BST_FunctionDef* fd) : BST_expr(BST_TYPE::MakeFunction, fd->lineno), function_def(fd) {}
static const BST_TYPE::BST_TYPE TYPE = BST_TYPE::MakeFunction;
};
......@@ -689,7 +687,7 @@ public:
virtual void accept(BSTVisitor* v);
virtual void* accept_expr(ExprVisitor* v);
BST_MakeClass(BST_ClassDef* cd) : BST_expr(BST_TYPE::MakeClass, cd->lineno, cd->col_offset), class_def(cd) {}
BST_MakeClass(BST_ClassDef* cd) : BST_expr(BST_TYPE::MakeClass, cd->lineno), class_def(cd) {}
static const BST_TYPE::BST_TYPE TYPE = BST_TYPE::MakeClass;
};
......
This diff is collapsed.
......@@ -997,11 +997,10 @@ void raiseSyntaxErrorHelper(llvm::StringRef file, llvm::StringRef func, AST* nod
// A data structure used for storing information for tracebacks.
struct LineInfo {
public:
int line, column;
int line;
BoxedString* file, *func;
LineInfo(int line, int column, BoxedString* file, BoxedString* func)
: line(line), column(column), file(file), func(func) {}
LineInfo(int line, BoxedString* file, BoxedString* func) : line(line), file(file), func(func) {}
};
// A data structure to simplify passing around all the data about a thrown exception.
......
......@@ -361,7 +361,7 @@ static void print_frame(unw_cursor_t* cursor, const unw_proc_info_t* pip) {
if (frame_type == INTERPRETED && cf && cur_stmt) {
auto source = cf->code_obj->source.get();
// FIXME: dup'ed from lineInfoForFrame
LineInfo line(cur_stmt->lineno, cur_stmt->col_offset, cf->code_obj->filename, cf->code_obj->name);
LineInfo line(cur_stmt->lineno, cf->code_obj->filename, cf->code_obj->name);
printf(" File \"%s\", line %d, in %s\n", line.file->c_str(), line.line, line.func->c_str());
}
}
......
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