Пример #1
0
        protected override Statement ExpandImpl(MacroStatement macro){
            if (macro.Arguments.Count == 0){
                Context.Errors.Add(new CompilerError(macro.LexicalInfo,
                                                     "sub macro requires at least one reference or string attribute for subview name"));
            }

            var call = new MethodInvocationExpression(AstUtil.CreateReferenceExpression("OutputSubView"));
            int i = 0;
            foreach (Expression argument in macro.Arguments){
                i++;
                Expression exp = argument;
                if (i == 1){
//action and contrller parameters
                    if (argument is ReferenceExpression && !(argument is MemberReferenceExpression)){
                        if (argument.ToCodeString().StartsWith("@") || argument.ToCodeString().Contains(".")){
                            exp = AstUtil.CreateReferenceExpression(argument.ToCodeString().Substring(1));
                        }
                        else{
                            exp = new StringLiteralExpression(argument.ToCodeString());
                        }
                    }
                }
                call.Arguments.Add(exp);
            }
            return new ExpressionStatement(call);
        }
        protected virtual void AddDependency(ArrayLiteralExpression dependencies, BinaryExpression binaryExpression)
        {
            StringLiteralExpression dependency;

            //HACK: replace with proper AST method invocation
            if (binaryExpression.Left is StringLiteralExpression)
            {
                dependency = new StringLiteralExpression(string.Format("{0}|{1}",
                                                    binaryExpression.Left.ToString().Trim('\''),
                                                    binaryExpression.Right.ToString().Trim('\'')));
            }
            else if(binaryExpression.Left is BinaryExpression)
            {

                var left = (BinaryExpression) binaryExpression.Left;

                var package = left.Left.ToString().Trim('\'');
                var version = left.Right.ToString().Trim('\'');
                var dll = binaryExpression.Right.ToString().Trim('\'');

                dependency = new StringLiteralExpression(string.Format("{0}|{1}|{2}",
                                                    package,
                                                    dll,
                                                    version));
            }
            else
                throw new ArgumentOutOfRangeException(string.Format("Unknown Expression type {0} passed to RightShiftToMethodCompilerStep.AddDependency", binaryExpression.Left.GetType().Name));

            dependencies.Items.Add(dependency);
        }
Пример #3
0
        protected override Statement ExpandImpl(MacroStatement macro){
            if (macro.Arguments.Count == 0)
            {
                Context.Errors.Add(new CompilerError(macro.LexicalInfo,
                                                     "call macro requires at least one reference or string attribute for action name"));
            }
            var basis = new ReferenceExpression("Html");
            var method = new MemberReferenceExpression(basis, "RenderAction");
            var call = new MethodInvocationExpression(method);
            int i = 0;
            var result = new Block();
            foreach (Expression argument in macro.Arguments){
                i++;
                Expression exp = argument;
                if (!(exp is HashLiteralExpression)){
//action and contrller parameters
                    if (!(exp is NullLiteralExpression)){
                        exp = new StringLiteralExpression(argument.ToCodeString());
                    }
                    call.Arguments.Add(exp);
                }
                else{
                    string name = "__rd";
                    result.Add(
                        new DeclarationStatement(
                            new Declaration(name, null),
                            new MethodInvocationExpression(AstUtil.CreateReferenceExpression("RouteValueDictionary"))
                            )
                        );
                    var dict = argument as HashLiteralExpression;
                    foreach (ExpressionPair item in dict.Items){
                        result.Add(
                            new MethodInvocationExpression(
                                AstUtil.CreateReferenceExpression(name + ".Add"),
                                item.First,
                                item.Second
                                )
                            );
                    }
                    if (i == 2){
                        call.Arguments.Add(new NullLiteralExpression());
                    }
                    call.Arguments.Add(AstUtil.CreateReferenceExpression(name));
                }
            }
            result.Add(call);
            return result;
        }
        public void Expression_statement_is_transformed()
        {
            LiteralExpression exp = new StringLiteralExpression("arg1");
            ExpressionStatement doStuffStatement = new ExpressionStatement(exp);

            MacroStatement fixture = new MacroStatement(new LexicalInfo("test", 1, 1));
            fixture.Name = "DoStuff";
            fixture.Block = new Block();
            fixture.Block.Add(doStuffStatement);

            BlockToArgumentsTransformer transformer = new BlockToArgumentsTransformer("DoStuff");
            transformer.Visit(fixture);

            Assert.AreEqual(exp, fixture.Arguments[0]);
            Assert.IsFalse(fixture.Block.HasStatements, "MacroStatement block should be empty after transformation.");
        }
        public void MacroStatement_with_block_is_transformed_to_MethodInvocationExpression()
        {
            const string methodInBlockName = "some_method";
            const string doStuff = "DoStuff";

            Expression argInBlockExpression = new StringLiteralExpression("argInBlock");
            Statement argInBlockStatement = new ExpressionStatement(argInBlockExpression);

            MacroStatement statementInBlock = GetMacroStatement(methodInBlockName, argInBlockStatement);

            MacroStatement doStuffStatement = GetMacroStatement(doStuff, statementInBlock);

            BlockToArgumentsTransformer transformer = new BlockToArgumentsTransformer(doStuff, methodInBlockName);
            transformer.Visit(doStuffStatement);

            MethodInvocationExpression mie = doStuffStatement.Arguments[0] as MethodInvocationExpression;

            Assert.IsNotNull(mie, "Could not cast argument one of MacroStatement to MethodInvocationExpression.");
            Assert.AreEqual(methodInBlockName, (mie.Target as ReferenceExpression).Name);
            Assert.IsAssignableFrom(typeof (BlockExpression), mie.Arguments[0]);
        }
