public PDefinition targetDefinition(PStateDesignator pStateDesignator, TypeCheckInfo question) { if (pStateDesignator instanceof AIdentifierStateDesignator) { AIdentifierStateDesignator stateDesignator = (AIdentifierStateDesignator) pStateDesignator; return question.env.findName(stateDesignator.getName(), NameScope.STATE); } else { return null; } }
@Override public PDefinition findName(ILexNameToken sought, NameScope scope) { PDefinition def = af.createPDefinitionAssistant().findName(classdef, sought, scope); if (def != null && !ExcludedDefinitions.isExcluded(def)) { return def; } return outer == null ? null : outer.findName(sought, scope); }
@Override public PDefinition findName(ILexNameToken name, NameScope scope) { PDefinition def = af.createPDefinitionListAssistant().findName(definitions, name, scope); if (def != null && !ExcludedDefinitions.isExcluded(def)) { return def; } if (outer == null) { return null; } else { if (limitStateScope) { scope = NameScope.NAMES; // Limit NAMESAND(ANY)STATE } return outer.findName(name, scope); } }
@Override public PDefinition findName(ILexNameToken name, NameScope scope) { PDefinition def = af.createSClassDefinitionAssistant().findName(classes, name, scope); if (def != null && af.createPAccessSpecifierAssistant().isPublic(def.getAccess()) && !ExcludedDefinitions.isExcluded(def)) { return def; } return outer == null ? null : outer.findName(name, scope); }
@Override public PType caseASelfObjectDesignator(ASelfObjectDesignator node, TypeCheckInfo question) { PDefinition def = question.env.findName(node.getSelf(), NameScope.NAMES); if (def == null) { TypeCheckerErrors.report(3263, "Cannot reference 'self' from here", node.getSelf().getLocation(), node.getSelf()); return AstFactory.newAUnknownType(node.getSelf().getLocation()); } return question.assistantFactory.createPDefinitionAssistant().getType(def); }
@Override public PType caseAParameterType(AParameterType type, Newquestion question) throws AnalysisException { if (type.getResolved()) { return type; } else { type.setResolved(true); } PDefinition p = question.question.env.findName(type.getName(), NameScope.NAMES); if (p == null || !(question.question.assistantFactory.createPDefinitionAssistant().getType(p) instanceof AParameterType)) { TypeCheckerErrors.report(3433, "Parameter type @" + type.getName() + " not defined", type.getLocation(), type); } return type; }
public TraceVariableList(Context ctxt, List<PDefinition> localDefs) { Environment local = new FlatEnvironment(ctxt.assistantFactory, localDefs); for (ILexNameToken key : ctxt.keySet()) { Value value = ctxt.get(key); PDefinition d = local.findName(key, NameScope.NAMES); boolean clone = false; if (value.isType(ObjectValue.class)) { ObjectValue obj = (ObjectValue) value.deref(); ObjectValue self = ctxt.getSelf(); // We have to clone new objects that were created within the trace, // while using other (local instance variable) objects unchanged. clone = self != null && obj.objectReference > self.objectReference; } add(new TraceVariable(key.getLocation(), key, value, d.getType(), clone)); } }
PDefinition existing = question.env.findName(exp.getName(), NameScope.NAMESANDSTATE);
return question.env.findName(fname, question.scope); } else
@Override public PType caseASelfExp(ASelfExp node, TypeCheckInfo question) { PDefinition cdef = question.env.findName(node.getName(), question.scope); if (cdef == null) { TypeCheckerErrors.report(3154, node.getName() + " not in scope", node.getLocation(), node); node.setType(AstFactory.newAUnknownType(node.getLocation())); return node.getType(); } node.setType(cdef.getType()); return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
PDefinition def = outer.findName(n1, NameScope.NAMESANDSTATE);
@Override public LexNameSet caseAApplyExp(AApplyExp node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(); if (node.getRoot() instanceof AVariableExp && node.getRoot().getType() != null && af.createPTypeAssistant().isFunction(node.getRoot().getType())) { // If this is a global call, then we depend on the function AVariableExp v = (AVariableExp)node.getRoot(); if (info.globals.findName(v.getName(), NameScope.NAMESANDSTATE) != null) { names.add(v.getName()); } } for (PExp exp: node.getArgs()) { names.addAll(exp.apply(this, info)); } return names; }
List<PType> atypes = getArgTypes(node.getArgs(), THIS, question); node.getField().setTypeQualifier(atypes); PDefinition fdef = classenv.findName(node.getField(), question.scope);
opname.setTypeQualifier(new LinkedList<PType>()); opname.getLocation().hit(); PDefinition opdef = question.env.findName(opname, NameScope.NAMES);
PDefinition opdef = question.env.findName(opname, NameScope.NAMES);
PDefinition mdef = question.env.findName(mname, question.scope);
if (question.env.findName(name, NameScope.STATE) == null)
List<PType> params = node.getType().getParameters(); if (question.env.isVDMPP()) exp.getName().setTypeQualifier(params); PDefinition def = question.env.findName(exp.getName(), question.scope);
PDefinition opdef = question.env.findName(node.getName(), question.scope);