public class MXMLClassDirectiveProcessor extends Object
MXMLClassDirectiveProcessor
is a subclass of
ClassDirectiveProcessor
that generates an ABC class
from an IMXMLClassDefinitionNode
and its contents.
Here are some register usage conventions for Code Generation:
local3: during parts of the constructor, local3 is used for a
lookup array of DeferredInstanceFromFunction.
local1 and 2: Used during the constructor as temporaries
for some data-binding init.Modifier and Type | Field and Description |
---|---|
protected LexicalScope |
globalScope
The AET lexical scope in which the generated class lives.
|
protected Map<Integer,IMXMLNode> |
indexToNodeMap |
protected Map<IMXMLNode,Integer> |
nodeToIndexMap
This keeps track of the entries in our temporary array of
DeferredInstanceFromFunction objects that we CG to help with
State override CG.
|
protected Map<IMXMLNode,InstructionList> |
nodeToInstanceDescriptorMap |
protected Collection<VariableNode> |
staticVariableInitializers
Collection of static variables with initial values which need to be initialized
before other static initialization code.
|
Modifier and Type | Method and Description |
---|---|
void |
addBindableVariableTrait(Name varName,
Name varType,
IDefinition def)
Adds an instance trait for a bindable variable,
such as one created by an id attribute.
|
void |
addVariableTrait(Name varName,
Name varType)
Adds an instance trait for a variable,
such as one created by an id attribute.
|
static MethodInfo |
createEventHandlerMethodInfo(ICompilerProject project,
IMXMLEventSpecifierNode eventNode,
String handlerName)
Creates a MethodInfo describing the signature for an autogenerated
MXML event handler method corresponding to an MXMLEventSpecifierNode.
|
static MethodInfo |
createVectorGeneratorMethodInfo(ICompilerProject project,
IMXMLVectorNode vectorNode,
String handlerName)
Creates a MethodInfo describing the signature for an autogenerated
vector generator method.
|
void |
declareBindableVariable(VariableNode varNode)
Translate a VaribleNode AST into ABC, and adding bindable support.
|
static int |
functionTraitKind(FunctionNode func,
int default_kind)
Getter/Setter functions need to be declared with a specific
trait kind; do so here.
|
protected void |
generateBindableImpl() |
protected boolean |
generateDescriptorCode(IASNode node,
org.apache.flex.compiler.internal.as.codegen.MXMLClassDirectiveProcessor.Context context)
Determines whether the specified node should generate
code to be incorporated into a UIComponentDescriptor.
|
protected void |
generateInstructions(IASNode node,
boolean isStatic)
Generate instructions for field initializers or static initialization statements.
|
protected void |
generateRequiredContingentDefinitions() |
protected static IMetaInfo[] |
getAllMetaTags(IDefinition definition)
Get all the user defined metadata plus
"go to definition help" metadata.
|
ClassDefinition |
getClassDefinition()
accessor function used by code-gen helper classes.
|
Name |
getEventHandlerName(IMXMLEventSpecifierNode eventNode)
Determines the Name of the event handler method for an event node.
|
LexicalScope |
getInstanceScope()
accessor function used by code-gen helper classes.
|
Collection<ICompilerProblem> |
getProblems()
Helper to give access to problem reporting to MXMLBindingDirectiveHelper2
|
FlexProject |
getProject()
Returns the
FlexProject for this processor. |
Name |
getVectorGeneratorName(Name typeName)
Determines the Name of the event handler method for an event node.
|
protected static boolean |
instanceAffectsBindings(IMXMLInstanceNode instanceNode) |
static boolean |
isDataBindingNode(IASNode node)
Is a give node a "databinding node"?
|
protected static boolean |
isDataboundProp(IMXMLPropertySpecifierNode propertyNode) |
protected boolean |
isStateDependent(IASNode node)
Determines whether a node is state-dependent.
|
protected boolean |
isStateDependentInstance(IASNode node)
Determines whether the geven node is an instance node, as is state dependent
|
protected void |
processMXMLClassDefinition(IMXMLClassDefinitionNode node,
org.apache.flex.compiler.internal.as.codegen.MXMLClassDirectiveProcessor.Context context) |
protected void |
processResourceBundles(IClassDefinition class_definition,
ICompilerProject project,
Collection<ICompilerProblem> problems) |
protected void |
verifyFunctionModifiers(FunctionNode f) |
protected void |
verifyVariableModifiers(VariableNode v) |
protected final LexicalScope globalScope
protected Map<IMXMLNode,Integer> nodeToIndexMap
protected Map<IMXMLNode,InstructionList> nodeToInstanceDescriptorMap
protected final Collection<VariableNode> staticVariableInitializers
public static MethodInfo createEventHandlerMethodInfo(ICompilerProject project, IMXMLEventSpecifierNode eventNode, String handlerName)
eventNode
- - an MXMLEventSpecifierNode, which is used to determine
the type of the 'event' parameter.handlerName
- - the name for the autogenerated event handler method.public static MethodInfo createVectorGeneratorMethodInfo(ICompilerProject project, IMXMLVectorNode vectorNode, String handlerName)
vectorNode
- - a node, which is used to determine
the type of the 'vector'.handlerName
- - the name for the autogenerated event handler method.public FlexProject getProject()
FlexProject
for this processor.public Collection<ICompilerProblem> getProblems()
public Name getEventHandlerName(IMXMLEventSpecifierNode eventNode)
public Name getVectorGeneratorName(Name typeName)
protected boolean isStateDependent(IASNode node)
protected boolean isStateDependentInstance(IASNode node)
public void addVariableTrait(Name varName, Name varType)
public void addBindableVariableTrait(Name varName, Name varType, IDefinition def)
protected boolean generateDescriptorCode(IASNode node, org.apache.flex.compiler.internal.as.codegen.MXMLClassDirectiveProcessor.Context context)
public static boolean isDataBindingNode(IASNode node)
protected static boolean instanceAffectsBindings(IMXMLInstanceNode instanceNode)
protected static boolean isDataboundProp(IMXMLPropertySpecifierNode propertyNode)
protected void processMXMLClassDefinition(IMXMLClassDefinitionNode node, org.apache.flex.compiler.internal.as.codegen.MXMLClassDirectiveProcessor.Context context)
protected static IMetaInfo[] getAllMetaTags(IDefinition definition)
definition
- The definition to get the metadata for.IMetaTag
.protected void processResourceBundles(IClassDefinition class_definition, ICompilerProject project, Collection<ICompilerProblem> problems)
public void declareBindableVariable(VariableNode varNode)
varNode
- - the variable's AST.public LexicalScope getInstanceScope()
public ClassDefinition getClassDefinition()
protected void generateBindableImpl()
protected void generateRequiredContingentDefinitions()
protected void verifyFunctionModifiers(FunctionNode f)
protected void verifyVariableModifiers(VariableNode v)
protected void generateInstructions(IASNode node, boolean isStatic)
node
- - the AST at the root of the statement.isStatic
- - true if the code should be generated in a static context.public static int functionTraitKind(FunctionNode func, int default_kind)
func
- - a FunctionNode.default_kind
- - the trait kind to use if the function
is not a getter or setter. Varies depending on caller's context.Copyright © 2016 The Apache Software Foundation. All rights reserved.