Invalid variant operation

edited 3:18AM in FastScript
Hi,

the following sequence is compiled without problems :

Var
V, VV : Variant ;

V := '1212' ;
VV := 12.12 ;
V := VV ;

But (after adding AddIndexProperty ('_Var', 'String', 'Variant', CallMethod)

Var
V, VV : Variant ;

V := '1212' ;
VV := 12.12 ;
V := VV ;
_Var := V ; <---- compilation returns invalid variant operation.

What can i do ?

Thanks in advance

Willi

Comments

  • edited 3:18AM
    Fix the fs_iilparser.pas file:

    function TfsILParser.DoDesignator(xi: TfsXMLItem; Prog: TfsScript;
    EmitOp: TfsEmitOp = emNone): TfsDesignator;
    var
    ...
    PriorIsIndex: Boolean;

    ...
    PriorItem := Result.Items[Result.Count - 2];
    // add this
    PriorIsIndex := (PriorItem.Ref is TfsMethodHelper) and
    TfsMethodHelper(PriorItem.Ref).IndexMethod and not PriorItem.Flag;
    //
    Typ := PriorItem.Ref.Typ;
    { late binding }
    // change this
    if (Typ = fvtVariant) and not PriorIsIndex then
    //

    ...

    // comment this out
    // if (PriorItem.Ref is TfsMethodHelper) and
    // TfsMethodHelper(PriorItem.Ref).IndexMethod and not PriorItem.Flag then

    // and add this instead:
    if PriorIsIndex then
    //
    begin
    PriorItem.Flag := True;
    Result.Remove(Item); { previous item is set up already }
    ...

Leave a Comment