Pas2JS Version Changes

From Free Pascal wiki
Jump to: navigation, search

Contents

Releases

Fixes Version

  • fixed assert to raise on false, bug 34643

Version 1.0.4

  • 14th Nov 2018
  • SVN release tag is https://svn.freepascal.org/svn/projects/pas2js/tags/release_1_0_4
  • fixed calling destructor after exception in constructor
  • fixed initializing static array of record
  • fixed parsing if expr then raise else
  • fixed local record and enum types
  • fixed for e in set do
  • fixed for-in of shared sets
  • fixed inc(classvar)
  • fixed assigning class var of descendant classes
  • fixed error position on include file not found
  • fixed loading include file from cache
  • fixed range check of o.aString[index] and o.aArray[index]
  • fixed Result:=inherited;
  • fixed escaping invalid UTF-16 in string literals
  • fixed not generating octal literals in ECMAScript5, it bites strict mode
  • fixed IsNaN on ECMAScript6
  • fixed error on method in record
  • fixed name clash published property and external
  • fixed str(aCurrency)
  • catch ECompilerTerminate while parsing params
  • sLineBreak and LineEnding are now var under platform NodeJS

Version 1.0.3

function GetItems(const i: integer): byte;
property Items[i: integer]: byte read GetItems;
  • fixed high(intvar)
  • fixed WPO when using record constants
  • fixed include(FuncResultSet,enum)
  • fixed if then <empty> else <something>;
  • fixed p^.x:=
  • fixed acurrency:=aninteger to become acurrency:=aninteger*10000
  • fixed integer(acurrency) to become Math.floor(acurrency/10000)
  • fixed calling $final, clearing references on destroy
  • fixed not calling BeforeDestruction on exception in constructor
  • fixed $class be a property of the class, not the object
  • fixed local var modifier absolute in method
  • fixed using external const in const expression, e.g. const tau = 2*pi;
  • fixed selecting procedure overload, preferring lossy int over int to float
  • fixed calling Free inside method
  • fixed System.Int() so it also works on IE (where Math.trunc is missing).
  • fixed FormatFloat() rounding logic (actually FloatToDecimal)
  • fixed stringofchar for count<=0
  • fixed quotestring and add quotedstr

Version 1.0.2

Version 1.0.1

Version 1.0.0

Version 1.0.0rc1

  • 24 Jul 2018
  • fixed TObject.Create()
  • -vd shows stacktraces

Version 0.9.32

  • 17 Jul 2018
  • fixed memory leaks and double frees

Version 0.9.31

  • 10 Jul 2018
  • fixed aIntSet:=[0]
  • fixed crash on List.Items.Dummy
  • fixed some mem leaks
  • fixed -MDelphi + $mode objfpc + overloads withouts overload keyword
  • TGUIDString is now type string
  • RTL: added websockets

Version 0.9.30

  • 4 Jul 2018
  • fixed calling COM interface _Release function for expressions.
  • fixed catching exception in pju variant of pas2js
  • split reserved words into two categories: the compiler now checks global JS identifiers like "Date" only for identifiers without path. That means a local variable Date will be renamed, a property Date will not, keeping the RTTI name of properties. Identifiers like apply are still renamed.
  • fixed property RTTI for alias type in other unit
  • fixed default value of integer variables, using 0 even if it is outside range. Reason: Delphi/FPC compatibility.

Version 0.9.29

  • 29 Jun 2018
  • fixed pcu reading alias type
  • fixed analyzer: element needing typeinfo marks indirect elements as used normally
  • hint for text after final "end.", disable with $warn GARBAGE off
  • $warn BOUNDS_ERROR off: disable range check warnings at compile time
  • $warn MESSAGE_DIRECTIVE off: disable $message notes

