-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing typeParameter resolve bugs and adding tests (also fixed reific…
…ation bug in bnf)
- Loading branch information
Showing
18 changed files
with
326 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 48 additions & 68 deletions
116
src/main/java/com/intellij/plugins/haxe/ide/annotator/semantics/HaxeCallExpressionUtil.java
Large diffs are not rendered by default.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/main/java/com/intellij/plugins/haxe/ide/annotator/semantics/TypeParameterTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.intellij.plugins.haxe.ide.annotator.semantics; | ||
|
||
import com.intellij.plugins.haxe.model.type.ResultHolder; | ||
import com.intellij.plugins.haxe.model.type.resolver.ResolveSource; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class TypeParameterTable { | ||
|
||
private record typeAndSource(ResultHolder type, ResolveSource resolveSource) {} | ||
|
||
Map<String, typeAndSource> data = new HashMap<>(); | ||
|
||
public void put(@NotNull String name, ResultHolder holder, ResolveSource scope) { | ||
data.put(name, new typeAndSource(holder, scope)); | ||
} | ||
|
||
public boolean contains(String name) { | ||
return data.containsKey(name); | ||
} | ||
public boolean contains(@NotNull String name, @NotNull ResolveSource scope) { | ||
return data.entrySet().stream().anyMatch(entry -> entry.getKey().equals(name) && entry.getValue().resolveSource().equals(scope)); | ||
} | ||
|
||
@Nullable | ||
public ResultHolder get(@NotNull String name) { | ||
if(!contains(name)) return null; | ||
return data.get(name).type(); | ||
} | ||
@Nullable | ||
public ResultHolder get(@NotNull String name, ResolveSource scope) { | ||
return data.entrySet().stream().filter(entry -> entry.getKey().equals(name) && entry.getValue().resolveSource().equals(scope)) | ||
.findFirst() | ||
.map(entry -> entry.getValue().type) | ||
.orElse(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.