diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-09-14 16:41:38 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-09-14 16:41:38 +0200 |
commit | 406ec56c703c29ad29da2f5f6df366577d851ea5 (patch) | |
tree | 734d5a13e4b864cd566f78ef3ab133cd46463b0d /src/dotty/tools/dotc/core/NameOps.scala | |
parent | e7ef08da8a699bdb96d0469c2a76c65709c29324 (diff) | |
download | dotty-406ec56c703c29ad29da2f5f6df366577d851ea5.tar.gz dotty-406ec56c703c29ad29da2f5f6df366577d851ea5.tar.bz2 dotty-406ec56c703c29ad29da2f5f6df366577d851ea5.zip |
Mixin: support trait setters.
Used to create a separate field from trait setter, as the field name wasn't deconstructed.
Diffstat (limited to 'src/dotty/tools/dotc/core/NameOps.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/NameOps.scala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index cab47025e..bf5b68ce9 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -69,6 +69,7 @@ object NameOps { def isLoopHeaderLabel = (name startsWith WHILE_PREFIX) || (name startsWith DO_WHILE_PREFIX) def isProtectedAccessorName = name startsWith PROTECTED_PREFIX def isReplWrapperName = name containsSlice INTERPRETER_IMPORT_WRAPPER + def isTraitSetterName = name containsSlice TRAIT_SETTER_SEPARATOR def isSetterName = name endsWith SETTER_SUFFIX def isSingletonName = name endsWith SINGLETON_SUFFIX def isModuleClassName = name endsWith MODULE_SUFFIX @@ -298,7 +299,14 @@ object NameOps { else setterToGetter def fieldName: TermName = - if (name.isSetterName) getterName.fieldName + if (name.isSetterName) { + if (name.isTraitSetterName) { + // has form <$-separated-trait-name>$_setter_$ `name`_$eq + val start = name.indexOfSlice(TRAIT_SETTER_SEPARATOR) + TRAIT_SETTER_SEPARATOR.length + val end = name.indexOfSlice(SETTER_SUFFIX) + name.slice(start, end) ++ LOCAL_SUFFIX + } else getterName.fieldName + } else name ++ LOCAL_SUFFIX private def setterToGetter: TermName = { |