diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-11-19 12:04:03 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-11-19 12:04:03 +0000 |
| commit | 4442967b63bbd8fb6be62e5fc3a3e24c4d33dd40 (patch) | |
| tree | 5047b6eefe2c0502fa8308aea565ab1d10e5abd8 /src/main/java | |
| parent | 44ec3bf7edfb45ec27f0ae8cc8c81d4f9bf42eab (diff) | |
Add accessor for effect tags
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java index 155e391f..85efa16b 100644 --- a/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java +++ b/src/main/java/org/shedlang/compiler/patio/PatioCodeGenContext.java @@ -87,6 +87,16 @@ public record PatioCodeGenContext( return tag; } } + + public int effectTag(UserDefinedEffect effect) { + var tag = this.effectTags.get(effect); + if (tag == null) { + // TODO: throw better error + throw new RuntimeException("No tag for: " + effect); + } else { + return tag; + } + } } public record CompilationUnitContext( @@ -297,6 +307,10 @@ public record PatioCodeGenContext( return globalContext.structTag(type); } + public int effectTag(UserDefinedEffect effect) { + return globalContext.effectTag(effect); + } + public PatioCodeGenResult<String> allocateCompilationUnitElementName( PatioCodeGenCompilationUnitElementSpace space, String name |
