コード例 #1
0
        public override bool IsVisible(LocationReference locationReference)
        {
            if (locationReference == null)
            {
                throw FxTrace.Exception.ArgumentNull("locationReference");
            }

            LocationReferenceEnvironment currentScope = this;

            while (currentScope != null)
            {
                ActivityLocationReferenceEnvironment activityEnvironment = currentScope as ActivityLocationReferenceEnvironment;

                if (activityEnvironment != null)
                {
                    if (activityEnvironment.declarations != null)
                    {
                        foreach (LocationReference declaration in activityEnvironment.declarations.Values)
                        {
                            if (locationReference == declaration)
                            {
                                return(true);
                            }
                        }
                    }

                    if (activityEnvironment.unnamedDeclarations != null)
                    {
                        for (int i = 0; i < activityEnvironment.unnamedDeclarations.Count; i++)
                        {
                            if (locationReference == activityEnvironment.unnamedDeclarations[i])
                            {
                                return(true);
                            }
                        }
                    }
                }
                else
                {
                    return(currentScope.IsVisible(locationReference));
                }

                currentScope = currentScope.Parent;
            }

            return(false);
        }
コード例 #2
0
 public override bool IsVisible(LocationReference locationReference)
 {
     if (locationReference == null)
     {
         throw FxTrace.Exception.ArgumentNull("locationReference");
     }
     for (LocationReferenceEnvironment environment = this; environment != null; environment = environment.Parent)
     {
         ActivityLocationReferenceEnvironment environment2 = environment as ActivityLocationReferenceEnvironment;
         if (environment2 == null)
         {
             return(environment.IsVisible(locationReference));
         }
         if (environment2.declarations != null)
         {
             foreach (LocationReference reference in environment2.declarations.Values)
             {
                 if (locationReference == reference)
                 {
                     return(true);
                 }
             }
         }
         if (environment2.unnamedDeclarations != null)
         {
             for (int i = 0; i < environment2.unnamedDeclarations.Count; i++)
             {
                 if (locationReference == environment2.unnamedDeclarations[i])
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }