private JsExpression GetBaseClass(ITypeDefinition type) { var csBase = type.DirectBaseTypes.SingleOrDefault(b => b.Kind == TypeKind.Class); if (csBase == null || csBase.IsKnownType(KnownTypeCode.Object) || MetadataUtils.IsImported(csBase.GetDefinition()) && MetadataUtils.IsSerializable(csBase.GetDefinition())) { return(null); } return(_runtimeLibrary.InstantiateType(csBase, new DefaultRuntimeContext(type, _metadataImporter, _errorReporter, _namer))); }
private bool IsLocalReference(ITypeDefinition type) { if (MetadataUtils.IsImported(type)) // Imported types must always be referenced the hard way... { return(false); } if (!type.ParentAssembly.Equals(_mainAssembly)) // ...so must types from other assemblies... { return(false); } var typeModule = GetTypeModuleName(type); return(string.IsNullOrEmpty(_mainModuleName) && string.IsNullOrEmpty(typeModule) || _mainModuleName == typeModule); // ...and types with a [ModuleName] that differs from that of the assembly. }