Skip to content

Commit afe38e8

Browse files
committed
The #= on Symbol and String should be symmetric
- it’s only defined in String - there’s no hint that it should behave differently in Symbol which is a subclass - so, we really should just consider the string content when comparing #foobar = ‘foobar’ Signed-off-by: Stefan Marr <[email protected]>
1 parent 5f52eef commit afe38e8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/som/primitives/SymbolPrimitives.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import { Primitives } from './Primitives.js';
2525

2626
import { universe } from '../vm/Universe.js';
27+
import { SString } from '../vmobjects/SString.js';
2728

2829
function _asString(_frame, args) {
2930
return universe.newString(args[0].getString());
@@ -35,6 +36,10 @@ function _equals(_frame, args) {
3536
if (op1 === op2) {
3637
return universe.trueObject;
3738
}
39+
40+
if (op1 instanceof SString && op1.getEmbeddedString() === op2.getEmbeddedString()) {
41+
return universe.trueObject;
42+
}
3843
return universe.falseObject;
3944
}
4045

0 commit comments

Comments
 (0)