use of org.ballerinalang.util.diagnostic.DiagnosticCode in project ballerina by ballerina-lang.
the class SemanticAnalyzer method analyzeNode.
BType analyzeNode(BLangNode node, SymbolEnv env, BType expType, DiagnosticCode diagCode) {
SymbolEnv prevEnv = this.env;
BType preExpType = this.expType;
DiagnosticCode preDiagCode = this.diagCode;
// TODO Check the possibility of using a try/finally here
this.env = env;
this.expType = expType;
this.diagCode = diagCode;
node.accept(this);
this.env = prevEnv;
this.expType = preExpType;
this.diagCode = preDiagCode;
return resType;
}
use of org.ballerinalang.util.diagnostic.DiagnosticCode in project ballerina by ballerina-lang.
the class TypeChecker method checkExpr.
public List<BType> checkExpr(BLangExpression expr, SymbolEnv env, List<BType> expTypes, DiagnosticCode diagCode) {
// TODO Check the possibility of using a try/finally here
SymbolEnv prevEnv = this.env;
List<BType> preExpTypes = this.expTypes;
DiagnosticCode preDiagCode = this.diagCode;
this.env = env;
this.diagCode = diagCode;
this.expTypes = expTypes;
expr.accept(this);
setExprType(expr, expTypes);
this.env = prevEnv;
this.expTypes = preExpTypes;
this.diagCode = preDiagCode;
return resultTypes;
}
use of org.ballerinalang.util.diagnostic.DiagnosticCode in project ballerina by ballerina-lang.
the class SymbolResolver method resolveTypeNode.
public BType resolveTypeNode(BLangType typeNode, SymbolEnv env, DiagnosticCode diagCode) {
SymbolEnv prevEnv = this.env;
DiagnosticCode preDiagCode = this.diagCode;
this.env = env;
this.diagCode = diagCode;
typeNode.accept(this);
this.env = prevEnv;
this.diagCode = preDiagCode;
// if it is not already a union type, JSON type, or any type
if (typeNode.nullable && this.resultType.tag == TypeTags.UNION) {
BUnionType unionType = (BUnionType) this.resultType;
unionType.memberTypes.add(symTable.nullType);
unionType.setNullable(true);
} else if (typeNode.nullable && resultType.tag != TypeTags.JSON && resultType.tag != TypeTags.ANY) {
Set<BType> memberTypes = new HashSet<BType>(2) {
{
add(resultType);
add(symTable.nullType);
}
};
this.resultType = new BUnionType(null, memberTypes, true);
}
typeNode.type = resultType;
return resultType;
}
Aggregations