本文整理汇总了Java中com.strobel.assembler.metadata.MemberReference.getName方法的典型用法代码示例。如果您正苦于以下问题:Java MemberReference.getName方法的具体用法?Java MemberReference.getName怎么用?Java MemberReference.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.strobel.assembler.metadata.MemberReference
的用法示例。
在下文中一共展示了MemberReference.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitMemberReferenceExpression
import com.strobel.assembler.metadata.MemberReference; //导入方法依赖的package包/类
@Override
public Void visitMemberReferenceExpression(MemberReferenceExpression node, SourceIndex index) {
MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
if (ref != null) {
// make sure this is actually a field
if (ref.getErasedSignature().indexOf('(') >= 0) {
throw new Error("Expected a field here! got " + ref);
}
ClassEntry classEntry = new ClassEntry(ref.getDeclaringType().getInternalName());
FieldEntry fieldEntry = new FieldEntry(classEntry, ref.getName(), new Type(ref.getErasedSignature()));
index.addReference(node.getMemberNameToken(), fieldEntry, m_behaviorEntry);
}
return recurse(node, index);
}
示例2: visitMemberReferenceExpression
import com.strobel.assembler.metadata.MemberReference; //导入方法依赖的package包/类
@Override
public Void visitMemberReferenceExpression(MemberReferenceExpression node,
SourceIndex index)
{
MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
if(ref != null)
{
// make sure this is actually a field
if(ref.getErasedSignature().indexOf('(') >= 0)
throw new Error("Expected a field here! got " + ref);
ClassEntry classEntry =
new ClassEntry(ref.getDeclaringType().getInternalName());
FieldEntry fieldEntry =
new FieldEntry(classEntry, ref.getName(), new Type(
ref.getErasedSignature()));
index.addReference(node.getMemberNameToken(), fieldEntry,
m_behaviorEntry);
}
return recurse(node, index);
}
示例3: visitIdentifierExpression
import com.strobel.assembler.metadata.MemberReference; //导入方法依赖的package包/类
@Override
public Void visitIdentifierExpression(IdentifierExpression node,
SourceIndex index)
{
MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
if(ref != null)
{
ClassEntry classEntry =
new ClassEntry(ref.getDeclaringType().getInternalName());
FieldEntry fieldEntry =
new FieldEntry(classEntry, ref.getName(), new Type(
ref.getErasedSignature()));
index.addReference(node.getIdentifierToken(), fieldEntry,
m_behaviorEntry);
}
return recurse(node, index);
}
示例4: visitIdentifierExpression
import com.strobel.assembler.metadata.MemberReference; //导入方法依赖的package包/类
@Override
public Void visitIdentifierExpression(IdentifierExpression node, SourceIndex index) {
MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
if (ref != null) {
ClassEntry classEntry = new ClassEntry(ref.getDeclaringType().getInternalName());
FieldEntry fieldEntry = new FieldEntry(classEntry, ref.getName(), new Type(ref.getErasedSignature()));
index.addReference(node.getIdentifierToken(), fieldEntry, m_behaviorEntry);
}
return recurse(node, index);
}
示例5: MemberInfo
import com.strobel.assembler.metadata.MemberReference; //导入方法依赖的package包/类
public MemberInfo(MemberReference mr) {
this.type = new TypeInfo(mr.getDeclaringType().getInternalName());
this.name = mr.getName();
this.signature = mr.getErasedSignature();
}
示例6: visitInvocationExpression
import com.strobel.assembler.metadata.MemberReference; //导入方法依赖的package包/类
@Override
public Void visitInvocationExpression(InvocationExpression node,
SourceIndex index)
{
MemberReference ref = node.getUserData(Keys.MEMBER_REFERENCE);
// get the behavior entry
ClassEntry classEntry =
new ClassEntry(ref.getDeclaringType().getInternalName());
BehaviorEntry behaviorEntry = null;
if(ref instanceof MethodReference)
{
MethodReference methodRef = (MethodReference)ref;
if(methodRef.isConstructor())
behaviorEntry =
new ConstructorEntry(classEntry, new Signature(
ref.getErasedSignature()));
else if(methodRef.isTypeInitializer())
behaviorEntry = new ConstructorEntry(classEntry);
else
behaviorEntry =
new MethodEntry(classEntry, ref.getName(), new Signature(
ref.getErasedSignature()));
}
if(behaviorEntry != null)
{
// get the node for the token
AstNode tokenNode = null;
if(node.getTarget() instanceof MemberReferenceExpression)
tokenNode =
((MemberReferenceExpression)node.getTarget())
.getMemberNameToken();
else if(node.getTarget() instanceof SuperReferenceExpression)
tokenNode = node.getTarget();
else if(node.getTarget() instanceof ThisReferenceExpression)
tokenNode = node.getTarget();
if(tokenNode != null)
index.addReference(tokenNode, behaviorEntry, m_behaviorEntry);
}
return recurse(node, index);
}