aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/UserDefinedFunction.java
Commit message (Collapse)AuthorAge
* Refactor Skylark Environment-sGravatar Francois-Rene Rideau2015-09-08
| | | | | | | | | | | | | | | | | Make Environment-s freezable: Introduce a class Mutability as a revokable capability to mutate objects in an Environment. For now, only Environment-s carry this capability. Make sure that every Mutability is revoked in the same function that creates it, so no Environment is left open for modification after being created and exported; exceptions for tests, the shell and initialization contexts. Unify Environment, SkylarkEnvironment and EvaluationContext into Environment. Have a notion of Frame for the bindings + parent + mutability. Replace the updateAndPropagate mechanism by a dynamicFrame. Simplify ValidationEnvironment, that is now always deduced from the Environment. -- MOS_MIGRATED_REVID=102363438
* Show a column with the location of a skylark function in HTML profiling ↵Gravatar Googler2015-09-02
| | | | | | | statistics. -- MOS_MIGRATED_REVID=102143715
* When a Skylark macro creates a native rule, it also sets the following rule ↵Gravatar Florian Weikert2015-09-02
| | | | | | | attributes: generator_{function, name, location} -- MOS_MIGRATED_REVID=102139196
* Move global objects to RuntimeGravatar Francois-Rene Rideau2015-08-31
| | | | | | | | Move away global constants and global namespaces out of Environment and into a new file Runtime. -- MOS_MIGRATED_REVID=101940218
* Roll back "When a Skylark macro creates a native rule, it also..."Gravatar Michajlo Matijkiw2015-08-31
| | | | | -- MOS_MIGRATED_REVID=101798931
* When a Skylark macro creates a native rule, it also sets the following rule ↵Gravatar Florian Weikert2015-08-28
| | | | | | | attributes: generator_{function, name, location} -- MOS_MIGRATED_REVID=101774632
* Add profiling for Skylark lexer, parser, user- and built-in functions.Gravatar Googler2015-08-28
| | | | | -- MOS_MIGRATED_REVID=101769963
* Skylark stack traces are now displayed in Python format.Gravatar Florian Weikert2015-08-27
| | | | | -- MOS_MIGRATED_REVID=101572295
* Skylark error messages now include a stack trace.Gravatar Florian Weikert2015-08-20
| | | | | | | This means that some tests had to be changed from using exact equality of error messages to working with contains() / startsWith(). -- MOS_MIGRATED_REVID=100923593
* Improved error messages for builtin Skylark functions that are invoked with ↵Gravatar Florian Weikert2015-08-12
| | | | | | | invalid arguments. -- MOS_MIGRATED_REVID=100386706
* Renamed Ident to Identifier, added some helper methods and refactored two ↵Gravatar Florian Weikert2015-07-23
| | | | | | | methods. -- MOS_MIGRATED_REVID=98922811
* New class hierarchy for Skylark functionsGravatar Francois-Rene Rideau2015-03-20
| | | | | | | | | | | | | | | | | | | | | | | | | | * New hierarchy BaseFunction > UserModeFunction, BuiltinFunction. The old hierarchy still exists for now, to be deleted after migration: Function > AbstractFunction > MixedModeFunction > (UserModeFunction, SkylarkFunction > SimpleSkylarkFunction) (UserModeFunction is already migrated, and BaseFunction implements Function, for now.) * Function supports *args and **kwargs when calling functions, and mandatory named-only parameters in the style of Python 3. Notable difference with Python: *args binds the variable to a tuple, because a Skylark list would have to be monomorphic. * A better, simpler, safer FFI using reflection with BuiltinFunction. Handles typechecking, passes parameters in a more Java style. (Not used for now, will be used later.) * A new annotation @SkylarkSignature, intended to replace @SkylarkBuiltin, supports the full function call protocol, including default arguments. * Support for annotating function Factory-s rather than functions. -- MOS_MIGRATED_REVID=88958581
* Introduce first class function signatures; make the parser use them.Gravatar Francois-Rene Rideau2015-02-19
| | | | | | | | | | | | | | | | | | | This is the first meaty cl in a series to refactor the Skylark function call protocol. 1- We introduce a first-class notion of FunctionSignature, that supports positional and named-only arguments, mandatory and optional, default values, type-checking, *stararg and **kwarg; 2- To keep things clean, we distinguish two different kinds of Argument's: Argument.Passed that appears in function calls, and Parameter, that appears in function definitions. 3- We refactor the Parser so it uses this infrastructure, and make minimal changes to MixedModeFunction so that it works with it (but don't actually implement *starparam and **kwparam yet). 4- As we modify FuncallExpression, we ensure that the args and kwargs arguments it passes to the underlying function are immutable, as a prerequisite to upcoming implementation of *starparam and **kwparam as being provided directly from a skylark list or dict. Further changes under review will take advantage of this FunctionSignature to redo all our function call protocol, to be used uniformly for both UserDefinedFunction's and builtin function. The result will be a simpler inheritance model, with better type-checking, builtin functions that are both simpler and better documented, and many redundant competing functionality-limited codepaths being merged and replaced by something better. NB: The changes to MixedModeFunction, SkylarkFunction and MethodLibrary are temporary hacks to be done away with in an upcoming CL. The rest is the actual changes. -- MOS_MIGRATED_REVID=86704072
* Update from Google.Gravatar Han-Wen Nienhuys2015-02-25
-- MOE_MIGRATED_REVID=85702957