Пример #6
0
		override public void OnStringLiteralExpression(StringLiteralExpression node)
		{
			Write("StringLiteralExpression(");
			BooPrinterVisitor.WriteStringLiteral(node.Value, _writer);
			Write(")");
		}
 public override void OnStringLiteralExpression(StringLiteralExpression literal)
 {
     _found = true;
     if ((_skip = _attributesOnly) == false)
     {
         _applied = BuildConfigurationChild(literal);
     }
 }
 private bool BuildConfigurationChild(StringLiteralExpression child)
 {
     return BuildConfigurationChild(child, null, null);
 }
 private static Expression CreateChild(StringLiteralExpression name)
 {
     var child = new MethodInvocationExpression(
         AstUtil.CreateReferenceExpression(typeof(ChildBuilder).FullName)
         );
     child.Arguments.Add(name);
     return child;
 }
 private static Expression joinInterpolations(ExpressionInterpolationExpression expressionInterpolationExpression) {
     var srcexpressions = expressionInterpolationExpression.Expressions.ToList();
     ExpressionInterpolationExpression result = new ExpressionInterpolationExpression();
     StringLiteralExpression current = null;
     foreach (var srcexpression in srcexpressions) {
         if(srcexpression is LiteralExpression) {
             var str = new StringLiteralExpression(((LiteralExpression) srcexpression).ValueObject.toStr());
             if(null==current) {
                 current = str;
             }else {
                 current.Value += str.Value;
             }
         }else {
             if(current!=null) {
                 result.Expressions.Add(current);
                 current = null;
             }
             result.Expressions.Add(srcexpression);
         }
     }
     if (current != null)
     {
         result.Expressions.Add(current);
     }
     if(result.Expressions.Count>1) return result;
     return result.Expressions[0];
 }
Пример #11
0
	protected Expression  string_literal() //throws RecognitionException, TokenStreamException
{
		Expression e;
		
		IToken  dqs = null;
		IToken  sqs = null;
		IToken  tqs = null;
		IToken  bqs = null;
		
				e = null;
			
		
		try {      // for error handling
			switch ( LA(1) )
			{
			case ESEPARATOR:
			{
				e=expression_interpolation();
				break;
			}
			case DOUBLE_QUOTED_STRING:
			{
				dqs = LT(1);
				match(DOUBLE_QUOTED_STRING);
				if (0==inputState.guessing)
				{
					
							e = new StringLiteralExpression(ToLexicalInfo(dqs), dqs.getText());
							e.Annotate("quote", "\"");
						
				}
				break;
			}
			case SINGLE_QUOTED_STRING:
			{
				sqs = LT(1);
				match(SINGLE_QUOTED_STRING);
				if (0==inputState.guessing)
				{
					
							e = new StringLiteralExpression(ToLexicalInfo(sqs), sqs.getText());
							e.Annotate("quote", "'");
						
				}
				break;
			}
			case TRIPLE_QUOTED_STRING:
			{
				tqs = LT(1);
				match(TRIPLE_QUOTED_STRING);
				if (0==inputState.guessing)
				{
					
							e = new StringLiteralExpression(ToLexicalInfo(tqs), tqs.getText());
							e.Annotate("quote", "\"\"\"");
						
				}
				break;
			}
			case BACKTICK_QUOTED_STRING:
			{
				bqs = LT(1);
				match(BACKTICK_QUOTED_STRING);
				if (0==inputState.guessing)
				{
					
							e = new StringLiteralExpression(ToLexicalInfo(bqs), bqs.getText());
							e.Annotate("quote", "`");
						
				}
				break;
			}
			default:
			{
				throw new NoViableAltException(LT(1), getFilename());
			}
			 }
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "string_literal");
				recover(ex,tokenSet_44_);
			}
			else
			{
				throw ex;
			}
		}
		return e;
	}
