public Set<FunctionPrototype> getPrototypes(String name) { Set<FunctionPrototype> result = new HashSet<>(); if (userDefinedFunctions.containsKey(name)) { result.addAll(userDefinedFunctions.get(name)); } if (TyperHelper.getBuiltins(shadingLanguageVersion).containsKey(name)) { result.addAll(TyperHelper.getBuiltins(shadingLanguageVersion).get(name)); } return result; }
for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t); for (Type t : genType()) { addBuiltin(builtinsForVersion, name, t, t);
public static Map<String, List<FunctionPrototype>> getBuiltins(ShadingLanguageVersion shadingLanguageVersion) { if (!builtins.containsKey(shadingLanguageVersion)) { builtins.putIfAbsent(shadingLanguageVersion, getBuiltinsForGlslVersion(shadingLanguageVersion)); } return Collections.unmodifiableMap(builtins.get(shadingLanguageVersion)); }
Type resolvedType = TyperHelper.resolveTypeOfMul(lhsType, rhsType); if (resolvedType != null) { types.put(binaryExpr, resolvedType); case MUL_ASSIGN: case SUB_ASSIGN: { Type resolvedType = TyperHelper.resolveTypeOfCommonBinary(lhsType, rhsType); if (resolvedType != null) { types.put(binaryExpr, resolvedType);
@Override public void visitFunctionCallExpr(FunctionCallExpr functionCallExpr) { if (!TyperHelper.getBuiltins(shadingLanguageVersion) .containsKey(functionCallExpr.getCallee())) { // Assume that any call to a non-builtin might have a side-effect. predicateHolds(); } super.visitFunctionCallExpr(functionCallExpr); }
@Override public void visitFunctionCallExpr(FunctionCallExpr functionCallExpr) { super.visitFunctionCallExpr(functionCallExpr); List<FunctionPrototype> candidateBuiltins = TyperHelper.getBuiltins(shadingLanguageVersion) .get(functionCallExpr.getCallee()); if (candidateBuiltins != null) { for (FunctionPrototype prototype : candidateBuiltins) { if (prototypeMatches(prototype, functionCallExpr)) { types.put(functionCallExpr, prototype.getReturnType()); } } } Set<FunctionPrototype> candidateUserDefined = userDefinedFunctions.get(functionCallExpr.getCallee()); if (candidateUserDefined != null) { for (FunctionPrototype prototype : candidateUserDefined) { if (prototypeMatches(prototype, functionCallExpr)) { types.put(functionCallExpr, prototype.getReturnType()); } } } }
Map<String, List<FunctionPrototype>> builtins = TyperHelper.getBuiltins( shadingLanguageVersion); List<String> keys = builtins.keySet().stream().collect(Collectors.toList());