Pas2JS Version Changes

From Free Pascal wiki
Jump to: navigation, search

Version 0.9.13

  • fixed keeping methods AfterConstruction, BeforeDestruction
  • fixed modeswitch ignoreinterfaces

Version 0.9.12

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

Version 0.9.11

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

Version 0.9.10

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

Version 0.9.9

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

Version 0.9.8

  • fixed optimizer keep overrides

Version 0.9.7

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

Version 0.9.6

  • 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

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

Version 0.9.4

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

Version 0.9.3

  • 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

  • Fixed -constant, when constant is a negative number

Version 0.9.1

  • Fixed class const evaluating expression.

Version 0.9.0

  • 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

  • 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

  • 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

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

Version 0.8.42

  • 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


  • 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

  • fixed circular unit dependencies

Version 0.8.38

  • 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

  • Bugfixed a combination of overload/override

Version 0.8.36

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

Version 0.8.35

  • fixed a bug in the overload code

Version 0.8.34

  • 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

  • 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

  • some bug fixes for warnings

Version 0.8.31

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

Version 0.8.30

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

Version 0.8.29

  • bugfixes
  • it now supports directive $M alias $TypeInfo

Version 0.8.28

  • fixed passing static array

Version 0.8.27

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

Version 0.8.26

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

Version 0.8.25

  • bugfixes
  • a new modeswitch ignoreattributes to ignore attributes.

Version 0.8.24

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

Version 0.8.23

  • 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

  • fixed loading dotted units
  • implemented property stored and default modifiers

Version 0.8.21

  • 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

  • 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

  • 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

Anonymous arrays in record members are now supported:

  TFloatRec = Record
     Digits: Array Of Char;

Version 0.8.17

  • 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

  • bugfix release.

Version 0.8.15

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

Version 0.8.14

  • 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

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

Version 0.8.12

  • dotted unit names and namespaces.

Version 0.8.11

  • 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

  • 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

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

  • bugfix release.

Version 0.8.7

  • $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

  • bugfix release.

Version 0.8.5

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

Version 0.8.4

  • bugfix release.