Fix Skylark parsing of call expressions.

This allows more complex expressions to be called, not just identifiers.
For example, "x[0]()" is not a syntax error anymore.

RELNOTES: None
PiperOrigin-RevId: 165157981
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
index 6bfa55a..0eb87da 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
@@ -727,14 +727,13 @@
 
   @Override
   Object doEval(Environment env) throws EvalException, InterruptedException {
+    // TODO: Remove this special case once method resolution and invocation are supported as
+    // separate steps.
     if (function instanceof DotExpression) {
       return invokeObjectMethod(env, (DotExpression) function);
     }
-    if (function instanceof Identifier) {
-      return invokeGlobalFunction(env);
-    }
-    throw new EvalException(
-        getLocation(), Printer.format("cannot evaluate function '%s'", function));
+    Object funcValue = function.eval(env);
+    return callFunction(funcValue, env);
   }
 
   /** Invokes object.function() and returns the result. */
@@ -752,14 +751,6 @@
   }
 
   /**
-   * Invokes function() and returns the result.
-   */
-  private Object invokeGlobalFunction(Environment env) throws EvalException, InterruptedException {
-    Object funcValue = function.eval(env);
-    return callFunction(funcValue, env);
-  }
-
-  /**
    * Calls a function object
    */
   private Object callFunction(Object funcValue, Environment env)