aspect ExtractCJP { //extract CJPs after having finished error checking refine CompileSequence public void Program.checkErrors(Options options, ErrorQueue error_queue) throws CompilerFailedException { CompileSequence.Program.checkErrors(options,error_queue); this.extractCJPs(); } public void ASTNode.extractCJPs() { for(int i = 0; i < getNumChild(); i++) getChild(i).extractCJPs(); } public void ClassDecl.extractCJPs() { extractIntoMethod(); } public void ASTNode.extractIntoMethod() { for(int i = 0; i < getNumChild(); i++) getChild(i).extractIntoMethod(); } public static int ClosureJoinpointAccess.methodCounter = 0; public void ClosureJoinpointAccess.extractIntoMethod() { AnonymousMethod am = this.convert(); MethodDecl md = am.doExtractToMethod(ASTNode.VIS_PRIVATE, "cjp$generated$"+(methodCounter++)); TypeDecl type = getName().type(); if(type instanceof JoinpointTypeDecl) { JoinpointTypeDecl joinpointTypeDecl = (JoinpointTypeDecl) type; md.cjpTypeName = joinpointTypeDecl.fullName(); } md.wasExtractedFromCJP = true; } public boolean MethodDecl.wasExtractedFromCJP = false; syn boolean MethodDecl.wasExtractedFromCJP() = wasExtractedFromCJP; public String MethodDecl.cjpTypeName = ""; syn String MethodDecl.cjpTypeName() = cjpTypeName; }