/// <summary> /// Reads an await expression from the code. /// </summary> /// <param name="parentReference"> /// The parent code unit. /// </param> /// <param name="unsafeCode"> /// Indicates whether the code being parsed resides in an unsafe code block. /// </param> /// <returns> /// Returns the expression. /// </returns> private Expression GetAwaitExpression(Reference<ICodePart> parentReference, bool unsafeCode) { Param.AssertNotNull(parentReference, "parentReference"); Param.Ignore(unsafeCode); Reference<ICodePart> expressionReference = new Reference<ICodePart>(); // The first symbol must be the await keyword. Node<CsToken> firstTokenNode = this.tokens.InsertLast(this.GetToken(CsTokenType.Await, SymbolType.Other, parentReference, expressionReference)); // Get the inner expression. Expression innerExpression = this.GetNextExpression(ExpressionPrecedence.None, expressionReference, unsafeCode); // Create the token list for the expression. CsTokenList partialTokens = new CsTokenList(this.tokens, firstTokenNode, this.tokens.Last); // Create and return the expression. AwaitExpression expression = new AwaitExpression(partialTokens, innerExpression); expressionReference.Target = expression; return expression; }
/// <summary> /// The save. /// </summary> /// <param name="awaitExpression"> /// The await expression. /// </param> private void Save(AwaitExpression awaitExpression) { @switch(awaitExpression.InternalExpression); this.cppWriter.Write("->GetResults()"); }