@Override
	public void typeCheck()
	{
		boolean nothing = true;
		boolean hasSystem = false;

		for (SClassDefinition c1 : classes)
		{
			c1.setType(assistantFactory.createSClassDefinitionAssistant().getType(c1));
			for (SClassDefinition c2 : classes)
			{
				if (c1 != c2 && c1.getName().equals(c2.getName()))
				{
					TypeChecker.report(3426, "Class " + c1.getName()
							+ " duplicates " + c2.getName(), c1.getName().getLocation());
				}
			}

			if (!c1.getTypeChecked())
			{
				nothing = false;
			}

			if (c1 instanceof ASystemClassDefinition)
			{
				if (hasSystem)
				{
					TypeChecker.report(3294, "Only one system class permitted", c1.getLocation());
				} else
				{
					hasSystem = true;
				}
			}
		}

		if (nothing)
		{
			return;
		}

		Environment allClasses = getAllClassesEnvronment();

		for (SClassDefinition c : classes)
		{
			if (!c.getTypeChecked())
			{
				assistantFactory.createSClassDefinitionAssistant().implicitDefinitions(c, allClasses);
			}
		}

		for (SClassDefinition c : classes)
		{
			if (!c.getTypeChecked())
			{
				try
				{
					Environment self = new PrivateClassEnvironment(assistantFactory, c, allClasses);
					assistantFactory.createSClassDefinitionAssistant().typeResolve(c, null, new TypeCheckInfo(assistantFactory, self));
				} catch (TypeCheckException te)
				{
					report(3427, te.getMessage(), te.location);
					
    				if (te.extras != null)
    				{
    					for (TypeCheckException e: te.extras)
    					{
    						report(3427, e.getMessage(), e.location);
    					}
    				}
				} catch (AnalysisException te)
				{
					report(3431, te.getMessage(), null);// FIXME: internal error
				}
			}
		}

		for (SClassDefinition c : classes)
		{
			if (!c.getTypeChecked())
			{
				assistantFactory.createSClassDefinitionAssistant().checkOver(c);
			}
		}

		QuestionAnswerAdaptor<TypeCheckInfo, PType> tc = getTypeCheckVisitor();
		for (Pass pass : Pass.values())
		{
			for (SClassDefinition c : classes)
			{
				if (!c.getTypeChecked())
				{
					try
					{
						Environment self = new PrivateClassEnvironment(assistantFactory, c, allClasses);
						assistantFactory.createSClassDefinitionAssistant().typeCheckPass(c, pass, self, tc);
					} catch (TypeCheckException te)
					{
						report(3428, te.getMessage(), te.location);
						
	    				if (te.extras != null)
	    				{
	    					for (TypeCheckException e: te.extras)
	    					{
	    						report(3428, e.getMessage(), e.location);
	    					}
	    				}
					} catch (AnalysisException te)
					{
						report(3431, te.getMessage(), null);// FIXME: internal error
					}
				}
			}
		}

		List<PDefinition> allDefs = new Vector<PDefinition>();

		for (SClassDefinition c : classes)
		{
			if (!c.getTypeChecked())
			{
				assistantFactory.createSClassDefinitionAssistant().initializedCheck(c);
				assistantFactory.createPDefinitionAssistant().unusedCheck(c);
				allDefs.addAll(c.getDefinitions());
			}
		}
    	
    	cyclicDependencyCheck(allDefs);
	}
@ Override public void typeCheck ( ) { boolean nothing = true ; boolean hasSystem = false ; for ( SClassDefinition c1 : classes ) { c1 . setType ( assistantFactory . createSClassDefinitionAssistant ( ) . getType ( c1 ) ) ; for ( SClassDefinition c2 : classes ) { if ( c1 != c2 && c1 . getName ( ) . equals ( c2 . getName ( ) ) ) { TypeChecker . report ( 3426 , "Class " + c1 . getName ( ) + " duplicates " + c2 . getName ( ) , c1 . getName ( ) . getLocation ( ) ) ; } } if ( ! c1 . getTypeChecked ( ) ) { nothing = false ; } if ( c1 instanceof ASystemClassDefinition ) { if ( hasSystem ) { TypeChecker . report ( 3294 , "Only one system class permitted" , c1 . getLocation ( ) ) ; } else { hasSystem = true ; } } } if ( nothing ) { return ; } Environment allClasses = getAllClassesEnvronment ( ) ; for ( SClassDefinition c : classes ) { if ( ! c . getTypeChecked ( ) ) { assistantFactory . createSClassDefinitionAssistant ( ) . implicitDefinitions ( c , allClasses ) ; } } for ( SClassDefinition c : classes ) { if ( ! c . getTypeChecked ( ) ) { try { Environment self = new PrivateClassEnvironment ( assistantFactory , c , allClasses ) ; assistantFactory . createSClassDefinitionAssistant ( ) . typeResolve ( c , null , new TypeCheckInfo ( assistantFactory , self ) ) ; } catch ( TypeCheckException te ) { report ( 3427 , te . getMessage ( ) , te . location ) ; if ( te . extras != null ) { for ( TypeCheckException e : te . extras ) { report ( 3427 , e . getMessage ( ) , e . location ) ; } } } catch ( AnalysisException te ) { report ( 3431 , te . getMessage ( ) , null ) ; } } } for ( SClassDefinition c : classes ) { if ( ! c . getTypeChecked ( ) ) { assistantFactory . createSClassDefinitionAssistant ( ) . checkOver ( c ) ; } } QuestionAnswerAdaptor < TypeCheckInfo , PType > tc = getTypeCheckVisitor ( ) ; for ( Pass pass : Pass . values ( ) ) { for ( SClassDefinition c : classes ) { if ( ! c . getTypeChecked ( ) ) { try { Environment self = new PrivateClassEnvironment ( assistantFactory , c , allClasses ) ; assistantFactory . createSClassDefinitionAssistant ( ) . typeCheckPass ( c , pass , self , tc ) ; } catch ( TypeCheckException te ) { report ( 3428 , te . getMessage ( ) , te . location ) ; if ( te . extras != null ) { for ( TypeCheckException e : te . extras ) { report ( 3428 , e . getMessage ( ) , e . location ) ; } } } catch ( AnalysisException te ) { report ( 3431 , te . getMessage ( ) , null ) ; } } } } List < PDefinition > allDefs = new Vector < PDefinition > ( ) ; for ( SClassDefinition c : classes ) { if ( ! c . getTypeChecked ( ) ) { assistantFactory . createSClassDefinitionAssistant ( ) . initializedCheck ( c ) ; assistantFactory . createPDefinitionAssistant ( ) . unusedCheck ( c ) ; allDefs . addAll ( c . getDefinitions ( ) ) ; } } cyclicDependencyCheck ( allDefs ) ; }
Perform type checking across all classes in the list.