Example #1
0
        /// <summary>
        /// Replaces the ForEachStatements in the mixin by ForStatements
        /// </summary>
        /// <param name="mixin">the mixin</param>
        private static void ExpandForEachStatements(ModuleMixin mixin)
        {
            foreach (var statementNodeCouple in mixin.ParsingInfo.ForEachStatements.Where(x => !(x.Statement as ForEachStatement).Variable.Qualifiers.Contains(XenkoStorageQualifier.Extern)))
            {
                var newStatement = ExpandForEachStatement(statementNodeCouple.Statement as ForEachStatement);
                if (newStatement != null)
                {
                    var replace = new XenkoReplaceVisitor(statementNodeCouple.Statement, newStatement);
                    replace.Run(statementNodeCouple.Node);
                }
            }

            mixin.InheritanceList.ForEach(ExpandForEachStatements);
        }
Example #2
0
 /// <summary>
 /// Replace a MemberReferenceExpression by a VariableReferenceExpression in the AST
 /// </summary>
 /// <param name="memberReferenceExpression">the member reference expression.</param>
 /// <param name="variableReferenceExpression">the variable reference expression.</param>
 /// <param name="parentNode">the parent node.</param>
 private static void ReplaceMemberReferenceExpressionByVariableReferenceExpression(MemberReferenceExpression memberReferenceExpression, VariableReferenceExpression variableReferenceExpression, Node parentNode)
 {
     var replacor = new XenkoReplaceVisitor(memberReferenceExpression, variableReferenceExpression);
     replacor.Run(parentNode);
 }
 /// <summary>
 /// rename the input/ouput of a method
 /// </summary>
 /// <param name="methodDeclaration">the method</param>
 /// <param name="inputName">the type replacement for Input</param>
 /// <param name="input2Name">the type replacement for Input2</param>
 /// <param name="outputName">the type replacement for Output</param>
 /// <param name="constantsName">the type replacement for Constants</param>
 private void RenameInputOutput(MethodDeclaration methodDeclaration, TypeName inputName, TypeName input2Name, TypeName outputName, TypeName constantsName)
 {
     if (inputName != null)
     {
         var replacor = new XenkoReplaceVisitor(StreamsType.Input, inputName);
         replacor.Run(methodDeclaration);
     }
     if (input2Name != null)
     {
         var replacor = new XenkoReplaceVisitor(StreamsType.Input2, input2Name);
         replacor.Run(methodDeclaration);
     }
     if (outputName != null)
     {
         var replacor = new XenkoReplaceVisitor(StreamsType.Output, outputName);
         replacor.Run(methodDeclaration);
     }
     if (constantsName != null)
     {
         var replacor = new XenkoReplaceVisitor(StreamsType.Constants, constantsName);
         replacor.Run(methodDeclaration);
     }
 }