// Dual licensed under the terms of the MIT X11 or GNU GPL
//
// Copyright 2009-2010 Novell, Inc.
+// Copyright 2011 Xamarin Inc
//
//
#if !STATIC
public class StaticImporter
{
- public StaticImporter (BuildinTypes buildin)
+ public StaticImporter (BuiltinTypes builtin)
{
throw new NotSupportedException ();
}
return false;
}
- public override void GetCustomAttributeTypeName (CustomAttributeData cad, out string typeNamespace, out string typeName)
- {
- cad.__TryReadTypeName (out typeNamespace, out typeName);
- }
-
public void ImportAssembly (Assembly assembly, RootNamespace targetNamespace)
{
// It can be used more than once when importing same assembly
public ImportedModuleDefinition ImportModule (Module module, RootNamespace targetNamespace)
{
- var module_definition = new ImportedModuleDefinition (module, this);
+ var module_definition = new ImportedModuleDefinition (module);
module_definition.ReadAttributes ();
var all_types = module.GetTypes ();
return module_definition;
}
- public void InitializeBuildinTypes (BuildinTypes buildin, Assembly corlib)
+ public void InitializeBuiltinTypes (BuiltinTypes builtin, Assembly corlib)
{
//
// Setup mapping for build-in types to avoid duplication of their definition
//
- foreach (var type in buildin.AllTypes) {
+ foreach (var type in builtin.AllTypes) {
compiled_types.Add (corlib.GetType (type.FullName), type);
}
}
sdk_directory = new Dictionary<string, string[]> ();
sdk_directory.Add ("2", new string[] { "2.0", "net_2_0", "v2.0.50727" });
sdk_directory.Add ("4", new string[] { "4.0", "net_4_0", "v4.0.30319" });
+ sdk_directory.Add ("4.5", new string[] { "4.5", "net_4_5", "v4.0.30319" });
}
public StaticLoader (StaticImporter importer, CompilerContext compiler)
var corlib_path = Path.GetDirectoryName (typeof (object).Assembly.Location);
string fx_path = corlib_path.Substring (0, corlib_path.LastIndexOf (Path.DirectorySeparatorChar));
- string sdk_path = null;
- string sdk_version = compiler.Settings.SdkVersion ?? "4";
- string[] sdk_sub_dirs;
+ if (compiler.Settings.StdLib) {
+ string sdk_path = null;
- if (!sdk_directory.TryGetValue (sdk_version, out sdk_sub_dirs))
- sdk_sub_dirs = new string[] { sdk_version };
+ string sdk_version = compiler.Settings.SdkVersion ?? "4.5";
+ string[] sdk_sub_dirs;
- foreach (var dir in sdk_sub_dirs) {
- sdk_path = Path.Combine (fx_path, dir);
- if (File.Exists (Path.Combine (sdk_path, "mscorlib.dll")))
- break;
+ if (!sdk_directory.TryGetValue (sdk_version, out sdk_sub_dirs))
+ sdk_sub_dirs = new string[] { sdk_version };
- sdk_path = null;
- }
+ foreach (var dir in sdk_sub_dirs) {
+ sdk_path = Path.Combine (fx_path, dir);
+ if (File.Exists (Path.Combine (sdk_path, "mscorlib.dll")))
+ break;
- if (sdk_path == null) {
- compiler.Report.Warning (-1, 1, "SDK path could not be resolved");
- sdk_path = corlib_path;
- }
+ sdk_path = null;
+ }
- paths.Add (sdk_path);
+ if (sdk_path == null) {
+ compiler.Report.Warning (-1, 1, "SDK path could not be resolved");
+ sdk_path = corlib_path;
+ }
+
+ paths.Add (sdk_path);
+ }
}
#region Properties
public override bool HasObjectType (Assembly assembly)
{
- return assembly.GetType (compiler.BuildinTypes.Object.FullName) != null;
+ return assembly.GetType (compiler.BuiltinTypes.Object.FullName) != null;
}
public override Assembly LoadAssemblyFile (string fileName)
// System.Object was not found in any referenced assembly, use compiled assembly as corlib
corlib = module.DeclaringAssembly.Builder;
} else {
- importer.InitializeBuildinTypes (compiler.BuildinTypes, corlib);
+ importer.InitializeBuiltinTypes (compiler.BuiltinTypes, corlib);
importer.ImportAssembly (corlib, module.GlobalRootNamespace);
}
continue;
if (m.IsManifestModule) {
- Error_FileCorrupted (moduleName);
+ Error_ModuleIsAssembly (moduleName);
continue;
}