Search in sources :

Example 31 with Constant

use of org.wso2.siddhi.query.api.expression.constant.Constant in project ballerina by ballerina-lang.

the class CodeGenerator method createTransformerInfoEntry.

private void createTransformerInfoEntry(BLangInvokableNode invokable) {
    BInvokableSymbol transformerSymbol = invokable.symbol;
    BInvokableType transformerType = (BInvokableType) transformerSymbol.type;
    // Add transformer name as an UTFCPEntry to the constant pool
    int transformerNameCPIndex = this.addUTF8CPEntry(currentPkgInfo, transformerSymbol.name.value);
    TransformerInfo transformerInfo = new TransformerInfo(currentPackageRefCPIndex, transformerNameCPIndex);
    transformerInfo.paramTypes = transformerType.paramTypes.toArray(new BType[0]);
    transformerInfo.retParamTypes = transformerType.retTypes.toArray(new BType[0]);
    transformerInfo.flags = transformerSymbol.flags;
    this.addWorkerInfoEntries(transformerInfo, invokable.getWorkers());
    // Add parameter default value info
    addParameterDefaultValues(invokable, transformerInfo);
    transformerInfo.signatureCPIndex = addUTF8CPEntry(this.currentPkgInfo, generateFunctionSig(transformerInfo.paramTypes, transformerInfo.retParamTypes));
    this.currentPkgInfo.transformerInfoMap.put(transformerSymbol.name.value, transformerInfo);
}
Also used : BType(org.wso2.ballerinalang.compiler.semantics.model.types.BType) BInvokableSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol) BInvokableType(org.wso2.ballerinalang.compiler.semantics.model.types.BInvokableType) BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint) TransformerInfo(org.wso2.ballerinalang.programfile.TransformerInfo)

Example 32 with Constant

use of org.wso2.siddhi.query.api.expression.constant.Constant in project ballerina by ballerina-lang.

the class DocumentationTest method testNestedInlineDeprecated.

@Test(description = "Test doc nested inline inside deprecated tag.")
public void testNestedInlineDeprecated() {
    CompileResult compileResult = BCompileUtil.compile("test-src/documentation/nested_inline_deprecated.bal");
    Assert.assertEquals(0, compileResult.getWarnCount());
    PackageNode packageNode = compileResult.getAST();
    BLangVariable constant = (BLangVariable) packageNode.getGlobalVariables().get(0);
    List<BLangDeprecatedNode> docNodes = constant.deprecatedAttachments;
    BLangDeprecatedNode dNode = docNodes.get(0);
    Assert.assertNotNull(dNode);
    Assert.assertEquals(dNode.documentationText, "\n" + "  Example of a string templates:\n" + "  ``` This starts ends triple backtick  ``string s = string `hello {{name}}`;`` " + "ends triple backtick```\n" + "\n" + "  Example for an xml literal:\n" + "    ``xml x = xml `<{{tagName}}>hello</{{tagName}}>`;``\n");
}
Also used : CompileResult(org.ballerinalang.launcher.util.CompileResult) BLangDeprecatedNode(org.wso2.ballerinalang.compiler.tree.BLangDeprecatedNode) PackageNode(org.ballerinalang.model.tree.PackageNode) BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable) Test(org.testng.annotations.Test)

Aggregations

BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)10 Test (org.testng.annotations.Test)9 SiddhiAppValidationException (org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)8 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)7 ConstantExpressionExecutor (org.wso2.siddhi.core.executor.ConstantExpressionExecutor)7 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)6 BInvokableType (org.wso2.ballerinalang.compiler.semantics.model.types.BInvokableType)5 ArrayList (java.util.ArrayList)4 CompileResult (org.ballerinalang.launcher.util.CompileResult)4 PackageNode (org.ballerinalang.model.tree.PackageNode)4 BInvokableSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol)4 SiddhiAppRuntime (org.wso2.siddhi.core.SiddhiAppRuntime)4 SiddhiManager (org.wso2.siddhi.core.SiddhiManager)4 BLangDocumentation (org.wso2.ballerinalang.compiler.tree.BLangDocumentation)3 StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)3 SiddhiAppCreationException (org.wso2.siddhi.core.exception.SiddhiAppCreationException)3 Variable (org.wso2.siddhi.query.api.expression.Variable)3 BoolConstant (org.wso2.siddhi.query.api.expression.constant.BoolConstant)3 Constant (org.wso2.siddhi.query.api.expression.constant.Constant)3 DoubleConstant (org.wso2.siddhi.query.api.expression.constant.DoubleConstant)3