Version 0.9.28

  • 27 Jun 2018
  • fixed static array of char = stringlit+stringlit
  • fixed libpas2js disk full error
  • $warn directive: {$warn identifier on|off|default|error}, identifier can be a message number as shown with -vq or one of the following. Note, that some hints like "Parameter %s not used" are currently using the enable state at the end of the module, not the state at the hint source position.
    • CONSTRUCTING_ABSTRACT: Constructing an instance of a class with abstract methods.
    • IMPLICIT_VARIANTS: Implicit use of the variants unit.
    • NO_RETVAL: Function result is not set
    • SYMBOL_DEPRECATED: Deprecated symbol
    • SYMBOL_EXPERIMENTAL: Experimental symbol
    • SYMBOL_LIBRARY
    • SYMBOL_PLATFORM: Platform-dependent symbol
    • SYMBOL_UNIMPLEMENTED: Unimplemented symbol
    • HIDDEN_VIRTUAL: method hides virtual method of ancestor

Version 0.9.27

  • 26 Jun 2018
  • mode delphi: fixed passing static array to open array
  • allow assigning aTypeInfo:=pointer, needed by units with and without using unit typinfo

Version 0.9.26

  • 25 Jun 2018
  • typecast function address to JS function, e.g. TJSFunction(@IntToStr)
  • typecast function reference to JS function, e.g. TJSFunction(OnClick)
  • typecast method address to JS function, e.g. TJSFunction(@List.Sort). Note that a method address creates a function wrapper to bind the Self argument.
  • changed some types to type alias: TDateTime, TDate, TTime, Single, Real, Comp, UnicodeString, WideString. This only effects typinfo and some compiler error messages. Reason: Delphi/FPC compatibility.
  • In mode delphi dynamic array initializations must now use square brackets instead of round brackets. For example var a: array of integer = [1,2];. Reason: Delphi compatibility.
  • Assignation using constant array. For instance Arr:=[1,2,3], where Arr is a dynamic array.
  • + operator for arrays: This concatenation operator is available using the new modeswitch arrayoperators, which is enabled by default in mode delphi.
  • unit webgl updated
  • unit webaudio added
  • unit webbluetooth added
  • db unit: ftDataset field type added (not supported)
  • JSONDataset unit: TField.OldValue now works for TJSONDataset
  • webidl2pas tool added. A command line tool to create Pascal units from idl specs.
  • allow external record fields.
  • hint 5024 'Parameter "%s" not used' was split into two:
    • 4501 for virtual/override methods
    • 5024 for others

Version 0.9.25

  • 7 Jun 2018
  • TComponent now supports IInterface
  • -o is now always relative to working directory, even if -FU or -FE is given. Reason: FPC compatibility
  • fixed typeinfo(typeintegerrange)
  • fixed using interface ancestor methods
  • fixed 'make' building with fpc 3.0.4

Version 0.9.24

  • 2 Jun 2018
  • fixed precompiled js formatting to same options as compiled js
  • fixed unit analyzer private method used by protected property
  • fixed class-of RTTI
  • fixed precompiled resolve pending scopes before pending units

Version 0.9.23

  • 28 May 2018
  • added webgl demos from Ryan Joseph
  • for value in jsarray do - where jsarray is any external class with a matching length and default property. This enumerates similar to other arrays the values, not the index.
  • allow typecast array to TJSObject
  • allow typecast TJSObject to array
  • Unicode character constants outside of BMP, e.g. #$10437
  • allow {$H+}, error on {$H-}
  • added intrinsic procedure WriteStr(out s: string; params...), which works similar to str(param,s), except it can take any amount of parameters, which are concatenated.
  • added option -Sm to enable macro replacements

Version 0.9.22

  • 17 May 2018
  • Fixed $00ff00

