예제 #1
0
        public LoadedModule(ModuleImage image)
        {
            Code              = image.Code.ToArray();
            EntryMethodIndex  = image.EntryMethodIndex;
            MethodRefs        = image.MethodRefs.ToArray();
            VariableRefs      = image.VariableRefs.ToArray();
            Methods           = image.Methods.ToArray();
            Constants         = new IValue[image.Constants.Count];
            Variables         = new VariablesFrame(image.Variables);
            ExportedProperies = image.ExportedProperties.ToArray();
            ExportedMethods   = image.ExportedMethods.ToArray();
            ModuleInfo        = image.ModuleInfo;
            LoadAddress       = image.LoadAddress;
            for (int i = 0; i < image.Constants.Count; i++)
            {
                var def = image.Constants[i];
                Constants[i] = ValueFactory.Parse(def.Presentation, def.Type);
            }

            // Resolve annotation constants
            for (int i = 0; i < Methods.Length; i++)
            {
                EvaluateAnnotationParametersValues(Methods[i].Signature.Annotations);
                for (int j = 0; j < Methods[i].Signature.ArgCount; j++)
                {
                    EvaluateAnnotationParametersValues(Methods[i].Signature.Params[j].Annotations);
                }
            }
        }
예제 #2
0
 private void ReadVariables(VariablesFrame vars, Dictionary <string, int> searchCache)
 {
     for (int i = 0; i < vars.Count; i++)
     {
         var variable = vars[i];
         searchCache[variable.Identifier] = variable.Index;
     }
 }
예제 #3
0
        public LoadedModule(ModuleImage image)
        {
            Code              = image.Code.ToArray();
            EntryMethodIndex  = image.EntryMethodIndex;
            MethodRefs        = image.MethodRefs.ToArray();
            VariableRefs      = image.VariableRefs.ToArray();
            Methods           = image.Methods.ToArray();
            Constants         = new IValue[image.Constants.Count];
            Variables         = new VariablesFrame(image.Variables);
            ExportedProperies = image.ExportedProperties.ToArray();
            ExportedMethods   = image.ExportedMethods.ToArray();
            ModuleInfo        = image.ModuleInfo;
            LoadAddress       = image.LoadAddress;
            for (int i = 0; i < image.Constants.Count; i++)
            {
                var def = image.Constants[i];
                Constants[i] = ValueFactory.Parse(def.Presentation, def.Type);
            }

            ResolveAnnotationConstants();
        }