final MXMLDialect mxmlDialect = builder.getMXMLDialect();
final String sourcePath = tag.getParent().getFileSpecification().getPath();
final MXMLClassDefinitionNode classNode = getContainingClassNode();
final ASScope classScope = (ASScope)classNode.getClassDefinition().getContainedScope();
final CompilerProject project = builder.getProject();
final OffsetLookup offsetLookup = classScope.getFileScope().getOffsetLookup();
setSourcePath(sourcePath);
try
{
// parse inline ActionScript
final List<ScopedBlockNode> scriptNodes = new ArrayList<ScopedBlockNode>();
for (IMXMLUnitData unit = tag.getFirstChildUnit(); unit != null; unit = unit.getNextSiblingUnit())
{
if (unit instanceof IMXMLTextData)
{
final IMXMLTextData mxmlTextData = (IMXMLTextData)unit;
String text = mxmlTextData.getCompilableText();
if (!mxmlDialect.isWhitespace(text))
{
// local offset at the end of the containing open script tag
assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
final int localOffset = mxmlTextData.getParentUnitData().getAbsoluteEnd();
final int[] absoluteOffsets = offsetLookup.getAbsoluteOffset(sourcePath, localOffset);
final int absoluteOffset = absoluteOffsets[0];
// create an include handler and mock its state as if it is
// before parsing for scope building
final IncludeHandler includeHandler = IncludeHandler.createForASTBuilding(
builder.getFileSpecificationGetter(),
sourcePath,
localOffset,
absoluteOffset);
// parse and build AST
final EnumSet<PostProcessStep> postProcess = EnumSet.of(
PostProcessStep.CALCULATE_OFFSETS,
PostProcessStep.RECONNECT_DEFINITIONS);
final ScopedBlockNode node = ASParser.parseInlineScript(
builder.getFileNode(),
mxmlTextData,
builder.getProblems(),
classScope,
project.getProjectConfigVariables(),
includeHandler,
postProcess);
MXMLFileNode filenode = builder.getFileNode();
filenode.updateIncludeTreeLastModified(includeHandler.getLastModified());
assert node != null : "Expected node from ASParser.getScopesFromInlineScript().";