public TemplateToCompiledLineLookup this[FunctionInfo function, int origLineNum, int originalColumnIndex]
        {
            get
            {
                if (ContainsKey(function, origLineNum))
                {
                    List <TemplateToCompiledLineLookup> lines = _Dictionary[origLineNum][function];
                    if (lines.Count == 0)
                    {
                        throw new Exception(string.Format(
                                                "The line {0} in function '{1}' does not have any generated code associated with it.",
                                                origLineNum, function));
                    }
                    TemplateToCompiledLineLookup returnValue = lines[0];

                    foreach (TemplateToCompiledLineLookup lookup in lines)
                    {
                        if (originalColumnIndex >= lookup.TemplateColumn)
                        {
                            return(lookup);
                        }
                    }

                    return(returnValue);
                }
                throw new Exception("Could not find key " + function.Name + ", " + origLineNum + " in Dictionary");
            }
        }
        public void AddLookup(FunctionInfo function, int origLineNum, TemplateToCompiledLineLookup value)
        {
            if (_Dictionary.ContainsKey(origLineNum) == false)
            {
                _Dictionary[origLineNum]           = new Dictionary <FunctionInfo, List <TemplateToCompiledLineLookup> >(_StartingCapacity);
                _Dictionary[origLineNum][function] = new List <TemplateToCompiledLineLookup>();
            }
            else if (_Dictionary[origLineNum].ContainsKey(function) == false)
            {
                _Dictionary[origLineNum][function] = new List <TemplateToCompiledLineLookup>();
            }

            _Dictionary[origLineNum][function].Add(value);
        }
Exemplo n.º 3
0
        public void AddLookup(FunctionInfo function, int origLineNum, TemplateToCompiledLineLookup value)
        {
            if (_Dictionary.ContainsKey(origLineNum) == false)
            {
                _Dictionary[origLineNum] = new Dictionary<FunctionInfo, List<TemplateToCompiledLineLookup>>(_StartingCapacity);
                _Dictionary[origLineNum][function] = new List<TemplateToCompiledLineLookup>();
            }
            else if (_Dictionary[origLineNum].ContainsKey(function) == false)
            {
                _Dictionary[origLineNum][function] = new List<TemplateToCompiledLineLookup>();
            }

            _Dictionary[origLineNum][function].Add(value);
        }