[Skylark] Do not perform if check in case it's result is not needed.
If `function` is not `null`, there is no need to perform field related
checks.
Closes
@@ -744,12 +744,12 @@ public final class FuncallExpression extends Expression {
Environment env)
throws EvalException, InterruptedException {
Location location = call.getLocation();
- @Nullable
- Object fieldValue =
- (value instanceof ClassObject) ? ((ClassObject) value).getValue(method) : null;
if (function != null) {
return function.call(positionalArgs, keyWordArgs, call, env);
- } else if (fieldValue != null) {
+ }
+ Object fieldValue =
+ (value instanceof ClassObject) ? ((ClassObject) value).getValue(method) : null;
+ if (fieldValue != null) {
if (!(fieldValue instanceof BaseFunction)) {
throw new EvalException(
location, String.format("struct field '%s' is not a function", method));
