comparison scripts/dgen.rb @ 15:7ff919f595d5

Added the Foundation framework, again
author Jacob Carlborg <doob@me.com>
date Mon, 03 Aug 2009 15:31:48 +0200
parents 4f583f7e242e
children 19885b43130e
comparison
equal deleted inserted replaced
14:89f3c3ef1fd2 15:7ff919f595d5
1135 method.arg.each_with_index do |arg, i| 1135 method.arg.each_with_index do |arg, i|
1136 str << get_identifier(arg.name) 1136 str << get_identifier(arg.name)
1137 str << ", " unless i == method.arg.length - 1 1137 str << ", " unless i == method.arg.length - 1
1138 end unless method.arg.nil? 1138 end unless method.arg.nil?
1139 1139
1140 if return_type == class_name 1140 str << ")".nl
1141 str << "return result is this.objcObject ? this : (result !is null ? new #{return_type}(result) : null);" 1141 str << "return result is this.objcObject ? this : (result !is null ? new #{return_type}(result) : null)".indent(2).nl if return_type == class_name && !static
1142 else
1143 str << ")".nl
1144 end
1145
1146 str << "}".indent.nl(false).nl(false) 1142 str << "}".indent.nl(false).nl(false)
1147 1143
1148 if name.length >= 4 && name[0 ... 4] == "init" && name != "initialize" 1144 if name.length >= 4 && name[0 ... 4] == "init" && name != "initialize"
1149 str << ("this" + declaration[index .. -1]).gsub(/ +/, " ").indent 1145 str << ("this" + declaration[index .. -1]).gsub(/ +/, " ").indent
1150 str << "{".indent.nl(false) 1146 str << "{".indent.nl(false)