public JCExpression thisExpression(Type type) { return TreeMaker.instance(context).This(type); }
public JCExpression thisExpression(Type type) { return TreeMaker.instance(context).This(type); }
/** Construct a tree simulating the expression {@code C.this}. * @param pos The source code position to be used for the tree. * @param c The qualifier class. */ JCExpression makeThis(DiagnosticPosition pos, TypeSymbol c) { if (currentClass == c) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOuterThis(pos, c); } }
/** Construct a tree simulating the expression {@code C.this}. * @param pos The source code position to be used for the tree. * @param c The qualifier class. */ JCExpression makeThis(DiagnosticPosition pos, TypeSymbol c) { if (currentClass == c) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOuterThis(pos, c); } }
/** Construct a tree simulating the expression <C.this>. * @param pos The source code position to be used for the tree. * @param c The qualifier class. */ JCExpression makeThis(DiagnosticPosition pos, TypeSymbol c) { if (currentClass == c) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOuterThis(pos, c); } }
/** Construct a tree simulating the expression <C.this>. * @param pos The source code position to be used for the tree. * @param c The qualifier class. */ JCExpression makeThis(DiagnosticPosition pos, TypeSymbol c) { if (currentClass == c) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOuterThis(pos, c); } }
/** Construct a tree that represents the closest outer instance * <C.this> such that the given symbol is a member of C. * @param pos The source code position to be used for the tree. * @param sym The accessed symbol. * @param preciseMatch should we accept a type that is a subtype of * sym's owner, even if it doesn't contain sym * due to hiding, overriding, or non-inheritance * due to protection? */ JCExpression makeOwnerThis(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) { Symbol c = sym.owner; if (preciseMatch ? sym.isMemberOf(currentClass, types) : currentClass.isSubClass(sym.owner, types)) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOwnerThisN(pos, sym, preciseMatch); } }
/** Construct a tree that represents the closest outer instance * {@code C.this} such that the given symbol is a member of C. * @param pos The source code position to be used for the tree. * @param sym The accessed symbol. * @param preciseMatch should we accept a type that is a subtype of * sym's owner, even if it doesn't contain sym * due to hiding, overriding, or non-inheritance * due to protection? */ JCExpression makeOwnerThis(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) { Symbol c = sym.owner; if (preciseMatch ? sym.isMemberOf(currentClass, types) : currentClass.isSubClass(sym.owner, types)) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOwnerThisN(pos, sym, preciseMatch); } }
/** Construct a tree that represents the closest outer instance * <C.this> such that the given symbol is a member of C. * @param pos The source code position to be used for the tree. * @param sym The accessed symbol. * @param preciseMatch should we accept a type that is a subtype of * sym's owner, even if it doesn't contain sym * due to hiding, overriding, or non-inheritance * due to protection? */ JCExpression makeOwnerThis(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) { Symbol c = sym.owner; if (preciseMatch ? sym.isMemberOf(currentClass, types) : currentClass.isSubClass(sym.owner, types)) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOwnerThisN(pos, sym, preciseMatch); } }
/** Construct a tree that represents the closest outer instance * {@code C.this} such that the given symbol is a member of C. * @param pos The source code position to be used for the tree. * @param sym The accessed symbol. * @param preciseMatch should we accept a type that is a subtype of * sym's owner, even if it doesn't contain sym * due to hiding, overriding, or non-inheritance * due to protection? */ JCExpression makeOwnerThis(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) { Symbol c = sym.owner; if (preciseMatch ? sym.isMemberOf(currentClass, types) : currentClass.isSubClass(sym.owner, types)) { // in this case, `this' works fine return make.at(pos).This(c.erasure(types)); } else { // need to go via this$n return makeOwnerThisN(pos, sym, preciseMatch); } }
/** Return tree simulating the assignment <this.this$n = this$n>. */ JCStatement initOuterThis(int pos) { VarSymbol rhs = outerThisStack.head; assert rhs.owner.kind == MTH; VarSymbol lhs = outerThisStack.tail.head; assert rhs.owner.owner == lhs.owner; make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
/** Return tree simulating the assignment <this.this$n = this$n>. */ JCStatement initOuterThis(int pos) { VarSymbol rhs = outerThisStack.head; assert rhs.owner.kind == MTH; VarSymbol lhs = outerThisStack.tail.head; assert rhs.owner.owner == lhs.owner; make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
/** Return tree simulating the assignment {@code this.this$n = this$n}. */ JCStatement initOuterThis(int pos) { VarSymbol rhs = outerThisStack.head; Assert.check(rhs.owner.kind == MTH); VarSymbol lhs = outerThisStack.tail.head; Assert.check(rhs.owner.owner == lhs.owner); make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
/** Return tree simulating the assignment {@code this.this$n = this$n}. */ JCStatement initOuterThis(int pos) { VarSymbol rhs = outerThisStack.head; Assert.check(rhs.owner.kind == MTH); VarSymbol lhs = outerThisStack.tail.head; Assert.check(rhs.owner.owner == lhs.owner); make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
/** Return tree simulating the assignment <this.name = name>, where * name is the name of a free variable. */ JCStatement initField(int pos, Name name) { Scope.Entry e = proxies.lookup(name); Symbol rhs = e.sym; assert rhs.owner.kind == MTH; Symbol lhs = e.next().sym; assert rhs.owner.owner == lhs.owner; make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
/** Return tree simulating the assignment <this.name = name>, where * name is the name of a free variable. */ JCStatement initField(int pos, Name name) { Scope.Entry e = proxies.lookup(name); Symbol rhs = e.sym; assert rhs.owner.kind == MTH; Symbol lhs = e.next().sym; assert rhs.owner.owner == lhs.owner; make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
if( !isStatic ) JCExpression thisArg = make.This( _tp.getClassDecl( tree ).type ); newArgs.add( 0, thisArg );
/** Return tree simulating the assignment {@code this.name = name}, where * name is the name of a free variable. */ JCStatement initField(int pos, Name name) { Scope.Entry e = proxies.lookup(name); Symbol rhs = e.sym; Assert.check(rhs.owner.kind == MTH); Symbol lhs = e.next().sym; Assert.check(rhs.owner.owner == lhs.owner); make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
/** Return tree simulating the assignment {@code this.name = name}, where * name is the name of a free variable. */ JCStatement initField(int pos, Name name) { Scope.Entry e = proxies.lookup(name); Symbol rhs = e.sym; Assert.check(rhs.owner.kind == MTH); Symbol lhs = e.next().sym; Assert.check(rhs.owner.owner == lhs.owner); make.at(pos); return make.Exec( make.Assign( make.Select(make.This(lhs.owner.erasure(types)), lhs), make.Ident(rhs)).setType(lhs.erasure(types))); }
if( !isStatic ) JCExpression thisArg = make.This( _tp.getClassDecl( tree ).type ); newArgs.add( 0, thisArg );