mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Minor fixes in development toolchain
This commit is contained in:
parent
6900fd587c
commit
58c19e3abc
|
@ -43,7 +43,7 @@ final class ExprOptimizer {
|
|||
case LESS:
|
||||
return Expr.binary(BinaryOperation.GREATER_OR_EQUALS, binary.getType(), a, b, expr.getLocation());
|
||||
case LESS_OR_EQUALS:
|
||||
return Expr.binary(BinaryOperation.GREATER, binary.getType(), a, b);
|
||||
return Expr.binary(BinaryOperation.GREATER, binary.getType(), a, b, expr.getLocation());
|
||||
case GREATER:
|
||||
return Expr.binary(BinaryOperation.LESS_OR_EQUALS, binary.getType(), a, b, expr.getLocation());
|
||||
case GREATER_OR_EQUALS:
|
||||
|
|
|
@ -14,13 +14,15 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var connected = false;
|
||||
window.addEventListener("message", function(event) {
|
||||
if (event.source !== window) {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = event.data;
|
||||
if (typeof data.teavmDebugger !== "undefined") {
|
||||
if (typeof data.teavmDebugger !== "undefined" && !connected) {
|
||||
connected = true;
|
||||
chrome.runtime.sendMessage({ command: "debug", port: data.teavmDebugger.port });
|
||||
}
|
||||
}, false);
|
||||
|
|
|
@ -20,10 +20,7 @@
|
|||
var debugPort = DEBUG_PORT;
|
||||
|
||||
function createWebSocket() {
|
||||
var loc = window.location;
|
||||
var newUri = loc.protocol === "https:" ? "wss:" : "ws:";
|
||||
newUri += "//WS_PATH";
|
||||
return new WebSocket(newUri);
|
||||
return new WebSocket("ws://WS_PATH");
|
||||
}
|
||||
|
||||
function createIndicator() {
|
||||
|
@ -170,15 +167,18 @@
|
|||
}
|
||||
|
||||
if (debugPort > 0) {
|
||||
var connected = false;
|
||||
function connectDebugAgent(event) {
|
||||
if (event.source !== window) {
|
||||
return;
|
||||
}
|
||||
var data = event.data;
|
||||
if (typeof data.teavmDebuggerRequest !== "undefined") {
|
||||
if (typeof data.teavmDebuggerRequest !== "undefined" && !connected) {
|
||||
connected = true;
|
||||
window.postMessage({teavmDebugger: {port: debugPort}}, "*");
|
||||
}
|
||||
}
|
||||
window.addEventListener("message", connectDebugAgent);
|
||||
window.postMessage({teavmDebugger: {port: debugPort}}, "*");
|
||||
}
|
||||
})();
|
|
@ -30,4 +30,6 @@ public interface DevServerManager extends Remote {
|
|||
void cancelBuild() throws RemoteException;
|
||||
|
||||
void addListener(DevServerManagerListener listener) throws RemoteException;
|
||||
|
||||
void removeListener(DevServerManagerListener listener) throws RemoteException;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class DevServerRunner extends UnicastRemoteObject implements DevServerMan
|
|||
private int port;
|
||||
private Registry registry;
|
||||
private DevServer server;
|
||||
private List<DevServerManagerListener> listeners = new ArrayList<>();
|
||||
private final List<DevServerManagerListener> listeners = new ArrayList<>();
|
||||
|
||||
private DevServerRunner(DevServer server) throws RemoteException {
|
||||
super();
|
||||
|
@ -94,8 +94,17 @@ public class DevServerRunner extends UnicastRemoteObject implements DevServerMan
|
|||
|
||||
@Override
|
||||
public void addListener(DevServerManagerListener listener) {
|
||||
synchronized (listeners) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(DevServerManagerListener listener) {
|
||||
synchronized (listeners) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
DevServer server = new DevServer();
|
||||
|
@ -265,10 +274,16 @@ public class DevServerRunner extends UnicastRemoteObject implements DevServerMan
|
|||
}
|
||||
}
|
||||
|
||||
private List<DevServerManagerListener> getListeners() {
|
||||
synchronized (listeners) {
|
||||
return new ArrayList<>(listeners);
|
||||
}
|
||||
}
|
||||
|
||||
final DevServerListener devServerListener = new DevServerListener() {
|
||||
@Override
|
||||
public void compilationStarted() {
|
||||
for (DevServerManagerListener listener : listeners) {
|
||||
for (DevServerManagerListener listener : getListeners()) {
|
||||
try {
|
||||
listener.compilationStarted();
|
||||
} catch (RemoteException e) {
|
||||
|
@ -279,7 +294,7 @@ public class DevServerRunner extends UnicastRemoteObject implements DevServerMan
|
|||
|
||||
@Override
|
||||
public void compilationProgress(double v) {
|
||||
for (DevServerManagerListener listener : listeners) {
|
||||
for (DevServerManagerListener listener : getListeners()) {
|
||||
try {
|
||||
listener.compilationProgress(v);
|
||||
} catch (RemoteException e) {
|
||||
|
@ -293,7 +308,7 @@ public class DevServerRunner extends UnicastRemoteObject implements DevServerMan
|
|||
DevServerBuildResult result = new DevServerBuildResult();
|
||||
result.callGraph = buildResult.getCallGraph();
|
||||
result.problems.addAll(buildResult.getProblems().getProblems());
|
||||
for (DevServerManagerListener listener : listeners) {
|
||||
for (DevServerManagerListener listener : getListeners()) {
|
||||
try {
|
||||
listener.compilationComplete(result);
|
||||
} catch (RemoteException e) {
|
||||
|
@ -304,7 +319,7 @@ public class DevServerRunner extends UnicastRemoteObject implements DevServerMan
|
|||
|
||||
@Override
|
||||
public void compilationCancelled() {
|
||||
for (DevServerManagerListener listener : listeners) {
|
||||
for (DevServerManagerListener listener : getListeners()) {
|
||||
try {
|
||||
listener.compilationCancelled();
|
||||
} catch (RemoteException e) {
|
||||
|
|
|
@ -74,11 +74,15 @@ public class TeaVMDevServerRunner extends GenericProgramRunner<RunnerSettings> {
|
|||
});
|
||||
runContent = debugSession.getRunContentDescriptor();
|
||||
|
||||
ProcessHandler debugProcessHandler = debugSession.getDebugProcess().getProcessHandler();
|
||||
debugProcessHandler.addProcessListener(new ProcessAdapter() {
|
||||
runContent.getProcessHandler().addProcessListener(new ProcessAdapter() {
|
||||
@Override
|
||||
public void startNotified(@NotNull ProcessEvent event) {
|
||||
processHandler.startNotify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processTerminated(@NotNull ProcessEvent event) {
|
||||
processHandler.destroyProcess();
|
||||
processHandler.detachProcess();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public class TeaVMDevServerConsole extends JPanel implements ConsoleView {
|
|||
} catch (RemoteException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
serverListener = null;
|
||||
}
|
||||
underlyingConsole.dispose();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user