Minor improvements & bugfixes

This commit is contained in:
konsoletyper 2014-09-30 23:19:10 +04:00
parent 50686c882d
commit b7754ea1a5
6 changed files with 35 additions and 10 deletions

View File

@ -62,13 +62,34 @@ class PropertyMap extends AbstractMap<String, Variable> {
Map<String, Variable> vars = new HashMap<>(); Map<String, Variable> vars = new HashMap<>();
for (Map.Entry<String, JavaScriptVariable> entry : jsVariables.entrySet()) { for (Map.Entry<String, JavaScriptVariable> entry : jsVariables.entrySet()) {
JavaScriptVariable jsVar = entry.getValue(); JavaScriptVariable jsVar = entry.getValue();
String name = debugger.mapField(className, entry.getKey()); String name;
if (name == null) { if (className.endsWith("[]")) {
continue; if (entry.getKey().equals("data")) {
name = entry.getKey();
} else {
continue;
}
} else if (isNumeric(entry.getKey())) {
name = entry.getKey();
} else {
name = debugger.mapField(className, entry.getKey());
if (name == null) {
continue;
}
} }
Value value = new Value(debugger, jsVar.getValue()); Value value = new Value(debugger, jsVar.getValue());
vars.put(entry.getKey(), new Variable(name, value)); vars.put(entry.getKey(), new Variable(name, value));
} }
backingMap.compareAndSet(null, vars); backingMap.compareAndSet(null, vars);
} }
private boolean isNumeric(String str) {
for (int i = 0; i < str.length(); ++i) {
char c = str.charAt(i);
if (c < '0' || c > '9') {
return false;
}
}
return true;
}
} }

View File

@ -426,6 +426,9 @@ public class SSATransformer {
@Override @Override
public void visit(UnwrapArrayInstruction insn) { public void visit(UnwrapArrayInstruction insn) {
insn.setArray(use(insn.getArray())); insn.setArray(use(insn.getArray()));
for (String debugName : insn.getArray().getDebugNames()) {
variableDebugMap.put(insn.getReceiver().getIndex(), debugName + ".data");
}
insn.setReceiver(define(insn.getReceiver())); insn.setReceiver(define(insn.getReceiver()));
} }

View File

@ -119,6 +119,7 @@ public class JSNativeGenerator implements Generator, Injector, DependencyPlugin
switch (method.getReference().getName()) { switch (method.getReference().getName()) {
case "invoke": case "invoke":
case "instantiate": case "instantiate":
case "function":
for (int i = 0; i < method.getReference().parameterCount(); ++i) { for (int i = 0; i < method.getReference().parameterCount(); ++i) {
method.getVariable(i).addConsumer(new DependencyConsumer() { method.getVariable(i).addConsumer(new DependencyConsumer() {
@Override public void consume(DependencyAgentType type) { @Override public void consume(DependencyAgentType type) {

View File

@ -3,11 +3,6 @@
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0
http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="TeaVM web application" partial="false"> name="TeaVM web application" partial="false">
<requiredProperties>
<requiredProperty key="package">
<defaultValue></defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets> <fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8"> <fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory> <directory>src/main/java</directory>

View File

@ -101,6 +101,10 @@
<!-- Whether TeaVM should produce source maps file --> <!-- Whether TeaVM should produce source maps file -->
<sourceMapsGenerated>true</sourceMapsGenerated> <sourceMapsGenerated>true</sourceMapsGenerated>
<!-- Whether TeaVM should also put source files into output directory,
for compatibility with source maps -->
<sourceFilesCopied>true</sourceFilesCopied>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@ -2,8 +2,9 @@
<html> <html>
<head> <head>
<title>Main page</title> <title>Main page</title>
<script type="text/javascript" src="teavm/runtime.js"></script> <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script type="text/javascript" src="teavm/classes.js"></script> <script type="text/javascript" charset="utf-8" src="teavm/runtime.js"></script>
<script type="text/javascript" charset="utf-8" src="teavm/classes.js"></script>
</head> </head>
<body onload="main()"> <body onload="main()">
<!-- TODO: add HTML content --> <!-- TODO: add HTML content -->