@ -8,6 +8,7 @@
using System ;
using System ;
using System.Collections ;
using System.Collections ;
using System.Collections.Generic ;
using System.Collections.Generic ;
using System.Linq ;
using ICSharpCode.Core ;
using ICSharpCode.Core ;
using ICSharpCode.SharpDevelop.Dom ;
using ICSharpCode.SharpDevelop.Dom ;
@ -127,6 +128,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
}
ResolveResult results = ParserService . Resolve ( expressionResult , caretLineNumber , caretColumn , fileName , document . TextContent ) ;
ResolveResult results = ParserService . Resolve ( expressionResult , caretLineNumber , caretColumn , fileName , document . TextContent ) ;
if ( results = = null )
return ;
LanguageProperties language = ParserService . CurrentProjectContent . Language ;
LanguageProperties language = ParserService . CurrentProjectContent . Language ;
TypeResolveResult trr = results as TypeResolveResult ;
TypeResolveResult trr = results as TypeResolveResult ;
if ( trr = = null & & language . AllowObjectConstructionOutsideContext ) {
if ( trr = = null & & language . AllowObjectConstructionOutsideContext ) {
@ -138,22 +141,14 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
constructorInsight = true ;
constructorInsight = true ;
}
}
if ( constructorInsight ) {
if ( constructorInsight ) {
if ( trr = = nu ll) {
if ( trr ! = null | | expressionResult . Context = = ExpressionContext . BaseConstructorCa ll) {
if ( ( expressionResult . Expression = = "this" ) & & ( expressionResult . Context = = ExpressionContext . BaseConstructorCall ) ) {
if ( results . ResolvedType ! = null ) {
methods . AddRange ( GetConstructorMethods ( results . ResolvedType . GetMethods ( ) ) ) ;
methods . AddRange ( GetConstructorMethods ( results . ResolvedType . GetMethods ( ) ) ) ;
}
IClass resolvedClass = ( trr ! = null ) ? trr . ResolvedClass : results . ResolvedType . GetUnderlyingClass ( ) ;
if ( methods . Count = = 0 & & resolvedClass ! = null & & ! resolvedClass . IsStatic ) {
if ( ( expressionResult . Expression = = "base" ) & & ( expressionResult . Context = = ExpressionContext . BaseConstructorCall ) ) {
// add default constructor
if ( results . CallingClass . BaseType . DotNetName = = "System.Object" )
methods . Add ( Constructor . CreateDefault ( resolvedClass ) ) ;
return ;
}
methods . AddRange ( GetConstructorMethods ( results . CallingClass . BaseType . GetMethods ( ) ) ) ;
}
} else {
methods . AddRange ( GetConstructorMethods ( trr . ResolvedType . GetMethods ( ) ) ) ;
if ( methods . Count = = 0 & & trr . ResolvedClass ! = null & & ! trr . ResolvedClass . IsAbstract & & ! trr . ResolvedClass . IsStatic ) {
// add default constructor
methods . Add ( Constructor . CreateDefault ( trr . ResolvedClass ) ) ;
}
}
}
}
} else {
} else {
@ -189,15 +184,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
}
}
}
List < IMethodOrProperty > GetConstructorMethods ( List < IMethod > methods )
IEnumerable < IMethodOrProperty > GetConstructorMethods ( List < IMethod > methods )
{
{
List < IMethodOrProperty > constructorMethods = new List < IMethodOrProperty > ( ) ;
return from method in methods
foreach ( IMethod method in methods ) {
where method . IsConstructor & & ! method . IsStatic
if ( method . IsConstructor & & ! method . IsStatic ) {
select ( IMethodOrProperty ) method ;
constructorMethods . Add ( method ) ;
}
}
return constructorMethods ;
}
}
public bool CaretOffsetChanged ( )
public bool CaretOffsetChanged ( )