bool Array::isValidMultiname(const multiname& name, uint32_t& index) { //First of all the multiname has to contain the null namespace //As the namespace vector is sorted, we check only the first one assert_and_throw(name.ns.size()!=0); if(!name.ns[0].hasEmptyName()) return false; return name.toUInt(index); }
bool Vector::isValidMultiname(SystemState* sys,const multiname& name, uint32_t& index) { //First of all the multiname has to contain the null namespace //As the namespace vector is sorted, we check only the first one assert_and_throw(name.ns.size()!=0); if(!name.ns[0].hasEmptyName()) return false; bool validIndex=name.toUInt(sys,index, true); return validIndex; }
bool Array::isValidMultiname(const multiname& name, uint32_t& index) { //First of all the multiname has to contain the null namespace //As the namespace vector is sorted, we check only the first one assert_and_throw(name.ns.size()!=0); if(!name.ns[0].hasEmptyName()) return false; if (name.name_type == multiname::NAME_STRING && !isIntegerWithoutLeadingZeros(name.normalizedName())) return false; return name.toUInt(index); }
bool Vector::isValidMultiname(const multiname& name, uint32_t& index) { //First of all the multiname has to contain the null namespace //As the namespace vector is sorted, we check only the first one assert_and_throw(name.ns.size()!=0); if(!name.ns[0].hasEmptyName()) return false; bool validIndex=name.toUInt(index); // Don't throw for non-numeric NAME_STRING or NAME_OBJECT // because they can still be valid built-in property names. if(!validIndex && (name.name_type==multiname::NAME_INT || name.name_type==multiname::NAME_NUMBER)) throw Class<RangeError>::getInstanceS("Error #1125"); return validIndex; }