Invalid variant operation

edited 5:46AM 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 5:46AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.