public void AddReferencableObject(string name, ProcessBlock scope, Type type, object referencableObject)
        {
            ReferencableObject           referenceType = new ReferencableObject(scope, type);
            IDictionary <string, object> referencables = null;

            if (!referencableObjects.ContainsKey(referenceType))
            {
                referencables = new Dictionary <string, object>();
                referencableObjects.Add(referenceType, referencables);
            }
            else
            {
                referencables = referencableObjects[referenceType];
            }

            referencables.Add(name, referencableObject);
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            ReferencableObject refObject = obj as ReferencableObject;

            if (refObject == null)
            {
                return(false);
            }

            return(refObject.Type.Equals(this.Type) &&
                   refObject.Scope.Equals(this.Scope));
        }
        private Object FindInScope(UnresolvedReference unresolvedReference, ProcessBlock scope)
        {
            Object referencedObject = null;

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

                var referencables = referencableObjects[referenceType];

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

            return(referencedObject);
        }