use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol in project ballerina by ballerina-lang.
the class CodeGenerator method visit.
public void visit(BLangVariable varNode) {
BVarSymbol varSymbol = varNode.symbol;
int ownerSymTag = env.scope.owner.tag;
if ((ownerSymTag & SymTag.INVOKABLE) == SymTag.INVOKABLE) {
varSymbol.varIndex = getLVIndex(varSymbol.type.tag);
LocalVariableInfo localVarInfo = getLocalVarAttributeInfo(varSymbol);
localVarAttrInfo.localVars.add(localVarInfo);
} else {
// TODO Support other variable nodes
throw new IllegalStateException("");
}
BLangExpression rhsExpr = varNode.expr;
if (rhsExpr != null) {
rhsExpr.regIndex = varSymbol.varIndex;
genNode(rhsExpr, this.env);
}
}
use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol in project ballerina by ballerina-lang.
the class CodeGenerator method visitVarSymbol.
private void visitVarSymbol(BVarSymbol varSymbol, VariableIndex variableIndex, LocalVariableAttributeInfo localVarAttrInfo) {
varSymbol.varIndex = getRegIndexInternal(varSymbol.type.tag, variableIndex.kind);
LocalVariableInfo localVarInfo = getLocalVarAttributeInfo(varSymbol);
localVarAttrInfo.localVars.add(localVarInfo);
}
use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol in project ballerina by ballerina-lang.
the class ASTBuilderUtil method createIndexBasesAccessExpr.
static BLangIndexBasedAccess createIndexBasesAccessExpr(DiagnosticPos pos, BType type, BVarSymbol varSymbol, BLangExpression indexExpr) {
final BLangIndexBasedAccess arrayAccess = (BLangIndexBasedAccess) TreeBuilder.createIndexBasedAccessNode();
arrayAccess.pos = pos;
arrayAccess.expr = createVariableRef(pos, varSymbol);
arrayAccess.indexExpr = indexExpr;
arrayAccess.type = type;
return arrayAccess;
}
use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol in project ballerina by ballerina-lang.
the class ASTBuilderUtil method createVariableRef.
static BLangSimpleVarRef createVariableRef(DiagnosticPos pos, BVarSymbol varSymbol) {
final BLangSimpleVarRef varRef = (BLangSimpleVarRef) TreeBuilder.createSimpleVariableReferenceNode();
varRef.pos = pos;
varRef.variableName = createIdentifier(pos, varSymbol.name.value);
varRef.symbol = varSymbol;
varRef.type = varSymbol.type;
return varRef;
}
use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol in project ballerina by ballerina-lang.
the class ASTBuilderUtil method defineVariable.
static void defineVariable(BLangVariable variable, BSymbol targetSymbol, Names names) {
variable.symbol = new BVarSymbol(0, names.fromIdNode(variable.name), targetSymbol.pkgID, variable.type, targetSymbol);
targetSymbol.scope.define(variable.symbol.name, variable.symbol);
}
Aggregations