예제 #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
        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);
        }