当前位置: 首页>>代码示例>>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;未经允许,请勿转载。