本文整理汇总了C#中Boo.Lang.Compiler.Ast.ExpressionCollection类的典型用法代码示例。如果您正苦于以下问题:C# ExpressionCollection类的具体用法?C# ExpressionCollection怎么用?C# ExpressionCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionCollection类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了ExpressionCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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());
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例8: HasOperatorSignature
bool HasOperatorSignature(IMethod method, ExpressionCollection args)
{
return method.IsStatic &&
(args.Count == method.GetParameters().Length) &&
CheckParameterTypesStrictly(method, args);
}
示例9: GetMostGenericType
IType GetMostGenericType(ExpressionCollection args)
{
return TypeSystemServices.GetMostGenericType(args);
}
示例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;
}
示例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);
}
示例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);
}
示例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_);
}
//.........这里部分代码省略.........
示例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;
}
//.........这里部分代码省略.........
示例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;
}