Browse Source

pastojs: error on var absolute

git-svn-id: trunk@36811 -
Mattias Gaertner 8 years ago
parent
commit
4a588fcbc2
2 changed files with 19 additions and 0 deletions
  1. 6 0
      packages/pastojs/src/fppas2js.pp
  2. 13 0
      packages/pastojs/tests/tcmodules.pas

+ 6 - 0
packages/pastojs/src/fppas2js.pp

@@ -248,6 +248,7 @@ Works:
 - dotted unit names, namespaces
 - dotted unit names, namespaces
 
 
 ToDos:
 ToDos:
+- ignore attributes
 - constant evaluation
 - constant evaluation
 - static arrays
 - static arrays
 - property index specifier
 - property index specifier
@@ -1988,6 +1989,11 @@ var
   ParentC: TClass;
   ParentC: TClass;
 begin
 begin
   inherited FinishVariable(El);
   inherited FinishVariable(El);
+
+  if El.AbsoluteLocation<>'' then
+    RaiseMsg(20170728133340,nInvalidVariableModifier,
+      sInvalidVariableModifier,['absolute'],El);
+
   ParentC:=El.Parent.ClassType;
   ParentC:=El.Parent.ClassType;
   if (ParentC=TPasClassType) then
   if (ParentC=TPasClassType) then
     begin
     begin

+ 13 - 0
packages/pastojs/tests/tcmodules.pas

@@ -191,6 +191,7 @@ type
     Procedure TestLocalConst;
     Procedure TestLocalConst;
     Procedure TestVarExternal;
     Procedure TestVarExternal;
     Procedure TestVarExternalOtherUnit;
     Procedure TestVarExternalOtherUnit;
+    Procedure TestVarAbsoluteFail;
 
 
     // numbers
     // numbers
     Procedure TestDouble;
     Procedure TestDouble;
@@ -3743,6 +3744,18 @@ begin
     '']) );
     '']) );
 end;
 end;
 
 
+procedure TTestModule.TestVarAbsoluteFail;
+begin
+  StartProgram(false);
+  Add([
+  'var',
+  '  a: longint;',
+  '  b: longword absolute a;',
+  'begin']);
+  SetExpectedPasResolverError('Invalid variable modifier "absolute"',nInvalidVariableModifier);
+  ConvertProgram;
+end;
+
 procedure TTestModule.TestDouble;
 procedure TTestModule.TestDouble;
 begin
 begin
   StartProgram(false);
   StartProgram(false);