org.teatrove.tea.compiler
Class TypeChecker

java.lang.Object
  extended by org.teatrove.tea.compiler.TypeChecker

public class TypeChecker
extends Object

A TypeChecker operates on a template's parse tree, created by a Parser, filling in type information while it checks the validity of the whole template. After a template has been type-checked and there are no errors, the template is ready for code generation. Add an ErrorListener to capture any semantic errors detected by the TypeChecker.

Author:
Brian S O'Neill

Nested Class Summary
static class TypeChecker.GenericArrayTypeImpl
           
static class TypeChecker.ParameterizedTypeImpl
           
protected  class TypeChecker.Visitor
           
 
Field Summary
protected  CompilationUnit mUnit
           
 
Constructor Summary
TypeChecker(CompilationUnit unit)
           
 
Method Summary
 void addErrorListener(ErrorListener listener)
           
 int getErrorCount()
           
 void removeErrorListener(ErrorListener listener)
           
 void setClassLoader(ClassLoader loader)
          Sets the ClassLoader to use to load classes with.
 void setExceptionGuardianEnabled(boolean enabled)
          Enabling Exception Guardian causes statements that might throw a exception to be guarded.
 void typeCheck()
           
 void typeCheck(TypeChecker.Visitor visitor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mUnit

protected CompilationUnit mUnit
Constructor Detail

TypeChecker

public TypeChecker(CompilationUnit unit)
Method Detail

addErrorListener

public void addErrorListener(ErrorListener listener)

removeErrorListener

public void removeErrorListener(ErrorListener listener)

setClassLoader

public void setClassLoader(ClassLoader loader)
Sets the ClassLoader to use to load classes with. If set to null, then classes are loaded using Class.forName.


setExceptionGuardianEnabled

public void setExceptionGuardianEnabled(boolean enabled)
Enabling Exception Guardian causes statements that might throw a exception to be guarded. By default, this feature is off. If a guarded statement throws a RuntimeException, it is caught and handed off to ThreadGroup.uncaughtException. Execution then proceeds to the next statement. If the guarded statement is an assignment, then the variable is assigned null if an exception is caught.


typeCheck

public void typeCheck()

typeCheck

public void typeCheck(TypeChecker.Visitor visitor)

getErrorCount

public int getErrorCount()


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.