Пример #1
0
 void ScriptObject::throwWriteSealedError(Atom name)
 {
     AvmCore* core = this->core();
     throwWriteSealedError(Multiname(core->getAnyPublicNamespace(), core->intern(name)));
 }
Пример #2
0
	Atom PoolObject::getDefaultValue(const Toplevel* toplevel, uint32 index, CPoolKind kind, Traits* t) const
	{
		// toplevel actually can be null, when resolving the builtin classes...
		// but they should never cause verification errors in functioning builds
		//AvmAssert(toplevel != NULL);

		AvmAssert(index != 0);
		uint32_t maxcount = 0;
		// Look in the cpool specified by kind
		switch(kind)
		{
		case CONSTANT_Int:
			if (index >= (maxcount = constantIntCount))
				goto range_error;
			return core->intToAtom(cpool_int[index]);

		case CONSTANT_UInt:
			if (index >= (maxcount = constantUIntCount))
				goto range_error;
			return core->uintToAtom(cpool_uint[index]);

		case CONSTANT_Double:
			if (index >= (maxcount = constantDoubleCount))
				goto range_error;
			return kDoubleType|(uintptr)cpool_double[index];

		case CONSTANT_Utf8:
			if (index >= (maxcount = constantStringCount))
				goto range_error;
			return cpool_string[index]->atom();

		case CONSTANT_True:
			return trueAtom;

		case CONSTANT_False:
			return falseAtom;

		case CONSTANT_Namespace:
        case CONSTANT_PackageNamespace:
        case CONSTANT_PackageInternalNs:
        case CONSTANT_ProtectedNamespace:
        case CONSTANT_ExplicitNamespace:
        case CONSTANT_StaticProtectedNs:
		case CONSTANT_PrivateNs:
			if (index >= (maxcount = constantNsCount))
				goto range_error;
			return cpool_ns[index]->atom();

		case CONSTANT_Null:
			return nullObjectAtom;

		default:
			// Multinames & NamespaceSets are invalid default values.
			if (t)
			{
				toplevel->throwVerifyError(kIllegalDefaultValue, core->toErrorString(Multiname(t->ns, t->name)));
			}
			else
			{
				toplevel->throwVerifyError(kCorruptABCError);
			}
			return undefinedAtom; // not reached
		}

range_error:
		if (toplevel)
			toplevel->throwVerifyError(kCpoolIndexRangeError, core->toErrorString(index), core->toErrorString(maxcount));
		AvmAssert(!"unhandled verify error");
		return undefinedAtom; // not reached
	}