本文整理汇总了C#中Boo.Lang.Compiler.Ast.MemberReferenceExpression类的典型用法代码示例。如果您正苦于以下问题:C# MemberReferenceExpression类的具体用法?C# MemberReferenceExpression怎么用?C# MemberReferenceExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberReferenceExpression类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了MemberReferenceExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeReferenceExpression
B.ReferenceExpression MakeReferenceExpression(string fullName)
{
string[] parts = fullName.Split('.');
B.ReferenceExpression r = new B.ReferenceExpression(lastLexicalInfo, parts[0]);
for (int i = 1; i < parts.Length; i++)
r = new B.MemberReferenceExpression(lastLexicalInfo, r, parts[i]);
return r;
}
示例2: OnMemberReferenceExpression
public override void OnMemberReferenceExpression(MemberReferenceExpression node)
{
Write("MemberReferenceExpression(");
BeginNode();
WriteIndented("Target: "); Visit(node.Target); Write(", "); WriteLine();
WriteIndented("Name: "); WriteString(node.Name);
EndNode();
}
示例3: WrapStatementsInBlockIfNeeded
public override void WrapStatementsInBlockIfNeeded(MemberReferenceExpression node, IUpdateCollector<LexicalInfo> updateCollector)
{
if (!this.IsInsideBlock(node))
{
Statement statement = BooExtensions.FindRootStatement(node);
updateCollector.Insert(BooExtensions.SourcePosition(BooExtensions.FindExpressionRoot(statement)), "{ ", node.get_LexicalInfo(), null).InclusiveRange = false;
updateCollector.Insert(new SourcePosition(statement.get_EndSourceLocation().get_Line(), statement.get_EndSourceLocation().get_Column() + 1), " }", node.get_LexicalInfo(), null);
}
}
示例4: OnMemberReferenceExpression
/// <summary>
/// Called when we encounters a member reference expression
/// </summary>
/// <param name="node">The node.</param>
public override void OnMemberReferenceExpression(MemberReferenceExpression node)
{
if (this.ShouldTransformNodeName(node))
{
this.TransformNodeName(node);
}
base.OnMemberReferenceExpression(node);
}
示例5: FixCondition
private Expression FixCondition(Expression condition)
{
if (IsTryGetParameterInvocation(condition) == false)
return condition;
var isNull =
new MemberReferenceExpression(condition, "_IsIgnoreNullReferencingNotNullObject_");
return isNull;
}
示例6: OnReferenceExpression
public override void OnReferenceExpression(ReferenceExpression node) {
if (node.Name[0] == '_')
{
var result = new MemberReferenceExpression(node.LexicalInfo);
result.Name = node.Name.Substring(1);
result.Target = instance.CloneNode();
ReplaceCurrentNode(result);
}
}
示例7: OnMemberReferenceExpression
override public void OnMemberReferenceExpression(MemberReferenceExpression node)
{
var tern = ProcessTargets(node);
if (tern != null)
{
ReplaceCurrentNode(tern);
return;
}
base.OnMemberReferenceExpression(node);
}
示例8: OnMemberReferenceExpression
public override void OnMemberReferenceExpression(MemberReferenceExpression node)
{
if (LookingFor(node))
{
Found(node);
}
else
{
base.OnMemberReferenceExpression(node);
}
}
示例9: OnMemberReferenceExpression
public override void OnMemberReferenceExpression(MemberReferenceExpression node)
{
var name = node.ToString();
if (name.StartsWith("@"))
{
ReplaceWithComponentReference(node, name);
return;
}
base.OnMemberReferenceExpression(node);
}
示例10: CreateReferenceExpression
public static ReferenceExpression CreateReferenceExpression(string fullname)
{
string[] parts = fullname.Split('.');
ReferenceExpression expression = new ReferenceExpression(parts[0]);
expression.IsSynthetic = true;
for (int i=1; i<parts.Length; ++i)
{
expression = new MemberReferenceExpression(expression, parts[i]);
expression.IsSynthetic = true;
}
return expression;
}
示例11: ExpandImpl
protected override Statement ExpandImpl(MacroStatement macro){
if (macro.Arguments.Count == 0)
{
Context.Errors.Add(new CompilerError(macro.LexicalInfo,
"call macro requires at least one reference or string attribute for action name"));
}
var basis = new ReferenceExpression("Html");
var method = new MemberReferenceExpression(basis, "RenderAction");
var call = new MethodInvocationExpression(method);
int i = 0;
var result = new Block();
foreach (Expression argument in macro.Arguments){
i++;
Expression exp = argument;
if (!(exp is HashLiteralExpression)){
//action and contrller parameters
if (!(exp is NullLiteralExpression)){
exp = new StringLiteralExpression(argument.ToCodeString());
}
call.Arguments.Add(exp);
}
else{
string name = "__rd";
result.Add(
new DeclarationStatement(
new Declaration(name, null),
new MethodInvocationExpression(AstUtil.CreateReferenceExpression("RouteValueDictionary"))
)
);
var dict = argument as HashLiteralExpression;
foreach (ExpressionPair item in dict.Items){
result.Add(
new MethodInvocationExpression(
AstUtil.CreateReferenceExpression(name + ".Add"),
item.First,
item.Second
)
);
}
if (i == 2){
call.Arguments.Add(new NullLiteralExpression());
}
call.Arguments.Add(AstUtil.CreateReferenceExpression(name));
}
}
result.Add(call);
return result;
}
示例12: FixCondition
private Expression FixCondition(Expression condition){
if (IsTryGetParameterInvocation(condition) == false){
return condition;
}
string name = ((ReferenceExpression) condition).Name.Substring(1);
condition = new MethodInvocationExpression(
new MemberReferenceExpression(new SuperLiteralExpression(), "TryGetParameter"),
new StringLiteralExpression(name)
);
var isNull =
new MemberReferenceExpression(condition, "_IsIgnoreNullReferencingNotNullObject_");
return isNull;
}
示例13: LeaveMemberReferenceExpression
public override void LeaveMemberReferenceExpression(MemberReferenceExpression node)
{
var property = node.Entity as IProperty;
if (property == null || node.IsTargetOfAssignment())
return;
var getter = CodeBuilder.CreatePropertyGet(node.Target, property);
// preserve duck typing...
if (property.IsDuckTyped)
ReplaceCurrentNode(
CodeBuilder.CreateCast(
TypeSystemServices.DuckType, getter));
else
ReplaceCurrentNode(getter);
}
示例14: OnMemberReferenceExpression
public override void OnMemberReferenceExpression(MemberReferenceExpression node)
{
ReferenceExpression reference = node.Target as ReferenceExpression;
if (reference != null && reference.Name.StartsWith("@"))
{
_component = reference;
}
else
{
_component = AstUtil.CreateMethodInvocationExpression(
AstUtil.CreateReferenceExpression(typeof(ComponentReference).FullName),
node.Target
);
}
_method = new StringLiteralExpression(node.Name);
_found = true;
}
示例15: AddResolvedNamedArgumentToEval
protected override void AddResolvedNamedArgumentToEval(MethodInvocationExpression eval, ExpressionPair pair, ReferenceExpression instance)
{
if (!TypeSystemServices.IsQuackBuiltin(pair.First))
{
base.AddResolvedNamedArgumentToEval(eval, pair, instance);
return;
}
MemberReferenceExpression memberRef = new MemberReferenceExpression(
pair.First.LexicalInfo,
instance.CloneNode(),
((ReferenceExpression)pair.First).Name);
BindQuack(memberRef);
eval.Arguments.Add(
CodeBuilder.CreateAssignment(
pair.First.LexicalInfo,
memberRef,
pair.Second));
}