Пример #1
0
        private static void AddMacroByName(MMap <Symbol, InternalList <InternalMacroInfo> > macros, Symbol name, bool isDeprecatedName, MacroInfo newMacro)
        {
            var macrosWithThisName = macros[name, InternalList <InternalMacroInfo> .Empty];

            // Check if the same macro was added earlier, possibly in a different namespace
            foreach (var macro in macrosWithThisName)
            {
                if (macro.Macro.Equals(newMacro.Macro))
                {
                    if (!macro.Namespaces.Select(p => p.A).Contains(newMacro.Namespace))
                    {
                        macro.Namespaces.Add(Pair.Create(newMacro.Namespace, isDeprecatedName));
                    }
                    return;
                }
            }

            // It's a new macro, add it
            var imi = new InternalMacroInfo
            {
                Name       = name,
                Attr       = newMacro,
                Macro      = newMacro.Macro,
                Namespaces = new InternalList <Pair <Symbol, bool> >(new [] { Pair.Create(newMacro.Namespace, isDeprecatedName) })
            };

            macrosWithThisName.Add(imi);
            macros[name] = macrosWithThisName;
        }
Пример #2
0
 public QualifiedMacroInfo(InternalMacroInfo imi, Symbol @namespace, bool deprecated)
 {
     IMI          = imi;
     Namespace    = @namespace;
     IsDeprecated = deprecated;
 }