本文整理汇总了Java中com.fujitsu.vdmj.typechecker.Environment类的典型用法代码示例。如果您正苦于以下问题:Java Environment类的具体用法?Java Environment怎么用?Java Environment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Environment类属于com.fujitsu.vdmj.typechecker包,在下文中一共展示了Environment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typeResolve
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public void typeResolve(Environment env)
{
if (resolved) return; else { resolved = true; }
try
{
fieldlist.typeResolve(env);
type = type.typeResolve(env, null);
if (!type.isClass(env))
{
report(3331, "obj_ expression is not an object type");
detail("Type", type);
}
else
{
typeCheck(env); // Note checked from resolve for simplicity
}
}
catch (TypeCheckException e)
{
unResolve();
throw e;
}
}
示例2: seqApply
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
private TCType seqApply(
TCSeqType seq, Environment env, NameScope scope, boolean unique)
{
if (args.size() != 1)
{
concern(unique, 3252, "Sequence application must have one argument");
return new TCUnknownType(location);
}
TCType argtype = args.get(0).typeCheck(env, null, scope, null);
if (!argtype.isNumeric(location))
{
concern(unique, 3253, "Sequence argument is not numeric");
detail(unique, "Type", argtype);
}
return seq.seqof;
}
示例3: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
TCType result;
if (value.value.isEmpty())
{
result = new TCSeqType(location, new TCCharacterType(location));
}
else
{
result = new TCSeq1Type(location, new TCCharacterType(location));
}
return checkConstraint(constraint, result);
}
示例4: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCType typeCheck(Environment base, NameScope scope)
{
plist.typeResolve(base);
type = type.typeResolve(base, null);
TCType ptype = getPossibleType();
TypeComparator.checkComposeTypes(type, base, false);
if (!TypeComparator.compatible(ptype, type))
{
type.report(3265, "At least one bind cannot match this type");
type.detail2("Binds", ptype, "Type", type);
}
return type;
}
示例5: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public void typeCheck(Environment env, TCDefinitionList actualDefs)
{
TCType resolved = type.typeResolve(env, null);
for (TCNameToken name: nameList)
{
TCDefinition actual = actualDefs.findName(name, NameScope.GLOBAL);
if (actual == null)
{
report(3185, "Exported operation " + name + " not defined in module");
}
else
{
TCType actualType = actual.getType();
if (actualType != null && !TypeComparator.compatible(resolved, actualType))
{
report(3186, "Exported operation type does not match actual type");
detail2("Exported", resolved, "Actual", actualType);
}
}
}
}
示例6: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
TCDefinition encl = env.getEnclosingDefinition();
if (encl != null && encl.isPure())
{
report(3346, "Cannot use 'threadid' in pure operations");
}
if (Settings.release == Release.VDM_10 && env.isFunctional())
{
report(3348, "Cannot use 'threadid' in a functional context");
}
return checkConstraint(constraint, new TCNaturalType(location));
}
示例7: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public void typeCheck(Environment base, NameScope scope)
{
type = type.typeResolve(base, null);
getDefinitions().setExcluded(true);
expType = expression.typeCheck(base, null, scope, type);
getDefinitions().setExcluded(false);
TypeComparator.checkComposeTypes(type, base, false);
if (expType instanceof TCVoidType)
{
expression.report(3048, "Expression does not return a value");
}
if (!TypeComparator.compatible(type, expType))
{
report(3000, "Expression does not match declared type");
detail2("Declared", type, "Expression", expType);
}
}
示例8: checkNumeric
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
protected void checkNumeric(Environment env, NameScope scope)
{
ltype = left.typeCheck(env, null, scope, null);
rtype = right.typeCheck(env, null, scope, null);
if (!ltype.isNumeric(location))
{
report(3139, "Left hand of " + op + " is not numeric");
detail("Actual", ltype);
ltype = new TCRealType(location);
}
if (!rtype.isNumeric(location))
{
report(3140, "Right hand of " + op + " is not numeric");
detail("Actual", rtype);
rtype = new TCRealType(location);
}
}
示例9: binaryCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
protected final TCType binaryCheck(Environment env, NameScope scope, TCType expected)
{
ltype = left.typeCheck(env, null, scope, null);
rtype = right.typeCheck(env, null, scope, null);
if (!ltype.isType(expected.getClass(), location))
{
report(3065, "Left hand of " + op + " is not " + expected);
}
if (!rtype.isType(expected.getClass(), location))
{
report(3066, "Right hand of " + op + " is not " + expected);
}
return expected;
}
示例10: typeResolve
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
public void typeResolve(Environment env, TCTypeDefinition root)
{
// Recursion defence done by the type
type = type.typeResolve(env, root);
if (env.isVDMPP())
{
if (type instanceof TCFunctionType)
{
tagname.setTypeQualifier(((TCFunctionType)type).parameters);
}
else if (type instanceof TCOperationType)
{
tagname.setTypeQualifier(((TCOperationType)type).parameters);
}
}
}
示例11: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCType typeCheck(Environment base, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
def = new TCMultiBindListDefinition(bind.location, bind.getMultipleBindList());
def.typeCheck(base, scope);
Environment local = new FlatCheckedEnvironment(def, base, scope);
if (bind instanceof TCTypeBind)
{
TCTypeBind tb = (TCTypeBind)bind;
tb.typeResolve(base);
}
if (!predicate.typeCheck(local, null, scope, new TCBooleanType(location)).isType(TCBooleanType.class, location))
{
predicate.report(3088, "Predicate is not boolean");
}
local.unusedCheck();
return checkConstraint(constraint, new TCBooleanType(location));
}
示例12: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCType typeCheck(Environment base, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
def = new TCMultiBindListDefinition(location, bindings);
def.typeCheck(base, scope);
Environment local = new FlatCheckedEnvironment(def, base, scope);
if (predicate != null &&
!predicate.typeCheck(local, null, scope, new TCBooleanType(location)).isType(TCBooleanType.class, location))
{
predicate.report(3118, "Predicate is not boolean");
}
TCType domConstraint = null;
TCType rngConstraint = null;
if (constraint != null && constraint.isMap(location))
{
domConstraint = constraint.getMap().from;
rngConstraint = constraint.getMap().to;
}
maptype = first.typeCheck(local, scope, domConstraint, rngConstraint); // The map from/to type
local.unusedCheck();
return maptype;
}
示例13: typeCheck
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
TCType lt = left.typeCheck(env, null, scope, null);
if (!lt.isClass(env))
{
left.report(3266, "Argument is not an object");
}
TCType rt = right.typeCheck(env, null, scope, null);
if (!rt.isClass(env))
{
right.report(3266, "Argument is not an object");
}
return checkConstraint(constraint, new TCBooleanType(location));
}
示例14: getFreeVariables
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCNameSet getFreeVariables(Environment globals, Environment env)
{
Environment local = new FlatEnvironment(def, env);
TCNameSet names = new TCNameSet(); // Note "first" is conditional
if (predicate != null)
{
predicate.getFreeVariables(globals, local);
}
for (TCMultipleBind mb: bindings)
{
names.addAll(mb.getFreeVariables(globals, local));
}
return names;
}
示例15: typeResolve
import com.fujitsu.vdmj.typechecker.Environment; //导入依赖的package包/类
@Override
public TCType typeResolve(Environment env, TCTypeDefinition root)
{
if (resolved) return this; else { resolved = true; }
try
{
setof = setof.typeResolve(env, root);
if (root != null) root.infinite = false; // Could be empty
return this;
}
catch (TypeCheckException e)
{
unResolve();
throw e;
}
}