[Pas2js] Class constant with "external" class

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jan 31 15:02:38 CET 2018


On Sat, 27 Jan 2018 10:46:23 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:

> On Fri, 26 Jan 2018, warleyalex via Pas2js wrote:
> 
> > the codegen does not emit corresponding const.
> >
> > type
> >  TBase = class external name 'TBase'
> >  public
> >    (* class var cPublic : String = '{"name":"warleyx"}'; *)  // not supported
> >    class const cTemp = '{"page:about2"}';  
> 
> What is that definition supposed to mean ?

pas2js 0.9.0 now does the following for external classes:

When a const with expression like
class const cTemp = '{"page:about2"}';
or simply
const cTemp = '{"page:about2"}';

is used, pas2js inserts the value.

While a const without an expression
const cTemp: string;
is now treated as a readonly variable.

Which means you can simplify many readonly properties to const.


Mattias


More information about the Pas2js mailing list