Interpreter - Class properties
This commit is contained in:
parent
09b4b4e688
commit
0ebe2e9f22
3 changed files with 55 additions and 5 deletions
src/interpreter
|
@ -540,7 +540,7 @@ impl ExprNode {
|
|||
get_expr: &GetExpr,
|
||||
) -> InterpreterResult {
|
||||
let instance = get_expr.instance.interpret(itpr_state)?.result();
|
||||
instance.with_instance(
|
||||
instance.with_property_carrier(
|
||||
|inst| inst.get(&get_expr.name).map(|v| v.into()),
|
||||
|| error(&get_expr.name, "only instances have properties"),
|
||||
)
|
||||
|
@ -553,7 +553,7 @@ impl ExprNode {
|
|||
set_expr: &SetExpr,
|
||||
) -> InterpreterResult {
|
||||
let instance = set_expr.instance.interpret(itpr_state)?.result();
|
||||
instance.with_instance(
|
||||
instance.with_property_carrier(
|
||||
|instance| {
|
||||
let value = set_expr.value.interpret(itpr_state)?.result();
|
||||
instance.set(&set_expr.name, value.clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue