func init // initialize the type of the loop variable if(isdef("Type")) this.type = '' isdef("Extern") ? sys.add_var(this.name, 'dynamic') : this.setfield('i', 'i' + this.id) else this.type = code(this.props("Type").value.props("TypeName").value) if(this.type == 'Object undefined') error(this.name + ' - property ' + this.props("Type").name + ' does not defined') end isdef("Extern") ? sys.add_var(this.name, this.type) : this.setfield('i', 'i' + this.id) end end func doFor() dt = linked("Start") ? d("Start") : code(replace(this.props("Start").value, "\\r\\n", "")) b = isdef("Type") ? dt : sys.to_type(dt, sys.type_code(this.type)) dt = linked("End") ? d("End") : code(replace(this.props("End").value, "\\r\\n", "")) e = isdef("Type") ? dt : sys.to_type(dt, sys.type_code(this.type)) dt = linked("Step") ? d("Step") : code(replace(this.props("Step").value, "\\r\\n", "")) s = isdef("Type") ? dt : sys.to_type(dt, sys.type_code(this.type)) c = this.props("Condition").value m = this.props("Modifier").value v = isdef("Extern") ? this.codename : this.i if(m == 'i++') op = v + '++' elseif(m == '++i') op = '++' + v elseif(m == 'i--') op = v + '--' elseif(m == '--i') op = '--' + v else op = v + m + s end blk.println('for(', isdef("Extern") ? '' : isdef("Type") ? 'var ' : this.type + ' ', v, '=', b, '; ', v, c, e, '; ', op, ') {').inc() event("onLoop", v) blk.dec().println('}') event("onStop") end func doBreak() if(linked("doFor")) blk.println('break;') end end func doContinue() if(linked("doFor")) blk.println('continue;') end end func Value return(isdef("Extern") ? this.codename : this.i) end