• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Ast.ArrayLiteralExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Boo.Lang.Compiler.Ast.ArrayLiteralExpression的典型用法代码示例。如果您正苦于以下问题:C# ArrayLiteralExpression类的具体用法?C# ArrayLiteralExpression怎么用?C# ArrayLiteralExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArrayLiteralExpression类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了ArrayLiteralExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LeaveArrayLiteralExpression

 public override void LeaveArrayLiteralExpression(ArrayLiteralExpression node)
 {
     if (LookingFor(node))
     {
         Found(node.Type);
     }
 }
开发者ID:paveltimofeev,项目名称:documentation,代码行数:7,代码来源:ArrayLiteralFinder.cs


示例2: typesOf

			public static Expression typesOf(params Expression[] args)
			{
				var result = new ArrayLiteralExpression();
				foreach (var arg in args)
					result.Items.Add(CodeBuilder.CreateTypeofExpression(arg.ExpressionType));
				return result;
			}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:7,代码来源:MetaMethodsTest.cs


示例3: AddDependency

        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);
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:30,代码来源:RightShiftToMethodCompilerStep.cs


示例4: OnMethodInvocationExpression

        protected virtual void OnMethodInvocationExpression(ArrayLiteralExpression dependencies, MethodInvocationExpression expression)
        {
            foreach (var arg in expression.Arguments)
            {
                var binaryExpression = arg as BinaryExpression;
                if (binaryExpression == null || binaryExpression.Operator != BinaryOperatorType.ShiftRight)
                    continue;

                AddDependency(dependencies, binaryExpression);
            }
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:11,代码来源:RightShiftToMethodCompilerStep.cs


示例5: LeaveArrayLiteralExpression

 public override void LeaveArrayLiteralExpression(ArrayLiteralExpression node)
 {
     IType elementType = GetExpressionType(node).ElementType;
     for (int i = 0; i < node.Items.Count; ++i)
     {
         Expression converted = Convert(elementType, node.Items[i]);
         if (null != converted)
         {
             node.Items.ReplaceAt(i, converted);
         }
     }
 }
开发者ID:rmartinho,项目名称:boo,代码行数:12,代码来源:InjectCallableConversions.cs


示例6: data

        public static Expression data(params StringLiteralExpression[] expressions)
        {
            var arrayExpression = new ArrayLiteralExpression();

            for (var i = 0; i < expressions.Length; i++)
                arrayExpression.Items.Add(expressions[i]);

            return new MethodInvocationExpression(
                new ReferenceExpression("SetData"),
                arrayExpression
            );
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:12,代码来源:BooConfigReader.cs


示例7: ExpandComplexArraySlicing

		void ExpandComplexArraySlicing(SlicingExpression node)
		{
			if (node.Indices.Count > 1)
			{
				MethodInvocationExpression mie = null;
				var computeEnd = new ArrayLiteralExpression();
				var collapse = new ArrayLiteralExpression();
				var ranges = new ArrayLiteralExpression();
				for (int i = 0; i < node.Indices.Count; i++)
				{
					ranges.Items.Add(node.Indices[i].Begin);
					if (node.Indices[i].End == null )
					{
						var end = new BinaryExpression(BinaryOperatorType.Addition, node.Indices[i].Begin, new IntegerLiteralExpression(1));
						ranges.Items.Add(end);
						BindExpressionType(end, GetExpressionType(node.Indices[i].Begin));
						computeEnd.Items.Add(new BoolLiteralExpression(false));
						collapse.Items.Add(new BoolLiteralExpression(true));
					}
					else if (node.Indices[i].End == OmittedExpression.Default)
					{
						var end = new IntegerLiteralExpression(0);
						ranges.Items.Add(end);
						BindExpressionType(end, GetExpressionType(node.Indices[i].Begin));
						computeEnd.Items.Add(new BoolLiteralExpression(true));
						collapse.Items.Add(new BoolLiteralExpression(false));
					}
					else
					{
						ranges.Items.Add(node.Indices[i].End);
						computeEnd.Items.Add(new BoolLiteralExpression(false));
						collapse.Items.Add(new BoolLiteralExpression(false));
					}
				}
				mie = CodeBuilder.CreateMethodInvocation(MethodCache.RuntimeServices_GetMultiDimensionalRange1, node.Target, ranges);
				mie.Arguments.Add(computeEnd);
				mie.Arguments.Add(collapse);

				BindExpressionType(ranges, TypeSystemServices.Map(typeof(int[])));
				BindExpressionType(computeEnd, TypeSystemServices.Map(typeof(bool[])));
				BindExpressionType(collapse, TypeSystemServices.Map(typeof(bool[])));
				node.ParentNode.Replace(node, mie);
			}
			else
			{
				var slice = node.Indices[0];
				var mie = IsNullOrOmitted(slice.End)
					? CodeBuilder.CreateMethodInvocation(MethodCache.RuntimeServices_GetRange1, node.Target, slice.Begin)
					: CodeBuilder.CreateMethodInvocation(MethodCache.RuntimeServices_GetRange2, node.Target, slice.Begin, slice.End);
				node.ParentNode.Replace(node, mie);
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:52,代码来源:ExpandComplexSlicingExpressions.cs


示例8: DoExpand

        /// <summary>
        /// Perform the actual expansion of the macro
        /// </summary>
        /// <param name="macro">The macro.</param>
        /// <returns></returns>
        protected override Statement DoExpand(MacroStatement macro)
        {
            Block body = (Block)macro.GetAncestor(NodeType.Block);
            MacroStatement macroParent = (MacroStatement)macro.GetAncestor(NodeType.MacroStatement);
           
            if (macro.Body.Statements.Count < 1 && parent.Name=="join")
            {
                Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo, "Join " + name + " section must contain at least a single expression statement"));
                return null;
            }

            if (macro.Arguments.Count == 0 && parent.Name!="join")
            {
                Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo, "Join " + name + " section must contain at least one key column"));
                return null;
            }

            if (macro.Arguments.Count > 0)
            {
                ArrayLiteralExpression ale = new ArrayLiteralExpression(macro.LexicalInfo);
                ale.Type = new ArrayTypeReference(CodeBuilder.CreateTypeReference(typeof(string)));
                foreach (Expression argument in macro.Arguments)
                {
                    ReferenceExpression expr = argument as ReferenceExpression;
                    if (expr == null)
                    {
                        Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo,"Join " + name +" section arguments must be reference expressions. Example: " + name + " name, surname"));
                        return null;
                    }
                    ale.Items.Add(new StringLiteralExpression(expr.Name));
                }
                var keyExpr = new BinaryExpression(BinaryOperatorType.Assign, new ReferenceExpression(name+"KeyColumns"), ale);
                macroParent.Arguments.Add(keyExpr);
            }

            foreach (Statement statement in macro.Body.Statements)
            {
                ExpressionStatement exprStmt = statement as ExpressionStatement;
                if(exprStmt==null)
                {
                    Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo, "Join " + name + " section can only contain expressions"));
                    return null;
                }
                Expression expr = exprStmt.Expression;
                parent.Arguments.Add(new MethodInvocationExpression(new ReferenceExpression(name), expr));
            }

            return null;
            
        }
