Browse Source

fcl-passrc: resolver: GetElementSourcePos for intrinsic

git-svn-id: trunk@38841 -
Mattias Gaertner 7 years ago
parent
commit
2750a0010c

+ 5 - 0
packages/fcl-passrc/src/pasresolver.pp

@@ -13376,6 +13376,11 @@ var
 begin
   if El=nil then exit('nil');
   UnmangleSourceLineNumber(El.SourceLinenumber,Line,Column);
+  if (Line=0) then
+    begin
+    if El is TPasUnresolvedSymbolRef then
+      exit('intrinsic');
+    end;
   Result:=CurrentParser.Scanner.FormatPath(El.SourceFilename)+'('+IntToStr(Line);
   if Column>0 then
     Result:=Result+','+IntToStr(Column);

+ 3 - 4
packages/pastojs/src/fppas2js.pp

@@ -324,19 +324,20 @@ Works:
 - currency:
   - as nativeint*10000
   - CurA+CurB -> CurA+CurB
+  - CurA-CurB -> CurA-CurB
   - CurA*CurB -> CurA*CurB/10000
   - CurA/CurB -> Math.floor(CurA/CurB*10000)
   - CurA^^CurB -> Math.floor(Math.pow(CurA/10000,CurB/10000)*10000)
   - Double:=Currency  ->  Double:=Currency/10000
   - Currency:=Double  -> Currency:=Math.floor(Double*10000)
   - jsvalue := currency  ->  jsvalue:=currency/10000
-- simplify Math.floor(number) to trunc(number)
+- simplify Math.floor(constnumber) to truncated constnumber
 - Pointer of record
   - p:=@r, p^:=r
   - p^.x, p.x
+  - dispose, new
 
 ToDos:
-- dispose, new
 - 'new', 'Function' -> class var use .prototype
 - btArrayLit
   a: array of jsvalue;
@@ -344,8 +345,6 @@ ToDos:
 - bug:
   v:=a[0]  gives Local variable "a" is assigned but never used
 - setlength(dynarray)  modeswitch to create a copy
-- range checks:
-  - case duplicates
 - typecast byte(longword) -> value & $ff
 - static arrays
   - a[] of record

+ 7 - 3
utils/pas2js/docs/translation.html

@@ -657,7 +657,13 @@ function(){
       <li>Since record types are JS objects it is possible to typecast a record type
       to the JS Object, e.g. TJSObject(TPoint)</li>
       <li>A pointer of record is simply a reference.
-      E.g. <i>p:=@r</i> translates to <i>p=r</i>, <i>p^.x</i> becomes <i>p.x</i>.</li>
+        <ul>
+          <li><i>p:=@r</i> translates to <i>p=r</i></li>
+          <li><i>p^.x</i> becomes <i>p.x</i>.</li>
+          <li><i>New(PointerOfRecord)</i> creates a new record</li>
+          <li><i>Dispose(PointerOfRecord)</i> Sets the variable to null if possible.</li>
+        </ul>
+      </li>
     </ul>
     </div>
 
@@ -2844,8 +2850,6 @@ End.
     <li>Resources</li>
     <li>RTTI extended, $RTTI</li>
     <li>Runtime checks: Overflow -Co, $Q</li>
-    <li>Runtime checks: Range -Cr, $R</li>
-    <li>Runtime checks: Typecast -CR</li>
     <li>Type alias, e.g. type TTranslateString = type string;</li>
     <li>Variant records</li>
     <li>Variants</li>