Пример #1
0
        void ResolveNamespaces()
        {
            ResolveUsingAssemblyReferences();
            OrganizeNamespaces();

            foreach (Boo.Lang.Ast.Module module in CompileUnit.Modules)
            {
                foreach (Using using_ in module.Using)
                {
                    IBinding binding = ResolveQualifiedName(using_.Namespace);
                    if (null == binding)
                    {
                        binding = ErrorBinding.Default;
                        Errors.InvalidNamespace(using_);
                    }
                    else
                    {
                        if (null != using_.AssemblyReference)
                        {
                            NamespaceBinding nsBinding = binding as NamespaceBinding;
                            if (null == nsBinding)
                            {
                                Errors.NotImplemented(using_, "assembly qualified type references");
                            }
                            else
                            {
                                binding = new AssemblyQualifiedNamespaceBinding(GetBoundAssembly(using_.AssemblyReference), nsBinding);
                            }
                        }
                        if (null != using_.Alias)
                        {
                            binding = new AliasedNamespaceBinding(using_.Alias.Name, binding);
                            BindingManager.Bind(using_.Alias, binding);
                        }
                    }

                    _context.TraceInfo("{1}: using reference '{0}' bound to {2}.", using_, using_.LexicalInfo, binding.Name);
                    BindingManager.Bind(using_, binding);
                }
            }
        }
 public void to_string_and_to_uri_support()
 {
     NamespaceBinding binding = new NamespaceBinding("Carbonfrost.Commons.Shared", expectedName);
     Assert.That(binding.ToUri().ToString(),
                 Is.EqualTo("clr-namespace:Carbonfrost.Commons.Shared;assembly:" + expectedName));
 }