[nem-en] More for completion

Alejandro Serrano trupill at yahoo.es
Sun Jul 2 17:43:37 CEST 2006


One final question: what happens in case of n.Field.Method (). Will I 
safely obtain plain "n.Field" when refering to the field so I can use it 
to locate the field, or will I get the entire n.Field.Method expression?

Kamil Skalski escribió:
> It refers to the location of whole expression 'obj.field'. You could
> get the place of '.' by comparing location of expr  and obj - or
> actually looking where obj's Location finishes.
>
> 2006/7/2, Alejandro Serrano <trupill at yahoo.es>:
>> What does this 'Location' refer to? The idea is to use the method inside
>> for the MonoDevelop refactorer, so I would need to get:
>>
>> obj.(just here)Field
>>
>> So refactoring could happen in the terms of MD.
>>
>> Kamil Skalski escribió:
>> > Yes, we should allow distinguishing between read and assign places, as
>> > it is very common to search only one kind of those operations.
>> >
>> > In this example it's just 'expr.Location', becasue this
>> > TExpr.FieldMember is describing a node in program tree for expression:
>> > 'obj.(fld : name)'
>> >
>> > 2006/7/2, Alejandro Serrano <trupill at yahoo.es>:
>> >> Well, yes, I think I have not found the best example. I've created 
>> two
>> >> overloads: one with Location and one which doesn't not have a 
>> Location
>> >> parameter. Just another example (typing/Typer2.n, line 834)
>> >>
>> >>         | TExpr.FieldMember (obj, fld) =>
>> >>           if (ctx %&& Context.NeedLValue)
>> >>             fld.HasBeenAssigned = true;
>> >>           else
>> >>             fld.HasBeenUsed = true;
>> >>           TExpr.FieldMember (Walk (obj), fld)
>> >>
>> >> First of all, it seems that I will need both a MarkAsUsed and a
>> >> MarkAsAssigned :-). Secondly, how do I retrieve the exact Location
>> >> there? Maybe the answer is obvious, but I can't find it.
>> >>
>> >> Thanks again
>> >>
>> >> Kamil Skalski escribió:
>> >> > This particular instance of MarkAsUsed seems like a 'shut up' 
>> mark for
>> >> > the compiler warnings. This is quite common to disable warnings for
>> >> > generated code, as user does not have direct influence on how to 
>> fix
>> >> > the warning.
>> >> >
>> >> > Isn't it feasible to use Location.Default here? The rationale 
>> for such
>> >> > hack is that you won't search for references of this generated 
>> member
>> >> > anyways.
>> >> >
>> >> > 2006/7/2, Alejandro Serrano <trupill at yahoo.es>:
>> >> >> Kamil Skalski escribió:
>> >> >> > bash-3.00$ cd nemerle/ncc/
>> >> >> > bash-3.00$ ./g HasBeenUsed
>> >> >> > external/LibrariesLoader.n:1102:      public override 
>> HasBeenUsed :
>> >> >> bool
>> >> >> > [...]
>> >> >> > typing/Typer2.n:1211:          meth.HasBeenUsed = true;
>> >> >> >
>> >> >> > Probably all the assignments to HasBeenUsed should be changed to
>> >> some
>> >> >> > kind of method
>> >> >> > ManagerClass.MarkAsUsed (IMember, Location), which could be then
>> >> >> > overriden in completion engine to catch all uses of given 
>> member.
>> >> >> > Then you would need to run the whole typing step for all 
>> methods.
>> >> >> Hi again,
>> >> >> Now I have some time, I'm trying to implement these MarkAsUsed
>> >> method.
>> >> >> However, I've got a big problem: I don't know where to find the
>> >> location
>> >> >> most of the times. For example, in generation/Typer3.n (line 789)
>> >> >>
>> >> >>       def rewrite (expr : TExpr) {
>> >> >>         | TryFinally (body, handler) =>
>> >> >>           def fld = clo_type.DefineAndReturn (<[ decl:
>> >> >>             mutable $(Macros.NewSymbol ("finally_needed") : 
>> name) :
>> >> >> bool;
>> >> >>           ]>) :> IField;
>> >> >>           fld.HasBeenAssigned = true;
>> >> >>           fld.HasBeenUsed = true;
>> >> >>           def fldref = TExpr.FieldMember (InternalType.Boolean,
>> >> thisref,
>> >> >> fld);
>> >> >>
>> >> >> How can I know where the reference is located so I can call the
>> >> >> MarkAsUsed (IMember, Location) method?
>> >> >>
>> >> >> Thanks in advance,
>> >> >> Alejandro Serrano "Serras"
>> >> >>
>> >>
>> >>
>> >>
>> >>
>> >> ______________________________________________
>> >> LLama Gratis a cualquier PC del Mundo.
>> >> Llamadas a fijos y móviles desde 1 céntimo por minuto.
>> >> http://es.voice.yahoo.com
>> >>
>> >>
>> >> _______________________________________________
>> >> https://nemerle.org/mailman/listinfo/devel-en
>> >>
>> >
>> >
>> > 
>> ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > https://nemerle.org/mailman/listinfo/devel-en
>> >
>>
>>
>>
>> ______________________________________________
>> LLama Gratis a cualquier PC del Mundo.
>> Llamadas a fijos y móviles desde 1 céntimo por minuto.
>> http://es.voice.yahoo.com
>>
>>
>> _______________________________________________
>> https://nemerle.org/mailman/listinfo/devel-en
>>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>   


		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com




More information about the devel-en mailing list