diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-11-16T12·49+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2010-11-16T12·49+0000 |
commit | fb9368b5a0b2457b28f19d4902bc0790123338a2 (patch) | |
tree | 8e0d68ccc2951c44cfd442b3dad261e190127013 /src/libexpr/nixexpr.hh | |
parent | 64fd29855a8ae49cacdaff424679821b4fd3bf57 (diff) | |
parent | 4aced7f8d0d5d2c1057b0f46a70a37a577f81fa5 (diff) |
* Sync with the trunk.
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r-- | src/libexpr/nixexpr.hh | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index b1043a32684e..8f976f1de8f9 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -1,10 +1,10 @@ #ifndef __NIXEXPR_H #define __NIXEXPR_H -#include <map> - #include "symbol-table.hh" +#include <map> + namespace nix { @@ -65,8 +65,8 @@ struct ExprInt : Expr struct ExprString : Expr { - string s; - ExprString(const string & s) : s(s) { }; + Symbol s; + ExprString(const Symbol & s) : s(s) { }; COMMON_METHODS }; @@ -101,6 +101,7 @@ struct VarRef unsigned int level; unsigned int displ; + VarRef() { }; VarRef(const Symbol & name) : name(name) { }; void bind(const StaticEnv & env); }; @@ -131,12 +132,18 @@ struct ExprOpHasAttr : Expr struct ExprAttrs : Expr { bool recursive; - typedef std::pair<Expr *, Pos> Attr; - typedef std::pair<VarRef, Pos> Inherited; - typedef std::map<Symbol, Attr> Attrs; - Attrs attrs; - list<Inherited> inherited; - std::map<Symbol, Pos> attrNames; // used during parsing + struct AttrDef { + bool inherited; + Expr * e; // if not inherited + VarRef var; // if inherited + Pos pos; + unsigned int displ; // displacement + AttrDef(Expr * e, const Pos & pos) : inherited(false), e(e), pos(pos) { }; + AttrDef(const Symbol & name, const Pos & pos) : inherited(true), var(name), pos(pos) { }; + AttrDef() { }; + }; + typedef std::map<Symbol, AttrDef> AttrDefs; + AttrDefs attrs; ExprAttrs() : recursive(false) { }; COMMON_METHODS }; |