Skip to content

Attributes does not recognized for sub-classes

Summary

We porting our code from Delphi to Lazarus (our goal is native Linux support). In Delphi, we've used custom attributes for class markup. In FreePascal, it seems all works fine for top-level classes, but does not work for sub-classes (classes that defined inside another class). In this case, we've get a compilation error. I did some research and tried to improve the compiler. I've attached my proposed solution.

System Information

  • Operating system: Alt.Linux 10.2
  • Processor architecture: x86-64
  • Compiler version: trunk
  • Device: Computer

Example Project

Here an example project: test.lpr

What is the current bug behavior?

Currently, I got the following error: test.lpr(20,5) Error: Syntax error, "identifier" expected but "[" found

What is the expected (correct) behavior?

No error, correct rtti information for sub-class.

Possible fixes

Suggested patch for the compiler: 11.fpc_attributes_for_sub-types.patch

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information