开发者ID:f4i2u1,项目名称:rhino-etl,代码行数:55,代码来源:JoinSectionMacro.cs


示例9: IsCompoundAssignment

        public static bool IsCompoundAssignment(Expression expression,
												out ArrayLiteralExpression assignments)
        {
            assignments = expression as ArrayLiteralExpression;

            if (assignments != null)
            {
                BinaryExpression assignment;
                return (assignments.Items.Count > 1 &&
                        IsAssignment(assignments.Items[1], out assignment));
            }

            return false;
        }
开发者ID:oz-systems,项目名称:rhino-commons,代码行数:14,代码来源:MacroHelper.cs


示例10: CreateGetColumnsToGroupByMethod

        private Method CreateGetColumnsToGroupByMethod(MacroStatement macro, IEnumerable<string> columns)
        {
            Method method = new Method("GetColumnsToGroupBy");
            method.Modifiers = TypeMemberModifiers.Override;
            ArrayLiteralExpression ale = new ArrayLiteralExpression(macro.LexicalInfo);
            ale.Type = new ArrayTypeReference(CodeBuilder.CreateTypeReference(typeof(string)));

            foreach (string column in columns)
            {
                ale.Items.Add(new StringLiteralExpression(column));
            }
            method.Body.Statements.Add(new ReturnStatement(ale));
            return method;
        }
