diff options
author | mihaylov <mihaylov@epfl.ch> | 2005-06-07 16:07:40 +0000 |
---|---|---|
committer | mihaylov <mihaylov@epfl.ch> | 2005-06-07 16:07:40 +0000 |
commit | ce80365a9dbce1419c0ad631d4d8b4279ea630a8 (patch) | |
tree | 1cf667371903685acaf11fbbef4c866821e4264c /sources/scalac | |
parent | 12be3aab0d822f9c3b7eefcd38fff01c0860d7fd (diff) | |
download | scala-ce80365a9dbce1419c0ad631d4d8b4279ea630a8.tar.gz scala-ce80365a9dbce1419c0ad631d4d8b4279ea630a8.tar.bz2 scala-ce80365a9dbce1419c0ad631d4d8b4279ea630a8.zip |
Improved serialization support
Diffstat (limited to 'sources/scalac')
-rw-r--r-- | sources/scalac/Global.java | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java index 6f6bb899a3..d3e434b4a7 100644 --- a/sources/scalac/Global.java +++ b/sources/scalac/Global.java @@ -417,27 +417,51 @@ public abstract class Global { } } - public void addAttribute(Symbol sym, Symbol aSym, AConstant[] params) { + + /** Add attribute for a symbol + * @param sym - symbol of the defininition to which the attribute is applied + * @param aSym - symbol of the constructor of the attribute class + * @param args - arguments to the attribute constructor + */ + public void addAttribute(Symbol sym, Symbol aSym, AConstant[] args) { AttributeInfo attr = getAttributes(sym); - attr = new AttributeInfo(aSym, params, attr); - //mapSymbolAttr.put(sym, attr); + attr = new AttributeInfo(aSym, args, attr); setAttribute(sym, attr); } + /** Add attribute with no arguments + * @param sym - symbol of the defininition to which the attribute is applied + * @param aSym - symbol of the constructor of the attribute class + */ public void addAttribute(Symbol sym, Symbol aSym) { addAttribute(sym, aSym, AConstant.EMPTY_ARRAY); } + /** Set the attributes for a given symbol + */ public void setAttribute(Symbol sym, AttributeInfo attr) { mapSymbolAttr.put(sym, attr); if (sym.isModule() && !sym.isModuleClass()) mapSymbolAttr.put(sym.moduleClass(), attr); } + /** Return all attributes for a given symbol + */ public AttributeInfo getAttributes(Symbol sym) { return (AttributeInfo)mapSymbolAttr.get(sym); } + /** Return attribute arguments + * @param sym - symbol of the definition + * @param aSym - symbol of the constructor of the attribute class + */ + public AConstant[] getAttrArguments(Symbol sym, Symbol aSym) { + AttributeInfo attrs = getAttributes(sym); + return attrs == null ? null : attrs.getAttrArguments(aSym); + } + + /** Remove the attributes for a given symbol + */ public AttributeInfo removeAttributes(Symbol sym) { return (AttributeInfo)mapSymbolAttr.remove(sym); } |