本文整理汇总了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;
}
示例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());
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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();
}
示例8: targetDefinition
import com.fujitsu.vdmj.typechecker.Environment; //导入方法依赖的package包/类
@Override
public TCDefinition targetDefinition(Environment env)
{
return env.findName(name, NameScope.STATE);
}
示例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);
}