mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Adds a new dependency event that is emitted when dependency checker is
about to start. Adds ability to examine classes from generators.
This commit is contained in:
parent
e5ea6b51a7
commit
4dd9eaa1fd
|
@ -89,6 +89,12 @@ public class DependencyChecker implements DependencyInformation {
|
|||
listeners.add(listener);
|
||||
}
|
||||
|
||||
public void startListeners() {
|
||||
for (DependencyListener listener : listeners) {
|
||||
listener.started(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void addEntryPoint(MethodReference methodRef, String... argumentTypes) {
|
||||
ValueType[] parameters = methodRef.getDescriptor().getParameterTypes();
|
||||
if (parameters.length != argumentTypes.length) {
|
||||
|
|
|
@ -23,6 +23,8 @@ import org.teavm.model.MethodReference;
|
|||
* @author Alexey Andreev
|
||||
*/
|
||||
public interface DependencyListener {
|
||||
void started(DependencyChecker dependencyChecker);
|
||||
|
||||
void classAchieved(DependencyChecker dependencyChecker, String className);
|
||||
|
||||
void methodAchieved(DependencyChecker dependencyChecker, MethodReference method);
|
||||
|
|
|
@ -112,6 +112,7 @@ public class JavascriptBuilder implements JavascriptBuilderHost {
|
|||
SourceWriterBuilder builder = new SourceWriterBuilder(naming);
|
||||
builder.setMinified(minifying);
|
||||
SourceWriter sourceWriter = builder.build(writer);
|
||||
dependencyChecker.startListeners();
|
||||
dependencyChecker.attachMethodGraph(new MethodReference("java.lang.Class", new MethodDescriptor("createNew",
|
||||
ValueType.object("java.lang.Class"))));
|
||||
dependencyChecker.attachMethodGraph(new MethodReference("java.lang.String", new MethodDescriptor("<init>",
|
||||
|
|
|
@ -373,6 +373,11 @@ public class Renderer implements ExprVisitor, StatementVisitor {
|
|||
public String getParameterName(int index) {
|
||||
return variableName(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassReaderSource getClassSource() {
|
||||
return classSource;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,10 +15,14 @@
|
|||
*/
|
||||
package org.teavm.javascript.ni;
|
||||
|
||||
import org.teavm.model.ClassReaderSource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public interface GeneratorContext {
|
||||
String getParameterName(int index);
|
||||
|
||||
ClassReaderSource getClassSource();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user