summaryrefslogtreecommitdiffstats
path: root/source/slang/check.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-11-07 16:55:08 -0500
committerGitHub <noreply@github.com>2017-11-07 16:55:08 -0500
commit417c9f3939e0545125317f49316a6dfb060d6c2c (patch)
treeb7560ff41a43cda235ab7db8a19fd2371e3f7ba8 /source/slang/check.cpp
parentd1b45f3059e100d096327eb178c1bac365e564f1 (diff)
parenta54364303241e3cd7c3d075ee1dd4164915d939f (diff)
Merge pull request #256 from tfoleyNV/falcor-integration-work
Falcor integration work
Diffstat (limited to 'source/slang/check.cpp')
-rw-r--r--source/slang/check.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index ed2ed4a1b..6bb7c232f 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -3471,11 +3471,33 @@ namespace Slang
decl->SetCheckState(DeclCheckState::CheckedHeader);
+ for(auto mm : decl->Members)
+ {
+ checkDecl(mm);
+ }
+
decl->SetCheckState(DeclCheckState::Checked);
}
void visitAccessorDecl(AccessorDecl* decl)
{
+ // An acessor must appear nested inside a subscript declaration (today),
+ // or a property declaration (when we add them). It will derive
+ // its return type from the outer declaration, so we handle both
+ // of these checks at the same place.
+ auto parent = decl->ParentDecl;
+ if(auto parentSubscript = dynamic_cast<SubscriptDecl*>(parent))
+ {
+ decl->ReturnType = parentSubscript->ReturnType;
+ }
+ // TODO: when we add "property" declarations, check for them here
+ else
+ {
+ getSink()->diagnose(decl, Diagnostics::accessorMustBeInsideSubscriptOrProperty);
+ }
+
+ decl->SetCheckState(DeclCheckState::CheckedHeader);
+
// TODO: check the body!
decl->SetCheckState(DeclCheckState::Checked);