コード例 #1
0
        private void addReferencableObject(String name, ProcessBlockImpl scope, Type type, Object referencableObject)
        {
            ReferencableObject referencableObjectScope = new ReferencableObject(scope, type);

            if (referencableObjects.ContainsKey(referencableObjectScope) == false)
            {
                referencableObjects[referencableObjectScope] = new Dictionary <string, object>();
            }

            var referenceObjectsByScope = this.referencableObjects[referencableObjectScope];

            referenceObjectsByScope.Add(name, referencableObject);
        }
コード例 #2
0
        private Object FindInScope(UnresolvedReference unresolvedReference, ProcessBlockImpl scope)
        {
            Object referencedObject = null;

            if (scope != null)
            {
                ReferencableObject referenceType = new ReferencableObject(scope, unresolvedReference.DestinationType);

                if ((referencableObjects.ContainsKey(referenceType) == true))
                {
                    IDictionary referencables = (IDictionary)referencableObjects[referenceType];
                    if (referencables != null && referencables.Contains(unresolvedReference.DestinationName))
                    {
                        referencedObject = referencables[unresolvedReference.DestinationName];
                    }
                }
                else
                {
                    referencedObject = FindInScope(unresolvedReference, scope.ParentBlock);
                }
            }

            return(referencedObject);
        }