예제 #1
0
 override public void OnMethod(Method node)
 {
     // The method itself has been bound earlier during BindMethods, so
     // we just have to remember to bind its parameters
     _parameters.Add(node);
     Visit(node.ExplicitInfo);
 }
예제 #2
0
 override public void OnMethod(Method node)
 {
     if (null == node.Entity)
     {
         node.Entity = new InternalMethod(TypeSystemServices, node);
     }
     _parameters.Add(node);
     Visit(node.ExplicitInfo);
 }
예제 #3
0
        void ResolveBaseTypes(Boo.Lang.List visited, TypeDefinition node)
        {
            visited.Add(node);

            int removed = 0;
            int index   = 0;

            foreach (SimpleTypeReference type in node.BaseTypes.ToArray())
            {
                NameResolutionService.ResolveSimpleTypeReference(type);

                AbstractInternalType internalType = type.Entity as AbstractInternalType;
                if (null != internalType)
                {
                    if (visited.Contains(internalType.TypeDefinition))
                    {
                        Error(CompilerErrorFactory.InheritanceCycle(type, internalType.FullName));
                        node.BaseTypes.RemoveAt(index - removed);
                        ++removed;
                    }
                    else
                    {
                        ResolveBaseTypes(visited, internalType.TypeDefinition);
                    }
                }
                ++index;
            }
        }
예제 #4
0
        void OrganizeNamespaces()
        {
            foreach (Assembly asm in CompilerParameters.References)
            {
                Type[] types = asm.GetTypes();
                foreach (Type type in types)
                {
                    string ns = type.Namespace;
                    if (null == ns)
                    {
                        ns = string.Empty;
                    }

                    string[] namespaceHierarchy        = ns.Split('.');
                    string   topLevelName              = namespaceHierarchy[0];
                    Bindings.NamespaceBinding topLevel = GetNamespaceBinding(topLevelName);
                    Bindings.NamespaceBinding current  = topLevel;
                    for (int i = 1; i < namespaceHierarchy.Length; ++i)
                    {
                        current = current.GetChildNamespace(namespaceHierarchy[i]);
                        // Trace(current);
                    }
                    current.Add(type);

                    List typeList = GetList(_externalTypes, type.FullName);
                    typeList.Add(type);
                }
            }
        }
예제 #5
0
        public CompilerPipeline Add(ICompilerStep step)
        {
            if (null == step)
            {
                throw new ArgumentNullException("step");
            }

            _items.Add(step);
            return(this);
        }
예제 #6
0
 private void CheckParameterUniqueness(Method method)
 {
     Boo.Lang.List parameters = new Boo.Lang.List();
     foreach (ParameterDeclaration parameter in method.Parameters)
     {
         if (parameters.Contains(parameter.Name))
         {
             Errors.Add(CompilerErrorFactory.DuplicateParameterName(parameter, parameter.Name, method.Name));
         }
         parameters.Add(parameter.Name);
     }
 }
예제 #7
0
		private void CheckParameterUniqueness(Method method)
		{
			Boo.Lang.List parameters = new Boo.Lang.List();
			foreach (ParameterDeclaration parameter in method.Parameters)
			{
				if (parameters.Contains(parameter.Name))
				{
					Errors.Add(
						CompilerErrorFactory.DuplicateParameterName(
							parameter, parameter.Name, GetEntity(method).ToString()));
				}				
				parameters.Add(parameter.Name);
			}
		}
예제 #8
0
        bool ResolveModuleMember(Boo.Lang.List targetList, string name, EntityType flags)
        {
            bool found = false;

            foreach (Boo.Lang.Compiler.Ast.TypeMember member in _module.Members)
            {
                if (name == member.Name)
                {
                    IEntity tag = TypeSystemServices.GetEntity(member);
                    if (NameResolutionService.IsFlagSet(flags, tag.EntityType))
                    {
                        targetList.Add(tag);
                        found = true;
                    }
                }
            }
            return(found);
        }
예제 #9
0
        void ResolveBaseTypes(Boo.Lang.List visited, TypeDefinition node)
        {
            // If type is generic, enter a special namespace to allow
            // correct resolution of generic parameters
            IType type = (IType)TypeSystemServices.GetEntity(node);

            if (type.GenericInfo != null)
            {
                EnterNamespace(new GenericParametersNamespaceExtender(
                                   type, NameResolutionService.CurrentNamespace));
            }

            visited.Add(node);

            int removed = 0;
            int index   = 0;

            foreach (SimpleTypeReference baseType in node.BaseTypes.ToArray())
            {
                NameResolutionService.ResolveSimpleTypeReference(baseType);

                AbstractInternalType internalType = baseType.Entity as AbstractInternalType;
                if (null != internalType)
                {
                    if (visited.Contains(internalType.TypeDefinition))
                    {
                        Error(CompilerErrorFactory.InheritanceCycle(baseType, internalType.FullName));
                        node.BaseTypes.RemoveAt(index - removed);
                        ++removed;
                    }
                    else
                    {
                        ResolveBaseTypes(visited, internalType.TypeDefinition);
                    }
                }
                ++index;
            }

            // Leave special namespace if we entered it before
            if (type.GenericInfo != null)
            {
                LeaveNamespace();
            }
        }
예제 #10
0
        bool ResolveModuleMember(Boo.Lang.List targetList, string name, EntityType flags)
        {
            bool found = false;

            foreach (TypeMember member in _module.Members)
            {
                if (name != member.Name)
                {
                    continue;
                }

                IEntity entity = _typeSystemServices.GetMemberEntity(member);
                if (NameResolutionService.IsFlagSet(flags, entity.EntityType))
                {
                    targetList.Add(entity);
                    found = true;
                }
            }
            return(found);
        }
예제 #11
0
 override public void OnEvent(Event node)
 {
     _events.Add(node);
 }
예제 #12
0
 void RegisterAdaptor(ICallableType to, ICallableType from, ClassDefinition adaptor)
 {
     _adaptors.Add(new AdaptorRecord(to, from, adaptor));
     TypeSystemServices.GetCompilerGeneratedTypesModule().Members.Add(adaptor);
 }
예제 #13
0
 override public void OnMethod(Method node)
 {
     _parameters.Add(node);
     base.OnMethod(node);
 }