- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
ValDef names (in compiler plugin)
Wed, 2010-02-10, 21:33
I haven't written compiler plugins for a while and don't know what has
changed in 2.8, so sorry if this is a stupid question, but
In a plug-in that runs after refchecks, for ValDefs that are member
variables of a class, I'm getting names (ValDef.name.toString) that end
with spaces. Why is that? Am I doing something wrong?
Erkki L
Wed, 2010-02-10, 22:47
#2
Re: ValDef names (in compiler plugin)
On Wed, Feb 10, 2010 at 10:32:11PM +0200, Erkki Lindpere wrote:
> In a plug-in that runs after refchecks, for ValDefs that are member
> variables of a class, I'm getting names (ValDef.name.toString) that
> end with spaces. Why is that? Am I doing something wrong?
Those are the local accessors created for values which are not actually
fields (or something like that.) You can probably ignore them. If you
look in StdNames you'll see "isLocalName" which will be true on those.
Thu, 2010-02-11, 21:57
#3
Re: ValDef names (in compiler plugin)
On Wed, Feb 10, 2010 at 10:38 PM, Paul Phillips wrote:
> On Wed, Feb 10, 2010 at 10:32:11PM +0200, Erkki Lindpere wrote:
>> In a plug-in that runs after refchecks, for ValDefs that are member
>> variables of a class, I'm getting names (ValDef.name.toString) that
>> end with spaces. Why is that? Am I doing something wrong?
>
> Those are the local accessors created for values which are not actually
> fields (or something like that.) You can probably ignore them. If you
> look in StdNames you'll see "isLocalName" which will be true on those.
>
More precisely, the field itself will always have a name ending in a
space. The getter has the same name w/o the space. The space will be
removed before a class file is generated. Things were like that for
all versions of Scala 2.
Cheers
Fri, 2010-02-12, 19:57
#4
Re: ValDef names (in compiler plugin)
Oh, I guess I just didn't notice because the previous plug-in I was
working on for 2.7.x only looked at methods.
Erkki L
> removed before a class file is generated. Things were like that for
> all versions of Scala 2.
>
>
> Cheers
>
Oh yeah, should have mentioned I'm using the scala-compiler and library
version 2.8.0.Beta1 (compiling with Maven).
Erkki Lindpere wrote:
> I haven't written compiler plugins for a while and don't know what has
> changed in 2.8, so sorry if this is a stupid question, but
>
> In a plug-in that runs after refchecks, for ValDefs that are member
> variables of a class, I'm getting names (ValDef.name.toString) that
> end with spaces. Why is that? Am I doing something wrong?
>
> Erkki L
>