Add() public method

public Add ( string key ) : Name
key string
return Name
Exemplo n.º 1
0
        internal static Name Add(string key)
        {
            if (key == null)
            {
                throw Error.InternalCompilerError();
            }

            return(s_names.Add(key));
        }
Exemplo n.º 2
0
        internal Name Add(string key)
        {
            if (key == null)
            {
                throw Error.InternalCompilerError();
            }

            return(s_knownNames.Lookup(key) ?? _names.Add(key));
        }
Exemplo n.º 3
0
        private static NameTable GetKnownNames()
        {
            NameTable table = new NameTable();

            foreach (Name name in s_predefinedNames)
            {
                table.Add(name);
            }

            return(table);
        }
Exemplo n.º 4
0
        private void InitKnownNames()
        {
            if (s_knownNames == null)
            {
                NameTable tmp = new NameTable();

                // add all predefined names
                Debug.Assert(s_predefinedNames.Length == (int)PredefinedName.PN_COUNT);
                for (int i = 0, n = s_predefinedNames.Length; i < n; i++)
                {
                    Debug.Assert((int)s_predefinedNames[i].PredefinedName == i);
                    Name name = s_predefinedNames[i];
                    tmp.Add(name);
                }

                // add all other names
                foreach (KnownName name in s_otherNames)
                {
                    tmp.Add(name);
                }

                Interlocked.CompareExchange <NameTable>(ref s_knownNames, tmp, null);
            }
        }
Exemplo n.º 5
0
        private void InitKnownNames()
        {
            if (s_knownNames == null)
            {
                NameTable tmp = new NameTable();

                // add all predefined names
                Debug.Assert(s_predefinedNames.Length == (int)PredefinedName.PN_COUNT);
                for (int i = 0, n = s_predefinedNames.Length; i < n; i++)
                {
                    Debug.Assert((int)s_predefinedNames[i].PredefinedName == i);
                    Name name = s_predefinedNames[i];
                    tmp.Add(name);
                }

                // add all other names
                foreach (KnownName name in s_otherNames)
                {
                    tmp.Add(name);
                }

                Interlocked.CompareExchange<NameTable>(ref s_knownNames, tmp, null);
            }
        }