提交 ddfbb655 编写于 作者: S Scott Olson

Handle statics.

上级 b8594445
......@@ -846,6 +846,8 @@ fn eval_operand(&mut self, op: &mir::Operand<'tcx>) -> EvalResult<Pointer> {
Value { ref value } => Ok(self.const_to_ptr(value)?),
Item { .. } => unimplemented!(),
Promoted { index } => {
// TODO(tsion): Mark constants and statics as read-only and cache their
// values.
let current_mir = self.mir();
let mir = &current_mir.promoted[index];
self.call_nested(mir).map(Option::unwrap)
......@@ -864,7 +866,11 @@ fn eval_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>) -> EvalResult<Lvalue> {
Var(i) => self.frame().locals[self.frame().var_offset + i as usize],
Temp(i) => self.frame().locals[self.frame().temp_offset + i as usize],
Static(_def_id) => unimplemented!(),
Static(def_id) => {
// TODO(tsion): Mark constants and statics as read-only and cache their values.
let mir = self.load_mir(def_id);
self.call_nested(&mir)?.unwrap()
}
Projection(ref proj) => {
let base = self.eval_lvalue(&proj.base)?;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册