Commit Graph

66818 Commits

Author SHA1 Message Date
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
Ivan Kylchik 27e2faa778 Implement enum interpretation 2020-06-24 16:12:48 +03:00
Ivan Kylchik d6a45dfe75 Implement instance of check in compile time 2020-06-24 16:12:48 +03:00
Ivan Kylchik 0a70277240 Make stack trace from exceptions more precise
Additional information is retrieved from original stack trace when
exception happened during wrapper invocation.
2020-06-24 16:12:48 +03:00
Ivan Kylchik 18d29f7d98 Make possible to create arrays with their constructors 2020-06-24 16:12:47 +03:00
Ivan Kylchik aca889a95b Add inc, dec methods in ir builtins map and remove toString and equals 2020-06-24 16:12:47 +03:00
Ivan Kylchik 169a2f361c Add support for cause field in exceptions 2020-06-24 16:12:47 +03:00
Ivan Kylchik 6af47ad7b3 Implement basic stack trace reporting if unhandled exception appear 2020-06-24 16:12:47 +03:00
Ivan Kylchik 66dbd1af34 Mark all IrInterpreter methods as suspend
This change is used to get rid of unhandled StackOverflowError and
to be able to manually throw it.
2020-06-24 16:12:47 +03:00
Ivan Kylchik 2985e8bcd3 Clean up code of ir builtins map generator 2020-06-24 16:12:47 +03:00
Ivan Kylchik cbc9c19faf Add methods for message and clause from Throwable in ir builtins map 2020-06-24 16:12:46 +03:00
Ivan Kylchik d9279bff73 Introduce ExceptionState class responsible for all kind of exceptions 2020-06-24 16:12:46 +03:00
Ivan Kylchik be3eb98fbd Introduce new Common state that represent common object
This is a replacement for Complex, that are now an abstract class.
2020-06-24 16:12:46 +03:00
Ivan Kylchik 4345294ac1 Add all methods from Any class in ir builtins map 2020-06-24 16:12:46 +03:00
Ivan Kylchik d03937cdb6 Pop return value after implicit coercion to unit 2020-06-24 16:12:46 +03:00
Ivan Kylchik 792ae8d272 Get rid of dynamic cast interpretation 2020-06-24 16:12:46 +03:00
Ivan Kylchik 3ccf542b38 Rework object and companion object interpretation
For now object value or fun can be interpreter only if they are
marked explicitly. Annotation for all object is restricted and if
whole class is marked with CompileTimeAnnotation this doesn't
mean that companion object is computable.
2020-06-24 16:12:46 +03:00
Ivan Kylchik 0ef34dcf53 Implement class cast interpretation 2020-06-24 16:12:45 +03:00
Ivan Kylchik a25896bf6a Implement string concatenation interpretation 2020-06-24 16:12:45 +03:00
Ivan Kylchik 0839e7afdc Describe default behaviour for Any class methods
We are talking about such methods as equals, hashCode and toString.
2020-06-24 16:12:45 +03:00
Ivan Kylchik a6cc7cdc23 Rewrite exception handler to catch null pointer exception in js ir
For now null check works as !! operator called in jvm.
So it throw KotlinNullPointerException, but js ir require
NullPointerException
2020-06-24 16:12:45 +03:00