当前位置: 首页>>代码示例>>C++>>正文


C++ multiname::normalizedNameId方法代码示例

本文整理汇总了C++中multiname::normalizedNameId方法的典型用法代码示例。如果您正苦于以下问题:C++ multiname::normalizedNameId方法的具体用法?C++ multiname::normalizedNameId怎么用?C++ multiname::normalizedNameId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在multiname的用法示例。


在下文中一共展示了multiname::normalizedNameId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initializeVar

void variables_map::initializeVar(const multiname& mname, ASObject* obj, multiname* typemname, ABCContext* context, TRAIT_KIND traitKind)
{
	const Type* type = NULL;
	 /* If typename is a builtin type, we coerce obj.
	  * It it's not it must be a user defined class,
	  * so we only allow Null and Undefined (which are both coerced to Null) */

	type = Type::getBuiltinType(typemname);
	if(type==NULL)
	{
		assert_and_throw(obj->is<Null>() || obj->is<Undefined>());
		if(obj->is<Undefined>())
		{
			//Casting undefined to an object (of unknown class)
			//results in Null
			obj->decRef();
			obj = getSys()->getNullRef();
		}
	}
	else
		obj = type->coerce(obj);

	assert(traitKind==DECLARED_TRAIT || traitKind==CONSTANT_TRAIT);

	uint32_t name=mname.normalizedNameId();
	Variables.insert(make_pair(varName(name, mname.ns[0]), variable(traitKind, obj, typemname, type)));
}
开发者ID:ViciousPotato,项目名称:lightspark,代码行数:27,代码来源:asobject.cpp

示例2: killObjVar

void variables_map::killObjVar(const multiname& mname)
{
	uint32_t name=mname.normalizedNameId();
	//The namespaces in the multiname are ordered. So it's possible to use lower_bound
	//to find the first candidate one and move from it
	assert(!mname.ns.empty());
	var_iterator ret=Variables.lower_bound(varName(name,mname.ns.front()));
	auto nsIt=mname.ns.begin();

	//Find the namespace
	while(ret!=Variables.end() && ret->first.nameId==name)
	{
		//breaks when the namespace is not found
		const nsNameAndKind& ns=ret->first.ns;
		if(ns==*nsIt)
		{
			Variables.erase(ret);
			return;
		}
		else if(*nsIt<ns)
		{
			++nsIt;
			if(nsIt==mname.ns.end())
				break;
		}
		else if(ns<*nsIt)
			++ret;
	}
	throw RunTimeException("Variable to kill not found");
}
开发者ID:ViciousPotato,项目名称:lightspark,代码行数:30,代码来源:asobject.cpp


注:本文中的multiname::normalizedNameId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。