Skip to content

Commit ebdde76

Browse files
committed
Make property accessor accessible to declared types.
1 parent 40c7842 commit ebdde76

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/main/java/org/byteskript/skript/compiler/structure/PropertyAccessGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void addUse(Type type, Method method) {
5151

5252
public void compile(Context context) {
5353
final MethodBuilder method = context.getBuilder().addMethod("property_" + type.name() + "$" + name);
54-
method.setModifiers(Modifier.PRIVATE | Modifier.STATIC | 0x00001000); // synth | 0x00001000
54+
method.setModifiers(Modifier.PUBLIC | Modifier.STATIC | 0x00001000); // synth | 0x00001000
5555
if (this.type.expectReturn()) method.setReturnType(CommonTypes.OBJECT);
5656
else method.setReturnType(new Type(void.class));
5757
method.addParameter(CommonTypes.OBJECT); // holder

src/test/resources/properties.bsk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ function basic_use:
3535
assert blob of {thing} is null: "Empty field was set somehow."
3636
assert blob() from {thing} is "hello": "Function access failed."
3737

38+
39+
type Foo:
40+
property blob:
41+
3842
type Blob:
3943
property name:
4044
type: String
@@ -46,6 +50,10 @@ type Blob:
4650
trigger:
4751
set (house of (this object)) to {house}
4852
assert house of this object is {house}: "Set comparison failed."
53+
set {foo} to a new Foo
54+
assert {foo} exists: "Creating type in type failed."
55+
set blob of {foo} to 5
56+
assert blob of {foo} is 5: "Other type property set failed."
4957

5058
function simple_example: // todo - check other property accessors inside types
5159
trigger:

0 commit comments

Comments
 (0)