Version 0.9.21

  • 16 May 2018
  • added option -FE: set the main output path, used for the main .js file, if there is no -o option or the -o option has no folder.
  • fixed WPO typeinfo of inherited property
  • for easier FPC integration the following message IDs were changed:
    • nVirtualMethodXHasLowerVisibility = 3250; // was 3050
    • nConstructingClassXWithAbstractMethodY = 4046; // was 3080
    • nNoMatchingImplForIntfMethodXFound = 5042; // was 3088
    • nSymbolXIsDeprecated = 5043; // was 3062
    • nSymbolXBelongsToALibrary = 5065; // was 3061
    • nSymbolXIsDeprecatedY = 5066; // 3063
    • nSymbolXIsNotPortable = 5076; // was 3058
    • nSymbolXIsNotImplemented = 5078; // was 3060
    • nSymbolXIsExperimental = 5079; // was 3059

Version 0.9.20

  • 11 May 2018
  • fixed passing typecasted alias type to var parameter
  • forbid typecast rectordtype to other recordtype
  • remove leading zeroes in number literals
  • added namespace option -FN<x>, marked -NS as obsolete. Reason: fpc compatibility.
  • added option -vz : write messages to stderr, -o. still uses stdout.
  • added option -ic : Write list of supported JS processors usable by -P<x>
  • added option -io : Write list of supported optimizations usable by -Oo<x>
  • added option -it : Write list of supported targets usable by -T<x>
  • added option -SIcom, -SIcorba interface style
  • added option -vv : Write pas2jsdebug.log with lots of debugging info
  • fixed option -va including option -vt
  • fixed combination of -Jc -o.
  • option -vt now writes used unit scopes
  • external class fields with brackets. e.g. X: nativeint external name '[0]'
  • autogenerated interface GUIDs now consider the unitname

Version 0.9.19

  • 2 May 2018
  • type alias type, e.g. type TCaption = type string;
  • record const, e.g. const p: TPoint = (x:1; y:2);
  • {$WriteableConst on|off}: treat typed constants as readonly, e.g. const i:byte=3;... i:=4; creates a compile time error.
  • forbid assignment of for-loop variable
  • nested classes
  • property specifier nodefault
  • default(type) returning the initial value of the type, e.g. default(recordtype).
  • external typed const: e.g. const NaN: Double; external name 'NaN';
  • case string of support for ranges
  • fixed typecast shortint(integer)

Version 0.9.18

  • 26 Apr 2018
  • Fixed rcArrR in rtl.js

Version 0.9.17

  • 25 Apr 2018
  • Fix recno calculation for TJSONDataset
  • Fix initializing next buffers in TDataset.
  • Implemented Currency as double, values are multiplied by 10000 and truncated, so a 2.7 is stored as 27000.
  • Implemented pointer of record. It's simply a reference.
    • p:=@r translates to p=r
    • p^.x becomes p.x
    • intrinsics new(PointerOfRecord), dispose(PointerOfRecord). dispose(p) sets p to null if possible.
  • enumerator for jsvalue: e.g. var v: jsvalue; key: string; for key in jsvalue do translates to for (key in jsvalue){}
  • enumerator for external class: e.g. var o: TJSObject; key: string; for key in o do translates to for (key in o){}
  • range checking $R+
    • compile time: warnings become errors
    • run time: int:=, int+=, enum:=, enum+=, intrange:=, intrange+=, enumrange:=, enumrange+=, char:=, charrange:=
    • run time: parameters: int, enum, intrange, enumrange, char, charrange
    • run time: array[index], string[index]
  • type cast integer to integer, e.g. byte(aLongInt)
    • with range checking enabled: error if outside range
    • without range checking: emulates the FPC/Delphi behaviour: e.g. byte(value) translates to value & 0xff, shortint(value) translates to value & 0xff <<24 >>24.
  • case-of statement: error on duplicate values
  • fixed error on int:=double

