Skip to content

Commit

Permalink
Update an old ForcedError (#1634)
Browse files Browse the repository at this point in the history
Co-authored-by: ike709 <[email protected]>
Co-authored-by: wixoaGit <[email protected]>
  • Loading branch information
3 people authored Feb 12, 2024
1 parent e38ea14 commit e6a174f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 1 addition & 5 deletions DMCompiler/DM/DMProc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,7 @@ public void CreateListEnumerator() {
WriteOpcode(DreamProcOpcode.CreateListEnumerator);
}

public void CreateFilteredListEnumerator(DreamPath filterType) {
if (!DMObjectTree.TryGetTypeId(filterType, out var filterTypeId)) {
DMCompiler.ForcedError($"Cannot filter enumeration by type {filterType}");
}

public void CreateFilteredListEnumerator(int filterTypeId) {
WriteOpcode(DreamProcOpcode.CreateFilteredListEnumerator);
WriteInt(filterTypeId);
}
Expand Down
10 changes: 8 additions & 2 deletions DMCompiler/DM/Visitors/DMProcBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,14 @@ public void ProcessStatementForList(DMExpression list, DMExpression outputVar, D

list.EmitPushValue(_dmObject, _proc);
if (implicitTypeCheck != null) {
// Create an enumerator that will do the implicit istype() for us
_proc.CreateFilteredListEnumerator(implicitTypeCheck.Value);
if (DMObjectTree.TryGetTypeId(implicitTypeCheck.Value, out var filterTypeId)) {
// Create an enumerator that will do the implicit istype() for us
_proc.CreateFilteredListEnumerator(filterTypeId);
} else {
DMCompiler.Emit(WarningCode.ItemDoesntExist, outputVar.Location,
$"Cannot filter enumeration by type {implicitTypeCheck.Value}, it does not exist");
_proc.CreateListEnumerator();
}
} else {
_proc.CreateListEnumerator();
}
Expand Down
1 change: 1 addition & 0 deletions OpenDream.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=ispath/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=issaved/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=isturf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=istype/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=keybind/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lerp/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=lerping/@EntryIndexedValue">True</s:Boolean>
Expand Down

0 comments on commit e6a174f

Please sign in to comment.