View Issue Details

IDProjectCategoryView StatusLast Update
0037920pas2jstranspilerpublic2020-11-05 18:40
Reporterhenrique Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPas2JsOSWindows 
Summary0037920: Custom attribute is being linked to the procedure and not the class
DescriptionCustom attribute is being linked to the class constructor, not the class in the example I attached.

And if you declare an attribute for a class procedure, the link is not created in the generated JS.
TagsNo tags attached.
Fixed in Revision
Attached Files

Activities

henrique

2020-10-13 20:39

reporter  

Error.zip (551 bytes)

Mattias Gaertner

2020-10-28 22:02

manager   ~0126618

Attributes are only supported for published fields and methods.

henrique

2020-10-28 22:19

reporter   ~0126624

Is this too complicated to implement to be bound to the attribute to the class?

Mattias Gaertner

2020-10-30 14:38

manager   ~0126655

You lost me.
What do you mean with "bound to the class"?

Sven Barth

2020-10-30 14:59

developer   ~0126659

@henrique: if you mean attributes that are bound to the class type, then that already works (except for 0037919). What does not work are non-published properties, methods and fields, because - like constructors in your other report - this requires Extended RTTI.

henrique

2020-10-30 15:10

reporter   ~0126661

@Mattias, I'm using a translator, because my English is not very good!

@PascalDragon, I attached the example, because apparently the attribute I put is not in the class, but in the class constructor.

Mattias Gaertner

2020-11-02 18:36

manager   ~0126699

I get the following code:

rtl.module("UnitError",["System"],function () {
  "use strict";
  var $mod = this;
  rtl.createClass(this,"MyClassAttribute",pas.System.TCustomAttribute,function () {
  });
  rtl.createClass(this,"TMyClass",pas.System.TObject,function () {
    var $r = this.$rtti;
    $r.attr = [$mod.MyClassAttribute,"Create"];
  });
  this.MakeError = function () {
    var MyClass = null;
    MyClass = $mod.TMyClass.$create("Create");
  };
});

What do you suggest?

henrique

2020-11-05 14:51

reporter   ~0126754

First, sorry for the delay in the response!

Second, I opened this task incorrectly, the attributes are actually working as expected.

What I need is for the attributes to work in public functions, but as mentioned, it needs the extended RTTI.

Mattias Gaertner

2020-11-05 18:40

manager   ~0126760

Fixed "the link is not created in the generated JS"
Attributes of non published properties will be supported by extended RTTI.

Issue History

Date Modified Username Field Change
2020-10-13 20:39 henrique New Issue
2020-10-13 20:39 henrique File Added: Error.zip
2020-10-13 22:26 Mattias Gaertner Assigned To => Mattias Gaertner
2020-10-13 22:26 Mattias Gaertner Status new => assigned
2020-10-28 22:02 Mattias Gaertner Status assigned => resolved
2020-10-28 22:02 Mattias Gaertner Resolution open => fixed
2020-10-28 22:02 Mattias Gaertner Note Added: 0126618
2020-10-28 22:19 henrique Note Added: 0126624
2020-10-30 14:38 Mattias Gaertner Status resolved => feedback
2020-10-30 14:38 Mattias Gaertner Resolution fixed => open
2020-10-30 14:38 Mattias Gaertner Note Added: 0126655
2020-10-30 14:59 Sven Barth Note Added: 0126659
2020-10-30 15:10 henrique Note Added: 0126661
2020-10-30 15:10 henrique Status feedback => assigned
2020-11-02 18:36 Mattias Gaertner Note Added: 0126699
2020-11-05 14:51 henrique Note Added: 0126754
2020-11-05 18:40 Mattias Gaertner Status assigned => resolved
2020-11-05 18:40 Mattias Gaertner Resolution open => fixed
2020-11-05 18:40 Mattias Gaertner Note Added: 0126760