B.ExplicitMemberInfo ConvertInterfaceImplementations(List <InterfaceImplementation> implementations, AttributedNode node, B.TypeMember targetMember)
 {
     if (implementations.Count == 0)
     {
         return(null);
     }
     if (implementations.Count > 1)
     {
         AddError(node, "Multiple explicit interface implementations are not supported");
     }
     if (implementations[0].MemberName != targetMember.Name)
     {
         AddError(node, "Explicit interface implementation: Implementing member with different name is not supported");
     }
     if (targetMember.Modifiers == B.TypeMemberModifiers.Private)
     {
         targetMember.Modifiers = B.TypeMemberModifiers.None;
     }
     else
     {
         AddError(node, "Explicit interface implementation: Only private methods can explicitly implement interfaces");
     }
     B.TypeReference tr = ConvertTypeReference(implementations[0].InterfaceType);
     if (tr is B.SimpleTypeReference)
     {
         B.ExplicitMemberInfo explicitInfo = new B.ExplicitMemberInfo(GetLexicalInfo(node));
         explicitInfo.InterfaceType = (B.SimpleTypeReference)tr;
         return(explicitInfo);
     }
     else
     {
         AddError(node, "Explicit interface implementation: invalid base type, expecting SimpleTypeReference");
         return(null);
     }
 }
		B.ExplicitMemberInfo ConvertInterfaceImplementations(List<InterfaceImplementation> implementations, AttributedNode node, B.TypeMember targetMember)
		{
			if (implementations.Count == 0)
				return null;
			if (implementations.Count > 1) {
				AddError(node, "Multiple explicit interface implementations are not supported");
			}
			if (implementations[0].MemberName != targetMember.Name) {
				AddError(node, "Explicit interface implementation: Implementing member with different name is not supported");
			}
			if (targetMember.Modifiers == B.TypeMemberModifiers.Private) {
				targetMember.Modifiers = B.TypeMemberModifiers.None;
			} else {
				AddError(node, "Explicit interface implementation: Only private methods can explicitly implement interfaces");
			}
			B.TypeReference tr = ConvertTypeReference(implementations[0].InterfaceType);
			if (tr is B.SimpleTypeReference) {
				B.ExplicitMemberInfo explicitInfo = new B.ExplicitMemberInfo(GetLexicalInfo(node));
				explicitInfo.InterfaceType = (B.SimpleTypeReference)tr;
				return explicitInfo;
			} else {
				AddError(node, "Explicit interface implementation: invalid base type, expecting SimpleTypeReference");
				return null;
			}
		}
Exemplo n.º 3
0
        override public object Clone()
        {
            ExplicitMemberInfo clone = (ExplicitMemberInfo)FormatterServices.GetUninitializedObject(typeof(ExplicitMemberInfo));

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

            if (null != _interfaceType)
            {
                clone._interfaceType = _interfaceType.Clone() as SimpleTypeReference;
                clone._interfaceType.InitializeParent(clone);
            }
            return(clone);
        }
Exemplo n.º 4
0
        override public object Clone()
        {
            ExplicitMemberInfo clone = new ExplicitMemberInfo();

            clone._lexicalInfo       = _lexicalInfo;
            clone._endSourceLocation = _endSourceLocation;
            clone._documentation     = _documentation;
            clone._isSynthetic       = _isSynthetic;
            clone._entity            = _entity;
            if (_annotations != null)
            {
                clone._annotations = (Hashtable)_annotations.Clone();
            }
            if (null != _interfaceType)
            {
                clone._interfaceType = _interfaceType.Clone() as SimpleTypeReference;
                clone._interfaceType.InitializeParent(clone);
            }
            return(clone);
        }
Exemplo n.º 5
0
	protected ExplicitMemberInfo  explicit_member_info() //throws RecognitionException, TokenStreamException
{
		ExplicitMemberInfo emi;
		
		IToken  id = null;
		IToken  id2 = null;
		
				emi = null; _sbuilder.Length = 0;
			
		
		try {      // for error handling
			{
				{
					{
						id = LT(1);
						match(ID);
						match(DOT);
					}
					if (0==inputState.guessing)
					{
						
										emi = new ExplicitMemberInfo(ToLexicalInfo(id));
										_sbuilder.Append(id.getText());
									
					}
					{    // ( ... )*
						for (;;)
						{
							if ((LA(1)==ID) && (LA(2)==DOT))
							{
								{
									id2 = LT(1);
									match(ID);
									match(DOT);
								}
								if (0==inputState.guessing)
								{
									
														_sbuilder.Append('.');
														_sbuilder.Append(id2.getText());
													
								}
							}
							else
							{
								goto _loop130_breakloop;
							}
							
						}
_loop130_breakloop:						;
					}    // ( ... )*
				}
			}
			if (0==inputState.guessing)
			{
				
						if (emi != null)
						{
							emi.InterfaceType = new SimpleTypeReference(emi.LexicalInfo);
							emi.InterfaceType.Name = _sbuilder.ToString();
						}
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "explicit_member_info");
				recover(ex,tokenSet_65_);
			}
			else
			{
				throw ex;
			}
		}
		return emi;
	}
 public override void OnExplicitMemberInfo(ExplicitMemberInfo node)
 {
     TypeMember member = (TypeMember)node.ParentNode;
     CheckExplicitMemberValidity((IExplicitMember)member);
     member.Visibility = TypeMemberModifiers.Private;
 }
 public override void LeaveExplicitMemberInfo(ExplicitMemberInfo node)
 {
     var member = (TypeMember) node.ParentNode;
     member.Modifiers |= TypeMemberModifiers.Private | TypeMemberModifiers.Virtual;
 }
Exemplo n.º 8
0
 public override void OnExplicitMemberInfo(ExplicitMemberInfo node)
 {
     Visit(node.InterfaceType);
 }
Exemplo n.º 9
0
		override public object Clone()
		{
		
			ExplicitMemberInfo clone = new ExplicitMemberInfo();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			if (null != _interfaceType)
			{
				clone._interfaceType = _interfaceType.Clone() as SimpleTypeReference;
				clone._interfaceType.InitializeParent(clone);
			}
			return clone;


		}