nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java
changeset 42376 8604f1a50c30
parent 41842 50202a344d28
equal deleted inserted replaced
42279:f4e854a77aa3 42376:8604f1a50c30
   537     public static int charCodeAt(final Object self, final double pos) {
   537     public static int charCodeAt(final Object self, final double pos) {
   538         return charCodeAt(self, (int)pos); //toInt pos is ok
   538         return charCodeAt(self, (int)pos); //toInt pos is ok
   539     }
   539     }
   540 
   540 
   541     /**
   541     /**
   542      * ECMA 15.5.4.5 String.prototype.charCodeAt (pos) - specialized version for long position
       
   543      * @param self self reference
       
   544      * @param pos  position in string
       
   545      * @return number representing charcode at position
       
   546      */
       
   547     @SpecializedFunction(linkLogic=CharCodeAtLinkLogic.class)
       
   548     public static int charCodeAt(final Object self, final long pos) {
       
   549         return charCodeAt(self, (int)pos);
       
   550     }
       
   551 
       
   552     /**
       
   553      * ECMA 15.5.4.5 String.prototype.charCodeAt (pos) - specialized version for int position
   542      * ECMA 15.5.4.5 String.prototype.charCodeAt (pos) - specialized version for int position
   554      * @param self self reference
   543      * @param self self reference
   555      * @param pos  position in string
   544      * @param pos  position in string
   556      * @return number representing charcode at position
   545      * @return number representing charcode at position
   557      */
   546      */
  1174         final String str = Integer.toString(arg);
  1163         final String str = Integer.toString(arg);
  1175         return newObj ? newObj(str) : str;
  1164         return newObj ? newObj(str) : str;
  1176     }
  1165     }
  1177 
  1166 
  1178     /**
  1167     /**
  1179      * ECMA 15.5.2.1 new String ( [ value ] ) - special version with exactly one {@code int} arg
  1168      * ECMA 15.5.2.1 new String ( [ value ] ) - special version with exactly one {@code double} arg
  1180      *
       
  1181      * Constructor
       
  1182      *
       
  1183      * @param newObj is this constructor invoked with the new operator
       
  1184      * @param self   self reference
       
  1185      * @param arg    the arg
       
  1186      *
       
  1187      * @return new NativeString containing the string representation of the arg
       
  1188      */
       
  1189     @SpecializedFunction(isConstructor=true)
       
  1190     public static Object constructor(final boolean newObj, final Object self, final long arg) {
       
  1191         final String str = Long.toString(arg);
       
  1192         return newObj ? newObj(str) : str;
       
  1193     }
       
  1194 
       
  1195     /**
       
  1196      * ECMA 15.5.2.1 new String ( [ value ] ) - special version with exactly one {@code int} arg
       
  1197      *
  1169      *
  1198      * Constructor
  1170      * Constructor
  1199      *
  1171      *
  1200      * @param newObj is this constructor invoked with the new operator
  1172      * @param newObj is this constructor invoked with the new operator
  1201      * @param self   self reference
  1173      * @param self   self reference