コード例 #1
0
        protected ImportedMember(ImportedModule module, StringHandle nameHandle, ImportedType declaringType)
        {
            Module        = module;
            DeclaringType = declaringType;

            _nameHandle = nameHandle;
        }
コード例 #2
0
        protected ImportedMember(ImportedModule module, StringHandle nameHandle, ImportedType declaringType)
        {
            Module = module;
            DeclaringType = declaringType;

            _nameHandle = nameHandle;
        }
コード例 #3
0
 private void AddAssembly(ImportedModule module)
 {
     MetadataReader mdReader = module.Reader;
     AssemblyDefinition assemblyDef = mdReader.GetAssemblyDefinition();
     string name = mdReader.GetString(assemblyDef.Name);
     if (!_importedAssemblyNames.Contains(name))
         _importedAssemblyNames.Add(name);
 }
コード例 #4
0
        private void AddAssembly(ImportedModule module)
        {
            MetadataReader     mdReader    = module.Reader;
            AssemblyDefinition assemblyDef = mdReader.GetAssemblyDefinition();
            string             name        = mdReader.GetString(assemblyDef.Name);

            if (!_importedAssemblyNames.Contains(name))
            {
                _importedAssemblyNames.Add(name);
            }
        }
コード例 #5
0
        public ImportedModule ImportModule(IntPtr metadataPtr, uint blockSize)
        {
            ImportedModule module;
            if (!_modulePtrMap.TryGetValue(metadataPtr, out module))
            {
                module = new ImportedModule(metadataPtr, blockSize);
                _modulePtrMap.Add(metadataPtr, module);
                AddAssembly(module);
            }

            return module;
        }
コード例 #6
0
        public ImportedModule ImportModule(IntPtr metadataPtr, uint blockSize)
        {
            ImportedModule module;

            if (!_modulePtrMap.TryGetValue(metadataPtr, out module))
            {
                module = new ImportedModule(metadataPtr, blockSize);
                _modulePtrMap.Add(metadataPtr, module);
                AddAssembly(module);
            }

            return(module);
        }
コード例 #7
0
 internal ImportedField(ImportedModule module, FieldDefinition fieldDef, ImportedType declaringType)
     : base(module, fieldDef.Name, declaringType)
 {
     _fieldDef = fieldDef;
 }
コード例 #8
0
 internal ImportedMethod(ImportedModule module, MethodDefinition methodDef, ImportedType declaringType)
     : base(module, methodDef.Name, declaringType)
 {
     _methodDef = methodDef;
     _signature = methodDef.DecodeSignature(Module.IrisTypeProvider);
 }
コード例 #9
0
 internal ImportedType(ImportedModule module, TypeDefinition typeDef)
     : base(module, typeDef.Name, null)
 {
     _typeDef = typeDef;
 }
コード例 #10
0
        public ImportedModule ImportMscorlib()
        {
            if (_mscorlib != null)
                return _mscorlib;

            DkmClrAppDomain currentAppDomain = InstructionAddress.ModuleInstance.AppDomain;
            if (currentAppDomain.IsUnloaded)
                return null;

            foreach (DkmClrModuleInstance moduleInstance in currentAppDomain.GetClrModuleInstances())
            {
                if (!moduleInstance.IsUnloaded && moduleInstance.ClrFlags.HasFlag(DkmClrModuleFlags.RuntimeModule))
                {
                    _mscorlib = ImportModule(moduleInstance);
                    return _mscorlib;
                }
            }

            return null;
        }
コード例 #11
0
 internal ImportedType(ImportedModule module, TypeDefinition typeDef)
     : base(module, typeDef.Name, null)
 {
     _typeDef = typeDef;
 }
コード例 #12
0
        protected void ImportMethod(
            FilePosition fp,
            string symbolName,
            ImportedModule module,
            string declaringTypeName,
            string methodName,
            bool instance,
            IrisType returnType,
            IrisType[] paramTypes)
        {
            ImportedType declaringType = module.TryGetTypeByName(declaringTypeName);
            if (declaringType == null)
            {
                CompileErrors.Add(fp, String.Format("Cannot find imported type '{0}'.", declaringTypeName));
                return;
            }

            ImportedMethod importedMethod = declaringType.TryFindMethod(methodName, instance, returnType, paramTypes);
            if (importedMethod == null)
            {
                CompileErrors.Add(fp, String.Format("Cannot find imported function or procedure '{0}.{1}'.", declaringTypeName, methodName));
                return;
            }

            Method method = importedMethod.ConvertToIrisMethod();
            bool containsInvalidType = method.ReturnType == IrisType.Invalid;
            foreach (Variable param in method.GetParameters())
            {
                if (containsInvalidType)
                    break;

                if (param.Type == IrisType.Invalid)
                    containsInvalidType = true;
            }

            if (containsInvalidType)
                CompileErrors.Add(fp, String.Format("The function or procedure '{0}.{1}' contains types that are not supported by the language.", declaringTypeName, methodName));
            else
                SymbolTable.Add(symbolName, method, StorageClass.Global, importedMethod);
        }
コード例 #13
0
        protected void ImportGlobalField(
            FilePosition fp,
            string symbolName,
            ImportedModule module,
            string declaringTypeName,
            string fieldName)
        {
            ImportedType declaringType = module.TryGetTypeByName(declaringTypeName);
            if (declaringType == null)
            {
                CompileErrors.Add(fp, String.Format("Cannot find imported type '{0}'.", declaringTypeName));
                return;
            }

            ImportedField field = declaringType.TryGetPublicStaticField(fieldName);
            if (field == null)
            {
                CompileErrors.Add(fp, String.Format("Cannot find imported field '{0}.{1}'.", declaringTypeName, fieldName));
                return;
            }

            IrisType fieldType = field.FieldType;
            if (fieldType == IrisType.Invalid)
            {
                CompileErrors.Add(fp, String.Format("Type of field '{0}.{1}' is not supported by the language.", declaringTypeName, fieldName));
                return;
            }

            SymbolTable.Add(symbolName, field.FieldType, StorageClass.Global, field);
        }
コード例 #14
0
 internal ImportedMethod(ImportedModule module, MethodDefinition methodDef, ImportedType declaringType)
     : base(module, methodDef.Name, declaringType)
 {
     _methodDef = methodDef;
     _signature = SignatureDecoder.DecodeMethodSignature(_methodDef.Signature, Module.IrisTypeProvider);
 }
コード例 #15
0
 internal ImportedField(ImportedModule module, FieldDefinition fieldDef, ImportedType declaringType)
     : base(module, fieldDef.Name, declaringType)
 {
     _fieldDef = fieldDef;
 }