Commit Graph
100 Commits
Author SHA1 Message Date
Dave Halter e2ca11435c Script._goto improvements and documentation. 2014-09-03 17:27:26 +02:00
Dave Halter 95852f5e7f Clarify inner workings of Evaluator.goto 2014-09-03 14:58:24 +02:00
Dave Halter bcc84820fe Fix issues with unreachable flows.
This benefits static analysis as well as autocompletion: Unreachable code (things like code within 'if 0:') should still be resolveable.
2014-09-03 00:05:37 +02:00
Dave Halter ea5b98905e Make statement_elements_in_statement work with ListComprehensions, Lambdas and 'except foo as' expressions 2014-09-02 14:52:04 +02:00
Dave Halter 38c71fce3f Added tests for statement_elements_in_statement 2014-09-02 12:10:16 +02:00
Dave Halter f785aa26dd Additional helper methods, to find all the statement elements that are needed. 2014-09-02 03:26:17 +02:00
Dave Halter be9e77d7d3 Add a temporary api._names, to make it possible to annotate a full script with types. 2014-09-01 18:10:40 +02:00
Dave Halter bbf1070ad9 Add a helper function to list all name parts of a given module. 2014-09-01 13:20:01 +02:00
Dave Halter 76d91ba72a Rename fast_parent_copy to deep_ast_copy. 2014-08-22 00:59:46 +02:00
Dave Halter ed3b507ab7 cleanup 2014-08-22 00:47:08 +02:00
Dave Halter 6ba0b7b81e lower than/greater than operators evaluate to a boolean now. This is not a 100% correct, because it doesn't evaluate __gt__, etc. But that's ok for now. 2014-08-22 00:26:55 +02:00
Dave Halter 039a5ecaf9 Fix issues caused by KeywordStatement, which needs to be copied as well. 2014-08-21 16:51:00 +02:00
Dave Halter 0ef030848d refactor fast_parent_copy, use new_elements_default to hand in a dictionary, that contains all the generated duplicates. 2014-08-21 13:17:33 +02:00
Dave Halter 3cf8bfa8e1 Fix a few tests by either fixing the test cases or adding py__bool__ functions to objects that should have such a method. 2014-08-20 17:28:54 +02:00
Dave Halter f911050300 Rewrote the isistance implementation, so that it works properly with tuples as well as normal classes. 2014-08-20 16:58:19 +02:00
Dave Halter 2a964d4e48 Also implement the or operator. 2014-08-20 16:28:04 +02:00
Dave Halter 148d17b3be Implementation of the and operation. 2014-08-20 16:21:33 +02:00
Dave Halter d6dd7cd55e Move process_precedence_element from the Evaluator to the precedence module. 2014-08-20 15:59:37 +02:00
Dave Halter 9abc8a19e7 By adding a py__class__ method to CompiledObject and Class, we Jedi is able to understand isinstance checks, now.
This also includes a CheckAttribute class in evaluatue.compiled, because it's way easier to generalize the AttributeErrors there.
2014-08-20 14:46:18 +02:00
Dave Halter 0e66aef511 Use IterableWrapper in the iterable module to be able to add methods like is_class quickly. 2014-08-20 14:01:41 +02:00
Dave Halter 442a1a1d08 wrap some more values with er.wrap 2014-08-20 13:52:49 +02:00
Dave Halter c9542cbc04 Start implementing an is_class function that will determine if an object is a class or not in the future. 2014-08-20 11:43:25 +02:00
Dave Halter 7f874620db Start documenting all the py__foo__ methods 2014-08-20 11:31:23 +02:00
Dave Halter 2e949b43bb Ignore FunctionExecutions in old style isinstance checks for now, because it collides with new style isinstance checks. 2014-08-20 11:31:11 +02:00
Dave Halter 09ca47fa93 Introduce a dedicated isinstance function implementation. 2014-08-19 23:57:59 +02:00
Dave Halter 49163e135c flow_analysis test for isinstance as well as and/or operations. 2014-08-19 01:03:14 +02:00
Dave Halter 77673ba986 Add an optional param 'parent' to parser.representation.Simple, which simplifies some calls to that superclass. 2014-08-19 00:30:17 +02:00
Dave Halter 8bde89cc58 Fix the remaining issues with the StatementElement.next refactoring. 2014-08-19 00:12:14 +02:00
Dave Halter 8006d6f190 Change implementation of StatementElement.
Instead of having both next and execution as attributes, we now only have next, because it's an execution if there's an array.
2014-08-18 22:25:55 +02:00
Dave Halter 7619bf27d1 Simplify goto_definition in case it done on a function. 2014-08-18 15:00:14 +02:00
Dave Halter 00d15da143 refactor search_call_signatures. Now we don't need to set Call.next.parent in a strange way anymore and the whole thing seems to be more logical. 2014-08-18 14:51:38 +02:00
Dave Halter 542648f5a0 first step in refactoring call_signature_array_for_pos, use original_call as a param. 2014-08-18 13:39:01 +02:00
Dave Halter 9f38f10366 fix tests. Operators should not equal to other operators with a different position. or even parent. 2014-08-18 13:13:07 +02:00
Dave Halter 1d812c2414 Use the "wrong" parents again for next/execution in StatementElement. This is important for call_signature lookups. We might still be able to change this somewhere in time. 2014-08-18 11:22:38 +02:00
Dave Halter fd90dfc4f5 Use a LazyName for module attributes, they should only be generated if needed. 2014-08-15 15:20:40 +02:00
Dave Halter 868dab4f51 small debug change 2014-08-15 02:26:13 +02:00
Dave Halter 89ab0ba137 Fix fast_parent_copy. The caching is now more solid than before (and doesn't produce weird side effects. This also solves an issue with Lambdas. However, by fixing all of this we have broken some other things. 2014-08-15 01:55:43 +02:00
Dave Halter 1965469050 fast_parent_copy should also change the parent of NameParts. 2014-08-14 23:48:27 +02:00
Dave Halter 1f9e7ddff8 Remove code in the parser that didn't make sense. 2014-08-14 13:24:26 +02:00
Dave Halter 425290aa8f Fix an issue with partial keyword inputs. 2014-08-14 12:25:00 +02:00
Dave Halter 1540ac89f8 Implement the descriptor protocoll properly for instances. 2014-08-14 12:15:48 +02:00
Dave Halter f743619fb8 Tests for conditions in descriptors. 2014-08-13 14:49:42 +02:00
Dave Halter ec7b3bf433 refactor py_base to py__bases__, because that's the general naming schema 2014-08-13 14:34:37 +02:00
Dave Halter cd433adf84 Speedup object lookup even further in classes. 2014-08-13 14:17:57 +02:00
Dave Halter 9702c4cdc6 Restructure the way we get self arguments (probably reduces executions of object). 2014-08-13 14:07:09 +02:00
Dave Halter cf32e15f65 Remove the old 'is not' logic to detect if not instances and use them to do branch predictions. This is not necessary anymore, since we now support that in a more general way (flow_analysis). 2014-08-12 18:14:03 +02:00
Dave Halter eeac77d360 Also support the not operator. 2014-08-12 18:09:59 +02:00
Dave Halter 8ed89e8245 implement !=, ==, is, is not operators to work in if statements (they also work in in non if contexts and return a bool value.), includes tests. 2014-08-12 17:59:19 +02:00
Dave Halter 6f018e4884 introduce maybe_docstr in parse_statement, which should have been introduced way earlier. 2014-08-12 17:13:14 +02:00
Dave Halter fb1dba269a re-enable the interpretation of the None keyword 2014-08-12 14:38:56 +02:00
Dave Halter 469988be9c actually add tests for the flow analysis of variables. 2014-08-12 09:57:00 +02:00
Dave Halter 968bc45314 even tests should not suffer too much from side effects. 2014-08-12 01:46:07 +02:00
Dave Halter 6b7ce590fa Simplify get_parent_scope 2014-08-12 01:37:58 +02:00
Dave Halter 33e5a3280a Remove IsScope in favor of an is_scope function.
This function was partially implemented anway. Now we've also added a function called 'get_parent_scope', to make it easy to get a scope of a Call, Statement, whatever.
2014-08-12 01:19:19 +02:00
Dave Halter 1865284fa9 fix the interpreter (previously broken by flow analysis) 2014-08-12 00:19:20 +02:00
Dave Halter 242072976a use py__mro__ in a classes scope_names_generator 2014-08-11 23:53:45 +02:00
Dave Halter 526af7ccbe settings should not be affected by exceptions. 2014-08-11 17:27:40 +02:00
Dave Halter f1711f8f9c possible direction of branch checks for name resolution. 2014-08-10 13:17:37 +02:00
Dave Halter 483f5c14ee Listeneres should be removed even in exception cases. Do a 'finally' cleanup. 2014-08-07 16:27:57 +02:00
Dave Halter 01bdd1e4fa Test fixes and for loops need to be handled a awell in flow_analysis. 2014-08-07 15:51:41 +02:00
Dave Halter 0ae9e520c1 flow analysis working for elif statements (even in combination with else) 2014-08-07 15:18:30 +02:00
Dave Halter 743d064e6d exception while using else as a scope 2014-08-07 12:10:31 +02:00
Dave Halter ee65764c3a more complicated logic working with else 2014-08-07 12:02:08 +02:00
Dave Halter d94a70b524 fix a logic issue in the flow_analysis.Status.__and__ 2014-08-07 03:02:40 +02:00
Dave Halter b7151c1ef9 add a first flow analysis test 2014-08-06 23:35:30 +02:00
Dave Halter 138fa1b4de deletion of returns from SCOPE_CONTENTS was wrong. 2014-08-06 22:42:38 +02:00
Dave Halter e7e7bd29e8 fix generator tests (multiple yields must be called with an if random. 2014-08-06 12:45:38 +02:00
Dave Halter 23c39eff9a fix lambda issues 2014-08-06 12:40:08 +02:00
Dave Halter e3bb0ccc2e fix a keyword statement issue 2014-08-06 12:10:36 +02:00
Dave Halter 15ec0a77fe a first very simple implementation of reachable/unreachable return statements. 2014-08-05 17:02:16 +02:00
Dave Halter f5e49e3218 flow analysis preparation 2014-08-05 12:06:58 +02:00
Dave Halter c44168f7ad add a Flow.previous attribute to be able to access the if flow from an else clause. 2014-08-05 11:17:18 +02:00
Dave Halter 54dce0e3b2 fix strange issues of Python's std lib tokenizer, might be in there as well (not sure, cause I modified a lot). fixes #449 2014-08-04 16:47:36 +02:00
Dave Halter b2b4827ce3 moved test_token to test_tokenize 2014-08-04 16:25:33 +02:00
Dave Halter cba100a801 test for #414 which doesn't seem to be failing anymore. 2014-08-04 16:08:47 +02:00
Dave Halter 625e88e851 isinstance checks now also give you type hints in class contexts, fixes #241. 2014-08-04 02:11:30 +02:00
Dave Halter 0a0673e87c refactoring in dynamic param searching 2014-08-04 01:39:05 +02:00
Dave Halter 7bba12e8c5 comments 2014-08-03 23:00:32 +02:00
Dave Halter 6e5d80a6b2 builtins shouldn't be unique if called by compiled.create 2014-08-01 15:51:59 +02:00
Dave Halter 68cecad996 tests for py__mro__ 2014-08-01 15:50:18 +02:00
Dave Halter 2c0a46fafe Fix an issue with CallSignatures:
If used in a longer statement, it could happen that parts of the statement was still evaluated, but the call signature is only valid at the cursor.
2014-07-31 17:47:56 +02:00
Dave Halter 7b4a188948 fix a few small issues that remained in the tests 2014-07-31 17:34:35 +02:00
Dave Halter 59b8c6b015 CompiledObjects should execute everything when reading the return information from docstring (because it's always types, not values) 2014-07-31 17:16:24 +02:00
Dave Halter 332a16a27e elements in tuples/lists in docstrings were not executed. 2014-07-31 17:13:56 +02:00
Dave Halter d09279e0ad change tests that provided wrong instance information 2014-07-31 15:16:24 +02:00
Dave Halter 50fa3a732d actually start checking if the integration tests are instances on both sides of the comparison. This wasnt necessary for just autocompletion, but it's way more important now. 2014-07-31 14:58:32 +02:00
Dave Halter d899f69686 simplify a lot of the current InstanceElement behavior, because we know now, that there's either a Statement or a Function inside (or maybe some other parser objects like an Array. 2014-07-31 13:41:10 +02:00
Dave Halter 0fbd5efefd wrap instance element creation so that it only contains functions and statements, not CompiledObject or Instance. 2014-07-31 13:16:11 +02:00
Dave Halter 870abe73d4 Calling an InstanceElement of an Instance of CompiledObject doesn't raise an error anymore. Yes, it's really that complicated. 2014-07-30 19:49:41 +02:00
Dave Halter 0851e7667e A module shouldn't be callable. 2014-07-30 17:07:57 +02:00
Dave Halter 723d1e4631 Nicer usage of py_call within InstanceElement and Python 2.7 compatibility 2014-07-30 17:00:16 +02:00
Dave Halter 7cc35fe0b8 remove a very old function call in FunctionExecution that had no effect 2014-07-30 16:41:02 +02:00
Dave Halter cf63d20988 get rid of the evaluate_generator param 2014-07-30 16:36:27 +02:00
Dave Halter 565cfce2fe Executable -> Executed 2014-07-30 16:00:38 +02:00
Dave Halter 7bd76022bf get rid of the whole is_callable stuff, because now we can just check for hasattr(obj, 'py__call__') 2014-07-30 15:50:47 +02:00
Dave Halter e58dc0a3d9 simplify evaluator.execute, because now everything is using py__call__ 2014-07-30 15:40:10 +02:00
Dave Halter 373ff2c45a fix most issues related to the py__call__ stuff and generalize it. 2014-07-30 15:23:41 +02:00
Dave Halter 1e6a950aec further progress in changing to py__call__ 2014-07-30 14:40:56 +02:00
Dave Halter ccd304bcb7 start switching to a more python similar approach of naming, start by naming execution stuff py__call__ 2014-07-30 14:06:32 +02:00
Dave Halter 196afaacbf always operate on class in super and not on an instance. that's the proper way. 2014-07-30 11:34:27 +02:00