当前位置: 首页>>代码示例>>C#>>正文


C# Ast.ParameterDeclaration类代码示例

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


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

示例1: OnProperty

        public override void OnProperty(Property node)
        {
            if (WasVisited(node))
            {
                return;
            }
            MarkVisited(node);

            Method setter = node.Setter;
            Method getter = node.Getter;

            Visit(node.Attributes);
            Visit(node.Type);
            Visit(node.Parameters);

            ResolvePropertyOverride(node);

            if (null != getter)
            {
                if (null != node.Type)
                {
                    getter.ReturnType = node.Type.CloneNode();
                }
                getter.Parameters.ExtendWithClones(node.Parameters);

                Visit(getter);
            }

            IType typeInfo = null;
            if (null != node.Type)
            {
                typeInfo = GetType(node.Type);
            }
            else
            {
                if (null != getter)
                {
                    typeInfo = GetEntity(node.Getter).ReturnType;
                    if (typeInfo == TypeSystemServices.VoidType)
                    {
                        typeInfo = TypeSystemServices.ObjectType;
                        node.Getter.ReturnType = CodeBuilder.CreateTypeReference(getter.LexicalInfo, typeInfo);
                    }
                }
                else
                {
                    typeInfo = TypeSystemServices.ObjectType;
                }
                node.Type = CodeBuilder.CreateTypeReference(node.LexicalInfo, typeInfo);
            }

            if (null != setter)
            {
                ParameterDeclaration parameter = new ParameterDeclaration();
                parameter.Type = CodeBuilder.CreateTypeReference(typeInfo);
                parameter.Name = "value";
                parameter.Entity = new InternalParameter(parameter, node.Parameters.Count+CodeBuilder.GetFirstParameterIndex(setter));
                setter.Parameters.ExtendWithClones(node.Parameters);
                setter.Parameters.Add(parameter);
                setter.Name = "set_" + node.Name;
                Visit(setter);
            }
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:63,代码来源:ProcessMethodBodies.cs

示例2: CreateParameterDeclaration

 public ParameterDeclaration CreateParameterDeclaration(int index, string name, IType type, bool byref)
 {
     var modifiers = byref ? ParameterModifiers.Ref : ParameterModifiers.None;
     var parameter = new ParameterDeclaration(name, CreateTypeReference(type), modifiers);
     parameter.Entity = new InternalParameter(parameter, index);
     return parameter;
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:7,代码来源:BooCodeBuilder.cs

示例3: MappedVariableDefinition

 public MappedVariableDefinition(CompileResults results, ParameterDeclaration node)
     : base(results, node, node.Name.Length)
 {
 }
开发者ID:Rfvgyhn,项目名称:Boo-Plugin,代码行数:4,代码来源:MappedVariableDefinition.cs

示例4: parameter_declaration

	protected bool  parameter_declaration(
		ParameterDeclarationCollection c
	) //throws RecognitionException, TokenStreamException
{
		bool variableArguments;
		
		IToken  id1 = null;
		IToken  begin1 = null;
		IToken  id2 = null;
		IToken  begin2 = null;
				
				IToken id = null;
				TypeReference tr = null;
				ParameterModifiers pm = ParameterModifiers.None;
				variableArguments = false;
				Expression nameSplice = null;
			
		
		try {      // for error handling
			attributes();
			{
				switch ( LA(1) )
				{
				case MULTIPLY:
				{
					{
						match(MULTIPLY);
						if (0==inputState.guessing)
						{
							variableArguments=true;
						}
						{
							switch ( LA(1) )
							{
							case ID:
							{
								id1 = LT(1);
								match(ID);
								if (0==inputState.guessing)
								{
									id = id1;
								}
								break;
							}
							case SPLICE_BEGIN:
							{
								begin1 = LT(1);
								match(SPLICE_BEGIN);
								nameSplice=atom();
								if (0==inputState.guessing)
								{
									id = begin1;
								}
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							switch ( LA(1) )
							{
							case AS:
							{
								match(AS);
								tr=array_type_reference();
								break;
							}
							case RPAREN:
							case RBRACK:
							case COMMA:
							case BITWISE_OR:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
					}
					break;
				}
				case REF:
				case ID:
				case SPLICE_BEGIN:
				{
					{
						{
							switch ( LA(1) )
							{
							case REF:
							{
								pm=parameter_modifier();
								break;
							}
							case ID:
//.........这里部分代码省略.........
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs

示例5: LeaveParameterDeclaration

 public override void LeaveParameterDeclaration(ParameterDeclaration node)
 {
     CheckName(node,node.Name);
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:4,代码来源:CheckIdentifiers.cs

示例6: OnParameterDeclaration

 public override void OnParameterDeclaration(ParameterDeclaration node)
 {
     if (node.LexicalInfo != null)
         results.MapParsedNode(new MappedVariableDefinition(results, node));
     base.OnParameterDeclaration(node);
 }
开发者ID:Rfvgyhn,项目名称:Boo-Plugin,代码行数:6,代码来源:ParsedModuleWalker.cs

示例7: GetParameterAttributes

 ParameterAttributes GetParameterAttributes(ParameterDeclaration param)
 {
     return ParameterAttributes.None;
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:4,代码来源:EmitAssembly.cs

示例8: CustomizeCompiler

        protected override void CustomizeCompiler(BooCompiler compiler, CompilerPipeline pipeline, string[] urls)
        {
            ParameterDeclarationCollection parameters = new ParameterDeclarationCollection();
            ParameterDeclaration newParameterDeclaration =
                new ParameterDeclaration("input", new SimpleTypeReference("System.String"));
            parameters.Add(newParameterDeclaration);

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(MyClassWithParams),
                "Hello",
                parameters,
                "System"));
        }
开发者ID:neilb14,项目名称:rhino-dsl,代码行数:12,代码来源:DslEngineFixture.cs

示例9: OnParameterDeclaration

 public override void OnParameterDeclaration(ParameterDeclaration node)
 {
     node.Name = node.Name.TrimStart('@');
     base.OnParameterDeclaration(node);
 }
开发者ID:JeremySkinner,项目名称:Phantom,代码行数:5,代码来源:UnescapeNamesStep.cs

示例10: OnParameterDeclaration

        public override void OnParameterDeclaration(ParameterDeclaration p)
        {
            WriteAttributes(p.Attributes, false);

            if (p.IsByRef)
            {
                WriteKeyword("ref ");
            }

            if (p.ParentNode.NodeType == NodeType.CallableTypeReference)
            {
                Visit(p.Type);
            }
            else
            {
                Write(p.Name);
                WriteTypeReference(p.Type);
            }
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:19,代码来源:BooPrinterVisitor.cs

示例11: callable_parameter_declaration

        //throws RecognitionException, TokenStreamException
        protected void callable_parameter_declaration(
		ParameterDeclarationCollection c
	)
        {
            TypeReference tr = null;
                ParameterModifiers pm = ParameterModifiers.None;

            try {      // for error handling
            {
                {
                    switch ( LA(1) )
                    {
                    case REF:
                    {
                        pm=parameter_modifier();
                        break;
                    }
                    case CALLABLE:
                    case CHAR:
                    case ID:
                    case LPAREN:
                    case SPLICE_BEGIN:
                    {
                        break;
                    }
                    default:
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
                     }
                }
                {
                    tr=type_reference();
                }
            }
            if (0==inputState.guessing)
            {

                        ParameterDeclaration pd = new ParameterDeclaration(tr.LexicalInfo);
                        pd.Name = "arg" + c.Count;
                        pd.Type = tr;
                        pd.Modifiers = pm;
                        c.Add(pd);

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_69_);
            }
            else
            {
                throw ex;
            }
            }
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:60,代码来源:WSABooParserBase.cs

示例12: SpliceParameterDeclaration

		public SpliceParameterDeclaration(ParameterDeclaration pd, Expression nameExpression) :
			base(pd.LexicalInfo)
		{
			this.ParameterDeclaration = pd;
			this.NameExpression = nameExpression;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:6,代码来源:SpliceParameterDeclaration.cs

示例13: parameter_declaration

        public void parameter_declaration(INodeWithParameters m)
        {
            try
            {
                TypeReference reference;
                switch (this.LA(1))
                {
                    case 0x63:
                        this.attributes();
                        break;

                    case 12:
                    case 0x10:
                    case 0x21:
                    case 0x3b:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                IToken token = this.identifier();
                switch (this.LA(1))
                {
                    case 0x42:
                        this.match(0x42);
                        reference = this.type_reference();
                        break;

                    case 0x40:
                    case 0x43:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                if (base.inputState.guessing == 0)
                {
                    ParameterDeclaration declaration;
                    ParameterDeclaration declaration1 = declaration = new ParameterDeclaration(ToLexicalInfo(token));
                    declaration.set_Name(token.getText());
                    declaration.set_Type(reference);
                    ParameterDeclaration node = declaration;
                    m.get_Parameters().Add(node);
                    this.FlushAttributes(node);
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_18_);
            }
        }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:56,代码来源:UnityScriptParser.cs

示例14: function_type_parameters

        public void function_type_parameters(ParameterDeclarationCollection parameters)
        {
            try
            {
                this.match(0x3f);
                switch (this.LA(1))
                {
                    case 0x13:
                    case 0x3b:
                    {
                        TypeReference reference = this.type_reference();
                        if (base.inputState.guessing == 0)
                        {
                            ParameterDeclaration declaration;
                            ParameterDeclaration declaration1 = declaration = new ParameterDeclaration();
                            declaration.set_Type(reference);
                            declaration.set_Name("arg" + parameters.Count);
                            parameters.Add(declaration);
                        }
                        while (this.LA(1) == 0x43)
                        {
                            this.match(0x43);
                            reference = this.type_reference();
                            if (base.inputState.guessing == 0)
                            {
                                ParameterDeclaration declaration2;
                                ParameterDeclaration declaration3 = declaration2 = new ParameterDeclaration();
                                declaration2.set_Type(reference);
                                declaration2.set_Name("arg" + parameters.Count);
                                parameters.Add(declaration2);
                            }
                        }
                        break;
                    }
                    case 0x40:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                this.match(0x40);
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_35_);
            }
        }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:52,代码来源:UnityScriptParser.cs

示例15: Replace

 public override bool Replace(Node existing, Node newNode)
 {
     if (base.Replace(existing, newNode))
     {
         return true;
     }
     if (_type == existing)
     {
         this.Type = (TypeReference)newNode;
         return true;
     }
     if (_attributes != null)
     {
         Attribute item = existing as Attribute;
         if (null != item)
         {
             Attribute newItem = (Attribute)newNode;
             if (_attributes.Replace(item, newItem))
             {
                 return true;
             }
         }
     }
     if (_parameterDeclaration == existing)
     {
         this.ParameterDeclaration = (ParameterDeclaration)newNode;
         return true;
     }
     if (_nameExpression == existing)
     {
         this.NameExpression = (Expression)newNode;
         return true;
     }
     return false;
 }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:35,代码来源:SpliceParameterDeclarationImpl.cs


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