Пример #1
0
 public TypeImporter(TypeLibraryDeserializer tldser, Dictionary <string, Constant> constants, TypeLibrary typelib)
 {
     this.tldser    = tldser;
     this.constants = constants;
     this.typelib   = typelib;
     this.ceval     = new ConstantEvaluator(new Dictionary <string, Exp>(), constants);
 }
Пример #2
0
 public TypeImporter(IPlatform platform, TypeLibraryDeserializer tldser, Dictionary <string, Constant> constants, TypeLibrary typelib)
 {
     this.tldser     = tldser;
     this.typelib    = typelib;
     this.constants  = constants;
     this.ceval      = new ConstantEvaluator(new Dictionary <string, Exp>(), constants);
     this.namedTypes = new Dictionary <string, SerializedType>(StringComparer.InvariantCultureIgnoreCase);
     this.sizes      = new Dictionary <string, int>(StringComparer.InvariantCultureIgnoreCase);
     this.sizer      = new TypeSizer(platform, namedTypes);
 }
Пример #3
0
        private Dictionary <string, Constant> EvaluateConstants(IEnumerable <Declaration> decls)
        {
            var evaluated = new Dictionary <string, Constant>();

            var dict = new SortedDictionary <string, Exp>();

            foreach (var qq in decls.OfType <ConstantDeclaration>())
            {
                dict[qq.Name] = qq.Exp;
            }
            var ceval = new ConstantEvaluator(dict, evaluated);

            foreach (var de in dict)
            {
                var c = de.Value.Accept(ceval);
                evaluated[de.Key] = c;
            }
            return(evaluated);
        }