void ConvertParameters(List <ParameterDeclarationExpression> input, B.ParameterDeclarationCollection output)
        {
            bool isParams = false;

            foreach (ParameterDeclarationExpression pde in input)
            {
                B.ParameterDeclaration para = ConvertParameter(pde, out isParams);
                if (para != null)
                {
                    output.Add(para);
                }
            }
            output.HasParamArray = isParams;
        }
 B.ParameterDeclaration ConvertParameter(ParameterDeclarationExpression pde, out bool isParams)
 {
     B.ParameterDeclaration para = new B.ParameterDeclaration(pde.ParameterName, ConvertTypeReference(pde.TypeReference));
     if ((pde.ParamModifier & ParameterModifiers.Optional) != 0)
     {
         AddError(pde, "Optional parameters are not supported.");
     }
     if ((pde.ParamModifier & ParameterModifiers.Out) != 0)
     {
         para.Modifiers |= B.ParameterModifiers.Ref;
     }
     if ((pde.ParamModifier & ParameterModifiers.Ref) != 0)
     {
         para.Modifiers |= B.ParameterModifiers.Ref;
     }
     isParams = (pde.ParamModifier & ParameterModifiers.Params) != 0;
     ConvertAttributes(pde.Attributes, para.Attributes);
     return(para);
 }
Beispiel #3
0
 public override void LeaveParameterDeclaration(ParameterDeclaration node)
 {
     CheckName(node,node.Name);
 }
Beispiel #4
0
	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:
							case SPLICE_BEGIN:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							switch ( LA(1) )
							{
							case ID:
							{
								id2 = LT(1);
								match(ID);
								if (0==inputState.guessing)
								{
									id = id2;
								}
								break;
							}
							case SPLICE_BEGIN:
							{
								begin2 = LT(1);
								match(SPLICE_BEGIN);
								nameSplice=atom();
								if (0==inputState.guessing)
								{
									id = begin2;
								}
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							switch ( LA(1) )
							{
							case AS:
							{
								match(AS);
								tr=type_reference();
								break;
							}
							case RPAREN:
							case RBRACK:
							case COMMA:
							case BITWISE_OR:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						ParameterDeclaration pd = new ParameterDeclaration(ToLexicalInfo(id));
						pd.Name = id.getText();
						pd.Type = tr;
						pd.Modifiers = pm;
						AddAttributes(pd.Attributes);
						
						c.Add(
							nameSplice != null
							? new SpliceParameterDeclaration(pd, nameSplice)
							: pd);
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "parameter_declaration");
				recover(ex,tokenSet_86_);
			}
			else
			{
				throw ex;
			}
		}
		return variableArguments;
	}
Beispiel #5
0
 public override void OnParameterDeclaration(ParameterDeclaration node)
 {
     _emitter.EmitParameterAttributes(node);
 }
Beispiel #6
0
 void EmitParameterAttributes(ParameterDeclaration node)
 {
     ParameterBuilder builder = (ParameterBuilder)GetBuilder(node);
     EmitAttributes(node, builder.SetCustomAttribute);
 }
Beispiel #7
0
        //throws RecognitionException, TokenStreamException
        protected bool parameter_declaration(
            ParameterDeclarationCollection c
            )
        {
            bool variableArguments;

            IToken  id1 = null;
            IToken  id2 = null;

                IToken id = null;
                TypeReference tr = null;
                ParameterModifiers pm = ParameterModifiers.None;
                variableArguments = false;

            try {      // for error handling
            attributes();
            {
                switch ( LA(1) )
                {
                case MULTIPLY:
                {
                    {
                        match(MULTIPLY);
                        if (0==inputState.guessing)
                        {
                            variableArguments=true;
                        }
                        id1 = LT(1);
                        match(ID);
                        {
                            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());
                            }
                             }
                        }
                        if (0==inputState.guessing)
                        {
                            id = id1;
                        }
                    }
                    break;
                }
                case REF:
                case ID:
                {
                    {
                        {
                            switch ( LA(1) )
                            {
                            case REF:
                            {
                                pm=parameter_modifier();
                                break;
                            }
                            case ID:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        id2 = LT(1);
                        match(ID);
                        {
                            switch ( LA(1) )
                            {
                            case AS:
                            {
                                match(AS);
                                tr=type_reference();
                                break;
                            }
                            case RPAREN:
                            case RBRACK:
                            case COMMA:
                            case BITWISE_OR:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        if (0==inputState.guessing)
                        {
                            id = id2;
                        }
                    }
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            if (0==inputState.guessing)
            {

                        ParameterDeclaration pd = new ParameterDeclaration(SourceLocationFactory.ToLexicalInfo(id));
                        pd.Name = id.getText();
                        pd.Type = tr;
                        pd.Modifiers = pm;
                        AddAttributes(pd.Attributes);
                        c.Add(pd);

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_81_);
            }
            else
            {
                throw ex;
            }
            }
            return variableArguments;
        }
Beispiel #8
0
        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);
            }
        }
