Skip to content

Adds PreIncrement & PreDecrement opcodes; fixes comparison operators#2666

Open
ike709 wants to merge 4 commits into
OpenDreamProject:masterfrom
ike709:preop_time
Open

Adds PreIncrement & PreDecrement opcodes; fixes comparison operators#2666
ike709 wants to merge 4 commits into
OpenDreamProject:masterfrom
ike709:preop_time

Conversation

@ike709

@ike709 ike709 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

The new unit tests passed in BYOND but not OpenDream.

This fixes ++/-- the parity issue by creating dedicated PreIncrement/PreDecrement opcodes with matching behavior. Deduplicated the opcode handlers with a shared helper method.

This also fixes the greater than / less than comparison operators (and the "or equals to" variants) with some types.

@ike709
ike709 requested a review from wixoaGit July 18, 2026 10:01
@boring-cyborg boring-cyborg Bot added Compiler Involves the OpenDream compiler Runtime Involves the OpenDream server/runtime labels Jul 18, 2026
@ike709 ike709 changed the title Adds PreIncrement & PreDecrement opcodes Adds PreIncrement & PreDecrement opcodes; fixes comparison operators Jul 18, 2026
@github-actions github-actions Bot added size/L and removed size/M labels Jul 18, 2026
Comment on lines +2999 to +3004
private static bool IsReferenceComparisonType(DreamValue.DreamValueType type) {
return type is DreamValue.DreamValueType.DreamObject or
DreamValue.DreamValueType.DreamProc or
DreamValue.DreamValueType.DreamResource or
DreamValue.DreamValueType.DreamType;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the maintainability issue this creates. BYOND doesn't make this sort of "reference type" distinction, would it be more accurate to say this applies to anything that isn't a number, null, or string?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably? I'd need to find time this weekend for further testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compiler Involves the OpenDream compiler Runtime Involves the OpenDream server/runtime size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants