aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/LValue.java
Commit message (Collapse)AuthorAge
* 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
* Remove syntactic sugar when assigning to a dict item.Gravatar Laurent Le Brun2016-01-07
| | | | | | | | | | | | | | e.g. a['key'] = value is handled through a proper lvalue, instead of using syntactic sugar. Benefits include: - better error messages (reference to the '+' operator was cryptic) - more robust, e.g. it is compatible with the += operator - can be used in a tuple, e.g. a[1], a[2] = 3, 4 - it is a step towards mutable dict -- MOS_MIGRATED_REVID=111597545
* Cleanup, code simplification, remove env.isSkylarkGravatar Laurent Le Brun2015-12-28
| | | | | -- MOS_MIGRATED_REVID=110836326
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Compile function call expressions.Gravatar Florian Weikert2015-11-10
| | | | | | | Mostly reuses the interpreters argument checking and helper functions. -- MOS_MIGRATED_REVID=107395974
* Compile assignments to byte code and throw errors.Gravatar Florian Weikert2015-11-10
| | | | | | | | Add EvalExceptions for cases in which the interpreter would throw them during evaluation of the function definition. -- MOS_MIGRATED_REVID=107376021
* 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
* Refactor Skylark Environment-sGravatar Francois-Rene Rideau2015-09-11
| | | | | | | | | | | | | | | | | | | | 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 create... This reinstates a change that previously rolled-back because it broke the serializability of SkylarkLookupValue. Bad news: serializing it succeeds for the wrong reason, because a SkylarkEnvironment was stored as a result (now an Environment.Extension) that was Serializable but inherited its bindings from an Environment (now an Environment.BaseExtension) which wasn't Serializable. Apparently, Java doesn't try to serialize the bindings then (or at least doesn't error out when it fails), because these bindings map variable names to pretty arbitrary objects, and a lot of those we find in practice aren't Serializable. Thus the current code passes the same tests as the previous code, but obviously the serialization is just as ineffective as it used to be. -- MOS_MIGRATED_REVID=102776694
* Rollback of commit 5a94e59f02833f9142bad9203acd72626b089535.Gravatar Janak Ramakrishnan2015-09-08
| | | | | | | | | *** Reason for rollback *** Breaks serialization of SkyValues. -- MOS_MIGRATED_REVID=102457225
* 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
* Rename isSkylarkEnabled to isSkylarkGravatar Francois-Rene Rideau2015-08-26
| | | | | -- MOS_MIGRATED_REVID=101518833
* Renamed Ident to Identifier, added some helper methods and refactored two ↵Gravatar Florian Weikert2015-07-23
| | | | | | | methods. -- MOS_MIGRATED_REVID=98922811
* Skylark: Allow variable reassignment to change the type of a variable.Gravatar Laurent Le Brun2015-06-18
| | | | | -- MOS_MIGRATED_REVID=96211360
* Skylark: support %r format specifierGravatar Francois-Rene Rideau2015-06-17
| | | | | | | | Refactor the implementation of format. Add %r. Improve some error messages. -- MOS_MIGRATED_REVID=96154542
* 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
* Allow if filtering in list comprehensionsGravatar Laurent Le Brun2015-05-18
| | | | | -- MOS_MIGRATED_REVID=93881507
* Skylark: Remove static type checking of variables/functions.Gravatar Laurent Le Brun2015-04-13
| | | | | | | | There are still some static checks (check existence of variable/function, readonly variables, etc.). More cleanup will come later. -- MOS_MIGRATED_REVID=90979748
* Simplify Skylark testsGravatar Francois-Rene Rideau2015-04-13
| | | | | | | | | | | | | | | | | | Use the new EvaluationContext infrastructure to simplify Skylark tests (said infrastructure is originally based on code from these tests). Merge AbstractEvaluationTestCase and AbstractParserTestCase into a non-abstract class EvaluationTestCase that uses EvaluationContext. Cleanup the EventCollectionApparatus it uses. Refactor all Skylark tests to use this new infrastructure. Fix EvaluationTest and MethodLibraryTest to actually and correctly run tests in both modes. Fix small bugs in the main code base discovered by actually running the code in both modes, and make error messages identical when possible. -- MOS_MIGRATED_REVID=90828053
* Enable support for multiple variable assignments.Gravatar Laurent Le Brun2015-03-23
| | | | | | | | | | This happens in for loops, list comprehensions and simple assigment. e.g. a, b = expr [a for a, b in expr] -- MOS_MIGRATED_REVID=89123977
* Skylark: Use LValue class in loops and comprehensions.Gravatar Laurent Le Brun2015-03-20
| | | | | -- MOS_MIGRATED_REVID=89020190
* Refactoring: Introduce a new class LValue.Gravatar Laurent Le Brun2015-03-20
This CL is just moving code from AssignmentStatement to a new class. The goal is to share code dealing with LValues. LValues can be found here: - lvalue = 2 - [for lvalue in exp] - {a: b for lvalue in exp] - for lvalue in exp: pass The LValue itself can have different forms: - a - a, b - a[0] - a, (b, c) - [a[0], (b, c)] - a[1:5] Although we may not handle everything, we need to make sure that the same things can be used in variable assignment and in for loops. -- MOS_MIGRATED_REVID=89015483