Пример #12
0
 public override void OnStringLiteralExpression(StringLiteralExpression node)
 {
     if (null == node.Value)
     {
         _il.Emit(OpCodes.Ldnull);
     }
     else if (0 != node.Value.Length)
     {
         _il.Emit(OpCodes.Ldstr, node.Value);
     }
     else /* force use of CLR-friendly string.Empty */
     {
         _il.Emit(OpCodes.Ldsfld, typeof(string).GetField("Empty"));
     }
     PushType(TypeSystemServices.StringType);
 }
Пример #13
0
        //throws RecognitionException, TokenStreamException
        protected Expression string_literal()
        {
            Expression e;

            IToken  dqs = null;
            IToken  sqs = null;
            IToken  tqs = null;

                e = null;

            try {      // for error handling
            switch ( LA(1) )
            {
            case ESEPARATOR:
            {
                e=expression_interpolation();
                break;
            }
            case DOUBLE_QUOTED_STRING:
            {
                dqs = LT(1);
                match(DOUBLE_QUOTED_STRING);
                if (0==inputState.guessing)
                {

                            e = new StringLiteralExpression(SourceLocationFactory.ToLexicalInfo(dqs), dqs.getText());

                }
                break;
            }
            case SINGLE_QUOTED_STRING:
            {
                sqs = LT(1);
                match(SINGLE_QUOTED_STRING);
                if (0==inputState.guessing)
                {

                            e = new StringLiteralExpression(SourceLocationFactory.ToLexicalInfo(sqs), sqs.getText());

                }
                break;
            }
            case TRIPLE_QUOTED_STRING:
            {
                tqs = LT(1);
                match(TRIPLE_QUOTED_STRING);
                if (0==inputState.guessing)
                {

                            e = new StringLiteralExpression(SourceLocationFactory.ToLexicalInfo(tqs), tqs.getText());

                }
                break;
            }
            default:
            {
                throw new NoViableAltException(LT(1), getFilename());
            }
             }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_36_);
            }
            else
            {
                throw ex;
            }
            }
            return e;
        }
Пример #14
0
        public static Expression mode(ReferenceExpression expression, BlockExpression action)
        {
            var modename = new StringLiteralExpression(expression.Name);

            return new MethodInvocationExpression(
                    new ReferenceExpression("ApplyModeSettings"),
                    modename,
                    action
                );
        }
Пример #15
0
		override public object Clone()
		{
		
			StringLiteralExpression clone = new StringLiteralExpression();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			clone._expressionType = _expressionType;
			clone._value = _value;
			return clone;


		}
Пример #16
0
		public override void OnStringLiteralExpression(StringLiteralExpression node)
		{
			_expression = new CodePrimitiveExpression(node.Value);
		}
Пример #17
0
        private bool checkSubstitution(ReferenceExpression node) {
            Match m = Regex.Match(node.ToCodeString(), @"^@_([\d\w]+?)(_)?$", RegexOptions.Compiled);
            if (m.Success){

                int idx = 0;
                var isordered = int.TryParse(m.Groups[1].Value, out idx);
                bool accomodate_to_strings = m.Groups[2].Value != "";
                Expression exp = new NullLiteralExpression();
                if (isordered){
                    idx = idx - 1;    
                    if (idx < args.Count){
                        exp = args[idx];
                    }
                }else{
                    var name = m.Groups[1].Value;
                    if(namedargs.ContainsKey(name)){
                        exp = namedargs[name];

                    }

                }
                
                if (accomodate_to_strings && (exp is ReferenceExpression))
                {
                    if (exp.ToCodeString().StartsWith("@"))
                    {
                        exp = new ReferenceExpression(exp.ToCodeString().Substring(1));
                    }
                    else
                    {
                        exp = new StringLiteralExpression(exp.ToCodeString());
                    }
                }
                node.ParentNode.Replace(node, exp);
                return true;
            }
            return false;
        }
