summaryrefslogtreecommitdiffstats
path: root/source/slang/mangle.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-11-07 09:38:32 -0800
committerTim Foley <tfoley@nvidia.com>2017-11-07 10:44:07 -0800
commit93a444fe1b5f1e3c6da67db4d948df53a0bdb3f6 (patch)
tree86e77146bb56f2b486b9705805b80d4520147433 /source/slang/mangle.cpp
parent9640df03814593d2f4b34c36bbec6756b1ed7fba (diff)
Attach correct types to subscript accessors
Subscript declarations can have nested "accessor" declarations for the get/set behavior: ``` __subscript(int index) -> float { get { ... } set { ... } } ``` The AST type checks an expression like `a[i]` into a call to an appropriate `__subscript` declaration, and reads the return type off of that, but doesn't drill down to the individual getters/setters. During IR code generation, we need to resolve a call to the subscript operation down to the actual getter or setter, since those are what will have the executable code (or be intrinsics). If we have a non-intrinsic accessor, then we end up asking for its "return type" and get NULL, which crashes the compiler. The fix in this case is to add a bit more semantic checking for accessors, mostly just so that we can have them copy the return type from their parent declaration. While we are at it, this change goes ahead and has an accessor validate that the parent declaration is one that should be allowed, and emit a diagnostic if it is nested in an improper place.
Diffstat (limited to 'source/slang/mangle.cpp')
0 files changed, 0 insertions, 0 deletions