コード例 #1
0
        public void GetSupertypesReturnsAnEmptyEnumerableForDeclarationsWithDeclarationTypeClassModuleWhichAreNoClassModuleDeclarations()
        {
            var projectDeclaration = GetTestProject("testProject");
            var fakeClassModule    = GetTestFakeClassModule(projectDeclaration, "testFakeClass");

            Assert.IsFalse(ClassModuleDeclaration.GetSupertypes(fakeClassModule).Any());
        }
コード例 #2
0
        public void GetSupertypesReturnsAnEmptyEnumerableForProceduralModules()
        {
            var projectDeclaration = GetTestProject("testProject");
            var proceduralModule   = GetTestProceduralModule(projectDeclaration, "testModule");

            Assert.IsFalse(ClassModuleDeclaration.GetSupertypes(proceduralModule).Any());
        }
コード例 #3
0
        public void GetSupertypesReturnsTheSupertypesOfAClassModule()
        {
            var projectDeclaration = GetTestProject("testProject");
            var supertype          = GetTestClassModule(projectDeclaration, "testSupertype", true, null);
            var classModule        = GetTestClassModule(projectDeclaration, "testClass", true, null);

            classModule.AddSupertype(supertype);

            Assert.AreEqual(supertype, ClassModuleDeclaration.GetSupertypes(classModule).First());
        }
コード例 #4
0
 private static bool IsEnclosingModule(Declaration callingModule, Declaration calleeMember)
 {
     if (callingModule.Equals(calleeMember.ParentScopeDeclaration))
     {
         return(true);
     }
     foreach (var supertype in ClassModuleDeclaration.GetSupertypes(callingModule))
     {
         if (IsEnclosingModule(supertype, calleeMember))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #5
0
 private static bool IsInstanceMemberOfModuleOrOneOfItsSupertypes(Declaration module, Declaration member)
 {
     return(IsInstanceMemberOfModule(module, member) ||
            ClassModuleDeclaration.GetSupertypes(module).Any(supertype => IsInstanceMemberOfModuleOrOneOfItsSupertypes(supertype, member)));         //ClassModuleDeclaration.GetSuperTypes never returns null.
 }