Cleaning up.

This commit is contained in:
Stan Angeloff
2010-04-26 21:54:31 +03:00
parent 2a3a713811
commit 76f9596f22
2 changed files with 8 additions and 8 deletions

View File

@@ -1462,7 +1462,7 @@
this.index = _b[1];
}
this.pattern = this.name instanceof ValueNode;
if (this.index instanceof ObjectNode) {
if (this.index instanceof ValueNode) {
throw new Error('index cannot be a pattern matching expression');
}
this.children = compact([this.body, this.source, this.filter]);
@@ -1520,13 +1520,12 @@
svar = scope.free_variable();
index_var = null;
source_part = ("" + svar + " = " + (this.source.compile(o)) + ";\n" + this.tab);
if (name && !this.pattern) {
var_part = ("" + body_dent + name + " = " + svar + "[" + ivar + "];\n");
}
if (this.pattern) {
o.indent = this.idt(1);
o.top = true;
var_part = new AssignNode(this.name, literal(("" + svar + "[" + ivar + "]"))).compile(o) + "\n";
} else if (name) {
var_part = ("" + body_dent + name + " = " + svar + "[" + ivar + "];\n");
}
if (!this.object) {
lvar = scope.free_variable();