Ejemplo n.º 1
0
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
     if (null != node.Entity)
     {
         return;
     }
     node.Entity = new InternalInterface(TypeSystemServices, node);
 }
Ejemplo n.º 2
0
		override public void LeaveInterfaceDefinition(InterfaceDefinition node)
		{
			CantBeMarkedAbstract(node);
			CantBeMarkedTransient(node);
			CantBeMarkedPartialIfNested(node);
			CantBeMarkedFinal(node);
			CantBeMarkedStatic(node);
		}
Ejemplo n.º 3
0
        override public object Clone()
        {
            InterfaceDefinition clone = (InterfaceDefinition)FormatterServices.GetUninitializedObject(typeof(InterfaceDefinition));

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._isSynthetic       = _isSynthetic;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }

            clone._modifiers = _modifiers;
            clone._name      = _name;
            if (null != _attributes)
            {
                clone._attributes = _attributes.Clone() as AttributeCollection;
                clone._attributes.InitializeParent(clone);
            }
            if (null != _members)
            {
                clone._members = _members.Clone() as TypeMemberCollection;
                clone._members.InitializeParent(clone);
            }
            if (null != _baseTypes)
            {
                clone._baseTypes = _baseTypes.Clone() as TypeReferenceCollection;
                clone._baseTypes.InitializeParent(clone);
            }
            if (null != _genericParameters)
            {
                clone._genericParameters = _genericParameters.Clone() as GenericParameterDeclarationCollection;
                clone._genericParameters.InitializeParent(clone);
            }
            return(clone);
        }
Ejemplo n.º 4
0
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
     ResolveBaseTypes(new Boo.Lang.List(), node);
     CheckInterfaceBaseTypes(node);
 }
Ejemplo n.º 5
0
		public override void OnInterfaceDefinition(InterfaceDefinition node)
		{
			OnTypeDefinition(node);
		}
Ejemplo n.º 6
0
        public override void LeaveInterfaceDefinition(InterfaceDefinition node)
        {
            base.LeaveInterfaceDefinition(node);

            Pop(node.EndSourceLocation.Line);
        }
Ejemplo n.º 7
0
 public override void LeaveInterfaceDefinition(InterfaceDefinition node)
 {
     _emitter.EmitTypeAttributes(node);
 }
Ejemplo n.º 8
0
 public override void LeaveInterfaceDefinition(AST.InterfaceDefinition node)
 {
     LeaveTypeDefinition(node);
     base.LeaveInterfaceDefinition(node);
 }
 public override void LeaveInterfaceDefinition(InterfaceDefinition node)
 {
     MarkVisited(node);
 }
Ejemplo n.º 10
0
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
     base.OnInterfaceDefinition(node);
     _emitter.EmitTypeAttributes(node);
 }
Ejemplo n.º 11
0
		override public void OnInterfaceDefinition(InterfaceDefinition node)
		{
			EnsureEntityFor(node);
		}	
Ejemplo n.º 12
0
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
     AddMember(node);
 }
Ejemplo n.º 13
0
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
     OnCandidatePartialDefinition(node);
 }
Ejemplo n.º 14
0
 public override bool EnterInterfaceDefinition(InterfaceDefinition node)
 {
     return false;
 }
 public override void LeaveInterfaceDefinition(InterfaceDefinition node)
 {
     this.SetPublicByDefault(node);
 }
Ejemplo n.º 16
0
 public override void LeaveInterfaceDefinition(InterfaceDefinition node)
 {
     CheckName(node,node.Name);
 }
Ejemplo n.º 17
0
		override public void OnInterfaceDefinition(InterfaceDefinition node)
		{
			// ignore
		}
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
 }
 public override void LeaveInterfaceDefinition(InterfaceDefinition node)
 {
     LeaveTypeDefinition(node);
 }
Ejemplo n.º 20
0
        public object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
        {
            if (typeDeclaration.Templates.Count > 0)
            {
                AddError(typeDeclaration, "Generic type definitions are not supported.");
            }
            B.TypeDefinition oldType = currentType;
            B.TypeDefinition typeDef;
            switch (typeDeclaration.Type)
            {
            case ClassType.Class:
                typeDef = new B.ClassDefinition(GetLexicalInfo(typeDeclaration));
                break;

            case ClassType.Interface:
                typeDef = new B.InterfaceDefinition(GetLexicalInfo(typeDeclaration));
                break;

            case ClassType.Enum:
                typeDef = new B.EnumDefinition(GetLexicalInfo(typeDeclaration));
                break;

            case ClassType.Struct:
                typeDef = new B.StructDefinition(GetLexicalInfo(typeDeclaration));
                break;

            case ClassType.Module:
                typeDef = new B.ClassDefinition(GetLexicalInfo(typeDeclaration));
                typeDeclaration.Modifier |= Modifiers.Static;
                break;

            default:
                AddError(typeDeclaration, "Unknown class type.");
                return(null);
            }
            if (currentType != null)
            {
                typeDef.Modifiers = ConvertModifier(typeDeclaration, B.TypeMemberModifiers.Private);
            }
            else
            {
                typeDef.Modifiers = ConvertModifier(typeDeclaration, B.TypeMemberModifiers.Internal);
            }
            typeDef.Name = typeDeclaration.Name;
            typeDef.EndSourceLocation = GetLocation(typeDeclaration.EndLocation);
            ConvertAttributes(typeDeclaration.Attributes, typeDef.Attributes);
            ConvertTypeReferences(typeDeclaration.BaseTypes, typeDef.BaseTypes);

            if (currentType != null)
            {
                currentType.Members.Add(typeDef);
            }
            else
            {
                module.Members.Add(typeDef);
            }
            currentType = typeDef;
            typeDeclaration.AcceptChildren(this, data);
            currentType = oldType;
            return(typeDef);
        }
