[Pas2js] My 1st type helper

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Feb 28 23:48:21 CET 2019


On Thu, 28 Feb 2019 04:14:02 -0700 (MST)
warleyalex via Pas2js <pas2js at lists.freepascal.org> wrote:

> # pas2js-windows-1.4.0RC3
> -------------------------------------------------------------
> type
>  Float = double;
> 
> type
>  TFloatHelper  =  type helper for Float
>    const NPI = 3.141592;
>    function ToStr: String;
>  end;
> 
> implementation
> 
> function  TFloatHelper.ToStr: String;
> begin
>   Result:=  FloatToStr(Self);
> end;
> 
> end.  
> (...)
> var
>   ReturnValue : Float;
> begin
>   ReturnValue := 2.71;
>   console.log(ReturnValue.ToStr);
> 
> -------------------------------------------------------------
> Fatal: bug: uncaught EStackOverflow: Stack overflow
> Fatal: EStackOverflow: Stack overflow

Fixed.

Mattias


More information about the Pas2js mailing list