本文整理汇总了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);
}
}
示例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;
}
示例3: MappedVariableDefinition
public MappedVariableDefinition(CompileResults results, ParameterDeclaration node)
: base(results, node, node.Name.Length)
{
}
示例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:
//.........这里部分代码省略.........
示例5: LeaveParameterDeclaration
public override void LeaveParameterDeclaration(ParameterDeclaration node)
{
CheckName(node,node.Name);
}
示例6: OnParameterDeclaration
public override void OnParameterDeclaration(ParameterDeclaration node)
{
if (node.LexicalInfo != null)
results.MapParsedNode(new MappedVariableDefinition(results, node));
base.OnParameterDeclaration(node);
}
示例7: GetParameterAttributes
ParameterAttributes GetParameterAttributes(ParameterDeclaration param)
{
return ParameterAttributes.None;
}
示例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"));
}
示例9: OnParameterDeclaration
public override void OnParameterDeclaration(ParameterDeclaration node)
{
node.Name = node.Name.TrimStart('@');
base.OnParameterDeclaration(node);
}
示例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);
}
}
示例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;
}
}
}
示例12: SpliceParameterDeclaration
public SpliceParameterDeclaration(ParameterDeclaration pd, Expression nameExpression) :
base(pd.LexicalInfo)
{
this.ParameterDeclaration = pd;
this.NameExpression = nameExpression;
}
示例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_);
}
}
示例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_);
}
}
示例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;
}