Beispiel #1
0
        internal void AddScopeIdentifier(int blockId, int classId, int procId,
                                         int startLine, int startColumn, int endLine, int endColumn, string scriptPath)
        {
            // Generated methods, built-in functions, class getters/setters
            // have no valid source location information, skip processing them.
            if (startLine < 0 || (startColumn < 0) || endLine < 0 || (endColumn < 0))
            {
                return;
            }

            if (null == scopeIdentifiers)
            {
                scopeIdentifiers = new Dictionary <ScopeInfo, CodeRange>();
            }

            ScopeInfo scope = new ScopeInfo()
            {
                BlockId       = blockId,
                ClassScope    = classId,
                FunctionIndex = procId
            };

            if (scopeIdentifiers.ContainsKey(scope))
            {
                throw new InvalidOperationException("No two scopes should be identical!");
            }

            scopeIdentifiers[scope] = SymbolDatabaseProxy.MakeCodeRange(
                startLine, startColumn, endLine, endColumn, scriptPath);
        }
Beispiel #2
0
        private void PromoteStagingDatabase()
        {
            // This method promotes the staging database connection to a
            // production database connection (closing out the previous one
            // if one exists).
            //
            lock (promotionSyncRoot)
            {
                if (null != productionDatabase)
                {
                    productionDatabase.CloseConnection();
                    productionDatabase = null;
                }

                productionDatabase = stagingDatabase;
                stagingDatabase    = null;
            }
        }
Beispiel #3
0
        private void OnUpdateDatabaseDoWork(object sender, DoWorkEventArgs e)
        {
            lock (updateSyncRoot)
            {
                AutoCompleteWorkData workData = e.Argument as AutoCompleteWorkData;

                // At the beginning of build and database population, assume
                // that at any point if we return earlier, the operation is
                // considered a failure, and no further database promotion
                // should be done.
                e.Result = false;

                ProtoCore.Core core = CompileCodeSnapshot(workData);
                if (null != core)
                {
                    stagingDatabase = new SymbolDatabaseProxy(core, scopeIdentifiers);
                    e.Result        = true;
                }
            }
        }