clean up pointerrange constructor

master
Daniel Kolesa 2017-02-09 22:54:09 +01:00
parent fda734a868
commit 6e67ce8574
2 changed files with 12 additions and 12 deletions

View File

@ -431,7 +431,7 @@ static inline void callcommand(
cscript::util::tvals_concat(buf, ostd::iter(args, i), " ");
CsValue tv;
tv.set_str(std::move(buf.get()));
CsCommandInternal::call(cs, id, CsValueRange(&tv, 1), res);
CsCommandInternal::call(cs, id, CsValueRange(&tv, &tv + 1), res);
return;
}
case 'V':
@ -450,7 +450,7 @@ static inline void callcommand(
}
}
++i;
CsCommandInternal::call(cs, id, CsValueRange(args, i), res);
CsCommandInternal::call(cs, id, CsValueRange(args, args + i), res);
}
static uint32_t *runcode(CsState &cs, uint32_t *code, CsValue &result);
@ -1339,10 +1339,9 @@ static uint32_t *runcode(CsState &cs, uint32_t *code, CsValue &result) {
);
int offset = numargs - id->get_num_args();
result.force_null();
CsCommandInternal::call(
cs, id, CsValueRange(args + offset, id->get_num_args()),
result
);
CsCommandInternal::call(cs, id, CsValueRange(
args + offset, args + offset + id->get_num_args()
), result);
force_arg(result, op & CsCodeRetMask);
numargs = offset;
continue;
@ -1380,7 +1379,7 @@ static uint32_t *runcode(CsState &cs, uint32_t *code, CsValue &result) {
);
CsValue tv;
tv.set_str(std::move(buf.get()));
CsCommandInternal::call(cs, id, CsValueRange(&tv, 1), result);
CsCommandInternal::call(cs, id, CsValueRange(&tv, &tv + 1), result);
}
force_arg(result, op & CsCodeRetMask);
numargs = offset;

View File

@ -531,14 +531,15 @@ bool CsState::have_ident(ostd::ConstCharRange name) {
}
CsIdentRange CsState::get_idents() {
return CsIdentRange(p_state->identmap.data(), p_state->identmap.size());
return CsIdentRange(
p_state->identmap.data(),
p_state->identmap.data() + p_state->identmap.size()
);
}
CsConstIdentRange CsState::get_idents() const {
return CsConstIdentRange(
const_cast<CsIdent const **>(p_state->identmap.data()),
p_state->identmap.size()
);
auto ptr = const_cast<CsIdent const **>(p_state->identmap.data());
return CsConstIdentRange(ptr, ptr + p_state->identmap.size());
}
CsIvar *CsState::new_ivar(