Java Doc for CompileStack.java in  » Scripting » groovy-1.0 » org » codehaus » groovy » classgen » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » groovy 1.0 » org.codehaus.groovy.classgen 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.codehaus.groovy.classgen.CompileStack

CompileStack
public class CompileStack implements Opcodes(Code)
This class is a helper for AsmClassGenerator. It manages different aspects of the code of a code block like handling labels, defining variables, and scopes. After a MethodNode is visited clear should be called, for initialization the method init should be used.

Some Notes:

  • every push method will require a later pop call
  • method parameters may define a category 2 variable, so don't ignore the type stored in the variable object
  • the index of the variable may not be as assumed when the variable is a parameter of a method because the parameter may be used in a closure, so don't ignore the stored variable index
  • the names of temporary variables can be ignored. The names are only used for debugging and do not conflict with each other or normal variables. For accessing the index of the variable must be used.

See Also:   org.codehaus.groovy.classgen.AsmClassGenerator
author:
   Jochen Theodorou




Method Summary
public  voidapplyFinallyBlocks(Label label, boolean isBreakLabel)
    
public  voidapplyFinallyBlocks()
    
public  voidclear()
     Clears the state of the class.
public  booleancontainsVariable(String name)
    
public  LabelcreateLocalLabel(String name)
    
public  intdefineTemporaryVariable(org.codehaus.groovy.ast.Variable var, boolean store)
     creates a temporary variable.
public  intdefineTemporaryVariable(String name, boolean store)
     creates a temporary variable.
public  intdefineTemporaryVariable(String name, ClassNode node, boolean store)
     creates a temporary variable.
public  VariabledefineVariable(org.codehaus.groovy.ast.Variable v, boolean initFromStack)
     Defines a new Variable using an AST variable.
Parameters:
  initFromStack - if true the last element of the stack will be used to initilizethe new variable.
public  LabelgetBreakLabel()
    
public  LabelgetContinueLabel()
    
public  intgetCurrentClassIndex()
    
public  intgetCurrentMetaClassIndex()
    
public  LabelgetLabel(String name)
    
protected  LabelgetNamedBreakLabel(String name)
     Used for break foo inside a loop to end the execution of the marked loop.
protected  LabelgetNamedContinueLabel(String name)
     Used for continue foo inside a loop to continue the execution of the marked loop.
public  VariableScopegetScope()
    
public  VariablegetVariable(String variableName)
    
public  VariablegetVariable(String variableName, boolean mustExist)
    
public  booleanhasFinallyBlocks()
    
protected  voidinit(VariableScope el, Parameter[] parameters, MethodVisitor mv, ClassNode cn)
     initializes this class for a MethodNode.
public  voidpop()
    
public  voidpopFinallyBlock()
    
protected  voidpushBooleanExpression()
    
public  voidpushFinallyBlock(Runnable block)
    
protected  voidpushLoop(VariableScope el, String labelName)
     Should be called when decending into a loop that defines also a scope.
protected  voidpushLoop(String labelName)
     Should be called when decending into a loop that does not define a scope.
protected  LabelpushSwitch()
    
protected  voidpushVariableScope(VariableScope el)
     Causes the statestack to add an element and sets the given scope as new current variable scope.
public  voidremoveVar(int tempIndex)
    
public  voidsetCurrentClassIndex(int index)
    
public  voidsetCurrentMetaClassIndex(int index)
    



Method Detail
applyFinallyBlocks
public void applyFinallyBlocks(Label label, boolean isBreakLabel)(Code)



applyFinallyBlocks
public void applyFinallyBlocks()(Code)



clear
public void clear()(Code)
Clears the state of the class. This method should be called after a MethodNode is visited. Note that a call to init will fail if clear is not called before



containsVariable
public boolean containsVariable(String name)(Code)
Returns true if a varibale is already defined



createLocalLabel
public Label createLocalLabel(String name)(Code)
creates a new named label



defineTemporaryVariable
public int defineTemporaryVariable(org.codehaus.groovy.ast.Variable var, boolean store)(Code)
creates a temporary variable.
Parameters:
  var - defines type and name
Parameters:
  store - defines if the toplevel argument of the stack should be stored the index used for this temporary variable



defineTemporaryVariable
public int defineTemporaryVariable(String name, boolean store)(Code)
creates a temporary variable.
Parameters:
  name - defines type and name
Parameters:
  store - defines if the toplevel argument of the stack should be stored the index used for this temporary variable



defineTemporaryVariable
public int defineTemporaryVariable(String name, ClassNode node, boolean store)(Code)
creates a temporary variable.
Parameters:
  name - defines the name
Parameters:
  node - defines the node
Parameters:
  store - defines if the toplevel argument of the stack should be stored the index used for this temporary variable



defineVariable
public Variable defineVariable(org.codehaus.groovy.ast.Variable v, boolean initFromStack)(Code)
Defines a new Variable using an AST variable.
Parameters:
  initFromStack - if true the last element of the stack will be used to initilizethe new variable. If false nullwill be used.



getBreakLabel
public Label getBreakLabel()(Code)



getContinueLabel
public Label getContinueLabel()(Code)



getCurrentClassIndex
public int getCurrentClassIndex()(Code)



getCurrentMetaClassIndex
public int getCurrentMetaClassIndex()(Code)



getLabel
public Label getLabel(String name)(Code)
Returns the label for the given name



getNamedBreakLabel
protected Label getNamedBreakLabel(String name)(Code)
Used for break foo inside a loop to end the execution of the marked loop. This method will return the break label of the loop if there is one found for the name. If not, the current break label is returned.



getNamedContinueLabel
protected Label getNamedContinueLabel(String name)(Code)
Used for continue foo inside a loop to continue the execution of the marked loop. This method will return the break label of the loop if there is one found for the name. If not, getLabel is used.



getScope
public VariableScope getScope()(Code)



getVariable
public Variable getVariable(String variableName)(Code)



getVariable
public Variable getVariable(String variableName, boolean mustExist)(Code)



hasFinallyBlocks
public boolean hasFinallyBlocks()(Code)



init
protected void init(VariableScope el, Parameter[] parameters, MethodVisitor mv, ClassNode cn)(Code)
initializes this class for a MethodNode. This method will automatically define varibales for the method parameters and will create references if needed. the created variables can be get by getVariable



pop
public void pop()(Code)



popFinallyBlock
public void popFinallyBlock()(Code)



pushBooleanExpression
protected void pushBooleanExpression()(Code)
because a boolean Expression may not be evaluated completly it is important to keep the registers clean



pushFinallyBlock
public void pushFinallyBlock(Runnable block)(Code)



pushLoop
protected void pushLoop(VariableScope el, String labelName)(Code)
Should be called when decending into a loop that defines also a scope. Calls pushVariableScope and prepares labels for a loop structure. Creates a element for the state stack so pop has to be called later



pushLoop
protected void pushLoop(String labelName)(Code)
Should be called when decending into a loop that does not define a scope. Creates a element for the state stack so pop has to be called later



pushSwitch
protected Label pushSwitch()(Code)
Creates a new break label and a element for the state stack so pop has to be called later



pushVariableScope
protected void pushVariableScope(VariableScope el)(Code)
Causes the statestack to add an element and sets the given scope as new current variable scope. Creates a element for the state stack so pop has to be called later



removeVar
public void removeVar(int tempIndex)(Code)



setCurrentClassIndex
public void setCurrentClassIndex(int index)(Code)



setCurrentMetaClassIndex
public void setCurrentMetaClassIndex(int index)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.