Version 0.9.16

  • 21 Apr 2018
  • mode delphi: allow "ObjVar is IntfType" and "ObjVar as IntfType" with unrelated types.
  • TVirtualInterface - create an implementation at runtime. rtl unit rtti.pas
  • typecast a class type to JS Object, e.g. TJSObject(TObject)
  • typecast an interface type to JS Object, e.g. TJSObject(IUnknown)
  • typecast a record type to JS Object, e.g. TJSObject(TPoint)
  • not jsvalue is converted to !jsvalue
  • "=" operator for records with static array fields
  • changed TGuid to record
  • TGUID record
    • GuidVar:='{guid}', StringVar:=GuidVar, GuidVar:=IntfTypeOrVar, GuidVar=IntfTypeOrVar, GuidVar=string
    • pass IntfTypeOrVar to GuidVar parameter
  • added new type TGuidString to system unit
    • GuidString:=IntfTypeOrVar, GuidString=IntfTypeOrVar
    • pass IntfTypeOrVar to GuidString parameter
  • added option -JoUseStrict, to enable or disable adding "use strict"

Version 0.9.15

  • 8 Apr 2018
  • fixed crash when ancestor implements more interfaces than current class.

Version 0.9.14

  • 8 Apr 2018
  • fixed duplicates in rtl/strutils.pas
  • fixed reference counts on reading element lists
  • implemented using function result variable in for-loop. e.g. for Result:=..., for Result in ...
  • fixed for string in arrayofstring do
  • fixed $scopedenums with anonymous enumtype. e.g. type TSet = set of (A,B);
  • implemented class interfaces:
    • methods, properties, default property
    • {$interfaces com|corba|default}
      • COM is default, default ancestor is IUnknown (mode delphi: IInterface), managed type, i.e. automatically reference counted via _AddRef, _Release, the checks for support call QueryInterface
      • CORBA: lightweight, no automatic reference counting, no default ancestor, fast support checks.
    • inheriting
    • GUIDs are simple string literals, TGUID = string.
    • An interface without a GUID gets one autogenerated from its name and method names.
    • a class implementing an interface must not be external
    • a ClassType "supports" an interface, if it itself or one of its ancestors implements the interface. It does not automatically support an ancestor of the interface.
    • method resolution, procedure IUnknown._AddRef = IncRef;
    • delegation: property Name: interface|class read Field|Getter implements AnInterface;
    • is-operator:
      • IntfVar is IntfType - types must be releated
      • IntfVar is ClassType - types can be unrelated, class must not be external
      • ObjVar is IntfType - can be unrelated
    • as-operator
      • IntfVar as IntfType - types must be releated
      • IntfVar as ClassType - types can be unrelated, nil returns nil, invalid raises EInvalidCast
      • ObjVar as IntfType - mode delphi: types must be related, objfpc: can be unrelated, nil if not found, COM: uses _AddRef
    • typecast:
      • IntfType(IntfVar) - must be related
      • ClassType(IntfVar) - can be unrelated, nil if invalid
      • IntfType(ObjVar) - mode delphi: must be related, objfpc: can be unrelated, nil if not found, COM: if ObjVar has delegate uses _AddRef
      • TJSObject(intfvar)
    • Assign operator:
      • IntfVar:=nil
      • IntfVar:=IntfVar2 - IntfVar2 must be same type or a descendant
      • IntfVar:=ObjVar - nil if unsupported
      • jsvalue:=IntfVar
    • Assigned(IntfVar)
    • RTTI
    • $modeswitch ignoreinterfaces was removed
    • Not supported: array of interface, interface as record member

Version 0.9.13

  • 21 Mar 2018
  • fixed keeping methods AfterConstruction, BeforeDestruction
  • fixed modeswitch ignoreinterfaces

Version 0.9.12

  • 19 Mar 2018
  • fixed parsing procedure p(var a; b: t)
  • fixed checking duplicate implementation of unit interface procedure

Version 0.9.11

  • 16 Mar 2018
  • fixed loading files encoded in non UTF-8, e.g. UTF-8 with BOM. This was a regression.

