Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #537 interop with ConcatenatedString can throw exception #630

Merged
merged 1 commit into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions Jint.Tests/Runtime/InteropTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1814,5 +1814,15 @@ public void ArrayFromShouldConvertIEnumerable()
");
}

[Fact]
public void ShouldBeAbleToPlusAssignStringProperty()
{
var p = new Person();
var engine = new Engine();
engine.SetValue("P", p);
engine.Execute("P.Name = 'b';");
engine.Execute("P.Name += 'c';");
Assert.Equal("bc", p.Name);
}
}
}
5 changes: 1 addition & 4 deletions Jint/Native/JsString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,7 @@ internal override bool IsNullOrEmpty()

public override int Length => _stringBuilder?.Length ?? _value?.Length ?? 0;

public override object ToObject()
{
return _stringBuilder.ToString();
}
public override object ToObject() => ToString();

public override bool Equals(JsValue other)
{
Expand Down