[nem-en] More for completion

Alejandro Serrano trupill at yahoo.es
Sun Jul 2 17:08:13 CEST 2006


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




More information about the devel-en mailing list