Version 0.9.10

  • 13 Mar 2018
  • fixed renaming overloads of unit interface at end of interface, not at end of module. Needed for unit cycles.

Version 0.9.9

  • 13 Mar 2018
  • Fixed libpas2js to use WorkingDir parameter instead of GetCurrentDir
  • Fixed static array clone function.

Version 0.9.8

  • 9 Mar 2018
  • fixed optimizer keep overrides

Version 0.9.7

  • 7 Mar 2018
  • fixed pass local variable v as argument to a var parameter.

Version 0.9.6

  • 6 Mar 2018
  • static arrays are now cloned on assignment or when passed as argument to a function (no const, var, out)
  • Fixed array[enum..enum] of
  • pas2jslib: fixed checks of directoryexists to use cache
  • uses with in-filename: In $mode delphi the in-filenames are only allowed in the program and the unitname must fit the filename, e.g. uses unit1 in 'sub/Unit1.pas'. In $mode objfpc units can use in-filenames too and alias are allowed, e.g. uses foo in 'bar.pas'.

Version 0.9.5

  • 12 Feb 2018
  • Error on duplicate forward class
  • Error on method class in other unit
  • Fixed index property override

Version 0.9.4

  • 8 Feb 2018
  • Removed debug writeln, fixing Disk Full errors in libpas2js.
  • Nicer error messages on illegal qualifier.

Version 0.9.3

  • 4 Feb 2018
  • Fixed number literals outside int64.
  • Shorten float numbers, e.g. 1.00000E+001 to 10
  • unexpected exception now sets ExitCode to 1

Version 0.9.2

  • 4 Feb 2018
  • Fixed -constant, when constant is a negative number

Version 0.9.1

  • 3 Feb 2018
  • Fixed class const evaluating expression.

Version 0.9.0

  • 31 Jan 2018
  • Fixed srcmap header. It must be )]}' to work in Firefox. Added option -JmXSSIHeader to exclude or include the XSSI protection header.
  • Ignore procedure modifier "inline"
  • Char(int)
  • search units and include files case insensitive by default. Enable FPC like search with parameter -JoSearchLikeFPC.
  • Const in external classes:
    • const c: type = value, const c = value are translated to the value.
    • const c: type, class const c: type are treated like readonly variables.

Version 0.8.45

  • 23 Jan 2018
  • is-operator: jsvalue is class-type, jsvalue is class-of-type
  • assertions: -Sa, $C+|-, $Assertions on|off, Assert(boolean), Assert(boolean,string)
  • object checks: -CR, $ObjectChecks on|off, check method calls, check object type casts
  • some bugfixes for alias types
  • multi dimensional static array const, e.g. array[1..2,3..4] of byte = ((5,6),(7,8))
  • fixed overloads when skipping class interface
  • fixed s[i]:= when s is a var parameter

Version 0.8.44

  • 15 Jan 2018
  • State of directives $Hints|Notes|Warnings on|off at end of procedure is used for analyzer hints, e.g. "local variable x not used".
  • Fixed re-reading directories after Reset.

Version 0.8.43

  • 4 Jan 2018
  • Fixed -Fi include path
  • Read directories instead of checking every single file. Added hooks for ReadDir to libpas2js.

Version 0.8.42

  • 25 Dec 2017
  • var absolute modifier for local variables
  • $scopedenums
  • $hint, $note, $warn, $error, $fatal, $message text
  • $message hint|note|warn|error|fatal text
  • $hints, $notes, $warnings on|off

Version 0.8.41

  • 25 Dec 2017
  • Enumerators:
    • ordinal types: char, boolean, byte, ..., longword, enums, sets, static array, custom range
    • const set
    • variables: set, string, array
    • class GetEnumerator
    • It does not support operator enumerator, IEnumerator, member modifier enumerator.

Version 0.8.40

  • File read callback for pas2jslib

Version 0.8.39

  • 14 Dec 2017
  • fixed circular unit dependencies

