本文整理汇总了C#中Boo.Lang.Compiler.Ast.ExpressionCollection类的典型用法代码示例。如果您正苦于以下问题:C# ExpressionCollection类的具体用法?C# ExpressionCollection怎么用?C# ExpressionCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionCollection类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了ExpressionCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PropagateChanges
public override void PropagateChanges(MethodInvocationExpression eval, List chain)
{
ExpressionCollection expressions = new ExpressionCollection();
foreach (object local1 in chain.Reversed)
{
if (!(local1 is ProcessAssignmentsToSpecialMembers.ChainItem))
{
}
ProcessAssignmentsToSpecialMembers.ChainItem item = (ProcessAssignmentsToSpecialMembers.ChainItem) RuntimeServices.Coerce(local1, typeof(ProcessAssignmentsToSpecialMembers.ChainItem));
if (item.Container is MethodInvocationExpression)
{
break;
}
if (item.Container is SlicingExpression)
{
SlicingExpression expression = item.Container;
Expression[] expressionArray1 = new Expression[] { expression.get_Target().CloneNode(), expression.get_Indices().get_Item(0).get_Begin().CloneNode(), this.get_CodeBuilder().CreateReference(item.Local) };
expressions.Add(this.CreateConstructorInvocation(this._sliceValueTypeChangeConstructor, expressionArray1));
break;
}
MemberReferenceExpression container = item.Container;
Expression[] args = new Expression[] { container.get_Target().CloneNode(), this.get_CodeBuilder().CreateStringLiteral(container.get_Name()), this.get_CodeBuilder().CreateReference(item.Local) };
expressions.Add(this.CreateConstructorInvocation(this._valueTypeChangeConstructor, args));
}
MethodInvocationExpression expression3 = this.get_CodeBuilder().CreateMethodInvocation(this._propagateChanges);
IArrayType type = this._valueTypeChangeType.MakeArrayType(1);
expression3.get_Arguments().Add(this.get_CodeBuilder().CreateArray(type, expressions));
eval.get_Arguments().Add(expression3);
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:29,代码来源:ProcessAssignmentToDuckMembers.cs
示例2: IsArrayArgumentExplicitlyProvided
public static bool IsArrayArgumentExplicitlyProvided(IParameter[] parameters, ExpressionCollection args)
{
IType expressionType = TypeSystemServices.GetExpressionType(args.get_Item(-1));
IType rhs = parameters[parameters.Length + -1].get_Type();
if (!RuntimeServices.EqualityOperator(expressionType, rhs))
{
}
return ((parameters.Length == args.Count) ? RuntimeServices.EqualityOperator(expressionType, EmptyArrayType.Default) : false);
}
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:9,代码来源:UnityCallableResolutionServiceModule.cs
示例3: GenericParameterInferrer
public GenericParameterInferrer(CompilerContext context, IMethod genericMethod, ExpressionCollection arguments)
{
_context = context;
_genericMethod = genericMethod;
_arguments = arguments;
InitializeInferredTypes(GenericMethod.GenericInfo.GenericParameters);
InitializeDependencies(
GenericMethod.GenericInfo.GenericParameters,
GenericMethod.CallableType.GetSignature());
}
开发者ID:boo,项目名称:boo-lang,代码行数:11,代码来源:GenericParameterInferrer.cs
示例4: GenericParameterInferrer
public GenericParameterInferrer(CompilerContext context, IMethod genericMethod, ExpressionCollection arguments)
{
_genericMethod = genericMethod;
Initialize(context);
InitializeArguments(arguments);
InitializeTypeParameters(GenericMethod.GenericInfo.GenericParameters);
InitializeDependencies(
GenericMethod.GenericInfo.GenericParameters,
GenericMethod.CallableType.GetSignature());
InitializeClosureDependencies();
}
开发者ID:BITechnologies,项目名称:boo,代码行数:12,代码来源:GenericParameterInferrer.cs
示例5: CreateArray
public ArrayLiteralExpression CreateArray(IType arrayType, ExpressionCollection items)
{
if (!arrayType.IsArray)
throw new ArgumentException(string.Format("'{0}' is not an array type!", arrayType), "arrayType");
var array = new ArrayLiteralExpression();
array.ExpressionType = arrayType;
array.Items.AddRange(items);
TypeSystemServices.MapToConcreteExpressionTypes(array.Items);
return array;
}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:11,代码来源:BooCodeBuilder.cs
示例6: ResolveAmbiguousPropertyReference
private IEntity ResolveAmbiguousPropertyReference(ReferenceExpression node, Ambiguous candidates, ExpressionCollection args)
{
IEntity[] entities = candidates.Entities;
IEntity[] getters = GetGetMethods(entities);
IEntity found = GetCorrectCallableReference(node, args, getters);
if (null != found && EntityType.Method == found.EntityType)
{
IProperty property = (IProperty)entities[GetIndex(getters, found)];
BindProperty(node, property);
return property;
}
return candidates;
}
开发者ID:stuman08,项目名称:boo,代码行数:14,代码来源:ProcessMethodBodies.cs
示例7: ResolveAmbiguousMethodReference
private IEntity ResolveAmbiguousMethodReference(ReferenceExpression node, Ambiguous candidates, ExpressionCollection args)
{
//BOO-656
if (!AstUtil.IsTargetOfMethodInvocation(node)
&& !AstUtil.IsTargetOfSlicing(node)
&& !node.IsTargetOfAssignment())
{
return candidates.Entities[0];
}
return candidates;
}
开发者ID:stuman08,项目名称:boo,代码行数:11,代码来源:ProcessMethodBodies.cs
示例8: HasOperatorSignature
bool HasOperatorSignature(IMethod method, ExpressionCollection args)
{
return method.IsStatic &&
(args.Count == method.GetParameters().Length) &&
CheckParameterTypesStrictly(method, args);
}
开发者ID:stuman08,项目名称:boo,代码行数:6,代码来源:ProcessMethodBodies.cs
示例9: GetMostGenericType
IType GetMostGenericType(ExpressionCollection args)
{
return TypeSystemServices.GetMostGenericType(args);
}
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs
示例10: GetCorrectCallableReference
IEntity GetCorrectCallableReference(Node sourceNode, ExpressionCollection args, IEntity[] candidates)
{
// BOO-844: Ensure all candidates were visited (to make property setters have correct signature)
foreach (IEntity candidate in candidates)
{
EnsureRelatedNodeWasVisited(sourceNode, candidate);
}
IEntity found = CallableResolutionService.ResolveCallableReference(args, candidates);
if (null == found)
EmitCallableResolutionError(sourceNode, candidates, args);
else
BindNullableParameters(args, ((IMethodBase) found).CallableType);
return found;
}
开发者ID:stuman08,项目名称:boo,代码行数:16,代码来源:ProcessMethodBodies.cs
示例11: CheckParameters
protected virtual bool CheckParameters(ICallableType method, ExpressionCollection args, bool reportErrors)
{
BindNullableParameters(args, method);
return AcceptVarArgs(method)
? CheckVarArgsParameters(method, args)
: CheckExactArgsParameters(method, args, reportErrors);
}
开发者ID:stuman08,项目名称:boo,代码行数:7,代码来源:ProcessMethodBodies.cs
示例12: CheckExactArgsParameters
protected bool CheckExactArgsParameters(ICallableType method, ExpressionCollection args, bool reportErrors)
{
if (method.GetSignature().Parameters.Length != args.Count) return false;
return AssertParameterTypes(method, args, args.Count, reportErrors);
}
开发者ID:stuman08,项目名称:boo,代码行数:5,代码来源:ProcessMethodBodies.cs
示例13: expression_list
protected void expression_list(
ExpressionCollection ec
) //throws RecognitionException, TokenStreamException
{
Expression e = null;
try { // for error handling
{
switch ( LA(1) )
{
case ESEPARATOR:
case CAST:
case CHAR:
case FALSE:
case NOT:
case NULL:
case SELF:
case SUPER:
case THEN:
case TRUE:
case TYPEOF:
case TRIPLE_QUOTED_STRING:
case LPAREN:
case DOUBLE_QUOTED_STRING:
case SINGLE_QUOTED_STRING:
case ID:
case MULTIPLY:
case LBRACK:
case SPLICE_BEGIN:
case DOT:
case LBRACE:
case QQ_BEGIN:
case SUBTRACT:
case LONG:
case INCREMENT:
case DECREMENT:
case ONES_COMPLEMENT:
case INT:
case BACKTICK_QUOTED_STRING:
case RE_LITERAL:
case DOUBLE:
case FLOAT:
case TIMESPAN:
{
e=expression();
if (0==inputState.guessing)
{
ec.Add(e);
}
{ // ( ... )*
for (;;)
{
if ((LA(1)==COMMA))
{
match(COMMA);
e=expression();
if (0==inputState.guessing)
{
if (e != null) ec.Add(e);
}
}
else
{
goto _loop653_breakloop;
}
}
_loop653_breakloop: ;
} // ( ... )*
break;
}
case EOL:
case IF:
case UNLESS:
case WHILE:
case EOS:
case RPAREN:
case COLON:
case RBRACE:
case QQ_END:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
}
catch (RecognitionException ex)
{
if (0 == inputState.guessing)
{
reportError(ex, "expression_list");
recover(ex,tokenSet_29_);
}
//.........这里部分代码省略.........
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs
示例14: list_items
protected void list_items(
ExpressionCollection items
) //throws RecognitionException, TokenStreamException
{
Expression item = null;
try { // for error handling
{
switch ( LA(1) )
{
case ESEPARATOR:
case CAST:
case CHAR:
case FALSE:
case NOT:
case NULL:
case SELF:
case SUPER:
case THEN:
case TRUE:
case TYPEOF:
case TRIPLE_QUOTED_STRING:
case LPAREN:
case DOUBLE_QUOTED_STRING:
case SINGLE_QUOTED_STRING:
case ID:
case MULTIPLY:
case LBRACK:
case SPLICE_BEGIN:
case DOT:
case LBRACE:
case QQ_BEGIN:
case SUBTRACT:
case LONG:
case INCREMENT:
case DECREMENT:
case ONES_COMPLEMENT:
case INT:
case BACKTICK_QUOTED_STRING:
case RE_LITERAL:
case DOUBLE:
case FLOAT:
case TIMESPAN:
{
item=expression();
if (0==inputState.guessing)
{
items.Add(item);
}
{
{ // ( ... )*
for (;;)
{
if ((LA(1)==COMMA) && (tokenSet_5_.member(LA(2))))
{
match(COMMA);
item=expression();
if (0==inputState.guessing)
{
items.Add(item);
}
}
else
{
goto _loop634_breakloop;
}
}
_loop634_breakloop: ;
} // ( ... )*
}
{
switch ( LA(1) )
{
case COMMA:
{
match(COMMA);
break;
}
case RBRACK:
case RBRACE:
{
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
break;
}
case RBRACK:
case RBRACE:
{
break;
}
//.........这里部分代码省略.........
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs
示例15: InferMethodGenericArguments
/// <summary>
/// Attempts to infer the generic parameters of a method from a set of arguments.
/// </summary>
/// <returns>
/// An array consisting of inferred types for the method's generic arguments,
/// or null if type inference failed.
/// </returns>
public IType[] InferMethodGenericArguments(IMethod method, ExpressionCollection arguments)
{
if (method.GenericInfo == null) return null;
GenericParameterInferrer inferrerr = new GenericParameterInferrer(Context, method, arguments);
if (inferrerr.Run())
{
return inferrerr.GetInferredTypes();
}
return null;
}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:18,代码来源:GenericsServices.cs
示例16: EmitCallableResolutionError
private void EmitCallableResolutionError(Node sourceNode, IEntity[] candidates, ExpressionCollection args)
{
//if this is call without arguments and ambiguous contains generic method without arguments
//than emit BCE0164 for readability
var genericMethod = candidates.OfType<IMethod>().FirstOrDefault(m => m.GenericInfo != null && m.GetParameters().Length == 0);
if (args.Count == 0 && genericMethod != null)
{
Error(CompilerErrorFactory.CannotInferGenericMethodArguments(sourceNode, genericMethod));
return;
}
if (CallableResolutionService.ValidCandidates.Count > 1)
{
Error(CompilerErrorFactory.AmbiguousReference(sourceNode, candidates[0].Name, CallableResolutionService.ValidCandidates.Select(c => (IEntity)c.Method)));
return;
}
var candidate = candidates[0];
var constructor = candidate as IConstructor;
if (constructor != null)
{
Error(CompilerErrorFactory.NoApropriateConstructorFound(sourceNode, constructor.DeclaringType, GetSignature(args)));
}
else
{
Error(CompilerErrorFactory.NoApropriateOverloadFound(sourceNode, GetSignature(args), candidate.FullName));
}
}
开发者ID:stuman08,项目名称:boo,代码行数:28,代码来源:ProcessMethodBodies.cs
示例17: FindOperator
IMethod FindOperator(IType type, string operatorName, ExpressionCollection args)
{
IEntity entity = NameResolutionService.Resolve(type, operatorName, EntityType.Method);
if (entity != null)
{
IMethod method = ResolveOperatorEntity(entity, args);
if (null != method) return method;
}
entity = NameResolutionService.ResolveExtension(type, operatorName);
if (entity != null)
return ResolveOperatorEntity(entity, args);
return null;
}
开发者ID:stuman08,项目名称:boo,代码行数:15,代码来源:ProcessMethodBodies.cs
示例18: CheckVarArgsParameters
protected bool CheckVarArgsParameters(ICallableType method, ExpressionCollection args)
{
return CallableResolutionService.IsValidVargsInvocation(method.GetSignature().Parameters, args);
}
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs
示例19: GetCorrectConstructor
IConstructor GetCorrectConstructor(Node sourceNode, IType type, ExpressionCollection arguments)
{
IConstructor[] constructors = type.GetConstructors().ToArray();
if (constructors.Length > 0)
return (IConstructor)GetCorrectCallableReference(sourceNode, arguments, constructors);
if (!IsError(type))
{
if (type is IGenericParameter)
Error(CompilerErrorFactory.CannotCreateAnInstanceOfGenericParameterWithoutDefaultConstructorConstraint(sourceNode, type));
else
Error(CompilerErrorFactory.NoApropriateConstructorFound(sourceNode, type, GetSignature(arguments)));
}
return null;
}
开发者ID:stuman08,项目名称:boo,代码行数:15,代码来源:ProcessMethodBodies.cs
示例20: AssertParameters
bool AssertParameters(Node sourceNode, IMethod method, ExpressionCollection args)
{
return AssertParameters(sourceNode, method, method.CallableType, args);
}
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs
注:本文中的Boo.Lang.Compiler.Ast.ExpressionCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论