@ -739,40 +739,40 @@ namespace ICSharpCode.NRefactory.CSharp
public override void Visit ( EventProperty ep )
public override void Visit ( EventProperty ep )
{
{
EventDeclaration newEvent = new EventDeclaration ( ) ;
Custom EventDeclaration newEvent = new Custom EventDeclaration ( ) ;
var location = LocationsBag . GetMemberLocation ( ep ) ;
var location = LocationsBag . GetMemberLocation ( ep ) ;
AddModifiers ( newEvent , location ) ;
AddModifiers ( newEvent , location ) ;
if ( location ! = null )
if ( location ! = null )
newEvent . AddChild ( new CSharpTokenNode ( Convert ( location [ 0 ] ) , "event" . Length ) , EventDeclaration . Roles . Keyword ) ;
newEvent . AddChild ( new CSharpTokenNode ( Convert ( location [ 0 ] ) , "event" . Length ) , Custom EventDeclaration. Roles . Keyword ) ;
newEvent . AddChild ( ( AstType ) ep . TypeName . Accept ( this ) , EventDeclaration . Roles . Type ) ;
newEvent . AddChild ( ( AstType ) ep . TypeName . Accept ( this ) , Custom EventDeclaration. Roles . Type ) ;
newEvent . AddChild ( new Identifier ( ep . MemberName . Name , Convert ( ep . MemberName . Location ) ) , EventDeclaration . Roles . Identifier ) ;
newEvent . AddChild ( new Identifier ( ep . MemberName . Name , Convert ( ep . MemberName . Location ) ) , Custom EventDeclaration. Roles . Identifier ) ;
if ( location ! = null & & location . Count > = 2 )
if ( location ! = null & & location . Count > = 2 )
newEvent . AddChild ( new CSharpTokenNode ( Convert ( location [ 1 ] ) , 1 ) , EventDeclaration . Roles . LBrace ) ;
newEvent . AddChild ( new CSharpTokenNode ( Convert ( location [ 1 ] ) , 1 ) , Custom EventDeclaration. Roles . LBrace ) ;
if ( ep . Add ! = null ) {
if ( ep . Add ! = null ) {
Accessor addAccessor = new Accessor ( ) ;
Accessor addAccessor = new Accessor ( ) ;
var addLocation = LocationsBag . GetMemberLocation ( ep . Add ) ;
var addLocation = LocationsBag . GetMemberLocation ( ep . Add ) ;
AddModifiers ( addAccessor , addLocation ) ;
AddModifiers ( addAccessor , addLocation ) ;
addAccessor . AddChild ( new CSharpTokenNode ( Convert ( ep . Add . Location ) , "add" . Length ) , EventDeclaration . Roles . Keyword ) ;
addAccessor . AddChild ( new CSharpTokenNode ( Convert ( ep . Add . Location ) , "add" . Length ) , Custom EventDeclaration. Roles . Keyword ) ;
if ( ep . Add . Block ! = null )
if ( ep . Add . Block ! = null )
addAccessor . AddChild ( ( BlockStatement ) ep . Add . Block . Accept ( this ) , EventDeclaration . Roles . Body ) ;
addAccessor . AddChild ( ( BlockStatement ) ep . Add . Block . Accept ( this ) , Custom EventDeclaration. Roles . Body ) ;
newEvent . AddChild ( addAccessor , EventDeclaration . AddAccessorRole ) ;
newEvent . AddChild ( addAccessor , Custom EventDeclaration. AddAccessorRole ) ;
}
}
if ( ep . Remove ! = null ) {
if ( ep . Remove ! = null ) {
Accessor removeAccessor = new Accessor ( ) ;
Accessor removeAccessor = new Accessor ( ) ;
var removeLocation = LocationsBag . GetMemberLocation ( ep . Remove ) ;
var removeLocation = LocationsBag . GetMemberLocation ( ep . Remove ) ;
AddModifiers ( removeAccessor , removeLocation ) ;
AddModifiers ( removeAccessor , removeLocation ) ;
removeAccessor . AddChild ( new CSharpTokenNode ( Convert ( ep . Remove . Location ) , "remove" . Length ) , EventDeclaration . Roles . Keyword ) ;
removeAccessor . AddChild ( new CSharpTokenNode ( Convert ( ep . Remove . Location ) , "remove" . Length ) , Custom EventDeclaration. Roles . Keyword ) ;
if ( ep . Remove . Block ! = null )
if ( ep . Remove . Block ! = null )
removeAccessor . AddChild ( ( BlockStatement ) ep . Remove . Block . Accept ( this ) , EventDeclaration . Roles . Body ) ;
removeAccessor . AddChild ( ( BlockStatement ) ep . Remove . Block . Accept ( this ) , Custom EventDeclaration. Roles . Body ) ;
newEvent . AddChild ( removeAccessor , EventDeclaration . RemoveAccessorRole ) ;
newEvent . AddChild ( removeAccessor , Custom EventDeclaration. RemoveAccessorRole ) ;
}
}
if ( location ! = null & & location . Count > = 3 )
if ( location ! = null & & location . Count > = 3 )
newEvent . AddChild ( new CSharpTokenNode ( Convert ( location [ 2 ] ) , 1 ) , EventDeclaration . Roles . RBrace ) ;
newEvent . AddChild ( new CSharpTokenNode ( Convert ( location [ 2 ] ) , 1 ) , Custom EventDeclaration. Roles . RBrace ) ;
typeStack . Peek ( ) . AddChild ( newEvent , TypeDeclaration . MemberRole ) ;
typeStack . Peek ( ) . AddChild ( newEvent , TypeDeclaration . MemberRole ) ;
}
}