Code that is excluded by conditional compilation still results in compile time errors

That’s the only syntax issue I have found so far, however this behaviour is causing a lot of other errors in a codebase that currently compiles in Delphi .NET and Win32.
For example, when keywords such as type and const are used inside conditional compile statements.

type
  test1 = String;
{$IFNDEF DOTNET}
  test2 = String;
const
  test3 = 1;
{$ENDIF}

Result:

(E279) No matching $IFDEF for $ENDIF
(E1) {$ENDIF} expected, got const

I’m also seeing errors relating to method implementations not being found, I’m still looking into this but I think at least one case is when the IFDEF condition doesn’t match exactly, e.g. IFDEF around the declaration and the implementation is contained in the ELSE block of an IFNDEF.