本文整理汇总了C#中ICSharpCode.NRefactory.Semantics.ResolveResult类的典型用法代码示例。如果您正苦于以下问题:C# ResolveResult类的具体用法?C# ResolveResult怎么用?C# ResolveResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResolveResult类属于ICSharpCode.NRefactory.Semantics命名空间,在下文中一共展示了ResolveResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetArgumentsForCall
public override IList<ResolveResult> GetArgumentsForCall()
{
ResolveResult[] results = new ResolveResult[Member.Parameters.Count];
List<ResolveResult> paramsArguments = IsExpandedForm ? new List<ResolveResult>() : null;
// map arguments to parameters:
for (int i = 0; i < Arguments.Count; i++) {
int mappedTo;
if (argumentToParameterMap != null)
mappedTo = argumentToParameterMap[i];
else
mappedTo = IsExpandedForm ? Math.Min(i, results.Length - 1) : i;
if (mappedTo >= 0 && mappedTo < results.Length) {
if (IsExpandedForm && mappedTo == results.Length - 1)
paramsArguments.Add(Arguments[i]);
else
results[mappedTo] = Arguments[i];
}
}
if (IsExpandedForm)
results[results.Length - 1] = new ArrayCreateResolveResult(Member.Parameters.Last().Type, null, paramsArguments.ToArray());
for (int i = 0; i < results.Length; i++) {
if (results[i] == null) {
if (Member.Parameters[i].IsOptional) {
results[i] = new ConstantResolveResult(Member.Parameters[i].Type, Member.Parameters[i].ConstantValue);
} else {
results[i] = ErrorResolveResult.UnknownError;
}
}
}
return results;
}
示例2: FromResolveResult
public static AccessPath FromResolveResult(ResolveResult resolveResult)
{
var memberPath = new List<IMember>();
var currentResolveResult = resolveResult;
do {
if (currentResolveResult is MemberResolveResult) {
var memberResolveResult = (MemberResolveResult)currentResolveResult;
memberPath.Add(memberResolveResult.Member);
currentResolveResult = memberResolveResult.TargetResult;
} else if (currentResolveResult is LocalResolveResult) {
// This is the root variable
var localResolveResult = (LocalResolveResult)currentResolveResult;
memberPath.Reverse();
return new AccessPath(localResolveResult.Variable) {
MemberPath = memberPath
};
} else if (currentResolveResult is ThisResolveResult) {
break;
} else {
// Unsupported path
return null;
}
} while (currentResolveResult != null);
memberPath.Reverse();
return new AccessPath(null) {
MemberPath = memberPath
};
}
示例3: ToolTipData
public ToolTipData (ICSharpCode.NRefactory.PlayScript.SyntaxTree unit, ICSharpCode.NRefactory.Semantics.ResolveResult result, ICSharpCode.NRefactory.PlayScript.AstNode node, CSharpAstResolver file)
{
this.Unit = unit;
this.Result = result;
this.Node = node;
this.Resolver = file;
}
示例4: FromResolveResult
public static InitializerPath FromResolveResult(ResolveResult resolveResult)
{
InitializerPath initializerPath = null;
var memberPath = new List<IMember>();
var currentResolveResult = resolveResult;
do {
if (currentResolveResult is MemberResolveResult) {
var memberResolveResult = (MemberResolveResult)currentResolveResult;
memberPath.Add(memberResolveResult.Member);
currentResolveResult = memberResolveResult.TargetResult;
} else if (currentResolveResult is LocalResolveResult) {
var localResolveResult = (LocalResolveResult)currentResolveResult;
memberPath.Reverse();
initializerPath = new InitializerPath(localResolveResult.Variable) {
MemberPath = memberPath
};
break;
} else if (currentResolveResult is ThisResolveResult) {
break;
} else {
return null;
}
} while (currentResolveResult != null);
if (initializerPath == null) {
// This path is rooted at a member
memberPath.Reverse();
initializerPath = new InitializerPath(memberPath [0]) {
MemberPath = memberPath.Skip(1).ToList()
};
}
return initializerPath;
}
示例5: TryResolveAt
public static bool TryResolveAt(this Document doc, DocumentLocation loc, out ResolveResult result, out AstNode node)
{
if(doc == null)
throw new ArgumentNullException("doc");
result = null;
node = null;
var parsed_doc = doc.ParsedDocument;
if(parsed_doc == null)
return false;
var unit = parsed_doc.GetAst<SyntaxTree>();
var parsed_file = parsed_doc.ParsedFile as BVE5UnresolvedFile;
if(unit == null || parsed_file == null)
return false;
try{
result = ResolveAtLocation.Resolve(new Lazy<ICompilation>(() => doc.Compilation), parsed_file, unit, loc, out node);
if(result == null || node is Statement)
return false;
}catch(Exception e){
Console.WriteLine("Got resolver exception:" + e);
return false;
}
return true;
}
示例6: Run
public override void Run(ResolveResult symbol)
{
var entity = GetSymbol(symbol);
if ((entity is IMember) && ((entity.SymbolKind == SymbolKind.Constructor) || (entity.SymbolKind == SymbolKind.Destructor))) {
// Don't rename constructors/destructors, rename their declaring type instead
entity = ((IMember) entity).DeclaringType.GetDefinition();
}
if (entity != null) {
var project = GetProjectFromSymbol(entity);
if (project != null) {
var languageBinding = project.LanguageBinding;
RenameSymbolDialog renameDialog = new RenameSymbolDialog(name => CheckName(name, languageBinding))
{
Owner = SD.Workbench.MainWindow,
OldSymbolName = entity.Name,
NewSymbolName = entity.Name
};
if ((bool) renameDialog.ShowDialog()) {
AsynchronousWaitDialog.ShowWaitDialogForAsyncOperation(
"${res:SharpDevelop.Refactoring.Rename}",
progressMonitor =>
FindReferenceService.RenameSymbol(entity, renameDialog.NewSymbolName, progressMonitor)
.ObserveOnUIThread()
.Subscribe(error => SD.MessageService.ShowError(error.Message), ex => SD.MessageService.ShowException(ex), () => {}));
}
}
}
}
示例7: Run
public override void Run(ResolveResult symbol)
{
var entity = GetSymbol(symbol) as IEntity;
if (entity != null) {
ILSpyController.OpenInILSpy(entity);
}
}
示例8: Run
public override void Run(ResolveResult symbol)
{
if (symbol == null)
return;
var trr = symbol as TypeResolveResult;
var def = symbol.Type.GetDefinition();
if (trr != null && def != null && def.Parts.Count > 1) {
ShowPopupWithPartialClasses(def);
return;
}
DomRegion pos = symbol.GetDefinitionRegion();
if (string.IsNullOrEmpty(pos.FileName)) {
IEntity entity = GetSymbol(symbol) as IEntity;
if (entity != null) {
NavigationService.NavigateTo(entity);
}
} else {
try {
if (pos.Begin.IsEmpty)
FileService.OpenFile(pos.FileName);
else
FileService.JumpToFilePosition(pos.FileName, pos.BeginLine, pos.BeginColumn);
} catch (Exception ex) {
MessageService.ShowException(ex, "Error jumping to '" + pos.FileName + "'.");
}
}
}
示例9: InvocationResolveResult
public InvocationResolveResult(
ResolveResult targetResult, IParameterizedMember member, IType returnType,
IList<ResolveResult> arguments)
: base(targetResult, member, returnType)
{
this.Arguments = arguments ?? EmptyList<ResolveResult>.Instance;
}
示例10: Run
public override void Run(ResolveResult symbol)
{
var entity = GetSymbol(symbol);
if (entity != null) {
var project = GetProjectFromSymbol(entity);
if (project != null) {
var languageBinding = project.LanguageBinding;
RenameSymbolDialog renameDialog = new RenameSymbolDialog(name => CheckName(name, languageBinding))
{
Owner = SD.Workbench.MainWindow,
OldSymbolName = entity.Name,
NewSymbolName = entity.Name
};
if ((bool) renameDialog.ShowDialog()) {
AsynchronousWaitDialog.ShowWaitDialogForAsyncOperation(
"${res:SharpDevelop.Refactoring.Rename}",
progressMonitor =>
FindReferenceService.RenameSymbol(entity, renameDialog.NewSymbolName, progressMonitor)
.ObserveOnUIThread()
.Subscribe(error => SD.MessageService.ShowError(error.Message), ex => SD.MessageService.ShowException(ex), () => {}));
}
}
}
}
示例11: MemberResolveResult
public MemberResolveResult(ResolveResult targetResult, IMember member, IType returnType) : base(returnType)
{
if (member == null)
throw new ArgumentNullException("member");
this.targetResult = targetResult;
this.member = member;
}
示例12: InvocationResolveResult
public InvocationResolveResult(ResolveResult targetResult, IParameterizedMember member,
IList<ResolveResult> arguments = null,
IList<ResolveResult> initializerStatements = null)
: base(targetResult, member)
{
this.Arguments = arguments ?? EmptyList<ResolveResult>.Instance;
this.InitializerStatements = initializerStatements ?? EmptyList<ResolveResult>.Instance;
}
示例13: ConversionResolveResult
public ConversionResolveResult(IType targetType, ResolveResult input, Conversion conversion)
: base(targetType)
{
if (input == null)
throw new ArgumentNullException("input");
this.Input = input;
this.Conversion = conversion;
}
示例14: MemberResolveResult
public MemberResolveResult(ResolveResult targetResult, IMember member, IType returnType, bool isConstant, object constantValue)
: base(returnType)
{
this.targetResult = targetResult;
this.member = member;
this.isConstant = isConstant;
this.constantValue = constantValue;
}
示例15: Run
public override void Run(ResolveResult symbol)
{
IEntity entityUnderCaret = GetSymbol(symbol) as IEntity;
if (entityUnderCaret is ITypeDefinition) {
MakePopupWithBaseClasses((ITypeDefinition)entityUnderCaret).OpenAtCaretAndFocus();
} else {
MessageService.ShowError("${res:ICSharpCode.Refactoring.NoClassUnderCursorError}");
}
}