开发者ID:nkmajeti,项目名称:rhino-tools,代码行数:14,代码来源:GroupByMacro.cs


示例11: OnArrayLiteralExpression

 public override void  OnArrayLiteralExpression(ArrayLiteralExpression node)
 {
     var need_expansion = false;
     if(node.Items.Count==2 && node.Items[0].ToCodeString().StartsWith("@_")){
         need_expansion = true;
     }
     base.OnArrayLiteralExpression(node);
     if(need_expansion){
         if(node.Items[0] is NullLiteralExpression){
             node.ParentNode.Replace(node, node.Items[1].CloneNode());
         }
         else{
             node.ParentNode.Replace(node, node.Items[0].CloneNode());
         }
     }
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:16,代码来源:TemplateBindVisitor.cs


示例12: LeaveArrayLiteralExpression

        public override void LeaveArrayLiteralExpression(ArrayLiteralExpression node)
        {
            IType expectedType = GetExpressionType(node).ElementType;
            if (!TypeSystemServices.IsPrimitiveNumber(expectedType))
                return;

            foreach (Expression item in node.Items)
            {
                IType itemType = item.ExpressionType;
                if (item is LiteralExpression)
                {
                    if (item.NodeType == NodeType.IntegerLiteralExpression)
                        AssertLiteralInRange((IntegerLiteralExpression) item, expectedType);
                    if (expectedType != itemType)
                        BindExpressionType(item, expectedType);
                }
            }
        }
开发者ID:neonux,项目名称:boo,代码行数:18,代码来源:CheckLiteralValues.cs


示例13: exclude

        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
            );
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:18,代码来源:BooConfigReader.cs