Version 0.8.38

  • 12 Dec 2017
  • support for * and ? in search paths
  • fixed converting a typecast to an alias proc type
  • fixed inherited-identifier-as-expr
  • emit warning method-hides-method-in-base-type only for virtual methods
  • reduced function hides identifier from level hint to info
  • fixed unit contnrs to always use mode objfpc.

Version 0.8.37

  • 5 Dec 2017
  • Bugfixed a combination of overload/override

Version 0.8.36

  • 5 Dec 2017
  • fixed missing brackets in binary expression and left side has a call (a-f(b)) / (c-d)

Version 0.8.35

  • 20 Nov 2017
  • fixed a bug in the overload code

Version 0.8.34

  • 19 Nov 2017
  • fixed skipping attributes behind procedure declarations.
  • Procedures/methods now properly hides procs with same name.
  • In mode delphi overloads now always require the 'overload' modifier.
  • In mode objfpc the modifier is required when using different scopes.
  • hints for hiding identifiers of other units.
  • implemented system.built-in-identifier.

Version 0.8.33

  • 14 Nov 2017
  • srcmaps with included sources now ignores untranslatable local paths and simply uses the full local path.
  • custom enum ranges, e.g. TBlobType = ftBlob..ftBla
  • custom integer ranges, e.g. TSome = 1..5
  • custom char ranges
  • set of custom enum/integer/char ranges
  • the conversion of the for-to-do loop has changed. If the loop is never executed, the loop variable is not touched. And the start expression is now executed before the end expression.

Version 0.8.32

  • 8 Nov 2017
  • some bug fixes for warnings

Version 0.8.31

  • 29 Oct 2017
  • bugfix for implicit function calls of parameters of some built in functions.

Version 0.8.30

  • 19 Oct 2017
  • nicer "can't find unit" position
  • fixed a crash parsing uses clause

Version 0.8.29

  • 16 Oct 2017
  • bugfixes
  • it now supports directive $M alias $TypeInfo

Version 0.8.28

  • fixed passing static array

Version 0.8.27

  • 4 Oct 2017
  • implemented resourcestrings
  • implemented logical xor
  • fixed class-of-typealias
  • fixed property index modifier expression

Version 0.8.26

  • 3 Oct 2017
  • fixed RTTI for static arrays
  • implemented property modifier index
  • implemented FuncName:=

Version 0.8.25

  • 1 Oct 2017
  • bugfixes
  • a new modeswitch ignoreattributes to ignore attributes.

Version 0.8.24

  • 28 Sep 2017
  • implemented multi dimensional SetLength
  • fixed keeping old values when using SetLength
  • fixed method override of override

Version 0.8.23

  • 27 Sep 2017
  • property default value for sets
  • custom integer ranges, like TValueRelationship
  • typecast enums to integer type (same as ord function)
  • new modeswitch ignoreinterfaces to parse class interfaces, but neither resolve nor convert them. Using them will cause an error.

Version 0.8.22

  • 24 Sep 2017
  • fixed loading dotted units
  • implemented property stored and default modifiers

Version 0.8.21

  • 21 Sep 2017
  • fixed aString[index]:=
  • fixed analyzer to mark default values of arguments
  • many improvements for sourcemaps making step-over/into nicer in Chrome.
  • new tool fpc/packages/fcl-js/examples/srcmapdump to dump the produced sourcemap.
  • unicodestring and widechar are now declared by the compiler instead of system.pas

Version 0.8.20

  • 14 Sep 2017
  • Static array const are now implemented. For example:
  • array['a'..'d'] of integer = (1,2,3,4);
  • array[1..3] of char = 'pas';

Version 0.8.19

  • 12 Sep 2017
  • several bug fixes
  • started static arrays:
    • array[2..6] of char
    • array['a'..'z'] of char
    • array[boolean] of longint
    • array[byte] of string
    • array[enum] of longint
    • array[char] of boolean // Note that char is widechar!
    • low(), high()

