Commit Graph

31 Commits

Author SHA1 Message Date
Daniel Mensinger c48b0dea27
types: Annotate ast/interpreter.py 2020-03-02 10:34:55 +01:00
Daniel Mensinger a75255bc4c
types: Annotate the AST visitors 2020-03-02 10:34:55 +01:00
Daniel Mensinger fc800a2cb8 mintro: Add version key to --scan-dependencies (fixes #6287) 2019-12-10 20:17:21 +02:00
Wolfgang Stöggl f037e7ef45 Fix typos found by codespell
- Typos were found by codespell v1.16.0
2019-11-06 09:55:30 -05:00
Daniel Mensinger b72b5365af mintro: Fix crash related to the sources kwarg (fixes #5741) 2019-07-31 00:30:17 +03:00
John Ericson 07777e15d4 Purge `is_cross` and friends without changing user interfaces
In most cases instead pass `for_machine`, the name of the relevant
machines (what compilers target, what targets run on, etc). This allows
us to use the cross code path in the native case, deduplicating the
code.

As one can see, environment got bigger as more information is kept
structured there, while ninjabackend got a smaller. Overall a few amount
of lines were added, but the hope is what's added is a lot simpler than
what's removed.
2019-06-09 13:13:25 -04:00
Daniel Mensinger cacc585b44 ast: fix #5376 2019-05-13 02:48:35 +03:00
Daniel Mensinger e75211d321
Fix builtin variable names 2019-04-29 12:17:40 +02:00
Daniel Mensinger bf98ffca9e
Fix blind exceptions 2019-04-29 12:16:06 +02:00
Daniel Mensinger 2bb4ec19f2
ast: resolve ID nodes in flatten_args 2019-04-23 09:10:42 +02:00
Dylan Baker add821db64 Don't use mutable types as default arguments
This isn't safe given the way python implements default arguments.
Basically python store a reference to the instance it was passed, and
then if that argument is not provided it uses the default. That means
that two calls to the same function get the same instance, if one of
them mutates that instance every subsequent call that gets the default
will receive the mutated instance. The idiom to this in python is to use
None and replace the None,

def in(value: str, container: Optional[List[str]]) -> boolean:
   return src in (container or [])

if there is no chance of mutation it's less code to use or and take
advantage of None being falsy. If you may want to mutate the value
passed in you need a ternary (this example is stupid):

def add(value: str, container: Optional[List[str]]) -> None:
    container = container if container is not None else []
    container.append(value)

I've used or everywhere I'm sure that the value will not be mutated by
the function and erred toward caution by using ternaries for the rest.
2019-04-23 02:03:19 +03:00
Daniel Mensinger 6da0df95c1
mintro: fix some interpreter crashes 2019-04-02 11:39:45 +02:00
Daniel Mensinger 1937bbafac
mintro: Fix crash when required is a function (closes #5177) 2019-04-02 11:21:05 +02:00
Daniel Mensinger e724fd5438
rewriter: Handle duplicate target 2019-03-04 13:00:29 +01:00
Daniel Mensinger 586ec5a28c
intro: Fixed code after rebase 2019-03-03 23:23:50 +01:00
Daniel Mensinger f9b41d5ecb
mintro: Dependencies from source 2019-03-03 23:19:03 +01:00
Daniel Mensinger 8a1411a1e8
Target introspection from source 2019-03-03 23:19:03 +01:00
Daniel Mensinger 7f9fb6a084 rewriter: Minor code cleanup 2019-03-03 20:25:07 +02:00
Daniel Mensinger bd5d54513c rewriter: Handle Arithmetic node 2019-03-03 20:25:07 +02:00
Daniel Schulte f0b0bcf86d mintro: Add subproject_dir to --projectinfo 2019-03-01 23:40:33 +02:00
Daniel Mensinger 4bf1a352cc mconf: Fixed crash for variables in targets (closes #4960) 2019-02-26 18:40:45 +02:00
Daniel Mensinger 24a2cf02e2
Can now find the assignment node of a value 2019-02-16 14:10:08 +01:00
Jussi Pakkanen 939b011114
Merge pull request #4858 from mensinda/rwKWARGS
rewriter: Add support for kwargs modification
2019-02-16 14:17:49 +02:00
Dylan Baker 5b896ed70b allow setting directory locations in a native file
This allows the person running configure (either a developer, user, or
distro maintainer) to keep a configuration of where various kinds of
files should end up.
2019-02-11 12:50:32 -08:00
Daniel Mensinger 8c364952af
Added dependecy kwargs support 2019-01-31 15:57:02 +01:00
Daniel Mensinger 5655865246
Added test case 2019-01-31 15:43:04 +01:00
Daniel Mensinger 8224ecfbe6
Some fixes and assignment based target find 2019-01-31 15:43:04 +01:00
Daniel Mensinger 6fe2c2b209
Fixed flake8 issues 2019-01-22 17:31:15 +01:00
Daniel Mensinger 86d5799bc4
First rewriter test case 2019-01-22 16:41:06 +01:00
Daniel Mensinger 08da3873dd
Added target AST Interpreter support 2019-01-22 16:09:35 +01:00
Daniel Mensinger 750af9c853
Moved the introspection interpreter 2019-01-22 16:09:34 +01:00