aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java
Commit message (Collapse)AuthorAge
* Delete the bytecode compiler experiment.Gravatar Laurent Le Brun2017-01-23
| | | | | | | | | The code has been untouched and unused for over a year (it's very likely broken) and we have other priorities for now. -- PiperOrigin-RevId: 145087310 MOS_MIGRATED_REVID=145087310
* Refactor SkylarkNestedSet to not implement IterableGravatar Jon Brandvein2017-01-20
| | | | | | | | | | | | | | This is not intended to be a user-visible semantic change, aside from error messages. This is to help avoid unintentional flattening of depsets, and to narrow down the number of call sites where this can occur, to help us print warning/deprecation messages. EvalUtils#toIterable will now return an ImmutableList in place of SkylarkNestedSet. This should be ok since the caller shouldn't be relying on the result being a Skylark-safe type. Code that takes Iterable because it accepts either a list or set, can instead be changed to take Object and use EvalUtils#toIterableStrict for validation. Note that NestedSet still implements Iterable, so native code can still easily and accidentally flatten sets. -- PiperOrigin-RevId: 145044023 MOS_MIGRATED_REVID=145044023
* Refactor a traversal over @SkylarkModule ancestorsGravatar Jon Brandvein2017-01-19
| | | | | | -- PiperOrigin-RevId: 144890965 MOS_MIGRATED_REVID=144890965
* Adding Java compilation to java_lite_proto_library Skylark version.Gravatar Irina Iancu2017-01-16
| | | | | | -- PiperOrigin-RevId: 144608820 MOS_MIGRATED_REVID=144608820
* Cleanup in error messages, try to improve consistency.Gravatar Laurent Le Brun2017-01-03
| | | | | | -- PiperOrigin-RevId: 143204724 MOS_MIGRATED_REVID=143204724
* Add `depset` as an alias to `set` in SkylarkGravatar Vladimir Moskva2016-12-27
| | | | | | | | | | Renamed all occurrences of `set` to `depset`, added a `set` object constructor for (temporary) backward compatibility. `type(depset())` still temporarily returns "set", that will be changed in the future. RELNOTES: The `set` constructor is deprecated in favor of `depset` -- PiperOrigin-RevId: 142851587 MOS_MIGRATED_REVID=142851587
* Allow dicts to contain non-comparable objects as keysGravatar Vladimir Moskva2016-12-05
| | | | | | | | | RELNOTES: Skylark dicts internally don't rely on keys order anymore and accept any hashable values (i.e. structs with immutable values) as keys. Iteration order of dictionaries is no longer specified. -- PiperOrigin-RevId: 141055080 MOS_MIGRATED_REVID=141055080
* Rollback of commit c182908910a370b490e7e027b867e11f9f2fb086.Gravatar Michajlo Matijkiw2016-12-01
| | | | | | | *** Reason for rollback *** -- MOS_MIGRATED_REVID=140687884
* Allow dicts to contain non-comparable objects as keysGravatar Vladimir Moskva2016-11-30
| | | | | | | | RELNOTES: Skylark dicts internally don't rely on keys order anymore and accept any hashable values (i.e. structs with immutable values) as keys. Iteration order of dictionaries is no longer specified. -- MOS_MIGRATED_REVID=140591710
* Rollback of commit 984d6d48d0e07ac3be2bbfec667158165390eb4f.Gravatar Tobias Werth2016-11-24
| | | | | -- MOS_MIGRATED_REVID=140121290
* Allow dicts to contain non-comparable objects as keysGravatar Vladimir Moskva2016-11-22
| | | | | | | | RELNOTES: Skylark dicts internally don't rely on keys order anymore and accept any hashable values (i.e. structs with immutable values) as keys. -- MOS_MIGRATED_REVID=139914704
* Fix bugs in slicing with a negative strideGravatar Jon Brandvein2016-11-14
| | | | | | | | | | | | | | There was a crash when the starting point of a negative slice is larger than the list length. In addition, there was an incorrect result when the ending point of a negative slice is less than the list's length times -1. It would wrongly exclude the first element. RELNOTES: Fix slicing bug where "abc"[:-4:-1] would give wrong answer -- MOS_MIGRATED_REVID=138878716
* Prohibited comparison of Skylark setsGravatar Vladimir Moskva2016-11-08
| | | | | | | RELNOTES: Comparing sets (`if set1 < set2:`) is not allowed anymore in Skylark because it didn't work correctly anyway. -- MOS_MIGRATED_REVID=138408411
* Refactor getParentWithSkylarkModule() into SkylarkInterfaceUtilsGravatar Jon Brandvein2016-10-13
| | | | | -- MOS_MIGRATED_REVID=135956016
* Make EvalUtils.getDataTypeNameFromClass() look for @SkylarkModules in parent ↵Gravatar Jon Brandvein2016-10-12
| | | | | | | | | classes This is needed to let subclasses of @SkylarkModules have the same type() string as their superclass, without requiring a second annotation for the subclass. -- MOS_MIGRATED_REVID=135814343
* Rollback of commit 9c25afe750a937b2152c21a93effc8b9ba82c27b.Gravatar Ulf Adams2016-10-11
| | | | | | | | | | | | | | | *** Reason for rollback *** Seems to break some parts of aspects. *** Original change description *** Make EvalUtils.getDataTypeNameFromClass() look for @SkylarkModules in parent classes This is needed to let subclasses of @SkylarkModules have the same type() string as their superclass, without requiring a second annotation for the subclass (which would lead to redundant documentation being generated). -- MOS_MIGRATED_REVID=135786137
* Make EvalUtils.getDataTypeNameFromClass() look for @SkylarkModules in parent ↵Gravatar Jon Brandvein2016-10-05
| | | | | | | | | classes This is needed to let subclasses of @SkylarkModules have the same type() string as their superclass, without requiring a second annotation for the subclass (which would lead to redundant documentation being generated). -- MOS_MIGRATED_REVID=135161653
* Disallow mutation of values being iterated by a for loop or comprehensionGravatar Jon Brandvein2016-09-28
| | | | | | | | | This entails adding a read-locking mechanism to Mutability contexts. RELNOTES[INC]: Updating list/dicts while they are being looped over is not allowed. Use an explicit copy if needed ("for x in list(mylist):"). -- MOS_MIGRATED_REVID=134442701
* Make SkylarkClassObject "Bazel-specific".Gravatar Dmitry Lomov2016-08-05
| | | | | | | This in preparation to DeclaredProviders implementation. -- MOS_MIGRATED_REVID=129420617
* Simplify immutability testGravatar Jon Brandvein2016-07-29
| | | | | -- MOS_MIGRATED_REVID=128800280
* Reinstate mutable maps, again.Gravatar Francois-Rene Rideau2016-02-17
| | | | | -- MOS_MIGRATED_REVID=114860576
* Rollback of commit f941d56acfad5f8c819c81b494f806ea74ea7fd8.Gravatar Carmi Grushko2016-02-02
| | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks many targets, see [] *** Original change description *** Reinstate mutable SkylarkDict Add <String, Object> annotation to optionMap invocation in SkylarkAttr, to make JDK 1.7 happy. Give the visible name "aspect" to class SkylarkAspect. -- MOS_MIGRATED_REVID=113543873
* Reinstate mutable SkylarkDictGravatar Francois-Rene Rideau2016-02-01
| | | | | | | | | | Add <String, Object> annotation to optionMap invocation in SkylarkAttr, to make JDK 1.7 happy. Give the visible name "aspect" to class SkylarkAspect. -- MOS_MIGRATED_REVID=113394826
* Rollback of commit c0a8c58b9230a1f5d76269eb7dc6b11e18f19686.Gravatar Damien Martin-Guillerez2016-01-29
| | | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Break Java 1.7 builds of Bazel. See http://ci.bazel.io/job/Bazel/JAVA_VERSION=1.7,PLATFORM_NAME=linux-x86_64/327/console Test: git clone ... && git revert c0a8c58 && export JAVA_VERSION=1.7 && export BAZEL_COMPILE_TARGET=compile && bash -c "source scripts/ci/build.sh; bazel_build" *** Original change description *** Make Skylark dicts mutable Represent Skylark dict using a new subclass SkylarkDict<K, V> of Map<K, V>. Back it with a TreeMap to provide a deterministic iteration order. Also make SkylarkList generic in its element type <E>. Have Artifact implement Comparable<Object> so it can be used as TreeMap key. -- MOS_MIGRATED_REVID=113359718
* Make Skylark dicts mutableGravatar Francois-Rene Rideau2016-01-29
| | | | | | | | | | Represent Skylark dict using a new subclass SkylarkDict<K, V> of Map<K, V>. Back it with a TreeMap to provide a deterministic iteration order. Also make SkylarkList generic in its element type <E>. Have Artifact implement Comparable<Object> so it can be used as TreeMap key. -- MOS_MIGRATED_REVID=113277489
* Make SkylarkList a List.Gravatar Francois-Rene Rideau2016-01-22
| | | | | | | | | | | | | | | SkylarkList now implements the List interfaces, except that its mutating methods throw an UnsupportedOperationException, just like ImmutableList does. To actually mutate a SkylarkList, you need to pass a Location and a suitable Environment object with a matching Mutability while it is still active. Introduce SkylarkMutable and SkylarkMutable.MutableCollection to better handle mutable data structures. Remove some functions in EvalUtils made obsolete by this and previous changes regarding Skylark lists. -- MOS_MIGRATED_REVID=112768457
* Fix small mistakes in some comments.Gravatar Francois-Rene Rideau2016-01-07
| | | | | -- MOS_MIGRATED_REVID=111530554
* Make unsafe list methods non-publicGravatar Laurent Le Brun2015-12-28
| | | | | -- MOS_MIGRATED_REVID=110838816
* Move annotation classes used for referencing framework Java classes from ↵Gravatar John Field2015-12-16
| | | | | | | | | | | | | | Skylark into their own package. This allows, e.g., classes in the syntax package to access classes in the cmdline package without creating circular dependencies. While we're here: - Removed a couple of unused BUILD deps flagged in []. - Updated SkylarkRuleImplementationFunctionsTest to remove non-ASCII characters and clarify the intent of the test. -- MOS_MIGRATED_REVID=110360763
* Skylark: implemented all() and any()Gravatar Florian Weikert2015-12-16
| | | | | -- MOS_MIGRATED_REVID=110348607
* Skylark: implemented min() and max().Gravatar Florian Weikert2015-12-13
| | | | | -- MOS_MIGRATED_REVID=110025690
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Compile list literals to byte code.Gravatar Klaas Boesche2015-11-06
| | | | | -- MOS_MIGRATED_REVID=107231604
* Improve error message for select objects ('+' operator for incompatible types)Gravatar Laurent Le Brun2015-11-05
| | | | | -- MOS_MIGRATED_REVID=107131704
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Separate build-specific types and types inherent to Skylark.Gravatar Lukacs Berki2015-09-21
| | | | | -- MOS_MIGRATED_REVID=103374106
* Refactor SkylarkList to allow MutableListGravatar Francois-Rene Rideau2015-09-21
| | | | | | | | Make SkylarkList no longer read-only to match Python and the BUILD language. Instead, subject it to a Mutability object inherited from the Environment. -- MOS_MIGRATED_REVID=103332973
* Cleanup Skylark types some moreGravatar Francois-Rene Rideau2015-09-17
| | | | | | | | | | | Clarify the criterion for being a valid Skylark value; stop claiming immutability is "the" criterion when Skylark now has mutable values; stop relying on a reflection with a magic list (this also fixes the SkylarkShell build). Clarify the criterion for determining immutable types when making a SkylarkNestedSet. Clarify and use the criterion for being a valid Skylark dict key. -- MOS_MIGRATED_REVID=103313934
* Create an abstraction for user defined data types in Skylark.Gravatar Lukacs Berki2015-09-17
| | | | | | | This will be used to remove Blaze-specific data types, FilesetEntry, Label and GlobList from the .syntax package. -- MOS_MIGRATED_REVID=103281375
* 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
* Improved error messages for builtin Skylark functions that are invoked with ↵Gravatar Florian Weikert2015-08-12
| | | | | | | invalid arguments. -- MOS_MIGRATED_REVID=100386706
* Changes related to the order of Skylark dictionaries:Gravatar Florian Weikert2015-08-04
| | | | | | | | | - Objects of different types can now be compared. - Printer now prints dictionaries in a deterministic order, even when the keys have different types. - testEval() in EvaluationTestCases evaluates both expressions instead of comparing expression strings. Consequently, if a statement describes a collection, its order does no longer matter when doing the comparison. -- MOS_MIGRATED_REVID=99829458
* Implement Skylark function reprGravatar Francois-Rene Rideau2015-06-15
| | | | | | | | | | | | | | | | | Move printing code from EvalUtils to Printer. Rename functions in Printer: printValue becomes str or print, prettyPrintValue becomes repr or write, formatString becomes format, makeFormattable becomes strFormattable, prettyPrintValues becomes listString. write being self-sufficient is made the reference, and print is the one that is a wrapper around write, rather than the other way around, avoiding mutual recursion. -- MOS_MIGRATED_REVID=95897834
* The Order enum now supports the conversion of its values to and from strings.Gravatar Florian Weikert2015-06-10
| | | | | | | This functionality used to be part of SkylarkNestedSet. -- MOS_MIGRATED_REVID=95526136
* Skylark: fix escaping of backslashGravatar Francois-Rene Rideau2015-06-08
| | | | | | | | | | | Create a Printer class into which to eventually move all printing infrastructure currently in EvalUtils. For now, only move string escaping there. Fix the forgotten case of backslash. Allow any style of Python quotes, while we're at it, but keep using simple double-quote as the default. -- MOS_MIGRATED_REVID=95328052
* Simplification in EvalUtils.optionMapGravatar Laurent Le Brun2015-06-05
| | | | | -- MOS_MIGRATED_REVID=95106558
* Improve the way a FuncallExpression is printed while debugging.Gravatar Francois-Rene Rideau2015-05-18
| | | | | -- MOS_MIGRATED_REVID=93908545
* Skylark: type of None is NoneType (instead of None), for consistency with ↵Gravatar Laurent Le Brun2015-05-08
| | | | | | | Python. -- MOS_MIGRATED_REVID=93120393
* Remove old Skylark Function hierarchyGravatar Francois-Rene Rideau2015-04-23
| | | | | | | Last step in refactoring of Skylark builtin functions. -- MOS_MIGRATED_REVID=91796746
* Define a reusable comparator for Skylark objects.Gravatar Laurent Le Brun2015-04-16
| | | | | -- MOS_MIGRATED_REVID=91304912