pastojs: error on var absolute

git-svn-id: trunk@36811 -
This commit is contained in:
Mattias Gaertner 2017-07-28 17:50:52 +00:00
parent e266fd75e0
commit 4a588fcbc2
2 changed files with 19 additions and 0 deletions

View File

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

View File

@ -191,6 +191,7 @@ type
Procedure TestLocalConst;
Procedure TestVarExternal;
Procedure TestVarExternalOtherUnit;
Procedure TestVarAbsoluteFail;
// numbers
Procedure TestDouble;
@ -3743,6 +3744,18 @@ begin
'']) );
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;
begin
StartProgram(false);