Version 0.8.18

  • 6 Sep 2017
  • Anonymous arrays in record members are now supported:
  TFloatRec = Record
     ...
     Digits: Array Of Char;
  End;

Version 0.8.17

  • 3 Sep 2017
  • checks for semicolons between statements
  • fixed proc type of procedure in Delphi mode
  • implemented @@ operator for proc types in Delphi mode.
  • compile time evaluation, range and overflow checking for boolean, base integer types, enums, sets, custom integer ranges, char, widechar, string, single and double.

Version 0.8.16

  • 28 Jul 2017
  • bugfix release.

Version 0.8.15

  • 8 Jul 2017
  • compiler can now generate source maps when passing option -Jm

Version 0.8.14

  • 17 May 2017
  • now supports TObject.Free.

In Delphi/FPC obj.Free works even if obj is nil. In JavaScript this would crash. And to free memory JS requires to clear all references, which is not required in Delphi/FPC. Therefore the compiler adds code to check for null, call the destructor and sets the variable to null.

It does not support freeing properties and function results. For example: List[i].Free; will give a compiler error. The property setter might create side effects, which would be incompatible to Delphi/FPC.

Version 0.8.13

  • 11 May 2017
  • $IF
  • $ELSEIF
  • $IFOPT
  • $Error
  • $Warning,
  • $Note
  • $Hint
  • And in the config files it supports #IF, #IFDEF, #IFNDEF, #ELSEIF, #ELSE, #ENDIF.

Version 0.8.12

  • 5 May 2017
  • dotted unit names and namespaces.

Version 0.8.11

  • 23 Apr 2017
  • dynamic arrays can now be initialized with a constant. Same syntax as static arrays: const a: array of string = ('one', 'two');
  • Classes can now be declared in the unit implementation.
  • Unit nodejs now has a console class TNJSConsole.
  • I added the fpcunit package. Successful tests already work. A fail is not yet caught.

Version 0.8.10

  • 22 Apr 2017
  • you can now use "if aJSValue then", which works just like the JS "if(v)".
  • added ParamCount, ParamStr, GetEnvironment* functions. The default is not doing much.
  • new package fcl_base_pas2js, containing custapp and nodejsapp: - TCustomApplication is the known class from the FCL, but with abstract methods.
  • TNodeJSApplication is a TCustomApplication using nodejs to read command line params and environment variables.

Version 0.8.9

  • 21 Apr 2017
  • The compiler now has the types 53bit NativeInt and 52bit NativeUInt. Keep in mind that there is still no range checking.

Current aliases:

  JSInteger = NativeInt;

  Integer = LongInt;
  Cardinal = LongWord;
  SizeInt = NativeInt;
  SizeUInt = NativeUInt;
  PtrInt = NativeInt;
  PtrUInt = NativeUInt;
  ValSInt = NativeInt;
  ValUInt = NativeUInt;
  ValReal = Double;
  Real = Double;
  Extended = Double;

  Int64 = NativeInt unimplemented;
  QWord = NativeUInt unimplemented;
  Single = Double unimplemented;
  Comp = Int64 unimplemented;

  UnicodeString = String;
  WideString = String;
  WideChar = char;

Version 0.8.8

  • 20 Apr 2017
  • bugfix release.

Version 0.8.7

  • 18 Apr 2017
  • $mod: the current module
  • Self: in a method with nested functions this holds the class or class instance.
  • overloads are now chosen like FPC/Delphi not only by type, but also by precision. This means if there are several compatible overloads, and none fits exactly it will choose the next higher. Formerly it gave an error.
  • cardinal is no longer a base type, but longword is. Same as FPC.

Version 0.8.6

  • 17 Apr 2017
  • bugfix release.

Version 0.8.5

  • 15 Apr 2017
  • bugfix for the analyzer.
  • supports published indexed properties and published records.
  • indexed properties for external classes.

