예제 #1
0
 void ResolveImportAssemblyReferences()
 {
     foreach (Boo.Lang.Compiler.Ast.Module module in CompileUnit.Modules)
     {
         ImportCollection imports     = module.Imports;
         Import[]         importArray = imports.ToArray();
         for (int i = 0; i < importArray.Length; ++i)
         {
             Import u = importArray[i];
             ReferenceExpression reference = u.AssemblyReference;
             if (null != reference)
             {
                 try
                 {
                     Assembly asm = Parameters.FindAssembly(reference.Name);
                     if (null == asm)
                     {
                         asm = Parameters.LoadAssembly(reference.Name);
                         if (null != asm)
                         {
                             Parameters.AddAssembly(asm);
                         }
                     }
                     reference.Entity = new TypeSystem.AssemblyReference(asm);
                 }
                 catch (Exception x)
                 {
                     Errors.Add(CompilerErrorFactory.UnableToLoadAssembly(reference, reference.Name, x));
                     imports.RemoveAt(i);
                 }
             }
         }
     }
 }
예제 #2
0
 private void ResolveAssemblyReferences(ImportCollection imports)
 {
     Import[] importArray = imports.ToArray();
     for (int i = 0; i < importArray.Length; ++i)
     {
         Import current = importArray[i];
         ReferenceExpression reference = current.AssemblyReference;
         if (null == reference)
         {
             continue;
         }
         try
         {
             reference.Entity = ResolveAssemblyReference(reference);
         }
         catch (Exception x)
         {
             Errors.Add(CompilerErrorFactory.UnableToLoadAssembly(reference, reference.Name, x));
             imports.RemoveAt(i);
         }
     }
 }