當前位置: 首頁>>代碼示例>>Java>>正文


Java Environment.findName方法代碼示例

本文整理匯總了Java中com.fujitsu.vdmj.typechecker.Environment.findName方法的典型用法代碼示例。如果您正苦於以下問題:Java Environment.findName方法的具體用法?Java Environment.findName怎麽用?Java Environment.findName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fujitsu.vdmj.typechecker.Environment的用法示例。


在下文中一共展示了Environment.findName方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFreeVariables

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCNameSet getFreeVariables(Environment globals, Environment env)
{
	TCNameSet names = new TCNameSet();
	
	if (root instanceof TCVariableExpression && type != null && type.isFunction(location))
	{
		// If this is a global call, then we depend on the function
		TCVariableExpression v = (TCVariableExpression)root;
		
		if (globals.findName(v.name, NameScope.NAMESANDSTATE) != null)
		{
			names.add(v.name);
		}
	}
	
	names.addAll(args.getFreeVariables(globals, env));
	return names;
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:20,代碼來源:TCApplyExpression.java

示例2: typeCheck

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
	TCDefinition cdef = env.findName(name, scope);

	if (cdef == null)
	{
		report(3154, name + " not in scope");
		return new TCUnknownType(location);
	}

	return checkConstraint(constraint, cdef.getType());
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:14,代碼來源:TCSelfExpression.java

示例3: getRecursiveDefinition

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
private TCDefinition getRecursiveDefinition(Environment env, NameScope scope)
{
	TCNameToken fname = null;
	
	if (root instanceof TCApplyExpression)
	{
		TCApplyExpression aexp = (TCApplyExpression)root;
		return aexp.getRecursiveDefinition(env, scope);
	}
	else if (root instanceof TCVariableExpression)
	{
		TCVariableExpression var = (TCVariableExpression)root;
		fname = var.name;
	}
	else if (root instanceof TCFuncInstantiationExpression)
	{
		TCFuncInstantiationExpression fie = (TCFuncInstantiationExpression)root;

		if (fie.expdef != null)
		{
			fname = fie.expdef.name;
		}
		else if (fie.impdef != null)
		{
			fname = fie.impdef.name;
		}
	}
		
	if (fname != null)
	{
		return env.findName(fname, scope);
	}
	else
	{
		return null;
	}
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:38,代碼來源:TCApplyExpression.java

示例4: getFreeVariables

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCNameSet getFreeVariables(Environment globals, Environment env)
{
	TCDefinition d = globals.findName(name, NameScope.NAMESANDSTATE);
	
	if (d != null && d.isFunction())
	{
		return new TCNameSet();
	}
	
	if (d instanceof TCRenamedDefinition)
	{
		TCRenamedDefinition rd = (TCRenamedDefinition)d;
		
		if (rd.def.name != null)
		{
			return new TCNameSet(rd.def.name.getExplicit(true));
		}
	}
	
	if (env.findName(name, NameScope.NAMESANDSTATE) == null)
	{
		return new TCNameSet(name.getExplicit(true));
	}
	else
	{
		return new TCNameSet();
	}
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:30,代碼來源:TCVariableExpression.java

示例5: getQualifiedDefs

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCDefinitionList getQualifiedDefs(Environment env)
{
	TCDefinitionList result = new TCDefinitionList();
	
	if (test instanceof TCVariableExpression)
	{
		TCVariableExpression exp = (TCVariableExpression)test;
		TCDefinition existing = env.findName(exp.name, NameScope.NAMESANDSTATE);
		
		if (existing != null && existing.nameScope.matches(NameScope.NAMES))
		{
       		if (basictype != null)
       		{
      				result.add(new TCQualifiedDefinition(existing, basictype));
       		}
       		else if (typename != null)
       		{
       			if (typedef == null)
       			{
       				typedef = env.findType(typename, location.module);
       			}

       			if (typedef != null)
       			{
       				result.add(new TCQualifiedDefinition(existing, typedef.getType()));
       			}
       		}
		}
	}
	
	return result;
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:34,代碼來源:TCIsExpression.java

示例6: typeResolve

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCType typeResolve(Environment env, TCTypeDefinition root)
{
	if (resolved) return this; else resolved = true;

	TCDefinition p = env.findName(name, NameScope.NAMES);

	if (p == null || !(p.getType() instanceof TCParameterType))
	{
		report(3433, "Parameter type @" + name + " not defined");
	}

	return this;
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:15,代碼來源:TCParameterType.java

示例7: typeCheck

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers)
{
	TCDefinition def = env.findName(self, NameScope.NAMES);

	if (def == null)
	{
		report(3263, "Cannot reference 'self' from here");
		return new TCUnknownType(location);
	}

	return def.getType();
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:14,代碼來源:TCObjectSelfDesignator.java

示例8: targetDefinition

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCDefinition targetDefinition(Environment env)
{
	return env.findName(name, NameScope.STATE);
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:6,代碼來源:TCIdentifierDesignator.java

示例9: typeCheck

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCType typeCheck(Environment base, NameScope scope, TCType constraint)
{
	TCDefinitionList defs = new TCDefinitionList();

	// Now we build local definitions for each of the externals, so
	// that they can be added to the local environment, while the
	// global state is made inaccessible.

	if (externals != null)
	{
   		for (TCExternalClause clause: externals)
   		{
   			for (TCNameToken name: clause.identifiers)
   			{
   				if (base.findName(name, NameScope.STATE) == null)
   				{
   					name.report(3274, "External variable is not in scope: " + name);
   				}
   				else
   				{
   					defs.add(new TCLocalDefinition(name.getLocation(), name, clause.type));
   				}
   			}
   		}
	}

	if (errors != null)
	{
		for (TCErrorCase err: errors)
		{
			TCType lt = err.left.typeCheck(base, null, NameScope.NAMESANDSTATE, null);
			TCType rt = err.right.typeCheck(base, null, NameScope.NAMESANDSTATE, null);

			if (!lt.isType(TCBooleanType.class, location))
			{
				err.left.report(3275, "Error clause must be a boolean");
			}

			if (!rt.isType(TCBooleanType.class, location))
			{
				err.right.report(3275, "Error clause must be a boolean");
			}
		}
	}

	defs.typeCheck(base, scope);
	Environment local = new FlatEnvironment(defs, base);	// NB. No check

	if (precondition != null &&
		!precondition.typeCheck(local, null, NameScope.NAMESANDSTATE, null).isType(TCBooleanType.class, location))
	{
		precondition.report(3233, "Precondition is not a boolean expression");
	}

	if (postcondition != null &&
		!postcondition.typeCheck(local, null, NameScope.NAMESANDANYSTATE, null).isType(TCBooleanType.class, location))
	{
		postcondition.report(3234, "postcondition is not a boolean expression");
	}

	return new TCVoidType(location);
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:64,代碼來源:TCSpecificationStatement.java


注:本文中的com.fujitsu.vdmj.typechecker.Environment.findName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。