示例14: OnBlockExpression

        public override void OnBlockExpression(BlockExpression node)
        {
            var dependencies = new ArrayLiteralExpression();

            foreach (Statement statement in node.Body.Statements)
            {
                var expressionStatement = (ExpressionStatement)statement;
                var expression = (MethodInvocationExpression)expressionStatement.Expression;

                OnMethodInvocationExpression(dependencies, expression);
            }

            if (dependencies.Items.Count == 0)
                return;

            var referenceExpression = new ReferenceExpression("AddDependencies");
            var replacementMethod = new MethodInvocationExpression(referenceExpression, dependencies);

            ReplaceCurrentNode(replacementMethod);
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:20,代码来源:RightShiftToMethodCompilerStep.cs


示例15: OnArrayLiteralExpression

		override public void OnArrayLiteralExpression(ArrayLiteralExpression node)
		{
			if (!_checked)
				return;

			base.OnArrayLiteralExpression(node);

			var expectedType = GetExpressionType(node).ElementType;
			if (!TypeSystemServices.IsPrimitiveNumber(expectedType))
				return;

			foreach (var item in node.Items)
			{
				var integerLiteral = item as IntegerLiteralExpression;
				if (integerLiteral != null)
				{
					AssertLiteralInRange(integerLiteral, expectedType);
					continue;
				}
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:21,代码来源:CheckLiteralValues.cs


示例16: OnArrayLiteralExpression

 public override void OnArrayLiteralExpression(ArrayLiteralExpression node)
 {
     IArrayType type = (IArrayType)node.ExpressionType;
     EmitArray(type.ElementType, node.Items);
     PushType(type);
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:6,代码来源:EmitAssembly.cs


示例17: array_or_expression

        //throws RecognitionException, TokenStreamException
        protected Expression array_or_expression()
        {
            Expression e;

            IToken  c = null;
            IToken  t = null;

                e = null;
                ArrayLiteralExpression tle = null;

            try {      // for error handling
            switch ( LA(1) )
            {
            case COMMA:
            {
                {
                    c = LT(1);
                    match(COMMA);
                    if (0==inputState.guessing)
                    {
                        e = new ArrayLiteralExpression(SourceLocationFactory.ToLexicalInfo(c));
                    }
                }
                break;
            }
            case ESEPARATOR:
            case CAST:
            case CHAR:
            case FALSE:
            case NOT:
            case NULL:
            case SELF:
            case SUPER:
            case TRUE:
            case TYPEOF:
            case ID:
            case TRIPLE_QUOTED_STRING:
            case LPAREN:
            case DOUBLE_QUOTED_STRING:
            case SINGLE_QUOTED_STRING:
            case LBRACK:
            case SUBTRACT:
            case SPLICE_BEGIN:
            case DOT:
            case MULTIPLY:
            case LBRACE:
            case QQ_BEGIN:
            case LONG:
            case INCREMENT:
            case DECREMENT:
            case ONES_COMPLEMENT:
            case INT:
            case RE_LITERAL:
            case DOUBLE:
            case FLOAT:
            case TIMESPAN:
            {
                {
                    e=expression();
                    {
                        switch ( LA(1) )
                        {
                        case COMMA:
                        {
                            t = LT(1);
                            match(COMMA);
                            if (0==inputState.guessing)
                            {

                                                    tle = new ArrayLiteralExpression(e.LexicalInfo);
                                                    tle.Items.Add(e);

                            }
                            {
                                switch ( LA(1) )
                                {
                                case ESEPARATOR:
                                case CAST:
                                case CHAR:
                                case FALSE:
                                case NOT:
                                case NULL:
                                case SELF:
                                case SUPER:
                                case TRUE:
                                case TYPEOF:
                                case ID:
                                case TRIPLE_QUOTED_STRING:
                                case LPAREN:
                                case DOUBLE_QUOTED_STRING:
                                case SINGLE_QUOTED_STRING:
                                case LBRACK:
                                case SUBTRACT:
                                case SPLICE_BEGIN:
                                case DOT:
                                case MULTIPLY:
                                case LBRACE:
                                case QQ_BEGIN:
                                case LONG:
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:boo,代码行数:101,代码来源:WSABooParserBase.cs


示例18: InferArrayType

 private IArrayType InferArrayType(ArrayLiteralExpression node)
 {
     if (null != node.Type) return (IArrayType)node.Type.Entity;
     if (0 == node.Items.Count) return EmptyArrayType.Default;
     return GetMostGenericType(node.Items).MakeArrayType(1);
 }
开发者ID:stuman08,项目名称:boo,代码行数:6,代码来源:ProcessMethodBodies.cs


示例19: LeaveArrayLiteralExpression

        public override void LeaveArrayLiteralExpression(ArrayLiteralExpression node)
        {
            TypeSystemServices.MapToConcreteExpressionTypes(node.Items);

            IArrayType type = InferArrayType(node);
            BindExpressionType(node, type);

            if (node.Type == null)
                node.Type = (ArrayTypeReference)CodeBuilder.CreateTypeReference(type);
            else
                CheckItems(type.ElementType, node.Items);
        }
开发者ID:stuman08,项目名称:boo,代码行数:12,代码来源:ProcessMethodBodies.cs


示例20: tasks

        public static Expression tasks(params ReferenceExpression[] expressions)
        {
            var arrayExpression = new ArrayLiteralExpression();

            for (var i = 0; i < expressions.Length; i++)
                arrayExpression.Items.Add(new StringLiteralExpression(expressions[i].Name));

            return new MethodInvocationExpression(
                new ReferenceExpression("SetBuildTargets"),
                arrayExpression
            );
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:12,代码来源:BooConfigReader.cs



注:本文中的Boo.Lang.Compiler.Ast.ArrayLiteralExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ast.BinaryExpression类代码示例发布时间:2022-05-24
下一篇:
C# Compiler.CompilerContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap