/** * Generate IL expression for a top-level declaration sequence</br> * * @see GenUtil.doGenModuleIL * @param ctx the context * @param isModule whether is is actually a module expression: true for the body of a module, * false for the body of a script * @return the IL expression of a module */ public Expression generateModuleIL(GenContext ctx, boolean isModule) { Sequence seqWithBlocks = combine(); TopLevelContext tlc = new TopLevelContext(ctx); seqWithBlocks.genTopLevel(tlc); Expression result = isModule ? tlc.getModuleExpression() : tlc.getExpression(); /*Iterator<TypedAST> ai = seqWithBlocks.iterator(); if (!ai.hasNext()) throw new RuntimeException("expected an expression in the list"); Expression decl = GenUtil.doGenModuleIL(ctx, ctx, ctx, ai, isModule);*/ return result; }