本文整理汇总了C#中ISyntaxRegion类的典型用法代码示例。如果您正苦于以下问题:C# ISyntaxRegion类的具体用法?C# ISyntaxRegion怎么用?C# ISyntaxRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISyntaxRegion类属于命名空间,在下文中一共展示了ISyntaxRegion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UFCSResolver
UFCSResolver(ResolutionContext ctxt, ISemantic firstArg, int nameHash = 0, ISyntaxRegion sr = null)
: base(ctxt)
{
this.firstArgument = firstArg;
this.nameFilterHash = nameHash;
this.sr = sr;
}
开发者ID:rainers,项目名称:D_Parser,代码行数:7,代码来源:UFCSResolver.cs
示例2: TryResolveFurtherIdViaOpDispatch
/// <summary>
/// http://dlang.org/operatoroverloading.html#Dispatch
/// Check for the existence of an opDispatch overload.
/// Important: Because static opDispatches are allowed as well, do check whether we can access non-static overloads from non-instance expressions or such
/// </summary>
public static IEnumerable<AbstractType> TryResolveFurtherIdViaOpDispatch (ResolutionContext ctxt, int nextIdentifierHash, UserDefinedType b, ISyntaxRegion typeBase = null)
{
// The usual SO prevention
if (nextIdentifierHash == opDispatchId || b == null)
yield break;
AbstractType[] overloads;
var opt = ctxt.CurrentContext.ContextDependentOptions;
// Look for opDispatch-Members inside b's Definition
using (ctxt.Push(b))
{
ctxt.CurrentContext.ContextDependentOptions = opt; // Mainly required for not resolving opDispatch's return type, as this will be performed later on in higher levels
overloads = TypeDeclarationResolver.ResolveFurtherTypeIdentifier(opDispatchId, b, ctxt, typeBase, false);
}
if (overloads == null || overloads.Length < 0)
yield break;
var av = new ArrayValue (Evaluation.GetStringType(ctxt), Strings.TryGet(nextIdentifierHash));
foreach (DSymbol o in overloads) {
var dn = o.Definition;
if (dn.TemplateParameters != null && dn.TemplateParameters.Length > 0 &&
dn.TemplateParameters[0] is TemplateValueParameter)
{
//TODO: Test parameter types for being a string value
o.SetDeducedTypes(new[]{ new TemplateParameterSymbol(dn.TemplateParameters[0], av) });
yield return o;
}
}
}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:37,代码来源:OpDispatchResolution.cs
示例3: MemberCompletionProvider
public MemberCompletionProvider(ICompletionDataGenerator cdg, ISyntaxRegion sr, IBlockNode b, IStatement stmt)
: base(cdg)
{
AccessExpression = sr;
ScopedBlock = b;
ScopedStatement = stmt;
}
开发者ID:rainers,项目名称:D_Parser,代码行数:7,代码来源:MemberCompletionProvider.cs
示例4: ExtractIdLocation
/// <summary>
/// Used to extract the adequate code location + the identifier length
/// </summary>
public static CodeLocation ExtractIdLocation(ISyntaxRegion sr, out int idLength)
{
if (sr is IdentifierDeclaration)
{
var id = (IdentifierDeclaration)sr;
idLength = id.Id.Length;
return id.Location;
}
else if (sr is IdentifierExpression)
{
var id = (IdentifierExpression)sr;
idLength = id.StringValue.Length;
return id.Location;
}
else if (sr is TemplateInstanceExpression)
{
var tix = (TemplateInstanceExpression)sr;
idLength = tix.TemplateId.Length;
return tix.Identifier.Location;
}
else if (sr is PostfixExpression_Access)
return ExtractIdLocation(((PostfixExpression_Access)sr).AccessExpression, out idLength);
else if (sr is NewExpression)
return ExtractIdLocation(((NewExpression)sr).Type, out idLength);
idLength = 0;
return CodeLocation.Empty;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:32,代码来源:DeepASTVisitor.cs
示例5: SearchAndResolve
public static List<AbstractType> SearchAndResolve(ResolutionContext ctxt, CodeLocation caret, int nameHash, ISyntaxRegion idObject=null)
{
var scan = new NameScan(ctxt, nameHash, idObject);
scan.IterateThroughScopeLayers(caret);
return scan.matches_types;
}
开发者ID:rainers,项目名称:D_Parser,代码行数:8,代码来源:NameScan.cs
示例6: AmbiguityError
public AmbiguityError(ISyntaxRegion syntaxObj, IEnumerable<ISemantic> results)
: base(syntaxObj, "Resolution returned too many results")
{
if (results is ISemantic[])
this.DetectedOverloads = (ISemantic[])results;
else if(results!=null)
this.DetectedOverloads = results.ToArray();
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:8,代码来源:ResolutionError.cs
示例7: GetMixinContent
static string GetMixinContent(MixinStatement mx, ResolutionContext ctxt, bool takeStmtCache ,out ISyntaxRegion cachedContent)
{
cachedContent = null;
if(!CheckAndPushAnalysisStack(mx))
return null;
bool pop;
if(pop = (ctxt.ScopedBlock != mx.ParentNode && mx.ParentNode != null))
ctxt.PushNewScope(mx.ParentNode as IBlockNode, mx);
bool hadCachedItem;
if(takeStmtCache)
{
BlockStatement stmt;
hadCachedItem = mixinStmtCache.TryGet(ctxt, mx, out stmt);
cachedContent = stmt;
}
else
{
DModule mod;
hadCachedItem = mixinDeclCache.TryGet(ctxt, mx, out mod);
cachedContent = mod;
}
if(hadCachedItem)
{
stmtsBeingAnalysed.Remove(mx);
if(pop)
ctxt.Pop();
return null;
}
var x = mx.MixinExpression;
ISemantic v = null;
try // 'try' because there is always a risk of e.g. not having something implemented or having an evaluation exception...
{
// Evaluate the mixin expression
v = Evaluation.EvaluateValue(x, ctxt);
}
catch{}
stmtsBeingAnalysed.Remove(mx);
if(pop)
ctxt.Pop();
// Ensure it's a string literal
var av = v as ArrayValue;
if(av != null && av.IsString)
return av.StringValue;
if(takeStmtCache)
mixinStmtCache.Add(ctxt, mx, null);
else
mixinDeclCache.Add(ctxt, mx, null);
return null;
}
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:57,代码来源:MixinAnalysis.cs
示例8: TryResolveUFCS
public static List<AbstractType> TryResolveUFCS(
ISemantic firstArgument,int nameHash,CodeLocation nameLoc,
ResolutionContext ctxt, ISyntaxRegion nameSr = null)
{
if (firstArgument == null || ctxt == null)
return new List<AbstractType>();
var us = new UFCSResolver (ctxt, firstArgument, nameHash, nameSr);
us.IterateThroughScopeLayers (nameLoc, MemberFilter.Methods | MemberFilter.Templates);
return us.matches;
}
开发者ID:rainers,项目名称:D_Parser,代码行数:11,代码来源:UFCSResolver.cs
示例9: ExtractId
public static string ExtractId(ISyntaxRegion o)
{
if (o is IdentifierDeclaration)
return ((IdentifierDeclaration)o).Id;
else if (o is IdentifierExpression && ((IdentifierExpression)o).IsIdentifier)
return (string)((IdentifierExpression)o).Value;
else if (o is PostfixExpression_Access)
return ExtractId(((PostfixExpression_Access)o).AccessExpression);
else if (o is TemplateInstanceExpression)
return ((TemplateInstanceExpression)o).TemplateIdentifier.Id;
else if (o is NewExpression)
return ExtractId(((NewExpression)o).Type);
return null;
}
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:14,代码来源:TypeReferenceFinder.cs
示例10: Handle
protected override void Handle(ISyntaxRegion o)
{
if (o is IdentifierDeclaration || o is TemplateInstanceExpression)
{
if (DoPrimaryIdCheck(ExtractId(o)))
result.TypeMatches.Add(o);
}
/* Though type resolution is very fast now it's still kinda slow - 300 ms for all expressions in std.stdio
else if (o is IdentifierExpression)
{
if (DoPrimaryIdCheck((string)((IdentifierExpression)o).Value))
q.Add(o);
}
else if (o is PostfixExpression_Access)
q.AddRange(DoPrimaryIdCheck((PostfixExpression_Access)o));*/
}
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:16,代码来源:TypeReferenceFinder.cs
示例11: InterfaceType
public InterfaceType(DClassLike dc, ISyntaxRegion td,
InterfaceType[] baseInterfaces,
ReadOnlyCollection<TemplateParameterSymbol> deducedTypes)
: base(dc, td, null, baseInterfaces, deducedTypes)
{
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:6,代码来源:DType.cs
示例12: TemplateType
public TemplateType(DClassLike dc, ISyntaxRegion td, ReadOnlyCollection<TemplateParameterSymbol> inheritedTypeParams = null)
: base(dc, td, null, null, inheritedTypeParams)
{
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:4,代码来源:DType.cs
示例13: TemplateParameterSymbol
public TemplateParameterSymbol(TemplateParameter tpn, ISemantic typeOrValue, ISyntaxRegion paramIdentifier = null)
: base(tpn != null ? tpn.Representation : null, AbstractType.Get(typeOrValue), paramIdentifier)
{
this.Parameter = tpn;
this.ParameterValue = typeOrValue as ISymbolValue;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:6,代码来源:DType.cs
示例14: TemplateIntermediateType
public TemplateIntermediateType(DClassLike dc, ISyntaxRegion td,
AbstractType baseType = null, InterfaceType[] baseInterfaces = null,
ReadOnlyCollection<TemplateParameterSymbol> deducedTypes = null)
: base(dc, baseType, deducedTypes, td)
{
this.BaseInterfaces = baseInterfaces;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:7,代码来源:DType.cs
示例15: PointerType
public PointerType(AbstractType Base, ISyntaxRegion td)
: base(Base, td)
{
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:4,代码来源:DType.cs
示例16: ModuleSymbol
public ModuleSymbol(DModule mod, ISyntaxRegion td, PackageSymbol packageBase = null)
: base(mod, packageBase, (IEnumerable<TemplateParameterSymbol>)null, td)
{
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:4,代码来源:DType.cs
示例17: MemberSymbol
public MemberSymbol(DNode member, AbstractType memberType, ISyntaxRegion td,
ReadOnlyCollection<TemplateParameterSymbol> deducedTypes = null)
: base(member, memberType, deducedTypes, td)
{
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:5,代码来源:DType.cs
示例18: DerivedDataType
public DerivedDataType(AbstractType Base, ISyntaxRegion td)
: base(td)
{
this.Base = Base;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:5,代码来源:DType.cs
示例19: PackageSymbol
public PackageSymbol(ModulePackage pack,ISyntaxRegion td)
: base(td)
{
this.Package = pack;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:5,代码来源:DType.cs
示例20: DSymbol
public DSymbol(DNode Node, AbstractType BaseType, IEnumerable<TemplateParameterSymbol> deducedTypes, ISyntaxRegion td)
: base(BaseType, td)
{
if(deducedTypes!=null)
this.DeducedTypes = new ReadOnlyCollection<TemplateParameterSymbol>(deducedTypes.ToArray());
if (Node == null)
throw new ArgumentNullException ("Node");
this.definition = new WeakReference(Node);
NameHash = Node.NameHash;
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:12,代码来源:DType.cs
注:本文中的ISyntaxRegion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论