Skip to content

Commit f18d7ad

Browse files
authored
Merge pull request #88 from ChanyaKushima/master
Fix the issue that an exception occurs when writing `return;` in setter…
2 parents 603ae98 + ec17a46 commit f18d7ad

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Assets/UdonSharp/Editor/UdonSharpASTVisitor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ public override void VisitPropertyDeclaration(PropertyDeclarationSyntax node)
557557
Debug.Assert(visitorContext.returnLabel == null, "Return label must be null");
558558
var returnLabel = visitorContext.labelTable.GetNewJumpLabel("return");
559559
visitorContext.returnLabel = returnLabel;
560+
visitorContext.returnSymbol = null;
560561

561562
visitorContext.uasmBuilder.AddJumpLabel(setter.entryPoint);
562563

Assets/UdonSharp/Tests/TestScripts/Core/PropertyTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public int MyIntBackedProperty
2525
get { return backingField; }
2626
set
2727
{
28+
if (value == 222)
29+
return;
30+
2831
MyIntProperty = value;
2932
backingField = value;
3033
}
@@ -85,6 +88,9 @@ public void ExecuteTests()
8588
MyIntBackedProperty = 8;
8689
tester.TestAssertion("Property manual setter", MyIntProperty == 8 && MyIntBackedProperty == 8);
8790

91+
MyIntBackedProperty = 222;
92+
tester.TestAssertion("Property setter return", MyIntBackedProperty == 8);
93+
8894
PropertyTest[] selfArr = new PropertyTest[] { this };
8995

9096
selfArr[0].MyIntProperty = 10;

0 commit comments

Comments
 (0)