Пример #18
0
 public override void OnStringLiteralExpression(StringLiteralExpression e)
 {
     WriteStringLiteral(e.Value);
 }
Пример #19
0
        public override Statement Expand(MacroStatement macro){
            var unit = macro.GetParentNodeOfType<CompileUnit>();
            var module = macro.GetParentNodeOfType<Module>();
            var ns = module.Namespace.Name;
            

            var key = new StringLiteralExpression(macro.Arguments[0].LiftToString());
            var value = macro.Arguments[1];


            var cls = unit.FindOrCreateClass(ns, "CommonData", null, c => c.Static());
            prepareField(cls);
            preparePublicProperty(cls);
            getBuilderMethod(cls).Append(1, Variable.Ref(resultVar).ByIndex(key).Assign(value));
            return null;
        }
Пример #20
0
        public Expression string_literal()
        {
            Expression expression = null;
            IToken token = null;
            IToken token2 = null;
            try
            {
                IToken token3;
                switch (this.LA(1))
                {
                    case 60:
                        token = this.LT(1);
                        this.match(60);
                        if (base.inputState.guessing == 0)
                        {
                            token3 = token;
                        }
                        break;

                    case 0x6d:
                        token2 = this.LT(1);
                        this.match(0x6d);
                        if (base.inputState.guessing == 0)
                        {
                            token3 = token2;
                        }
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                if (base.inputState.guessing == 0)
                {
                    expression = new StringLiteralExpression(ToLexicalInfo(token3), token3.getText());
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_20_);
                return expression;
            }
            return expression;
        }
Пример #21
0
        public static Expression install(ReferenceExpression expression,
            BlockExpression action)
        {
            var installName = new StringLiteralExpression(expression.Name);

            return new MethodInvocationExpression(
                    new ReferenceExpression("GetInstallerMeta"),
                    installName,
                    action
                );
        }
Пример #22
0
		public override Statement Expand(MacroStatement macro)
		{
			componentContextName = ComponentNaming.GetComponentContextName(macro);
			componentFactoryName = ComponentNaming.GetComponentFactoryName(macro);
			componentVariableName = ComponentNaming.GetComponentNameFor(macro);

			if (macro.Arguments.Count == 0) throw new MonoRailException("Component must be called with a name");

			var block = new Block();

			var method = (Method) macro.GetAncestor(NodeType.Method);

			var componentName = new StringLiteralExpression(macro.Arguments[0].ToString());

			var dictionary = CreateParametersDictionary(macro);

			var macroBody = CodeBuilderHelper.CreateCallableFromMacroBody(CodeBuilder, macro);

			var initContext = new MethodInvocationExpression
			{
				Target = AstUtil.CreateReferenceExpression("Castle.MonoRail.Views.Brail.BrailViewComponentContext")
			};
			initContext.Arguments.Extend(
				new[]
					{
						new SelfLiteralExpression(),
						macroBody, componentName,
						AstUtil.CreateReferenceExpression("OutputStream"),
						dictionary
					});

			// compilerContext = BrailViewComponentContext(macroBodyClosure, "componentName", OutputStream, dictionary)
			block.Add(new BinaryExpression(BinaryOperatorType.Assign,
			                               new ReferenceExpression(componentContextName), initContext));

			// AddViewComponentProperties( compilerContext.ComponentParams )
			var addProperties =
				new MethodInvocationExpression(AstUtil.CreateReferenceExpression("AddViewComponentProperties"));
			addProperties.Arguments.Add(AstUtil.CreateReferenceExpression(componentContextName + ".ComponentParameters"));
			block.Add(addProperties);

			var viewComponentFactoryLocal = CodeBuilder.DeclareLocal(method, componentFactoryName,
			                                                                   TypeSystemServices.Map(
			                                                                   	typeof(IViewComponentFactory)));

			// viewComponentFactory = context.GetService(IViewComponentFactory)
			var callService = new MethodInvocationExpression(
				AstUtil.CreateReferenceExpression("context.GetService"));
			callService.Arguments.Add(CodeBuilder.CreateTypeofExpression(typeof(IViewComponentFactory)));

			block.Add(new BinaryExpression(BinaryOperatorType.Assign,
			                               CodeBuilder.CreateLocalReference(componentFactoryName, viewComponentFactoryLocal),
			                               callService));

			// component = viewComponentFactory.Create( componentName)
			var createComponent = new MethodInvocationExpression(
				new MemberReferenceExpression(CodeBuilder.CreateLocalReference(componentFactoryName, viewComponentFactoryLocal),
				                              "Create"));
			createComponent.Arguments.Add(componentName);
			block.Add(new BinaryExpression(BinaryOperatorType.Assign,
			                               new ReferenceExpression(componentVariableName),
			                               createComponent));
			AddSections(block, macro);

			// component.Init(context, componentContext)
			var initComponent = new MethodInvocationExpression(
				AstUtil.CreateReferenceExpression(componentVariableName + ".Init"));
			initComponent.Arguments.Extend(
				new Expression[]
					{
						new ReferenceExpression("context"),
						new ReferenceExpression(componentContextName)
					});

			block.Add(initComponent);

			// component.Render()
			block.Add(new MethodInvocationExpression(
			          	AstUtil.CreateReferenceExpression(componentVariableName + ".Render")));

			// if component.ViewToRender is not null:
			//	OutputSubView("/"+component.ViewToRender, context.CompnentParameters)
			var renderView = new Block();
			var outputSubView = new MethodInvocationExpression(
				AstUtil.CreateReferenceExpression("OutputSubView"));
			outputSubView.Arguments.Add(new BinaryExpression(BinaryOperatorType.Addition,
			                                                 new StringLiteralExpression("/"),
			                                                 AstUtil.CreateReferenceExpression(componentContextName +
			                                                                                   ".ViewToRender")));

			outputSubView.Arguments.Add(AstUtil.CreateReferenceExpression(componentContextName + ".ComponentParameters"));
			renderView.Add(outputSubView);

			block.Add(new IfStatement(AstUtil.CreateReferenceExpression(componentContextName + ".ViewToRender"),
			                          renderView, new Block()));

			// RemoveViewComponentProperties( compilerContext.ComponentParams )
			var removeProperties =
				new MethodInvocationExpression(AstUtil.CreateReferenceExpression("RemoveViewComponentProperties"));
			removeProperties.Arguments.Add(AstUtil.CreateReferenceExpression(componentContextName + ".ComponentParameters"));
			block.Add(removeProperties);

			return block;
		}
Пример #23
0
        public static Expression exclude(BlockExpression action)
        {
            var arrayExpression = new ArrayLiteralExpression();

            foreach (Statement statement in action.Body.Statements)
            {
                var stringLiteral =
                    new StringLiteralExpression(
                        ((MethodInvocationExpression) (((ExpressionStatement) (statement)).Expression)).Arguments[0].ToString().Trim(new[]{'\''}));

                arrayExpression.Items.Add(stringLiteral);
            }

            return new MethodInvocationExpression(
                new ReferenceExpression("SetExcludeList"),
                arrayExpression
            );
        }
 public override void OnStringLiteralExpression(StringLiteralExpression literal)
 {
     literal.Value = _name = NormalizeName(literal.Value);
     _node = !_isAttribute ? literal : CreateAttribute(_name);
 }
Пример #25
0
		public override Statement Expand(MacroStatement macro)
		{
			if (macro.Arguments.Count == 0)
				throw new RailsException("Component must be called with a name");

            Block block = new Block();

		    Method method;
			Node parent = macro.ParentNode;
			while((parent is Method) == false)
			{
				parent = parent.ParentNode;
			}
			method = (Method) parent;

			StringLiteralExpression componentName = new StringLiteralExpression(macro.Arguments[0].ToString());

			MethodInvocationExpression dictionary = CreateParametersDictionary(macro);


			Expression macroBody = CodeBuilderHelper.CreateCallableFromMacroBody(CodeBuilder, macro);

			MethodInvocationExpression initContext = new MethodInvocationExpression();
			initContext.Target = AstUtil.CreateReferenceExpression("Castle.MonoRail.Views.Brail.BrailViewComponentContext");
			initContext.Arguments.Extend(
				new Expression[]
					{
					    new SelfLiteralExpression(),
						macroBody, componentName,
						AstUtil.CreateReferenceExpression("OutputStream"),
						dictionary
					});

			// compilerContext = BrailViewComponentContext(macroBodyClosure, "componentName", OutputStream, dictionary)
			block.Add(new BinaryExpression(BinaryOperatorType.Assign,
			                               new ReferenceExpression("componentContext"), initContext));

			// AddViewComponentProperties( compilerContext.ComponentParams )
			MethodInvocationExpression addProperties = new MethodInvocationExpression(AstUtil.CreateReferenceExpression("AddViewComponentProperties"));
			addProperties.Arguments.Add(AstUtil.CreateReferenceExpression("componentContext.ComponentParameters"));
			block.Add(addProperties);

			InternalLocal viewComponentFactoryLocal = CodeBuilder.DeclareLocal(method, "viewComponentFactory",
			                                                                   TypeSystemServices.Map(
			                                                                   	typeof(IViewComponentFactory)));
		    // viewComponentFactory = MonoRailHttpHandler.CurrentContext.GetService(IViewComponentFactory)
			MethodInvocationExpression callService = new MethodInvocationExpression(
				AstUtil.CreateReferenceExpression("MonoRailHttpHandler.CurrentContext.GetService"));
			callService.Arguments.Add(CodeBuilder.CreateTypeofExpression(typeof(IViewComponentFactory)));

			block.Add(new BinaryExpression(BinaryOperatorType.Assign,
			                               CodeBuilder.CreateLocalReference("viewComponentFactory", viewComponentFactoryLocal),
			                               callService));

			// component = viewComponentFactory.Create( componentName)
			MethodInvocationExpression createComponent = new MethodInvocationExpression(
				new MemberReferenceExpression(CodeBuilder.CreateLocalReference("viewComponentFactory", viewComponentFactoryLocal),
				                              "Create"));
			createComponent.Arguments.Add(componentName);
			block.Add(new BinaryExpression(BinaryOperatorType.Assign,
			                               new ReferenceExpression("component"),
			                               createComponent));

		    
            AddSections(block, macro);
		    

			// component.Init(context, componentContext)
			MethodInvocationExpression initComponent = new MethodInvocationExpression(
				AstUtil.CreateReferenceExpression("component.Init"));
			initComponent.Arguments.Extend(
				new Expression[] {AstUtil.CreateReferenceExpression("context"), new ReferenceExpression("componentContext")});

			block.Add(initComponent);    
		    
			// component.Render()
			block.Add(new MethodInvocationExpression(
			          	AstUtil.CreateReferenceExpression("component.Render")));

			// if component.ViewToRender is not null:
			//	OutputSubView("/"+component.ViewToRender, context.CompnentParameters)
			Block renderView = new Block();
			MethodInvocationExpression outputSubView = new MethodInvocationExpression(
				AstUtil.CreateReferenceExpression("OutputSubView"));
			outputSubView.Arguments.Add(new BinaryExpression(BinaryOperatorType.Addition,
			                                                 new StringLiteralExpression("/"),
			                                                 AstUtil.CreateReferenceExpression("componentContext.ViewToRender")));

			outputSubView.Arguments.Add(AstUtil.CreateReferenceExpression("componentContext.ComponentParameters"));
			renderView.Add(outputSubView);

			block.Add(new IfStatement(AstUtil.CreateReferenceExpression("componentContext.ViewToRender"),
			                          renderView, new Block()));

			// RemoveViewComponentProperties( compilerContext.ComponentParams )
			MethodInvocationExpression removeProperties = new MethodInvocationExpression(AstUtil.CreateReferenceExpression("RemoveViewComponentProperties"));
			removeProperties.Arguments.Add(AstUtil.CreateReferenceExpression("componentContext.ComponentParameters"));
			block.Add(removeProperties);

			return block;
		}
Пример #26
0
 public override void OnStringLiteralExpression(StringLiteralExpression node)
 {
     ReplaceWithCallToExpressionConstant(node);
 }
        public override void OnMemberReferenceExpression(MemberReferenceExpression node)
        {
            ReferenceExpression reference = node.Target as ReferenceExpression;

            if (reference != null && reference.Name.StartsWith("@"))
            {
                _component = reference;
            }
            else
            {
                _component = AstUtil.CreateMethodInvocationExpression(
                    AstUtil.CreateReferenceExpression(typeof(ComponentReference).FullName),
                    node.Target
                    );
            }

            _method = new StringLiteralExpression(node.Name);
            _found = true;
        }
Пример #28
0
		public override void OnStringLiteralExpression(StringLiteralExpression node)
		{
			MakeResult(projectContent.SystemTypes.String);
		}
Пример #29
0
 public override void OnStringLiteralExpression(StringLiteralExpression node)
 {
     BindExpressionType(node, TypeSystemServices.StringType);
 }
Пример #30
0
 public StringLiteralExpression CreateStringLiteral(string value)
 {
     StringLiteralExpression expression = new StringLiteralExpression(value);
     expression.ExpressionType = _tss.StringType;
     return expression;
 }