Skip to content

Commit

Permalink
Exclude NoConstFold from Typemaker Type var
Browse files Browse the repository at this point in the history
  • Loading branch information
out-of-phaze committed Feb 23, 2025
1 parent eb945b9 commit 004b1d9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DMCompiler/DM/DMValueType.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace DMCompiler.DM;
namespace DMCompiler.DM;

// If you are modifying this, you must also modify OpenDreamShared.Dream.DreamValueType !!
// Unfortunately the client needs this and it can't reference DMCompiler due to the sandbox
Expand Down Expand Up @@ -59,7 +59,7 @@ public readonly struct DMComplexValueType {
public readonly DMListValueTypes? ListValueTypes;

public DMComplexValueType(DMValueType type, DreamPath? typePath) {
Type = type & ~(DMValueType.Unimplemented | DMValueType.CompiletimeReadonly); // Ignore these 2 types
Type = type & ~(DMValueType.Unimplemented | DMValueType.CompiletimeReadonly | DMValueType.NoConstFold); // Ignore these 3 types
TypePath = typePath;
IsUnimplemented = type.HasFlag(DMValueType.Unimplemented);
IsCompileTimeReadOnly = type.HasFlag(DMValueType.CompiletimeReadonly);
Expand Down Expand Up @@ -96,6 +96,8 @@ internal bool MatchesType(DMCompiler compiler, DMComplexValueType type) {
}
var theirPath = type.AsPath();

Check warning

Code scanning / InspectCode

Incorrect blank lines: Blank lines are missing elsewhere Warning

Blank lines are missing, expected minimum 1 instead of 0
if (type.ListValueTypes is null && theirPath is not null) {
if (theirPath == TypePath!.Value) // exception for /icon and similar, which may not have entries in the object tree

Check warning

Code scanning / InspectCode

Redundant nullable warning suppression expression Warning

The nullable warning suppression expression is redundant
return true;
compiler.DMObjectTree.TryGetDMObject(theirPath!.Value, out var theirObject);
if (theirObject?.IsSubtypeOf(TypePath!.Value) is true) {
return true;
Expand Down

0 comments on commit 004b1d9

Please sign in to comment.