Exemplo n.º 1
0
        public ITreeNode Add(IPsiSourceFile sourceFile, string text, int start, int len)
        {
            var name = text.Substring(start, len);
              NitraDeclaredElement declaredElement;
              if (!_declaredElements.TryGetValue(name.ToLower(), out declaredElement))
            declaredElement = new NitraDeclaredElement(sourceFile.GetSolution(), name);

              if (name.Length > 0 && char.IsUpper(name[0]))
              {
            var node = new NitraDeclaration(declaredElement, sourceFile, name, start, len);
            declaredElement.AddDeclaration(node);
            _declaredElements.Add(name, declaredElement);
            return node;
              }
              else
              {
            List<NitraNameReference> refs;
            if (!_references.TryGetValue(declaredElement, out refs))
            {
              refs = new List<NitraNameReference>();
              _references.Add(declaredElement, refs);
            }

            var node = new NitraNameReference(sourceFile, name, start, len);
            refs.Add(node);
            return node;
              }
        }
Exemplo n.º 2
0
        public ITreeNode Add(IPsiSourceFile sourceFile, string text, int start, int len)
        {
            var name = text.Substring(start, len);
            NitraDeclaredElement declaredElement;

            if (!_declaredElements.TryGetValue(name.ToLower(), out declaredElement))
            {
                declaredElement = new NitraDeclaredElement(sourceFile.GetSolution(), name);
            }

            if (name.Length > 0 && char.IsUpper(name[0]))
            {
                var node = new NitraDeclaration(declaredElement, sourceFile, name, start, len);
                declaredElement.AddDeclaration(node);
                _declaredElements.Add(name, declaredElement);
                return(node);
            }
            else
            {
                List <NitraNameReference> refs;
                if (!_references.TryGetValue(declaredElement, out refs))
                {
                    refs = new List <NitraNameReference>();
                    _references.Add(declaredElement, refs);
                }

                var node = new NitraNameReference(sourceFile, name, start, len);
                refs.Add(node);
                return(node);
            }
        }
Exemplo n.º 3
0
 public void AddDeclaration(NitraDeclaration declaration)
 {
     if (_declarations.Contains(declaration))
     {
         Debug.Assert(false);
     }
     _declarations.Add(declaration);
 }
Exemplo n.º 4
0
 public void AddDeclaration(NitraDeclaration declaration)
 {
     if (_declarations.Contains(declaration))
     Debug.Assert(false);
       _declarations.Add(declaration);
 }