Version 0.8.4

  • 14 Apr 2017
  • bugfix release.

Version 0.8.3

  • 4 Apr 2017
  • pas2js now has code navigation in Lazarus

Trunk

  • Anonymous Functions:
type
  TRefProc = reference to procedure;
  TProc = procedure;
procedure DoIt(arg: TRefProc);
var 
  ref: TRefProc;
  proc: TProc;
begin
  ref:=procedure begin end; // assign to "reference of procedure" type
  ref:=procedure  // note the omitted semicolon
    var i: integer; // var, types, const, local procedures
    begin
    end; 
  DoIt(procedure begin end); // pass as argument
  refproc:=procedure assembler asm // embed JavaScript
      console.log("foo");
    end; 
  // Note that typecasting to non "reference to" does not make a difference 
  // because in JS all functions are closures:
  proc:=TProc(procedure begin end);   
end;
  • added variable rtl.version, which correspond to the compiler version Major*10000+Minor*100+Release
  • added option -JoCheckVersion:
    • -JoCheckVersion- : do not add rtl version check, default.
    • -JoCheckVersion=main : insert rtl.checkVersion() into main.
    • -JoCheckVersion=system : insert rtl.checkVersion() into system unit.
    • -JoCheckVersion=unit : insert rtl.checkVersion() into every unit.
  • moved classtopas function to a class2pas unit, improved the interface so it uses a stringlist. Adapted the demo.
  • Fix System.Int() so it also works on IE (where Math.trunc is missing).
  • allow typecasting string(apointer) and pointer(astring)
  • asm-blocks now skips Pascal comments //... and Pascal string literals with single quotes. It no longer stops at end in such comments and string literals.
  • Fix FormatFloat() rounding logic (actually FloatToDecimal)
  • Fix stringofchar for count<=0
  • Fix quotestring and add quotedstr
  • implemented special includes like {$i %date%}:
    •  %date%: current date as string literal, '[yyyy/mm/dd]'
    •  %time%: current time as string literal, 'hh:mm:ss' Note that the inclusion of %date% and %time% will not cause the compiler to recompile the unit every time it is used: the date and time will be the date and time when the unit was last compiled.
    •  %line%: current source line number as string literal, e.g. '123'
    •  %linenum%: current source line number as integer, e.g. 123
    •  %currentroutine%: name of current routine as string literal
    •  %pas2jstarget%, %pas2jstargetos%, %fpctarget%, %fpctargetos%: target os as string literal, e.g. 'Browser'
    •  %pas2jstargetcpu%, %fpctargetcpu%: target cpu as string literal, e.g. 'ECMAScript5'
    •  %pas2jsversion%, %fpcversion%: compiler version as strnig literal, e.g. '1.0.2'
    • If param is none of the above it will use the environment variable. Keep in mind that depending on the platform the name may be case sensitive. If there is no such variable an empty string is inserted.
  • implemented pred(char), succ(char)
  • allow typecasting TypedPointer(UntypedPointer)
  • allow assign UntypedPointer:=TypedPointer
  • skip double quotes in asm-blocks, e.g. s = "end"+"'";
  • added {$modeswitch OmitRTTI}: treat class section 'published' as 'public' and typeinfo() does not work on symbols declared with this switch. This allows to easily disable generating RTTI and allows the optimizer to omit unused published properties.
  • added option -Jpcmd<command>: Run postprocessor. For each generated js execute command passing the js as stdin and read the new js from stdout. This option can be added multiple times to call several postprocessors in succession. Quote the <command> to add options for the postprocessor. For an example see minifier.
  • Added built-in procedure Debugger;, which is converted to the JavaScript statement debugger;. If a debugger is running it will break on this line just like a break point.
  • Changed operator precedence level of is to same as and, or, xor. Same as fpc/delphi.
  • built-in procedure val(const string; out enum; out int)

Navigation