-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReactModifyKeyword.jrag
32 lines (28 loc) · 1.12 KB
/
ReactModifyKeyword.jrag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* ReactiveDominoJ is a practical implementation of an expand event system
* supporting reactive programming. This project is an implementation of its
* compiler built on top of DominoJ and JastAddJ.
*
* Copyright (c) 2013-, YungYu Zhuang. All rights reserved.
*
* The contents of this file are licensed under the modified BSD License
* (please see the LICENSE file for the full text).
*/
/*
*
*/
aspect ReactModifyKeyword {
refine ModifyKeyword public void MethodAccess.nameCheck() {
if(decls().isEmpty() && (!isQualified() || !qualifier().isUnknown())) {
if(name().endsWith("$getSlot") && hostType().isAnonymous()) {
TypeDecl td = hostType().enclosingBodyDecl().hostType();
TypeDecl atype = td.lookupType("java.util", "ArrayList");
Block b = new Block();
b.addStmt(new ReturnStmt(new ClassInstanceExpr(atype.createQualifiedAccess(), new List())));
td.createMemberMethod(name(), atype.createQualifiedAccess(), new List(), b, false);
bottomupFlushCache();
}
}
refined();
}
}