Skip to content

Commit

Permalink
post.x = y defines metadata tag x
Browse files Browse the repository at this point in the history
  • Loading branch information
jwiegley committed Apr 4, 2012
1 parent 5a615ec commit 322d558
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,13 @@ value_t get_comment(item_t& item)
}
}

void item_t::define(const symbol_t::kind_t, const string& name,
expr_t::ptr_op_t def)
{
bind_scope_t bound_scope(*scope_t::default_scope, *this);
set_tag(name, def->calc(bound_scope));
}

expr_t::ptr_op_t item_t::lookup(const symbol_t::kind_t kind,
const string& name)
{
Expand Down
2 changes: 2 additions & 0 deletions src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ class item_t : public supports_flags<uint_least16_t>, public scope_t
return _state;
}

virtual void define(const symbol_t::kind_t, const string&,
expr_t::ptr_op_t);
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind,
const string& name);

Expand Down

0 comments on commit 322d558

Please sign in to comment.