本文整理汇总了C#中Boo.Lang.Compiler.Ast.ParameterDeclaration类的典型用法代码示例。如果您正苦于以下问题:C# ParameterDeclaration类的具体用法?C# ParameterDeclaration怎么用?C# ParameterDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParameterDeclaration类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了ParameterDeclaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: GetContextFieldDeclaration
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;
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:69,代码来源:IntroduceEvaluationContext.cs
示例17: parameter_declaration
//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:
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:boo,代码行数:101,代码来源:WSABooParserBase.cs
示例18: ConvertParameter
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;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:16,代码来源:ConvertVisitorTypeMembers.cs
示例19: EmitParameterAttributes
void EmitParameterAttributes(ParameterDeclaration node)
{
ParameterBuilder builder = (ParameterBuilder)GetBuilder(node);
EmitAttributes(node, builder.SetCustomAttribute);
}
开发者ID:Bombadil77,项目名称:boo,代码行数:5,代码来源:EmitAssembly.cs
示例20: Lift
public static Expression Lift(ParameterDeclaration p)
{
return new ReferenceExpression(p.LexicalInfo, p.Name);
}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:4,代码来源:Expression.cs
注:本文中的Boo.Lang.Compiler.Ast.ParameterDeclaration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论