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

View File

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