Skip to content

Commit bba8a97

Browse files
khatchadjuliandolby
andcommitted
Jumpstart jep merge (wala#254)
- More tests and fixes for use with the new front end. - Work on wala#246. --------- Co-authored-by: Julian Dolby <[email protected]>
1 parent df4342c commit bba8a97

File tree

56 files changed

+632
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+632
-203
lines changed

com.ibm.wala.cast.python.jython.test/.classpath

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,12 @@
1717
<attribute name="test" value="true"/>
1818
</attributes>
1919
</classpathentry>
20+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
21+
<attributes>
22+
<attribute name="maven.pomderived" value="true"/>
23+
<attribute name="test" value="true"/>
24+
<attribute name="optional" value="true"/>
25+
</attributes>
26+
</classpathentry>
2027
<classpathentry kind="output" path="target/classes"/>
2128
</classpath>

com.ibm.wala.cast.python.jython/.classpath

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,12 @@
2929
<attribute name="test" value="true"/>
3030
</attributes>
3131
</classpathentry>
32+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
33+
<attributes>
34+
<attribute name="maven.pomderived" value="true"/>
35+
<attribute name="test" value="true"/>
36+
<attribute name="optional" value="true"/>
37+
</attributes>
38+
</classpathentry>
3239
<classpathentry kind="output" path="target/classes"/>
3340
</classpath>

com.ibm.wala.cast.python.jython/source/com/ibm/wala/cast/python/parser/PythonFileParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static void main(String[] args) throws Exception {
5252
new PythonFileParser(new File(args[0]), new CAstTypeDictionaryImpl<String>(), pythonPath);
5353
CAstEntity script = p.translateToCAst();
5454
System.err.println(script);
55-
System.err.println(CAstPrinter.print(script));
55+
System.err.println(CAstPrinter.print(script.getAST()));
5656
}
5757

5858
@Override

com.ibm.wala.cast.python.jython/source/com/ibm/wala/cast/python/parser/PythonModuleParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static void main(String[] args) throws Exception {
6767
pythonPath);
6868
CAstEntity script = p.translateToCAst();
6969
System.err.println(script);
70-
System.err.println(CAstPrinter.print(script));
70+
System.err.println(CAstPrinter.print(script.getAST()));
7171
}
7272

7373
@Override

com.ibm.wala.cast.python.jython/source/com/ibm/wala/cast/python/parser/PythonParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
import org.python.antlr.base.stmt;
124124
import org.python.core.PyObject;
125125

126-
public abstract class PythonParser<T> extends AbstractParser<T> implements TranslatorToCAst {
126+
public abstract class PythonParser<T> extends AbstractParser implements TranslatorToCAst {
127127

128128
private static boolean COMPREHENSION_IR = true;
129129

@@ -215,7 +215,7 @@ public Map<CAstNode, Collection<CAstEntity>> getScopedEntities() {
215215

216216
private final CAst Ast = new CAstImpl();
217217

218-
private class CAstVisitor extends AbstractParser<T>.CAstVisitor implements VisitorIF<CAstNode> {
218+
private class CAstVisitor extends AbstractParser.CAstVisitor implements VisitorIF<CAstNode> {
219219
private final PythonParser.WalkContext context;
220220
private final WalaPythonParser parser;
221221

com.ibm.wala.cast.python.jython3.test/test-source/com/ibm/wala/cast/python/jython3/test/TestAnnotations.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import com.ibm.wala.cast.python.ipa.callgraph.PythonSSAPropagationCallGraphBuilder;
88
import com.ibm.wala.cast.python.loader.PythonLoader.DynamicMethodBody;
99
import com.ibm.wala.cast.python.modref.PythonModRef;
10-
import com.ibm.wala.cast.python.test.TestPythonCallGraphShape;
10+
import com.ibm.wala.cast.python.test.TestJythonCallGraphShape;
1111
import com.ibm.wala.cast.python.types.PythonTypes;
1212
import com.ibm.wala.cast.types.AstMethodReference;
1313
import com.ibm.wala.classLoader.IClass;
@@ -28,7 +28,7 @@
2828
import java.io.IOException;
2929
import org.junit.Test;
3030

31-
public class TestAnnotations extends TestPythonCallGraphShape {
31+
public class TestAnnotations extends TestJythonCallGraphShape {
3232

3333
@Test
3434
public void testAnnotation1()

com.ibm.wala.cast.python.jython3/source/com/ibm/wala/cast/python/parser/PythonFileParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static void main(String[] args) throws Exception {
5252
new PythonFileParser(new File(args[0]), new CAstTypeDictionaryImpl<String>(), pythonPath);
5353
CAstEntity script = p.translateToCAst();
5454
System.err.println(script);
55-
System.err.println(CAstPrinter.print(script));
55+
System.err.println(CAstPrinter.print(script.getAST()));
5656
}
5757

5858
@Override

com.ibm.wala.cast.python.jython3/source/com/ibm/wala/cast/python/parser/PythonModuleParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public static void main(String[] args) throws Exception {
315315
pythonPath);
316316
CAstEntity script = p.translateToCAst();
317317
System.err.println(script);
318-
System.err.println(CAstPrinter.print(script));
318+
System.err.println(CAstPrinter.print(script.getAST()));
319319
}
320320

321321
@Override

com.ibm.wala.cast.python.jython3/source/com/ibm/wala/cast/python/parser/PythonParser.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.ibm.wala.cast.tree.CAstType;
3636
import com.ibm.wala.cast.tree.impl.AbstractSourcePosition;
3737
import com.ibm.wala.cast.tree.impl.CAstControlFlowRecorder;
38+
import com.ibm.wala.cast.tree.impl.CAstImpl;
3839
import com.ibm.wala.cast.tree.impl.CAstNodeTypeMapRecorder;
3940
import com.ibm.wala.cast.tree.impl.CAstOperator;
4041
import com.ibm.wala.cast.tree.impl.CAstSourcePositionRecorder;
@@ -144,7 +145,9 @@
144145
import org.python.antlr.base.stmt;
145146
import org.python.core.PyObject;
146147

147-
public abstract class PythonParser<T> extends AbstractParser<T> implements TranslatorToCAst {
148+
public abstract class PythonParser<T> extends AbstractParser implements TranslatorToCAst {
149+
150+
private static CAst Ast = new CAstImpl();
148151

149152
private static final Logger LOGGER = getLogger(PythonParser.class.getName());
150153

@@ -164,7 +167,7 @@ public Collection<CAstType> getSupertypes() {
164167
}
165168
};
166169

167-
interface WalkContext extends TranslatorToCAst.WalkContext<WalkContext, PythonTree> {
170+
public interface WalkContext extends TranslatorToCAst.WalkContext<WalkContext, PythonTree> {
168171

169172
default void addDefinedName(String name) {
170173
getParent().addDefinedName(name);
@@ -292,7 +295,7 @@ public Map<CAstNode, Collection<CAstEntity>> getScopedEntities() {
292295
}
293296
}
294297

295-
public class CAstVisitor extends AbstractParser<T>.CAstVisitor implements VisitorIF<CAstNode> {
298+
public class CAstVisitor extends AbstractParser.CAstVisitor implements VisitorIF<CAstNode> {
296299
private final PythonParser.WalkContext context;
297300
private final WalaPythonParser parser;
298301

com.ibm.wala.cast.python.ml.test/TestTensorflow2Model.launch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
2323
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
2424
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
25+
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
2526
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.python.ml.test.TestTensorflow2Model"/>
2627
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.python.ml.test"/>
2728
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>

0 commit comments

Comments
 (0)