Beispiel #9
0
        //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;
            }
            }
        }
Beispiel #10
0
 override public bool Replace(Node existing, Node newNode)
 {
     if (base.Replace(existing, 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 (_parameters != null)
     {
         ParameterDeclaration item = existing as ParameterDeclaration;
         if (null != item)
         {
             ParameterDeclaration newItem = (ParameterDeclaration)newNode;
             if (_parameters.Replace(item, newItem))
             {
                 return(true);
             }
         }
     }
     if (_genericParameters != null)
     {
         GenericParameterDeclaration item = existing as GenericParameterDeclaration;
         if (null != item)
         {
             GenericParameterDeclaration newItem = (GenericParameterDeclaration)newNode;
             if (_genericParameters.Replace(item, newItem))
             {
                 return(true);
             }
         }
     }
     if (_returnType == existing)
     {
         this.ReturnType = (TypeReference)newNode;
         return(true);
     }
     if (_returnTypeAttributes != null)
     {
         Attribute item = existing as Attribute;
         if (null != item)
         {
             Attribute newItem = (Attribute)newNode;
             if (_returnTypeAttributes.Replace(item, newItem))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #11
0
        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);
            }
        }
		public SpliceParameterDeclaration(ParameterDeclaration pd, Expression nameExpression) :
			base(pd.LexicalInfo)
		{
			this.ParameterDeclaration = pd;
			this.NameExpression = nameExpression;
		}
        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_);
            }
        }
        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_);
            }
        }
 public MappedVariableDefinition(CompileResults results, ParameterDeclaration node)
     : base(results, node, node.Name.Length)
 {
 }
Beispiel #16
0
 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;
 }
Beispiel #17
0
		override public object Clone()
		{
		
			ParameterDeclaration clone = new ParameterDeclaration();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			clone._name = _name;
			if (null != _type)
			{
				clone._type = _type.Clone() as TypeReference;
				clone._type.InitializeParent(clone);
			}
			clone._modifiers = _modifiers;
			if (null != _attributes)
			{
				clone._attributes = _attributes.Clone() as AttributeCollection;
				clone._attributes.InitializeParent(clone);
			}
			return clone;


		}
