Commit Graph

66838 Commits

Author SHA1 Message Date
Ivan Kylchik 0c1f2edbf2 Get rid of abstract and fake override checks in ir call interpretation
For now interpreter will find necessary method for interpretation in
one step instead of checking is this method abstract or fake override
2020-06-24 16:12:56 +03:00
Ivan Kylchik 80d83f8703 Change check for Wrapper method
For now method is wrapper if its receiver is Wrapper and
method itself isn't inline only
2020-06-24 16:12:56 +03:00
Ivan Kylchik 38822c3bf8 Implement correct interpretation of toList function 2020-06-24 16:12:56 +03:00
Ivan Kylchik ba8147cd47 Allow lambda to be used in built in calculation
Primary use case to allow lambda null check
2020-06-24 16:12:55 +03:00
Ivan Kylchik 5f61f6f3a5 Simplify interpretation for java methods with names other in kotlin 2020-06-24 16:12:55 +03:00
Ivan Kylchik 2e0d4c9af1 Add correct interpretation for unsigned arrays in vararg method handler 2020-06-24 16:12:55 +03:00
Ivan Kylchik 30f2affb93 Add support for local function that are declared and called immediately 2020-06-24 16:12:55 +03:00
Ivan Kylchik 296f343cab Change conditions for saving type arguments into stack
For now all type arguments are saved. This is necessary for several
reason:
1. ir type operator call need to get right type argument class
2. if class is local then information about type argument cannot be lost
2020-06-24 16:12:55 +03:00
Ivan Kylchik a095309e10 Allow local declaration interpretation
By local declaration is meant local functions and local objects
2020-06-24 16:12:55 +03:00
Ivan Kylchik 2c93c46b84 Implement do while loop 2020-06-24 16:12:55 +03:00
Ivan Kylchik 1e82975a7c Replace explicit returnLabel call to check call inside try interpreter 2020-06-24 16:12:54 +03:00
Ivan Kylchik a14e8e4c28 Implement cache for enum entries and objects 2020-06-24 16:12:54 +03:00
Ivan Kylchik 0b0550f562 Remove useless Intrinsic interface
Moved all its methods inside sealed class
2020-06-24 16:12:54 +03:00
Ivan Kylchik eb3ac74c3f Move out intrinsic evaluation from interpreter class 2020-06-24 16:12:54 +03:00
Ivan Kylchik 6eae77572a Move stack trace inside Stack class 2020-06-24 16:12:54 +03:00
Ivan Kylchik e00dc76645 Simplify constructor interpretation
Unified case with secondary and primary constructors
2020-06-24 16:12:53 +03:00
Ivan Kylchik cf63a5f52b Replace some casts to Primitive with corresponding extension calls 2020-06-24 16:12:53 +03:00
Ivan Kylchik 5791ecd4f7 Remove redundant suspend modifiers 2020-06-24 16:12:53 +03:00
Ivan Kylchik cb0eb008f8 Implement correct access to stack
Rewrote work with data and implement Stack class that work over Frame
2020-06-24 16:12:53 +03:00
Ivan Kylchik 06e6c7cdf5 Implement interpretation for object with overridden methods 2020-06-24 16:12:53 +03:00
Ivan Kylchik fe7abb7132 Remove unnecessary code about handling KotlinNullPointerException
This part of code was necessary because jvm threw
KotlinNullPointerException, but js expected NullPointerException.
2020-06-24 16:12:53 +03:00
Ivan Kylchik 2f41eef797 Replace throw of interpreter errors by throw of InterpreterException 2020-06-24 16:12:53 +03:00
Ivan Kylchik aed78f3c9b Bound commands limit and throw interpreter exception upon exceeding 2020-06-24 16:12:52 +03:00
Ivan Kylchik be42ae470d Simplify extraction logic of receiver in ir call interpreter 2020-06-24 16:12:52 +03:00
Ivan Kylchik 2189fe5796 Add suspend modifier to getNextLabel method in Label interface 2020-06-24 16:12:52 +03:00
Ivan Kylchik fd51a9a085 Change signature in getArgsForMethodInvocation method 2020-06-24 16:12:52 +03:00
Ivan Kylchik 30e352ea27 Move Variable data class to separate file 2020-06-24 16:12:52 +03:00
Ivan Kylchik ef4e4881b7 Implement spread operator interpretation 2020-06-24 16:12:52 +03:00
Ivan Kylchik c9e5b6a234 Unify value arguments interpretation 2020-06-24 16:12:52 +03:00
Ivan Kylchik 520f2455b3 Create and implement ExecutionResult interface to use as return status
This is replacement for Code enum class that was returned from
methods of interpreter earlier
2020-06-24 16:12:51 +03:00
Ivan Kylchik 77978637a8 Move all classes from State.kt into separate files 2020-06-24 16:12:51 +03:00
Ivan Kylchik 530252eea8 Move State.kt in separate package 2020-06-24 16:12:51 +03:00
Ivan Kylchik 7e7a5fe736 Add reference to sub class in Complex class
This is replacement for instance field
2020-06-24 16:12:51 +03:00
Ivan Kylchik ad7055b8a0 Move additional stack filling in ExceptionState class 2020-06-24 16:12:51 +03:00
Ivan Kylchik 900e78b39b Add hashCode, equals and toString methods from String in builtin map 2020-06-24 16:12:51 +03:00
Ivan Kylchik 82acf7deb6 Change getting function receiver for method with multiple overridden 2020-06-24 16:12:50 +03:00
Ivan Kylchik 0400a62014 Improve receivers search in data pool 2020-06-24 16:12:50 +03:00
Ivan Kylchik b6cf17af1b Save context of inline and local functions 2020-06-24 16:12:50 +03:00
Ivan Kylchik 28d6752315 Change usages of IrFunctionImpl to more common IrSimpleFunction 2020-06-24 16:12:50 +03:00
Ivan Kylchik c45993b2b1 Implement interpretation for return statements with labels 2020-06-24 16:12:50 +03:00
Ivan Kylchik 5c845da18a Implement interpretation for unsigned numbers 2020-06-24 16:12:50 +03:00
Ivan Kylchik b175f46315 Implement interpretation of Char and Long classes from js stdlib 2020-06-24 16:12:50 +03:00
Ivan Kylchik 2310a04e4e Add toString, hashCode and equals primitives methods in ir builtin map 2020-06-24 16:12:49 +03:00
Ivan Kylchik 00366197f8 Implement interpretation of Enum class hashCode method 2020-06-24 16:12:49 +03:00
Ivan Kylchik 6a9f4cf8b7 Change interpretCall to be able to interpret data class copy method 2020-06-24 16:12:49 +03:00
Ivan Kylchik bab4407c0a Implement interpretation for destructing declaration 2020-06-24 16:12:49 +03:00
Ivan Kylchik ff6e06aa14 Implement regular expression interpretation 2020-06-24 16:12:49 +03:00
Ivan Kylchik 4d80d17b23 Implement interpretation for expect enum class 2020-06-24 16:12:49 +03:00
Ivan Kylchik 731fb9bc70 Make ir interpreter to work with minimal dependence on ir lowerings 2020-06-24 16:12:48 +03:00
Ivan Kylchik 4c1727b82e Move intrinsic handling inside IrInterpreter class 2020-06-24 16:12:48 +03:00