Skip to content

Commit 799a06e

Browse files
author
robertDurst
committed
fix for calling method and attribute on attribute
1 parent 6a6e98e commit 799a06e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

examples/test.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ start {
55
dec Foo f = new Foo {i: 10, s: empty}
66
dec Foo b = new Foo {i: 11, s: f}
77

8-
f = b.s...self(void)
8+
f.i = b.s.i
99
}

src/sailfish/sailfishc.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,10 +1450,14 @@ sailfishc::parseAttributeAccess(const std::string& udtname,
14501450
attributeAccessStack.push_back(std::make_tuple(udtname, attribute));
14511451
else
14521452
{
1453-
if (udtname != "own")
1454-
targetBuffer += udtname;
1455-
else
1456-
targetBuffer += "this";
1453+
if (attributeAccessStack.size() <= 1 && methodAccessStack.size() == 0 &&
1454+
!udttable->hasUDT(udtname)) // bandaid solution
1455+
{
1456+
if (udtname != "own")
1457+
targetBuffer += udtname;
1458+
else
1459+
targetBuffer += "this";
1460+
}
14571461
targetBuffer += "->" + builtinTypesTranslator(attribute);
14581462
}
14591463

0 commit comments

Comments
 (0)