Beispiel #18
0
        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"));
        }
 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;
 }
 public override void OnParameterDeclaration(ParameterDeclaration node)
 {
     node.Name = node.Name.TrimStart('@');
     base.OnParameterDeclaration(node);
 }
 public ClassDefinition GetContextFieldDeclaration()
 {
     Field field;
     Field field2;
     ParameterDeclaration declaration;
     MemberReferenceExpression expression;
     ReferenceExpression expression2;
     BinaryExpression expression3;
     ReferenceExpression expression4;
     ReferenceExpression expression5;
     MemberReferenceExpression expression6;
     BinaryExpression expression7;
     Block block;
     Constructor constructor;
     ClassDefinition definition;
     Type type = this._evaluationContext.GetType();
     Type type2 = this._evaluationContext.ScriptContainer.GetType();
     ClassDefinition definition1 = definition = new ClassDefinition(LexicalInfo.Empty);
     definition.set_Name("_");
     TypeMember[] memberArray1 = new TypeMember[3];
     Field field1 = field = new Field(LexicalInfo.Empty);
     field.set_Modifiers(40);
     field.set_Name("ScriptContainer");
     field.set_Type(TypeReference.Lift(type2));
     field.set_IsVolatile(false);
     memberArray1[0] = field;
     Field field3 = field2 = new Field(LexicalInfo.Empty);
     field2.set_Name("EvaluationContext");
     field2.set_Type(TypeReference.Lift(type));
     field2.set_IsVolatile(false);
     memberArray1[1] = field2;
     Constructor constructor1 = constructor = new Constructor(LexicalInfo.Empty);
     constructor.set_Name("constructor");
     ParameterDeclaration[] declarationArray1 = new ParameterDeclaration[1];
     ParameterDeclaration declaration1 = declaration = new ParameterDeclaration(LexicalInfo.Empty);
     declaration.set_Name("context");
     declaration.set_Type(TypeReference.Lift(type));
     declarationArray1[0] = declaration;
     constructor.set_Parameters(ParameterDeclarationCollection.FromArray(false, declarationArray1));
     Block block1 = block = new Block(LexicalInfo.Empty);
     Statement[] statementArray1 = new Statement[2];
     BinaryExpression expression1 = expression3 = new BinaryExpression(LexicalInfo.Empty);
     expression3.set_Operator(15);
     MemberReferenceExpression expression14 = expression = new MemberReferenceExpression(LexicalInfo.Empty);
     expression.set_Name("EvaluationContext");
     expression.set_Target(new SelfLiteralExpression(LexicalInfo.Empty));
     expression3.set_Left(expression);
     ReferenceExpression expression15 = expression2 = new ReferenceExpression(LexicalInfo.Empty);
     expression2.set_Name("context");
     expression3.set_Right(expression2);
     statementArray1[0] = Statement.Lift(expression3);
     BinaryExpression expression16 = expression7 = new BinaryExpression(LexicalInfo.Empty);
     expression7.set_Operator(15);
     ReferenceExpression expression17 = expression4 = new ReferenceExpression(LexicalInfo.Empty);
     expression4.set_Name("ScriptContainer");
     expression7.set_Left(expression4);
     MemberReferenceExpression expression18 = expression6 = new MemberReferenceExpression(LexicalInfo.Empty);
     expression6.set_Name("ScriptContainer");
     ReferenceExpression expression19 = expression5 = new ReferenceExpression(LexicalInfo.Empty);
     expression5.set_Name("context");
     expression6.set_Target(expression5);
     expression7.set_Right(expression6);
     statementArray1[1] = Statement.Lift(expression7);
     block.set_Statements(StatementCollection.FromArray(statementArray1));
     constructor.set_Body(block);
     memberArray1[2] = constructor;
     definition.set_Members(TypeMemberCollection.FromArray(memberArray1));
     return definition;
 }
Beispiel #22
0
 public static Expression Lift(ParameterDeclaration p)
 {
     return(new ReferenceExpression(p.LexicalInfo, p.Name));
 }
 public override void OnParameterDeclaration(ParameterDeclaration node)
 {
     if (node.LexicalInfo != null)
         results.MapParsedNode(new MappedVariableDefinition(results, node));
     base.OnParameterDeclaration(node);
 }
		B.ParameterDeclaration ConvertParameter(ParameterDeclarationExpression pde, out bool isParams)
		{
			B.ParameterDeclaration para = new B.ParameterDeclaration(pde.ParameterName, ConvertTypeReference(pde.TypeReference));
			if ((pde.ParamModifier & ParameterModifiers.Optional) != 0) {
				AddError(pde, "Optional parameters are not supported.");
			}
			if ((pde.ParamModifier & ParameterModifiers.Out) != 0) {
				para.Modifiers |= B.ParameterModifiers.Ref;
			}
			if ((pde.ParamModifier & ParameterModifiers.Ref) != 0) {
				para.Modifiers |= B.ParameterModifiers.Ref;
			}
			isParams = (pde.ParamModifier & ParameterModifiers.Params) != 0;
			ConvertAttributes(pde.Attributes, para.Attributes);
			return para;
		}
Beispiel #25
0
 ParameterAttributes GetParameterAttributes(ParameterDeclaration param)
 {
     return ParameterAttributes.None;
 }
Beispiel #26
0
		public static Expression Lift(ParameterDeclaration p)
		{
			return new ReferenceExpression(p.LexicalInfo, p.Name);
		}