Ejemplo n.º 21
0
 public override bool EnterInterfaceDefinition(AST.InterfaceDefinition node)
 {
     EnterTypeDefinition(node, ClassType.Interface);
     return(base.EnterInterfaceDefinition(node));
 }
Ejemplo n.º 22
0
 public override void LeaveInterfaceDefinition(InterfaceDefinition node)
 {
     CheckMemberName(node);
     CantBeMarkedAbstract(node);
     CantBeMarkedTransient(node);
     CantBeMarkedPartial(node);
     CantBeMarkedFinal(node);
     CantBeMarkedStatic(node);
 }
Ejemplo n.º 23
0
        //throws RecognitionException, TokenStreamException
        protected void interface_definition(
            TypeMemberCollection container
            )
        {
            IToken  id = null;

                InterfaceDefinition itf = null;
                TypeMemberCollection members = null;
                GenericParameterDeclarationCollection genericParameters = null;

            try {      // for error handling
            match(INTERFACE);
            id = LT(1);
            match(ID);
            if (0==inputState.guessing)
            {

                        itf = new InterfaceDefinition(SourceLocationFactory.ToLexicalInfo(id));
                        itf.Name = id.getText();
                        itf.Modifiers = _modifiers;
                        AddAttributes(itf.Attributes);
                        container.Add(itf);
                        members = itf.Members;
                        genericParameters = itf.GenericParameters;

            }
            {
                switch ( LA(1) )
                {
                case LBRACK:
                {
                    match(LBRACK);
                    {
                        switch ( LA(1) )
                        {
                        case OF:
                        {
                            match(OF);
                            break;
                        }
                        case ID:
                        {
                            break;
                        }
                        default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                         }
                    }
                    generic_parameter_declaration_list(genericParameters);
                    match(RBRACK);
                    break;
                }
                case LPAREN:
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            {
                switch ( LA(1) )
                {
                case LPAREN:
                {
                    base_types(itf.BaseTypes);
                    break;
                }
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            begin_with_doc(itf);
            {    // ( ... )*
                for (;;)
                {
                    if ((tokenSet_33_.member(LA(1))))
                    {
                        attributes();
                        {
                            switch ( LA(1) )
                            {
                            case DEF:
                            {
                                interface_method(members);
                                break;
                            }
                            case EVENT:
                            {
                                event_declaration(members);
                                break;
                            }
                            case SELF:
                            case ID:
                            {
                                interface_property(members);
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                    }
                    else
                    {
                        goto _loop77_breakloop;
                    }

                }
            _loop77_breakloop:				;
            }    // ( ... )*
            end(itf);
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_32_);
            }
            else
            {
                throw ex;
            }
            }
        }
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
     EnterNamespace((INamespace)GetEntity(node));
     VisitTypeDefinitionBody(node);
     LeaveNamespace();
 }
Ejemplo n.º 25
0
 public override void OnInterfaceDefinition(InterfaceDefinition node)
 {
     TypeBuilder builder = GetTypeBuilder(node);
     foreach (TypeReference baseType in node.BaseTypes)
     {
         builder.AddInterfaceImplementation(GetSystemType(baseType));
     }
 }
Ejemplo n.º 26
0
 public override void LeaveInterfaceDefinition(InterfaceDefinition node)
 {
     CheckMembers(node);
 }
Ejemplo n.º 27
0
        public override bool EnterInterfaceDefinition(InterfaceDefinition node)
        {
            Push(new InterfaceTreeNode(new EntitySourceOrigin(GetEntity(node)), node.FullName), node.LexicalInfo.Line);

            return base.EnterInterfaceDefinition(node);
        }
Ejemplo n.º 28
0
		void CheckInterfaceBaseTypes(InterfaceDefinition node)
		{
			foreach (var baseTypeRef in node.BaseTypes)
			{
				var baseType = GetType(baseTypeRef);
				if (!baseType.IsInterface)
					Error(CompilerErrorFactory.InterfaceCanOnlyInheritFromInterface(baseTypeRef, GetType(node), baseType));
			}
		}
Ejemplo n.º 29
0
 void CheckInterfaceBaseTypes(InterfaceDefinition node)
 {
     foreach (TypeReference baseType in node.BaseTypes)
     {
         IType tag = GetType(baseType);
         if (!tag.IsInterface)
         {
             Error(CompilerErrorFactory.InterfaceCanOnlyInheritFromInterface(baseType, node.FullName, tag.FullName));
         }
     }
 }
Ejemplo n.º 30
0
		override public void OnInterfaceDefinition(InterfaceDefinition node)
		{
			ResolveBaseTypesOf(node);
			CheckInterfaceBaseTypes(node);
		}
Ejemplo n.º 31
0
	protected void interface_definition(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  id = null;
		IToken  begin = null;
		
				InterfaceDefinition itf = null;
				TypeMemberCollection members = null;
				GenericParameterDeclarationCollection genericParameters = null;
				Expression nameSplice = null;
			
		
		try {      // for error handling
			match(INTERFACE);
			{
				switch ( LA(1) )
				{
				case ID:
				{
					id = LT(1);
					match(ID);
					break;
				}
				case SPLICE_BEGIN:
				{
					{
						begin = LT(1);
						match(SPLICE_BEGIN);
						nameSplice=atom();
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						IToken token = id ?? begin;
						itf = new InterfaceDefinition(ToLexicalInfo(token));
						itf.Name = token.getText();
						itf.Modifiers = _modifiers;
						AddAttributes(itf.Attributes);
						if (id != null) {
							container.Add(itf);
						} else {
							container.Add(new SpliceTypeMember(itf, nameSplice));
						}
						members = itf.Members;
						genericParameters = itf.GenericParameters;
					
			}
			{
				switch ( LA(1) )
				{
				case LBRACK:
				{
					match(LBRACK);
					{
						switch ( LA(1) )
						{
						case OF:
						{
							match(OF);
							break;
						}
						case ID:
						{
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					generic_parameter_declaration_list(genericParameters);
					match(RBRACK);
					break;
				}
				case LPAREN:
				case COLON:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			{
				switch ( LA(1) )
				{
				case LPAREN:
				{
					base_types(itf.BaseTypes);
					break;
				}
				case COLON:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			begin_with_doc(itf);
			{
				switch ( LA(1) )
				{
				case PASS:
				{
					{
						match(PASS);
						eos();
					}
					break;
				}
				case DEF:
				case EVENT:
				case SELF:
				case ID:
				case LBRACK:
				{
					{ // ( ... )+
						int _cnt90=0;
						for (;;)
						{
							if ((tokenSet_40_.member(LA(1))))
							{
								attributes();
								{
									switch ( LA(1) )
									{
									case DEF:
									{
										interface_method(members);
										break;
									}
									case EVENT:
									{
										event_declaration(members);
										break;
									}
									case SELF:
									case ID:
									{
										interface_property(members);
										break;
									}
									default:
									{
										throw new NoViableAltException(LT(1), getFilename());
									}
									 }
								}
							}
							else
							{
								if (_cnt90 >= 1) { goto _loop90_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
							}
							
							_cnt90++;
						}
_loop90_breakloop:						;
					}    // ( ... )+
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			end(itf);
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "interface_definition");
				recover(ex,tokenSet_22_);
			}
			else
			{
				throw ex;
			}
		}
	}
Ejemplo n.º 32
0
		public object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
		{
			if (typeDeclaration.Templates.Count > 0) {
				AddError(typeDeclaration, "Generic type definitions are not supported.");
			}
			B.TypeDefinition oldType = currentType;
			B.TypeDefinition typeDef;
			switch (typeDeclaration.Type) {
				case ClassType.Class:
					typeDef = new B.ClassDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Interface:
					typeDef = new B.InterfaceDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Enum:
					typeDef = new B.EnumDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Struct:
					typeDef = new B.StructDefinition(GetLexicalInfo(typeDeclaration));
					break;
				case ClassType.Module:
					typeDef = new B.ClassDefinition(GetLexicalInfo(typeDeclaration));
					typeDeclaration.Modifier |= Modifiers.Static;
					break;
				default:
					AddError(typeDeclaration, "Unknown class type.");
					return null;
			}
			if (currentType != null)
				typeDef.Modifiers = ConvertModifier(typeDeclaration, B.TypeMemberModifiers.Private);
			else
				typeDef.Modifiers = ConvertModifier(typeDeclaration, B.TypeMemberModifiers.Internal);
			typeDef.Name = typeDeclaration.Name;
			typeDef.EndSourceLocation = GetLocation(typeDeclaration.EndLocation);
			ConvertAttributes(typeDeclaration.Attributes, typeDef.Attributes);
			ConvertTypeReferences(typeDeclaration.BaseTypes, typeDef.BaseTypes);
			
			if (currentType != null)
				currentType.Members.Add(typeDef);
			else
				module.Members.Add(typeDef);
			currentType = typeDef;
			typeDeclaration.AcceptChildren(this, data);
			currentType = oldType;
			return typeDef;
		}
Ejemplo n.º 33
0
        public override void OnInterfaceDefinition(InterfaceDefinition node)
        {
            if (WasVisited(node)) return;
            MarkVisited(node);

            VisitTypeDefinition(node);
        }
Ejemplo n.º 34
0
		public override void OnInterfaceDefinition(InterfaceDefinition node)
		{
			ConvertTypeDefinition(node).IsInterface = true;
		}