Removed handling of the unnused INDEX operator.
This commit is contained in:
parent
1de748fc13
commit
0c8970584e
2 changed files with 3 additions and 37 deletions
18
src/op.cc
18
src/op.cc
|
|
@ -140,16 +140,6 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * context)
|
||||||
return (right()->calc(scope, context).as_mask()
|
return (right()->calc(scope, context).as_mask()
|
||||||
.match(left()->calc(scope, context).to_string()));
|
.match(left()->calc(scope, context).to_string()));
|
||||||
|
|
||||||
case INDEX: {
|
|
||||||
const call_scope_t& args(downcast<const call_scope_t>(scope));
|
|
||||||
|
|
||||||
if (as_index() < args.size())
|
|
||||||
return args[as_index()];
|
|
||||||
else
|
|
||||||
throw_(calc_error, "Reference to non-existing argument " << as_index());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case O_EQ:
|
case O_EQ:
|
||||||
return left()->calc(scope, context) == right()->calc(scope, context);
|
return left()->calc(scope, context) == right()->calc(scope, context);
|
||||||
case O_LT:
|
case O_LT:
|
||||||
|
|
@ -246,10 +236,6 @@ bool expr_t::op_t::print(std::ostream& out, const context_t& context) const
|
||||||
out << "<FUNCTION>";
|
out << "<FUNCTION>";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INDEX:
|
|
||||||
out << '@' << as_index();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case O_NOT:
|
case O_NOT:
|
||||||
out << "!(";
|
out << "!(";
|
||||||
if (left() && left()->print(out, context))
|
if (left() && left()->print(out, context))
|
||||||
|
|
@ -437,10 +423,6 @@ void expr_t::op_t::dump(std::ostream& out, const int depth) const
|
||||||
out << "IDENT: " << as_ident();
|
out << "IDENT: " << as_ident();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INDEX:
|
|
||||||
out << "INDEX: " << as_index();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FUNCTION:
|
case FUNCTION:
|
||||||
out << "FUNCTION";
|
out << "FUNCTION";
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
22
src/op.h
22
src/op.h
|
|
@ -67,19 +67,17 @@ private:
|
||||||
mutable short refc;
|
mutable short refc;
|
||||||
ptr_op_t left_;
|
ptr_op_t left_;
|
||||||
|
|
||||||
variant<std::size_t, // used by constant INDEX
|
variant<ptr_op_t, // used by all binary operators
|
||||||
value_t, // used by constant VALUE
|
value_t, // used by constant VALUE
|
||||||
string, // used by constant IDENT
|
string, // used by constant IDENT
|
||||||
function_t, // used by terminal FUNCTION
|
function_t // used by terminal FUNCTION
|
||||||
ptr_op_t> // used by all binary operators
|
> data;
|
||||||
data;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum kind_t {
|
enum kind_t {
|
||||||
// Constants
|
// Constants
|
||||||
VALUE,
|
VALUE,
|
||||||
IDENT,
|
IDENT,
|
||||||
INDEX,
|
|
||||||
|
|
||||||
CONSTANTS,
|
CONSTANTS,
|
||||||
|
|
||||||
|
|
@ -138,20 +136,6 @@ public:
|
||||||
assert(refc == 0);
|
assert(refc == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_index() const {
|
|
||||||
return data.type() == typeid(std::size_t);
|
|
||||||
}
|
|
||||||
std::size_t& as_index_lval() {
|
|
||||||
assert(kind == INDEX);
|
|
||||||
return boost::get<std::size_t>(data);
|
|
||||||
}
|
|
||||||
const std::size_t& as_index() const {
|
|
||||||
return const_cast<op_t *>(this)->as_index_lval();
|
|
||||||
}
|
|
||||||
void set_index(std::size_t val) {
|
|
||||||
data = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_value() const {
|
bool is_value() const {
|
||||||
if (kind == VALUE) {
|
if (kind == VALUE) {
|
||||||
assert(data.type() == typeid(value_t));
|
assert(data.type() == typeid(value_t));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue