aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax
Commit message (Collapse)AuthorAge
* Rollback of commit 01120026dc313ee7ad9ea95069a29252eb19173b.Gravatar Jon Brandvein2017-03-01
| | | | | | -- PiperOrigin-RevId: 148888469 MOS_MIGRATED_REVID=148888469
* Export exportable values as we go instead of at the end of evaluation.Gravatar Dmitry Lomov2017-03-01
| | | | | | | | | This simplifies implementation of attr.* functions and helps make declared provider implementation simpler. -- PiperOrigin-RevId: 148867326 MOS_MIGRATED_REVID=148867326
* Update depset constructor/method docsGravatar Jon Brandvein2017-02-27
| | | | | | -- PiperOrigin-RevId: 148469323 MOS_MIGRATED_REVID=148469323
* Add more depset documentationGravatar Jon Brandvein2017-02-27
| | | | | | | | | | Updated class doc, added examples to depsets.md. Constructor/method doc updates will be a follow-up CL. -- PiperOrigin-RevId: 148463032 MOS_MIGRATED_REVID=148463032
* Add the LABEL_KEYED_STRING_DICT type for attributes.Gravatar Michael Staib2017-02-24
| | | | | | | | | This enables both native and Skylark rules to declare attributes which have labels/Targets as keys, and have string values. -- PiperOrigin-RevId: 148365033 MOS_MIGRATED_REVID=148365033
* str.partition and str.rpartition return tuples instead of listsGravatar Vladimir Moskva2017-02-23
| | | | | | -- PiperOrigin-RevId: 148281228 MOS_MIGRATED_REVID=148281228
* Use skylark-preferred quote char for string literalGravatar Michajlo Matijkiw2017-02-23
| | | | | | | | | | We currently have no need to discern between strings quoted with ' or ". While it could be nice for something one day (and may have been in the past), it's yagni now. Removing the distinction simplifies string concatenation. -- PiperOrigin-RevId: 148273400 MOS_MIGRATED_REVID=148273400
* Make Expression.eval() public.Gravatar Carmi Grushko2017-02-23
| | | | | | -- PiperOrigin-RevId: 148244816 MOS_MIGRATED_REVID=148244816
* Augmented assignments don't evaluate lhs multiple timesGravatar Vladimir Moskva2017-02-21
| | | | | | -- PiperOrigin-RevId: 148092963 MOS_MIGRATED_REVID=148092963
* parseBuildString doesn't crash on files with hash lines.Gravatar Carmi Grushko2017-02-21
| | | | | | -- PiperOrigin-RevId: 148042501 MOS_MIGRATED_REVID=148042501
* Raise error in function calls when star argument is not iterableGravatar Laurent Le Brun2017-02-20
| | | | | | | | This was a bug, f(*4) was silently handled as f(). -- PiperOrigin-RevId: 148017021 MOS_MIGRATED_REVID=148017021
* Update doc wrt set vs depset.Gravatar Laurent Le Brun2017-02-20
| | | | | | -- PiperOrigin-RevId: 147908180 MOS_MIGRATED_REVID=147908180
* Add missing fall through commentGravatar Liam Miller-Cushon2017-02-20
| | | | | | -- PiperOrigin-RevId: 147892584 MOS_MIGRATED_REVID=147892584
* Do not sort dict keys when printingGravatar Vladimir Moskva2017-02-17
| | | | | | | | | | Dict keys can in theory belong to different types, it's not allowed anymore to compare such objects by < in Skylark, so the Printer class shouldn't do it either. -- PiperOrigin-RevId: 147827109 MOS_MIGRATED_REVID=147827109
* Make unnecessarily public BinaryOperationExpression methods privateGravatar Michajlo Matijkiw2017-02-17
| | | | | | | | | The reasons for these being public are outdated. Hide them so that no one gets too attached. -- PiperOrigin-RevId: 147739764 MOS_MIGRATED_REVID=147739764
* Minor code cleanupGravatar Laurent Le Brun2017-02-16
| | | | | | | | Inlining the function makes the code more readable. -- PiperOrigin-RevId: 147711468 MOS_MIGRATED_REVID=147711468
* Disallow comparison of objects of different types in SkylarkGravatar Vladimir Moskva2017-02-16
| | | | | | | | | | RELNOTES[INC]: It's not allowed anymore to compare objects of different types (i.e. a string to an integer) and objects for which comparison rules are not defined (i.e. a dict to another dict) using order operators. -- PiperOrigin-RevId: 147710942 MOS_MIGRATED_REVID=147710942
* Generate documentation for bool and int types.Gravatar Laurent Le Brun2017-02-15
| | | | | | | | | This improves consistency in the documentation (string and list already have their own page). -- PiperOrigin-RevId: 147599068 MOS_MIGRATED_REVID=147599068
* Clarify documentation of PACKAGE_NAMEGravatar Laurent Le Brun2017-02-15
| | | | | | -- PiperOrigin-RevId: 147517743 MOS_MIGRATED_REVID=147517743
* BuildFileAST.eval() doesn't execute the code when there's a static error.Gravatar Laurent Le Brun2017-02-15
| | | | | | | | | | | This has no visible effect on Bazel (eval is used just for internal expressions that don't fail), and is therefore not tested. It will be tested when we add tests to the standalone Skylark interpreter. -- PiperOrigin-RevId: 147495990 MOS_MIGRATED_REVID=147495990
* Refactoring: Types report what class of labels they contain.Gravatar Michael Staib2017-02-14
| | | | | | | | | | | | | | | | | | | | | Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do exotic things based on the type. But most sites can avoid having to enumerate all the types they work with explicitly. This causes LABEL_DICT_UNARY to start being treated like the other label types, which means that CcToolchainSuiteRule and JavaRuntimeSuiteRule need to include a set of allowed file types (none, in their case). Skylark will continue treating it as a dictionary from String to Label in its rule context, however, to avoid visible behavior changes. -- PiperOrigin-RevId: 147471542 MOS_MIGRATED_REVID=147471542
* Fix the documentation of set/depsetGravatar Vladimir Moskva2017-02-14
| | | | | | -- PiperOrigin-RevId: 147456653 MOS_MIGRATED_REVID=147456653
* Rollback of commit cdbad585187dfe7bbb4d69ad68a1baf852beb691.Gravatar Michael Staib2017-02-14
| | | | | | | | | | | | | | | | | | | | | | *** Reason for rollback *** Breaks Skylark aspects running over rules with LABEL_DICT_UNARY attributes. *** Original change description *** Refactoring: Types report what class of labels they contain. Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do... -- PiperOrigin-RevId: 147385072 MOS_MIGRATED_REVID=147385072
* Refactoring: Types report what class of labels they contain.Gravatar Michael Staib2017-02-13
| | | | | | | | | | | | | | | | | | | Currently label-type attributes are detected in many places across the codebase by simply reference-comparing against each of the label types. This CL aims to generalize most of these cases, moving the encoding of this logic into a single place (Type/BuildType itself). Not all of these cases can be made general without further refactoring, and some perhaps shouldn't be - serialization and Skylark rule context, for example, need to do exotic things based on the type. But most sites can avoid having to enumerate all the types they work with explicitly. This causes LABEL_DICT_UNARY to start being treated like the other label types, which means that CcToolchainSuiteRule and JavaRuntimeSuiteRule need to include a set of allowed file types (none, in their case). -- PiperOrigin-RevId: 147175424 MOS_MIGRATED_REVID=147175424
* Fix int*list binary operator.Gravatar Laurent Le Brun2017-02-09
| | | | | | | | [2] * 3 should return [2, 2, 2] and not [2, 2, 2, 2]. -- PiperOrigin-RevId: 147017581 MOS_MIGRATED_REVID=147017581
* Wrong description for String.hashCode(). Gravatar Chaoren Lin2017-02-06
| | | | | | | | | Closes #2484. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/2484 PiperOrigin-RevId: 146687145 MOS_MIGRATED_REVID=146687145
* Add type checking to select() keys.Gravatar Greg Estren2017-02-01
| | | | | | | | | Aside from making error messaging clearer, this stops Bazel from crashing on select({None: ...}) (a pretty anti-social error message). -- PiperOrigin-RevId: 146173043 MOS_MIGRATED_REVID=146173043
* Change depset conversion to stringsGravatar Vladimir Moskva2017-01-30
| | | | | | | | | | RELNOTES[INC]: Depsets (former sets) are converted to strings as "depset(...)" instead of "set(...)". -- PiperOrigin-RevId: 145990995 MOS_MIGRATED_REVID=145990995
* Update dict docsGravatar Jon Brandvein2017-01-30
| | | | | | -- PiperOrigin-RevId: 145859025 MOS_MIGRATED_REVID=145859025
* Update print() doc to admonish use in production codeGravatar Jon Brandvein2017-01-30
| | | | | | -- PiperOrigin-RevId: 145792618 MOS_MIGRATED_REVID=145792618
* 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
* Add new names for depset traversal ordersGravatar Jon Brandvein2017-01-20
| | | | | | | | | | The old names are deprecated but still supported for now. A flag for enforcing the deprecation will come in a later change. RELNOTES[INC]: The traversal orders for depsets have been renamed. The old names are deprecated and will be removed in the future. New names: "stable" -> "default", "compile" -> "postorder", "link" -> "topological", "naive_link" -> "preorder". -- PiperOrigin-RevId: 145004718 MOS_MIGRATED_REVID=145004718
* Refactor a traversal over @SkylarkModule ancestorsGravatar Jon Brandvein2017-01-19
| | | | | | -- PiperOrigin-RevId: 144890965 MOS_MIGRATED_REVID=144890965
* Make frame bindings use LinkedHashMap for determinismGravatar Jon Brandvein2017-01-19
| | | | | | | | | This matters when the same rule (or other exportable) is bound to multiple variables, since the identifier of the first variable will become its name. -- PiperOrigin-RevId: 144881310 MOS_MIGRATED_REVID=144881310
* Require parens around tuple with trailing comma.Gravatar Laurent Le Brun2017-01-17
| | | | | | | | | | RELNOTES[INC]: Tuples that end with a trailing comma must now be inside parens, e.g. (1,) instead of 1, -- PiperOrigin-RevId: 144690953 MOS_MIGRATED_REVID=144690953
* Adding Java compilation to java_lite_proto_library Skylark version.Gravatar Irina Iancu2017-01-16
| | | | | | -- PiperOrigin-RevId: 144608820 MOS_MIGRATED_REVID=144608820
* Add a to_list() method to depsetsGravatar Jon Brandvein2017-01-16
| | | | | | | | | | | | This is the preferred way to test for membership in, or iterate over, depsets (aka nested sets, aka plain old set()). The old way of doing membership tests or iterations over the raw depset itself is deprecated and may be removed in the future. Note that membership testing in a depset was always an O(n) operation, perhaps contrary to the user's expectation, so using to_list() does not make things asymptotically worse. It just makes things more explicit. RELNOTES: To iterate over or test for membership in a set, prefer using the new to_list() method. E.g., "for x in myset.to_list():", or "print(x in myset.to_list())". Iteration/membership-test on the raw set itself is deprecated. -- PiperOrigin-RevId: 144452510 MOS_MIGRATED_REVID=144452510
* Refactor SkylarkNestedSet type checks and testsGravatar Jon Brandvein2017-01-13
| | | | | | | | Moved some tests, fixed formatting, changed to use assertThat(). -- PiperOrigin-RevId: 144356402 MOS_MIGRATED_REVID=144356402
* Rollback of commit 0d1dc5537903a8c2ad56e66cee129b8f4d4e2592.Gravatar Pedro Liberal Fernandez2017-01-11
| | | | | | -- PiperOrigin-RevId: 144194956 MOS_MIGRATED_REVID=144194956
* Improve performance and semantics of union of Skylark setsGravatar Jon Brandvein2017-01-10
| | | | | | | | | | | | | | | | | | | | | | == Before this change == Previously, if a and b are sets, then a + b created a new set c whose direct and transitive elements were all those of a, and with b appended as an additional transitive element. If on the other hand b is a list instead of a set, then its contents were appended as additional direct elements of c. In both cases, you can think of c as a copy of a that also knows about b. This copying of a's elements into c can lead to accumulation when you do it repeatedly, e.g. x += y in a loop. Each union can take O(n) time so you get O(n^2) time overall. Nested set union is supposed to be O(1) time per operation and O(n) time overall. It also leads to surprising iteration orders. If you do a + b + c + d (left-associative), where each one is a set, then when you do a post-order traversal you get the elements of b, c, d, and a, in that order. This is because b, c, and d each get appended as transitive children of the copies of a. == After this change == If a and b are sets, then a + b returns a new set c with a and b as its two transitive children. If b is a list, then c has a as its only transitive child and b's elements as its only direct elements. This is straightforward, O(1), and avoids the problem with the confusing order. It is implemented by removing the items/transitiveItems fields and just relying on NestedSetBuilder. RELNOTES[INC]: (Skylark) Set union is now O(1). As a side-effect, the iteration order of sets produced by union has changed. "print(set([1]) + set([2]) + set([3]))" will now give back the order 1, 2, 3 instead of 2, 3, 1. -- PiperOrigin-RevId: 143972165 MOS_MIGRATED_REVID=143972165
* Minor improvements to error messages.Gravatar Laurent Le Brun2017-01-04
| | | | | | | | In case of conflict, show the location of the original rule. -- PiperOrigin-RevId: 143541281 MOS_MIGRATED_REVID=143541281
* Manually add periods to documentation strings where needed.Gravatar John Cater2017-01-03
| | | | | | | | -- Change-Id: I9ec3209a69ba5a51943b334f278ba93d67d4f9f4 Reviewed-on: https://cr.bazel.build/8090 PiperOrigin-RevId: 143470915 MOS_MIGRATED_REVID=143470915
* Make the string strip() methods compatible with PythonGravatar Jon Brandvein2017-01-03
| | | | | | | | | | | | | | strip(), lstrip(), and rstrip() now accept a None argument as a synonym for the no-arg version. The characters that are considered as whitespace (to be removed by default in the no-arg form) are now the same as in Python 3.6. RELNOTES[INC]: The string methods strip(), lstrip(), and rstrip() now by default remove the same whitespace characters as Python 3 does, and accept None as an argument. -- PiperOrigin-RevId: 143388250 MOS_MIGRATED_REVID=143388250
* Add 'did you mean' suggestion for load() statements.Gravatar Laurent Le Brun2017-01-03
| | | | | | -- PiperOrigin-RevId: 143381556 MOS_MIGRATED_REVID=143381556
* Add 'did you mean' suggestion when accessing a struct fieldGravatar Laurent Le Brun2017-01-03
| | | | | | -- PiperOrigin-RevId: 143380643 MOS_MIGRATED_REVID=143380643
* Add 'did you mean' suggestion when accessing an undefined variable.Gravatar Laurent Le Brun2017-01-03
| | | | | | -- PiperOrigin-RevId: 143373605 MOS_MIGRATED_REVID=143373605
* Cleanup in error messages, try to improve consistency.Gravatar Laurent Le Brun2017-01-03
| | | | | | -- PiperOrigin-RevId: 143204724 MOS_MIGRATED_REVID=143204724
* Make depsets temporarily completely backward compatibleGravatar Vladimir Moskva2016-12-27
| | | | | | | | | `str(depset(...))` should return "set(...)" for now as some of the existing code may rely on it. -- PiperOrigin-RevId: 143014369 MOS_MIGRATED_REVID=143014369
* 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