本文整理汇总了C#中YieldStatementSyntax类的典型用法代码示例。如果您正苦于以下问题:C# YieldStatementSyntax类的具体用法?C# YieldStatementSyntax怎么用?C# YieldStatementSyntax使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
YieldStatementSyntax类属于命名空间,在下文中一共展示了YieldStatementSyntax类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetIteratorElementType
// NOTE: Specifically not overriding IsIndirectlyInIterator.
internal override TypeSymbol GetIteratorElementType(YieldStatementSyntax node, DiagnosticBag diagnostics)
{
if (node != null)
{
diagnostics.Add(ErrorCode.ERR_YieldInAnonMeth, node.YieldKeyword.GetLocation());
}
return CreateErrorType();
}
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:10,代码来源:WithLambdaParametersBinder.cs
示例2: MakeTaskYieldReturnStatements
private async Task<Document> MakeTaskYieldReturnStatements(Document document, YieldStatementSyntax yieldStatement, CancellationToken ct)
{
var root = await document.GetSyntaxRootAsync(ct).ConfigureAwait(false);
var semanticModel = await document.GetSemanticModelAsync(ct);
var nodes = yieldStatement.CreateFixedYieldReturn(semanticModel);
root = root.ReplaceNode(yieldStatement, nodes);
return document.WithSyntaxRoot(root);
}
开发者ID:endo0407,项目名称:IteratorTasks,代码行数:9,代码来源:CodeFixProvider.cs
示例3: Go
public static void Go(OutputWriter writer, YieldStatementSyntax yieldStatementSyntax)
{
if (yieldStatementSyntax.ReturnOrBreakKeyword.IsKind(SyntaxKind.ReturnKeyword))
{
writer.WriteLine("__iter.yieldReturn({0});", Core.WriteString(yieldStatementSyntax.Expression));
}
else
{
writer.WriteLine("__iter.yieldBreak();");
}
}
开发者ID:mortezabarzkar,项目名称:SharpNative,代码行数:13,代码来源:WriteYieldStatement.cs
示例4: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
var nextState = GetNextState(node);
if (node.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))
{
currentState.Add(ChangeState(nextState));
currentState.Add(Cs.Return(Cs.False()));
}
else
{
currentState.Add(ChangeState(nextState));
currentState.Add(Cs.Express(Cs.This().Member("Current").Assign(StateMachineThisFixer.Fix(node.Expression))));
currentState.Add(Cs.Return(Cs.True()));
}
SetClosed(currentState);
currentState = nextState;
}
开发者ID:mortezabarzkar,项目名称:SharpNative,代码行数:19,代码来源:YieldStateGenerator.cs
示例5: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
var nextState = GetNextState();
if (node.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))
{
CurrentState.Add(ChangeState(nextState));
CurrentState.Add(Js.Primitive(false).Return());
}
else
{
CurrentState.Add(ChangeState(nextState));
// if (Transformer.Model.Compilation.Assembly.AreAutoPropertiesMinimized())
// CurrentState.Add(Js.Reference(stateMachine).Member("Current").Assign((JsExpression)node.Expression.Accept(Transformer)).Express());
// else
CurrentState.Add(Js.Reference(stateMachine).Member("set_Current").Invoke((JsExpression)node.Expression.Accept(Transformer)).Express());
CurrentState.Add(Js.Primitive(true).Return());
}
CurrentState = nextState;
}
开发者ID:x335,项目名称:WootzJs,代码行数:20,代码来源:YieldStateGenerator.cs
示例6: VisitYieldStatement
public void VisitYieldStatement(YieldStatementSyntax node)
{
if (node == null)
throw new ArgumentNullException("node");
node.Validate();
WriteLeadingTrivia(node);
_writer.WriteIndent();
_writer.WriteKeyword(PrinterKeyword.Yield);
_writer.WriteSpace();
switch (node.Kind)
{
case ReturnOrBreak.Break: _writer.WriteKeyword(PrinterKeyword.Break); break;
case ReturnOrBreak.Return: _writer.WriteKeyword(PrinterKeyword.Return); break;
default: throw ThrowHelper.InvalidEnumValue(node.Kind);
}
if (node.Expression != null)
{
_writer.WriteSpace();
node.Expression.Accept(this);
}
_writer.EndStatement();
WriteTrailingTrivia(node);
}
开发者ID:modulexcite,项目名称:CSharpSyntax,代码行数:30,代码来源:SyntaxPrinter.cs
示例7: GetIteratorElementType
internal override TypeSymbol GetIteratorElementType(YieldStatementSyntax node, DiagnosticBag diagnostics)
{
if (IsScriptClass)
{
// This is the scenario where a `yield return` exists in the script file as a global statement.
// This method is to guard against hitting `BuckStopsHereBinder` and crash.
return this.Compilation.GetSpecialType(SpecialType.System_Object);
}
else
{
// This path would eventually throw, if we didn't have the case above.
return Next.GetIteratorElementType(node, diagnostics);
}
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:14,代码来源:InContainerBinder.cs
示例8: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
base.VisitYieldStatement(node);
isSpecial = true;
}
开发者ID:mortezabarzkar,项目名称:SharpNative,代码行数:5,代码来源:YieldChecker.cs
示例9: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
base.VisitYieldStatement(node);
_counter++;
}
开发者ID:jjrdk,项目名称:ArchiMetrics,代码行数:5,代码来源:LinesOfCodeCalculator.cs
示例10: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
if (node.IsKind(SyntaxKind.YieldBreakStatement))
{
// end not connected with data
curNode = builder.CreateEndNode(node);
}
else {
CreateConnectedEndNode(node);
}
}
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:11,代码来源:ControlFlow.cs
示例11: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
_sawYield = true;
base.VisitYieldStatement(node);
}
开发者ID:GloryChou,项目名称:roslyn,代码行数:5,代码来源:LocalBinderFactory.cs
示例12: BindYieldBreakStatement
private BoundStatement BindYieldBreakStatement(YieldStatementSyntax node, DiagnosticBag diagnostics)
{
if (this.Flags.Includes(BinderFlags.InFinallyBlock))
{
Error(diagnostics, ErrorCode.ERR_BadYieldInFinally, node.YieldKeyword);
}
GetIteratorElementType(node, diagnostics);
return new BoundYieldBreakStatement(node);
}
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:10,代码来源:Binder_Statements.cs
示例13: GetIteratorElementType
internal override TypeSymbol GetIteratorElementType(YieldStatementSyntax node, DiagnosticBag diagnostics)
{
TypeSymbol returnType = this.Owner.ReturnType;
if (!this.IsDirectlyInIterator)
{
// This should only happen when speculating, but we don't have a good way to assert that since the
// original binder isn't available here.
// If we're speculating about a yield statement inside a non-iterator method, we'll try to be nice
// and deduce an iterator element type from the return type. If we didn't do this, the
// TypeInfo.ConvertedType of the yield statement would always be an error type. However, we will
// not mutate any state (i.e. we won't store the result).
return GetIteratorElementTypeFromReturnType(returnType, node, diagnostics) ?? CreateErrorType();
}
if (this.iteratorInfo == IteratorInfo.Empty)
{
TypeSymbol elementType = null;
DiagnosticBag elementTypeDiagnostics = DiagnosticBag.GetInstance();
elementType = GetIteratorElementTypeFromReturnType(returnType, node, elementTypeDiagnostics);
if ((object)elementType == null)
{
Error(elementTypeDiagnostics, ErrorCode.ERR_BadIteratorReturn, this.Owner.Locations[0], this.Owner, returnType);
elementType = CreateErrorType();
}
var info = new IteratorInfo(elementType, elementTypeDiagnostics.ToReadOnlyAndFree());
Interlocked.CompareExchange(ref this.iteratorInfo, info, IteratorInfo.Empty);
}
if (node == null)
{
// node==null indicates this we are being called from the top-level of processing of a method. We report
// the diagnostic, if any, at that time to ensure it is reported exactly once.
diagnostics.AddRange(this.iteratorInfo.ElementTypeDiagnostics);
}
return this.iteratorInfo.ElementType;
}
开发者ID:riversky,项目名称:roslyn,代码行数:42,代码来源:InMethodBinder.cs
示例14: VisitYieldStatement
public override SyntaxNode VisitYieldStatement(YieldStatementSyntax node)
{
this.AppendCompileIssue(node, IssueType.Error, IssueId.YieldNotSupport);
return node;
}
开发者ID:rexzh,项目名称:SharpJs,代码行数:5,代码来源:Rewriter_BasicStructure.cs
示例15: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
if (node.Expression != null)
{
var patternBinder = new PatternVariableBinder(node, _enclosing);
AddToMap(node, patternBinder);
Visit(node.Expression, patternBinder);
}
_sawYield = true;
}
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:11,代码来源:LocalBinderFactory.cs
示例16: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
VisitNodeToBind(node.Expression);
}
开发者ID:natidea,项目名称:roslyn,代码行数:4,代码来源:ExpressionVariableFinder.cs
示例17: VisitYieldStatement
public override void VisitYieldStatement(YieldStatementSyntax node)
{
Fail = true;
}
开发者ID:antiufo,项目名称:RoslynLinqRewrite,代码行数:4,代码来源:CanRewrapForeachVisitor.cs
示例18: VisitYieldStatement
/// <summary>
///
/// </summary>
/// <param name="node"></param>
public override sealed void VisitYieldStatement(YieldStatementSyntax node)
{
this.OnNodeVisited(node, this.type.IsInstanceOfType(node));
base.VisitYieldStatement(node);
}
开发者ID:andry-tino,项目名称:Rosetta,代码行数:9,代码来源:ASTWalkerNodeTypeOperationExecutor.cs
示例19: VisitYieldStatement
/// <summary>
///
/// </summary>
/// <param name="node"></param>
public override sealed void VisitYieldStatement(YieldStatementSyntax node)
{
this.OnNodeVisited(node);
if (!this.traverseRootOnly) base.VisitYieldStatement(node);
}
开发者ID:andry-tino,项目名称:Rosetta,代码行数:9,代码来源:MultiPurposeASTWalker.cs
示例20: VisitYieldStatement
/// <summary>
///
/// </summary>
/// <param name="node"></param>
public override void VisitYieldStatement(YieldStatementSyntax node)
{
throw new NotSupportedException("We do not support translation of yield statements!");
}
开发者ID:afrog33k,项目名称:Rosetta,代码行数:8,代码来源:MethodASTWalker.cs
注:本文中的YieldStatementSyntax类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论