Java Reference
In-Depth Information
.initializer());
assignOp.isStatementExpression=true;
initializations.add(newJStatementExpression(decl
.line(),assignOp).analyze(context));
}
}
returnthis;
}
Analysis of a JVariableDeclaration such as that in Figure 4.8 involves the following:
1. LocalVariableDefn s and their corresponding stack frame offsets are allocated for
each of the declared variables.
2. The code checks to make sure that the declared variables do not shadow existing local
variables.
3. The variables are declared in the local context.
4. Any initializations are rewritten as explicit assignment statements; those assignments
are re-analyzed and stored in an initializations list. Later, code generation will
generate code for any assignments in this list.
Figure 4.9 illustrates the result of analyzing the JVariableDeclaration in Figure 4.8.
Notice that re-analyzing the assignment statements attaches types to each node in the
sub-trees; more on that below.
 
Search WWH ::




Custom Search