mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-02 05:14:11 -08:00
jso: don't insert casts to JS classes in non-strict mode
This commit is contained in:
parent
81fc843da3
commit
19518eb191
jso/impl/src/main/java/org/teavm/jso/impl
tools/junit/src/main/java/org/teavm/junit
|
@ -104,18 +104,20 @@ class JSClassProcessor {
|
|||
private final JSTypeHelper typeHelper;
|
||||
private final Diagnostics diagnostics;
|
||||
private final Map<MethodReference, MethodReader> overriddenMethodCache = new HashMap<>();
|
||||
private final boolean strict;
|
||||
private JSValueMarshaller marshaller;
|
||||
private IncrementalDependencyRegistration incrementalCache;
|
||||
private JSImportAnnotationCache annotationCache;
|
||||
private ClassReader objectClass;
|
||||
|
||||
JSClassProcessor(ClassReaderSource classSource, JSTypeHelper typeHelper, JSBodyRepository repository,
|
||||
Diagnostics diagnostics, IncrementalDependencyRegistration incrementalCache) {
|
||||
Diagnostics diagnostics, IncrementalDependencyRegistration incrementalCache, boolean strict) {
|
||||
this.classSource = classSource;
|
||||
this.typeHelper = typeHelper;
|
||||
this.repository = repository;
|
||||
this.diagnostics = diagnostics;
|
||||
this.incrementalCache = incrementalCache;
|
||||
this.strict = strict;
|
||||
javaInvocationProcessor = new JavaInvocationProcessor(typeHelper, repository, classSource, diagnostics);
|
||||
|
||||
annotationCache = new JSImportAnnotationCache(classSource, diagnostics);
|
||||
|
@ -477,7 +479,7 @@ class JSClassProcessor {
|
|||
|
||||
ClassReader targetClass = classSource.get(targetClassName);
|
||||
if (targetClass.getAnnotations().get(JSFunctor.class.getName()) == null) {
|
||||
if (isTransparent(targetClassName)) {
|
||||
if (!strict || isTransparent(targetClassName)) {
|
||||
var assign = new AssignInstruction();
|
||||
assign.setLocation(location.getSourceLocation());
|
||||
assign.setAssignee(cast.getValue());
|
||||
|
|
|
@ -70,7 +70,7 @@ class JSObjectClassTransformer implements ClassHolderTransformer {
|
|||
if (processor == null || processor.getClassSource() != hierarchy.getClassSource()) {
|
||||
typeHelper = new JSTypeHelper(hierarchy.getClassSource());
|
||||
processor = new JSClassProcessor(hierarchy.getClassSource(), typeHelper, repository,
|
||||
context.getDiagnostics(), context.getIncrementalCache());
|
||||
context.getDiagnostics(), context.getIncrementalCache(), context.isStrict());
|
||||
}
|
||||
processor.processClass(cls);
|
||||
if (typeHelper.isJavaScriptClass(cls.getName())) {
|
||||
|
|
|
@ -85,6 +85,7 @@ abstract class TestPlatformSupport<T extends TeaVMTarget> {
|
|||
.setClassSource(classSource)
|
||||
.setReferenceCache(referenceCache)
|
||||
.setDependencyAnalyzerFactory(dependencyAnalyzerFactory)
|
||||
.setStrict(true)
|
||||
.build();
|
||||
|
||||
configuration.apply(vm);
|
||||
|
|
Loading…
Reference in New Issue
Block a user