aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast
AgeCommit message (Collapse)AuthorFilesLines
2020-08-01Put machine file and cmd line parsing in EnvironmentDylan Baker1-1/+1
This creates a full set of option in environment that mirror those in coredata, this mirroring of the coredata structure is convenient because lookups int env (such as when initializing compilers) becomes a straight dict lookup, with no list iteration. It also means that all of the command line and machine files are read and stored in the correct order before they're ever accessed, simplifying the logic of using them.
2020-05-23ast: Handle NotNodeDaniel Mensinger1-0/+5
2020-05-23ast: Add AST JSON printerDaniel Mensinger3-4/+162
2020-03-19interpreterbase: Add warning when built-in object method has no kwargsXavier Claessens1-5/+6
2020-03-08Merge pull request #6736 from dcbaker/mesonlib-type-annotationsJussi Pakkanen1-2/+2
Mesonlib type annotations
2020-03-06ast: Implement dummy evaluate_notstatementDaniel Mensinger1-0/+5
2020-03-06ast: Do not resolve dict keysXavier Claessens1-1/+1
Fixes: #6748
2020-03-05mesonbuild/mesonlib: Add type annotationsDylan Baker1-2/+2
2020-03-02types: Remove redundant __init__() -> None annotationDaniel Mensinger5-8/+8
2020-03-02types: Use import typing as TDaniel Mensinger2-26/+26
2020-03-02review: Initial fixupDaniel Mensinger1-5/+5
2020-03-02types: Annotate ast/introspection.pyDaniel Mensinger2-48/+60
2020-03-02types: (partially) annotate interpreterbase.pyDaniel Mensinger1-13/+21
This commit annotates most of interpreterbase.py. However, there are stil the @wraps missing, since I am unsure what the types are supposed to be here.
2020-03-02types: Annotate ast/interpreter.pyDaniel Mensinger2-42/+49
2020-03-02types: Annotate the AST visitorsDaniel Mensinger5-89/+87
2020-03-02types: Annotate mparser.pyDaniel Mensinger2-6/+11
This also fixes that the keys in ArgumentNode.kwargs are all of the type BaseNode now. Before this commit, it was possible that both strings and Nodes where used as keys.
2020-02-28Store filename in node locationJon Turney1-1/+1
Warnings have a location node object (with subdir and lineno attributes), which is passed as a location: kwarg to mlog.warning() and formatted in _log_error(). Re-purpose the subdir attribute (path relative to the source root dir, with an implied filename of 'meson.build'), which is stored into the node by parser(), to contain a pathname. (Properly I should rename 'subdir' -> 'file' everywhere, but that's a lot of churn just to see if this works) Notes: The warning location node may also have a colno attribute, which is currently ignored by _log_error(). We can't currently issue warnings with locations in meson_options.txt because the filename isn't part of the location (as it's assumed to be 'meson.build).
2020-02-28Adjust all the other places MesonException file attribute is setJon Turney1-1/+1
A MesonException has file, lineno and colno attributes, which get formatted as a location in mlog.exception(). The file attribute got changed from a path relative to the root source directory to a pathname (absolute or relative to cwd) in one place in commit b8fbbf59. Adjust all the other places the file attribute is set to match. Also: Setting MesonException.file seems to be missing in the case where Parser returned a non-CodeBlockNode object. Fortunately, that looks like it's unreachable, but add it just in case.
2020-01-08types: import typing as T (fixes #6333)Daniel Mensinger1-5/+5
2019-12-12Add a summary() function for configuration summarizationXavier Claessens1-0/+1
Based on patch from Dylan Baker. Fixes #757
2019-12-10mintro: Add version key to --scan-dependencies (fixes #6287)Daniel Mensinger1-1/+6
2019-12-10assert(): Make message argument optionalXavier Claessens1-2/+5
2019-11-06Fix typos found by codespellWolfgang Stöggl2-3/+3
- Typos were found by codespell v1.16.0
2019-09-04mintro: Fix resolving nodes in kwargs (fixes #5884)Daniel Mensinger1-42/+66
2019-08-12Add is_disabler functionJames Hilliard1-0/+1
This is useful if one needs to check if a variable is a disabler. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2019-07-31mintro: Fix crash related to the sources kwarg (fixes #5741)Daniel Mensinger2-3/+7
2019-07-11Merge pull request #5606 from xclaesse/alias_targetJussi Pakkanen1-0/+1
Add alias_target() function
2019-07-10Add alias_target() functionXavier Claessens1-0/+1
2019-06-28ast: printer fix index node printingDaniel Mensinger2-1/+3
2019-06-09Purge `is_cross` and friends without changing user interfacesJohn Ericson1-7/+8
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-05-13ast: fix #5376Daniel Mensinger2-3/+9
2019-04-29Fix flake8-bugbear warningsDaniel Mensinger1-2/+0
2019-04-29Fix builtin variable namesDaniel Mensinger1-3/+3
2019-04-29Fix blind exceptionsDaniel Mensinger1-1/+1
2019-04-25ast/printer: remove useless ternaryDylan Baker1-1/+1
The ternary returns True or False from an expression that returns True or False: i.e. True if bool(value) else False.
2019-04-23ast: Address code reviewDaniel Mensinger1-3/+7
2019-04-23make flake8 happyDaniel Mensinger1-1/+0
2019-04-23ast: Make sure to avoid infinite recursionsDaniel Mensinger1-9/+9
2019-04-23ast: support elementary object methodsDaniel Mensinger1-6/+40
2019-04-23ast: resolve simple arithmetic nodesDaniel Mensinger1-4/+29
2019-04-23ast: resolve ID nodes in flatten_argsDaniel Mensinger2-23/+27
2019-04-23Don't use mutable types as default argumentsDylan Baker2-4/+5
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-13mintro: Fix set_variable plus assign bug (closes #5256)Daniel Mensinger1-0/+1
2019-04-02mintro: fix some interpreter crashesDaniel Mensinger2-1/+27
2019-04-02mintro: Fix crash when required is a function (closes #5177)Daniel Mensinger1-0/+2
2019-03-04rewriter: Handle duplicate targetDaniel Mensinger2-5/+7
2019-03-03intro: Fixed code after rebaseDaniel Mensinger1-1/+1
2019-03-03mintro: Dependencies from sourceDaniel Mensinger3-1/+40
2019-03-03Target introspection from sourceDaniel Mensinger1-2/+4
2019-03-03rewriter: Minor code cleanupDaniel Mensinger1-12/+13