Beispiel #27
0
 override public bool Replace(Node existing, Node newNode)
 {
     if (base.Replace(existing, 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 (_parameters != null)
     {
         ParameterDeclaration item = existing as ParameterDeclaration;
         if (null != item)
         {
             ParameterDeclaration newItem = (ParameterDeclaration)newNode;
             if (_parameters.Replace(item, newItem))
             {
                 return(true);
             }
         }
     }
     if (_genericParameters != null)
     {
         GenericParameterDeclaration item = existing as GenericParameterDeclaration;
         if (null != item)
         {
             GenericParameterDeclaration newItem = (GenericParameterDeclaration)newNode;
             if (_genericParameters.Replace(item, newItem))
             {
                 return(true);
             }
         }
     }
     if (_returnType == existing)
     {
         this.ReturnType = (TypeReference)newNode;
         return(true);
     }
     if (_returnTypeAttributes != null)
     {
         Attribute item = existing as Attribute;
         if (null != item)
         {
             Attribute newItem = (Attribute)newNode;
             if (_returnTypeAttributes.Replace(item, newItem))
             {
                 return(true);
             }
         }
     }
     if (_body == existing)
     {
         this.Body = (Block)newNode;
         return(true);
     }
     if (_locals != null)
     {
         Local item = existing as Local;
         if (null != item)
         {
             Local newItem = (Local)newNode;
             if (_locals.Replace(item, newItem))
             {
                 return(true);
             }
         }
     }
     if (_explicitInfo == existing)
     {
         this.ExplicitInfo = (ExplicitMemberInfo)newNode;
         return(true);
     }
     return(false);
 }
Beispiel #28
0
			public override void OnParameterDeclaration(ParameterDeclaration node)
			{
				_emitter.EmitParameterAttributes(node, this._knownTypes);
			}
Beispiel #29
0
	protected bool  callable_parameter_declaration(
		ParameterDeclarationCollection c
	) //throws RecognitionException, TokenStreamException
{
		bool varArgs;
		
				
				TypeReference tr = null;
				ParameterModifiers pm = ParameterModifiers.None;
				varArgs = false;
			
		
		try {      // for error handling
			{
				switch ( LA(1) )
				{
				case MULTIPLY:
				{
					{
						match(MULTIPLY);
						if (0==inputState.guessing)
						{
							varArgs=true;
						}
						tr=type_reference();
					}
					break;
				}
				case CALLABLE:
				case CHAR:
				case REF:
				case THEN:
				case LPAREN:
				case ID:
				case SPLICE_BEGIN:
				{
					{
						{
							switch ( LA(1) )
							{
							case REF:
							{
								pm=parameter_modifier();
								break;
							}
							case CALLABLE:
							case CHAR:
							case THEN:
							case LPAREN:
							case ID:
							case SPLICE_BEGIN:
							{
								break;
							}
							default:
							{
								throw new NoViableAltException(LT(1), getFilename());
							}
							 }
						}
						{
							tr=type_reference();
						}
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			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, "callable_parameter_declaration");
				recover(ex,tokenSet_87_);
			}
			else
			{
				throw ex;
			}
		}
		return varArgs;
	}
Beispiel #30
0
		void EmitParameterAttributes(ParameterDeclaration node, TypeCreator knownTypes)
		{
			ParameterBuilder builder = (ParameterBuilder)GetBuilder(node);
			EmitAttributes(node, builder.SetCustomAttribute, knownTypes);
		}
Beispiel #31
0
 public override void LeaveParameterDeclaration(ParameterDeclaration node)
 {
     AssertIdentifierName(node, node.Name);
     CheckParameterType(node.Type);
 }
Beispiel #32
0
 public InternalParameter(ParameterDeclaration parameter, int index)
 {
     _parameter = parameter;
     _index = index;
 }
Beispiel #33
0
 public ReferenceExpression CreateReference(ParameterDeclaration parameter)
 {
     return CreateReference((InternalParameter)TypeSystemServices.GetEntity(parameter));
 }
 public SpliceParameterDeclaration(ParameterDeclaration pd, Expression nameExpression) :
     base(pd.LexicalInfo)
 {
     this.ParameterDeclaration = pd;
     this.NameExpression       = nameExpression;
 }