Beispiel #1
0
        internal static IVersioned GetAggregate(IVersioned from, ProjectEntry with) {
            if (from == with) {
                // No aggregation
                return from;
            }

            if (from is AggregateProjectEntry) {
                // We can use our fast check to see if we're already in the aggregate
                // or if we have a known transition.
                return ((AggregateProjectEntry)from).AggregateWith(with);
            }

            // We're aggregating two random project entries.
            Debug.Assert(from is IProjectEntry);
            return with.ProjectState.GetAggregate((IProjectEntry)from, with);
        }
Beispiel #2
0
        public CalledFunctionAnalysisUnit(IVersioned agg, FunctionAnalysisUnit originalUnit, CallChain callChain, ArgumentSet callArgs)
            : base(originalUnit.Function, originalUnit._declUnit)
        {
            _originalUnit = originalUnit;
            _agg = agg;
            CallChain = callChain;

            var scope = new FunctionScope(
                Function,
                Ast,
                originalUnit.Scope.OuterScope,
                originalUnit.DeclaringModule.ProjectEntry
            );
            scope.UpdateParameters(this, callArgs, false, originalUnit.Scope as FunctionScope);
            _scope = scope;

            var walker = new OverviewWalker(_originalUnit.ProjectEntry, this, Tree);
            if (Ast.Body != null) {
                Ast.Body.Walk(walker);
            }

            AnalysisLog.NewUnit(this);
            Enqueue();
        }
        private void UpdateVersionId(IVersioned data)
        {
            if (data.VersionId != Guid.Empty)
            {
                return;
            }

            if (data is IPage)
            {
                var page = (IPage)data;

                Guid versionId;

                if (_pageVersionIds.TryGetValue(page.Id, out versionId))
                {
                    page.VersionId = versionId;
                }
                else
                {
                    page.VersionId = Guid.NewGuid();
                    _pageVersionIds[page.Id] = page.VersionId;
                }
            }

            else if (data is IPagePlaceholderContent)
            {
                Guid pageId = ((IPagePlaceholderContent)data).PageId;
                Guid versionId;

                if (_pageVersionIds.TryGetValue(pageId, out versionId))
                {
                    data.VersionId = versionId;
                }
            }
            else if (data is IPageData)
            {
                Guid pageId = ((IPageData)data).PageId;
                Guid versionId;

                if (_pageVersionIds.TryGetValue(pageId, out versionId))
                {
                    data.VersionId = versionId;
                }
            }
        }
Beispiel #4
0
 public bool AddAssignment(EncodedLocation location, IVersioned entry)
 {
     return(GetDependentItems(entry).AddAssignment(location));
 }
        protected void RisePublishVersionInfo(IVersioned container)
        {
            if (!this.Visible)
                return;

            if (PublishVersionInfo != null)
            {
                PublishVersionInfo(this, new VersionEventArgs()
                {
                    UserID = container.UserID,
                    Date = container.Date,
                    Version = container.Version
                });
            }
        }
Beispiel #6
0
        protected static bool IsVisible(IVersioned accessor, IVersioned declaringScope, IVersioned assigningScope)
        {
            return(true);

            /*
             * if (accessor != null && accessor.IsVisible(assigningScope)) {
             *  return true;
             * }
             * if (declaringScope != null && declaringScope.IsVisible(assigningScope)) {
             *  return true;
             * }
             * return false;*/
        }
Beispiel #7
0
 public bool AddReference(EncodedLocation location, IVersioned module)
 {
     return(GetDependentItems(module).AddReference(location));
 }
 public ApplyOrderEditCommand(IVersioned <OrderEdit> orderEdit, int resourceVersion)
     : base(orderEdit.Id, orderEdit.Version, resourceVersion)
 {
 }
 public DeleteByIdCommand(IVersioned <T> versioned, List <Expansion <T> > expandPredicates)
     : base(expandPredicates)
 {
     this.Init(versioned.Id, versioned.Version);
 }
 public DeleteByIdCommand(IVersioned <T> versioned, IAdditionalParameters <T> additionalParameters)
     : base(additionalParameters)
 {
     this.Init(versioned.Id, versioned.Version);
 }
 public DeleteByIdCommand(IVersioned <T> versioned)
 {
     this.Init(versioned.Id, versioned.Version);
 }
Beispiel #12
0
        public bool AddTypes(IVersioned projectEntry, IAnalysisSet newTypes, bool enqueue = true, IProjectEntry declaringScope = null)
        {
            object dummy;

            if (LockedVariableDefs.TryGetValue(this, out dummy))
            {
                return(false);
            }

            bool added = false;

            if (newTypes.Count > 0)
            {
                var dependencies = GetDependentItems(projectEntry);

                foreach (var value in newTypes)
                {
#if DEBUG || FULL_VALIDATION
                    if (ENABLE_SET_CHECK)
                    {
                        bool testAdded;
                        var  original   = dependencies.ToImmutableTypeSet();
                        var  afterAdded = original.Add(value, out testAdded, false);
                        if (afterAdded.Comparer == original.Comparer)
                        {
                            if (testAdded)
                            {
                                if (!ObjectComparer.Instance.Equals(afterAdded, original))
                                {
                                    // Double validation, as sometimes testAdded is a false positive
                                    afterAdded = original.Add(value, out testAdded, false);
                                    if (testAdded)
                                    {
                                        Validation.Assert(!ObjectComparer.Instance.Equals(afterAdded, original), $"Inconsistency adding {value} to {original}");
                                    }
                                }
                            }
                            else if (afterAdded.Count == original.Count)
                            {
                                Validation.Assert(ObjectComparer.Instance.Equals(afterAdded, original), $"Inconsistency not adding {value} to {original}");
                            }
                        }
                    }
#endif

                    if (dependencies.AddType(value))
                    {
                        added = true;
                    }
                }
            }

            if (added)
            {
                _cache = null;
            }
            if (added && enqueue)
            {
                EnqueueDependents(projectEntry, declaringScope);
            }

            return(added);
        }