fix C# fork() error
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
mono bin/cs/test/bin/TestMain.exe || echo "C# tests failed"
|
mono bin/cs/test/bin/TestMain.exe
|
||||||
@@ -212,7 +212,8 @@ class EmbeddedScript {
|
|||||||
var fork = new kiss.cloner.Cloner().clone(this);
|
var fork = new kiss.cloner.Cloner().clone(this);
|
||||||
fork.instructions[instructionPointer] = command;
|
fork.instructions[instructionPointer] = command;
|
||||||
if (fork.breakPoints == null) {
|
if (fork.breakPoints == null) {
|
||||||
throw 'cloning failed';
|
// This field is so much trouble to clone in C# because of its type
|
||||||
|
fork.breakPoints = [for (point => condition in this.breakPoints) point => condition];
|
||||||
}
|
}
|
||||||
// trace('running a fork from ' + Std.string(instructionPointer + 1));
|
// trace('running a fork from ' + Std.string(instructionPointer + 1));
|
||||||
fork.run();
|
fork.run();
|
||||||
|
|||||||
@@ -100,13 +100,12 @@ class Cloner {
|
|||||||
var classValue = Type.getClass(inValue);
|
var classValue = Type.getClass(inValue);
|
||||||
var outValue:T = Type.createEmptyInstance(classValue);
|
var outValue:T = Type.createEmptyInstance(classValue);
|
||||||
var fields:Array<String> = Type.getInstanceFields(classValue);
|
var fields:Array<String> = Type.getInstanceFields(classValue);
|
||||||
for (i in 0...fields.length) {
|
for (field in fields) {
|
||||||
var field = fields[i];
|
|
||||||
var property = Reflect.getProperty(inValue, field);
|
var property = Reflect.getProperty(inValue, field);
|
||||||
try {
|
try {
|
||||||
Reflect.setField(outValue, field, _clone(property));
|
Reflect.setField(outValue, field, _clone(property));
|
||||||
} catch (s) {
|
} catch (s) {
|
||||||
// There will be errors on C++ when trying to assign to a member function.
|
// There will be errors on C++ and C# when trying to assign to a member function.
|
||||||
// They're not important, because the function will already be on the clone.
|
// They're not important, because the function will already be on the clone.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user