diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-08 13:30:58 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-08 13:30:58 +0200 |
commit | 2ce940ad11786aae4486f37fb5f17bfc4d6e6589 (patch) | |
tree | 4109c6c22ca69af128159682706896316c04a7c3 /src/dotty/tools/dotc/transform/Memoize.scala | |
parent | 291aecabf400df4a85af498d1045b9ec618dda13 (diff) | |
download | dotty-2ce940ad11786aae4486f37fb5f17bfc4d6e6589.tar.gz dotty-2ce940ad11786aae4486f37fb5f17bfc4d6e6589.tar.bz2 dotty-2ce940ad11786aae4486f37fb5f17bfc4d6e6589.zip |
Copy @field annotations from getters to fields.
For the moment, we keep all annotations on getters and setters, but this could be changed.
Diffstat (limited to 'src/dotty/tools/dotc/transform/Memoize.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/Memoize.scala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/Memoize.scala b/src/dotty/tools/dotc/transform/Memoize.scala index 6b19b6d13..cf3011bc8 100644 --- a/src/dotty/tools/dotc/transform/Memoize.scala +++ b/src/dotty/tools/dotc/transform/Memoize.scala @@ -50,7 +50,16 @@ import Decorators._ name = sym.name.asTermName.fieldName, flags = Private | (if (sym is Stable) EmptyFlags else Mutable), info = sym.info.resultType, - coord = tree.pos).enteredAfter(thisTransform) + coord = tree.pos) + .withAnnotationsCarrying(sym, defn.FieldMetaAnnot) + .enteredAfter(thisTransform) + + /** Can be used to filter annotations on getters and setters; not used yet */ + def keepAnnotations(denot: SymDenotation, meta: ClassSymbol) = { + val cpy = sym.copySymDenotation() + cpy.filterAnnotations(_.symbol.derivesFrom(meta)) + if (cpy.annotations ne denot.annotations) cpy.installAfter(thisTransform) + } lazy val field = sym.field.orElse(newField).asTerm if (sym.is(Accessor, butNot = NoFieldNeeded)) |