Commits

Fredrik Johansson committed 712b13c

Refactoring of fbuiltin to jsbuiltin

  • Participants
  • Parent commits 7eecf71

Comments (0)

Files changed (1)

File maven/protocol-generator-plugin/src/main/scripts/javascript_generator.rb

   JAVASCRIPT_TYPES2[generic_type] || camelcasetype(generic_type)
 end
 
-def fbuiltin?(generic_type)
+def jsbuiltin?(generic_type)
   JAVASCRIPT_TYPES.has_key?(generic_type)
 end
 
 
   def save_scalar(scalar)
     name = camelcase(scalar.name)
-    if(fbuiltin?(scalar.obj_type))
+    if(jsbuiltin?(scalar.obj_type))
       wi("byteArray.write#{jstype2(scalar.obj_type)}(this.#{name});")
     else
       wi("byteArray.writeArray(this.#{name}.save());")
       
       wi("for( i = 0; i < this.#{name}.length; i ++) {")
       #@indent_level += 1
-      if(fbuiltin?(list.obj_type))
+      if(jsbuiltin?(list.obj_type))
         wi("byteArray.write#{ltype}(this.#{name}[i]);",1)
         
       elsif(enum?(list.obj_type))
 
   def load_scalar(scalar)
     name = camelcase(scalar.name)
-    if(fbuiltin?(scalar.obj_type))
+    if(jsbuiltin?(scalar.obj_type))
       wi("this.#{name} = byteArray.read#{jstype2(scalar.obj_type)}();")
     else
       wi("this.#{name} = new #{$javascript_namespace}.#{jstype(scalar.obj_type)}();")
       wi("var #{name}Count = byteArray.readInt();")
       wi("this.#{name} = byteArray.readArray(#{name}Count);")
     
-    elsif(fbuiltin?(list.obj_type))
+    elsif(jsbuiltin?(list.obj_type))
       if ( @index == 0 )
         wi("var i;")
         @index += 1
       
       wi("var #{name}Count = byteArray.readInt();")
       
-      if(!fbuiltin?(list.obj_type))
+      if(!jsbuiltin?(list.obj_type))
         wi("var o#{ltype};");
       end
       wi("this.#{name} = [];")
       wi("for( i = 0; i < #{name}Count; i ++) {")
-      if(fbuiltin?(list.obj_type))
+      if(jsbuiltin?(list.obj_type))
         wi("this.#{name}.push(byteArray.read#{ltype}());",1)
       elsif(enum?(list.obj_type))
       	wi("o#{ltype} =  #{$javascript_namespace}.#{ltype}Enum.make#{ltype}Enum(byteArray.readUnsignedByte());", 1)
           wi("normalizedObject.details[\"#{camelcase(member.name)}\"].push(FIREBASE.Styx.getParam(this.#{camelcase(member.name)}[i]));",2)
         elsif enum?(member.obj_type)
           wi("normalizedObject.details[\"#{camelcase(member.name)}\"].push(#{$javascript_namespace}.#{camelcasetype(member.obj_type)}Enum.toString(this.#{camelcase(member.name)}[i]));",2)
-        elsif fbuiltin?(member.obj_type)
+        elsif jsbuiltin?(member.obj_type)
           wi("normalizedObject.details[\"#{camelcase(member.name)}\"].push(this.#{camelcase(member.name)}[i]);",2)
         else
           wi("normalizedObject.details[\"#{camelcase(member.name)}\"].push(this.#{camelcase(member.name)}[i].getNormalizedObject());",2)
       elsif member.kind_of?(ProtoEnum)
         wi("normalizedObject.details[\"#{camelcase(member.name)}\"] = #{$javascript_namespace}.#{camelcasetype(member.type)}Enum.toString(this.#{camelcase(member.name)});",1);
       else
-          if member.obj_type && fbuiltin?(member.obj_type)
+          if member.obj_type && jsbuiltin?(member.obj_type)
             wi("normalizedObject.details[\"#{camelcase(member.name)}\"] = this.#{camelcase(member.name)};",1)
           else
             wi("normalizedObject.details[\"#{camelcase(member.name)}\"] = this.#{camelcase(member.name)}.getNormalizedObject();",1)