private void replacePrototypeMemberDeclaration ( PrototypeMemberDeclaration declar ) { // x.prototype.y = ... -> t.y = ... Node assignment = declar . node . getFirstChild ( ) ; Node lhs = assignment . getFirstChild ( ) ; Node name = NodeUtil . newQName ( compiler , PROTOTYPE_ALIAS + "." + declar . memberName , declar . node , declar . memberName ) ; // Save the full prototype path on the left hand side of the assignment for debugging purposes. // declar.lhs = x.prototype.y so first child of the first child is 'x'. Node accessNode = declar . lhs . getFirstFirstChild ( ) ; String originalName = accessNode . getOriginalName ( ) ; String className = originalName != null ? originalName : "?" ; name . getFirstChild ( ) . useSourceInfoFromForTree ( lhs ) ; name . putBooleanProp ( Node . IS_CONSTANT_NAME , lhs . getBooleanProp ( Node . IS_CONSTANT_NAME ) ) ; name . getFirstChild ( ) . setOriginalName ( className + ".prototype" ) ; assignment . replaceChild ( lhs , name ) ; compiler . reportChangeToEnclosingScope ( name ) ; }
Replaces a member declaration to an assignment to the temp prototype object .