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); }
override public void OnMethod(Method node) { if (null == node.Entity) { node.Entity = new InternalMethod(TypeSystemServices, node); } _parameters.Add(node); Visit(node.ExplicitInfo); }
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; } }
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); } } }
public CompilerPipeline Add(ICompilerStep step) { if (null == step) { throw new ArgumentNullException("step"); } _items.Add(step); return(this); }
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); } }
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); } }
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); }
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(); } }
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); }
override public void OnEvent(Event node) { _events.Add(node); }
void RegisterAdaptor(ICallableType to, ICallableType from, ClassDefinition adaptor) { _adaptors.Add(new AdaptorRecord(to, from, adaptor)); TypeSystemServices.GetCompilerGeneratedTypesModule().Members.Add(adaptor); }
override public void OnMethod(Method node) { _parameters.Add(node); base.OnMethod(node); }