Beispiel #1
0
            public string ParameterlessCtor()
            {
                var translationUnit = TranslationUnitBuilder.BuildObjectCreationExpressionTranslationUnit(
                    IdentifierTranslationUnit.Create("MyType"), new ITranslationUnit[] { });

                return(translationUnit.Translate());
            }
Beispiel #2
0
            public string RenderThrowStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildThrowStatementTranslationUnit(
                    TranslationUnitBuilder.BuildNullLiteralTranslationUnit());

                return(translationUnit.Translate());
            }
Beispiel #3
0
            public string MemberAccessExpressionNone()
            {
                var translationUnit = TranslationUnitBuilder.BuildExpressionTranslationUnit("MyMember",
                                                                                            MemberAccessExpressionTranslationUnit.MemberAccessMethod.None);

                return(translationUnit.Translate());
            }
Beispiel #4
0
            public string InvokationExpressionParameterlessInvokation()
            {
                var translationUnit = TranslationUnitBuilder.BuildExpressionTranslationUnit(
                    IdentifierTranslationUnit.Create("myMethod"), new ITranslationUnit[] { });

                return(translationUnit.Translate());
            }
Beispiel #5
0
            public string RenderReturnStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildReturnStatementTranslationUnit(
                    TranslationUnitBuilder.BuildLiteralTranslationUnit(true));

                return(translationUnit.Translate());
            }
Beispiel #6
0
            public string InvokationExpressionOneParameter()
            {
                var translationUnit = TranslationUnitBuilder.BuildExpressionTranslationUnit(
                    IdentifierTranslationUnit.Create("myMethod"), new ITranslationUnit[]
                {
                    TranslationUnitBuilder.BuildLiteralTranslationUnit("string1")
                });

                return(translationUnit.Translate());
            }
Beispiel #7
0
            // TODO: There is a problem, in body block, no semicolons are added between statements
            //[RenderingResource("ConditionalStatements.IfStatement.ts")]
            public string RenderIfStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildIfStatementTranslationUnit(
                    TranslationUnitBuilder.BuildLiteralTranslationUnit(true),
                    new ITranslationUnit[]
                {
                    TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable1",
                                                                                   TranslationUnitBuilder.BuildExpressionTranslationUnit(OperatorToken.Addition, 12, 23)),
                    TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable2",
                                                                                   TranslationUnitBuilder.BuildLiteralTranslationUnit(14))
                });

                return(translationUnit.Translate());
            }
Beispiel #8
0
            // TODO: There is a problem, in body block, no semicolons are added between statements
            //[RenderingResource("ConditionalStatements.IfElseStatement.ts")]
            public string RenderIfElseStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildIfStatementTranslationUnit(
                    TranslationUnitBuilder.BuildLiteralTranslationUnit(true),
                    new ITranslationUnit[]
                {
                    TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable1",
                                                                                   TranslationUnitBuilder.BuildExpressionTranslationUnit(OperatorToken.Subtraction, 1, 2)),
                    TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.StringType, "variable2",
                                                                                   TranslationUnitBuilder.BuildLiteralTranslationUnit("Hello"))
                },
                    new ITranslationUnit[]
                {
                    TranslationUnitBuilder.BuildVariableDeclarationTranslationUnit(Lexems.NumberType, "variable1",
                                                                                   TranslationUnitBuilder.BuildExpressionTranslationUnit(OperatorToken.Multiplication, 100, 21))
                });

                return(translationUnit.Translate());
            }
Beispiel #9
0
            public string BinaryExpressionIntegerSum()
            {
                var translationUnit = TranslationUnitBuilder.BuildExpressionTranslationUnit(OperatorToken.Addition, 1, 2);

                return(translationUnit.Translate());
            }
Beispiel #10
0
            public string CastExpressionNativeCast()
            {
                var translationUnit = TranslationUnitBuilder.BuildExpressionTranslationUnit("int", "myVariable");

                return(translationUnit.Translate());
            }
Beispiel #11
0
            public string UnaryExpressionPrefixIncrement()
            {
                var translationUnit = TranslationUnitBuilder.BuildExpressionTranslationUnit(OperatorToken.Increment, 1, false);

                return(translationUnit.Translate());
            }
Beispiel #12
0
            public string LiteralExpressionNull()
            {
                var translationUnit = TranslationUnitBuilder.BuildNullLiteralTranslationUnit();

                return(translationUnit.Translate());
            }
Beispiel #13
0
            public string LiteralExpressionBoolean()
            {
                var translationUnit = TranslationUnitBuilder.BuildLiteralTranslationUnit(true);

                return(translationUnit.Translate());
            }
Beispiel #14
0
            public string LiteralExpressionInteger()
            {
                var translationUnit = TranslationUnitBuilder.BuildLiteralTranslationUnit(1);

                return(translationUnit.Translate());
            }
Beispiel #15
0
            public string ParenthesizedExpressionVariableWrapping()
            {
                var translationUnit = TranslationUnitBuilder.BuildExpressionTranslationUnit(IdentifierTranslationUnit.Create("myVariable"));

                return(translationUnit.Translate());
            }
Beispiel #16
0
            public string RenderThrowVoidStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildThrowStatementTranslationUnit();

                return(translationUnit.Translate());
            }
Beispiel #17
0
            public string RenderContinueStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildContinueStatementTranslationUnit();

                return(translationUnit.Translate());
            }
Beispiel #18
0
            public string RenderBreakStatement()
            {
                ITranslationUnit translationUnit = TranslationUnitBuilder.BuildBreakStatementTranslationUnit();

                return(translationUnit.Translate());
            }