feat: some behavioral fixes
This commit is contained in:
parent
6c8c329992
commit
4c53689d9c
@ -30,9 +30,22 @@ public class VariableDeclareNode extends Node {
|
||||
}
|
||||
@Override public void compile(CompileResult target, boolean pollute) {
|
||||
for (var entry : values) {
|
||||
var index = target.scope.get(entry.var.name, false);
|
||||
|
||||
if (entry.value != null) {
|
||||
entry.value.compile(target, true);
|
||||
target.add(VariableNode.toSet(target, loc(), entry.var.name, false, true)).setLocation(loc());
|
||||
}
|
||||
|
||||
if (index == null) {
|
||||
if (entry.value == null) {
|
||||
target.add(Instruction.globDef(entry.var.name));
|
||||
}
|
||||
else {
|
||||
target.add(Instruction.globSet(entry.var.name, false, true));
|
||||
}
|
||||
}
|
||||
else if (entry.value != null) {
|
||||
target.add(index.index().toSet(false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ public class RegexNode extends Node {
|
||||
var inBrackets = false;
|
||||
|
||||
loop: while (true) {
|
||||
if (i + n >= src.size()) break;
|
||||
switch (src.at(i + n)) {
|
||||
case '[':
|
||||
inBrackets = true;
|
||||
|
@ -115,7 +115,7 @@ public abstract class FunctionValue extends ObjectValue {
|
||||
this.length = length;
|
||||
this.name = name;
|
||||
|
||||
prototype.defineOwnField(null, "constructor", this);
|
||||
prototype.defineOwnField(null, "constructor", this, true, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user