Commit Graph

2621 Commits

Author SHA1 Message Date
Roman Artemev d4fb76c1da [JS IR BE] Fix overriding property of Throwable 2019-07-09 10:40:01 +03:00
Ilya Gorbunov 7573fcde53 Demote new experimental capitalize overloads in overload resolution
Revert "Fix method reference ambiguity in test after introducing 'capitalize' overload"
This reverts commit fe9bd9ee
2019-07-09 03:39:25 +03:00
Ilya Gorbunov 686bcb830e Bit query and bit rotation functions for UInt, ULong, UShort, UByte
#KT-12749
2019-07-08 19:09:32 +03:00
Ilya Gorbunov 39bdf34b9f Use common implementation of fastLog2 based on countLeadingZeroBits 2019-07-08 19:09:32 +03:00
Ilya Gorbunov f8724654a1 Bit query and bit rotation functions for Int, Long, Short, Byte
#KT-12749
2019-07-08 19:09:32 +03:00
Ilya Gorbunov 32fc131d62 Rename jvm actuals from Numbers to NumbersJVM
Rename multifile facade to from MathKt to NumbersKt to avoid confusion
with kotlin.math.MathKt
2019-07-08 19:09:32 +03:00
Svyatoslav Kuzmich 675f01ee80 [JS IR BE] Set Throwable subtype name in extendThrowable function 2019-07-05 19:31:23 +03:00
Svyatoslav Kuzmich a2625c7bc8 [JS IR BE] Don't render null messages in Throwable
Set message property to 'undefined' to make Error.prototype.toString
skip it
2019-07-04 18:33:23 +03:00
Svyatoslav Kuzmich 94aebd0101 [JS IR BE] Proper support for String and Any constructors
Remove workarounds from codegen
2019-07-04 17:03:47 +03:00
Svyatoslav Kuzmich 918d470e1b [JS IR BE] Simplify throwable lowering.
- Make kotlin.Throwable class extenral
- Add runtime function 'extendThrowable' to use instead of delegating
  constructors to Throwable
2019-07-03 20:37:48 +03:00
Svyatoslav Kuzmich 69962cbf8c [JS IR BE] Add JsExport annotations 2019-07-01 18:55:41 +03:00
Sergey Rostov f35680e823 Build: cleanup stdlib/jps-build/build.gradle.kts 2019-06-27 17:56:52 +03:00
Vyacheslav Gerasimov 72be81ba46 Build: Add JPS artifact for dist 2019-06-27 17:56:49 +03:00
Vyacheslav Gerasimov db3b01d2d4 Build: Centralize compiler dist build logic in :kotlin-compiler project 2019-06-27 17:56:48 +03:00
Ilya Gorbunov d58c8c68d5 Fix replacement for deprecated Math.pow #KT-32083 2019-06-27 05:22:25 +03:00
AJ Alt ed96197d6b Always use LF line endings in generated stdlib code
The code generation uses a mixture of literal `\n` characters and `appendln`. The latter insert `\r\n` on Windows by default, causing generated files to contain a mixture of line endings.

This commit sets the `line.separator` system property for the generator to `\n` so that `appendln` will never insert `\r` characters. As an additional measure, `.gitattributes` files were added to checkout generated stdlib files always with LF line endings.
2019-06-27 03:02:10 +03:00
Roman Artemev 97203973ac [JS IR BE] Fix coroutine context 2019-06-24 20:14:19 +03:00
Svyatoslav Kuzmich 0b19a4a32b [JS IR BE] Initial version of member namer 2019-06-21 17:02:01 +03:00
Ilya Gorbunov eae1813ead stdlib-js(-v1/-ir): rename source files to avoid duplicates in sources
Prohibit having duplicates in sources jar and rename those source files,
that clash with the same named source files coming from
the common js source root.

Relates to KT-31965
2019-06-18 20:03:04 +03:00
Ilya Gorbunov 5bafba6bff stdlib-js-ir: preserve source directory structure of common js sources 2019-06-18 19:58:47 +03:00
Ilya Gorbunov ff9d2744ce Provide conversions between Kotlin and Java time durations 2019-06-18 19:49:50 +03:00
Ilya Gorbunov d7252548fc Add symmetric number * duration operators 2019-06-18 19:49:50 +03:00
Ilya Gorbunov a2b1c537af Change Duration.toString scientific exponent formatting
- use 'e+' for positive exponents in scientific format
2019-06-18 19:49:35 +03:00
Ilya Gorbunov a5b7c270ae Change Duration.toString(unit, decimals) formatting
- switch to scientific notation when value is too big (greater than 1e14)
- allow at most 12 decimals, larger values are coerced to 12
- use scientific format with exactly two decimals in mantissa in JVM
2019-06-18 19:49:35 +03:00
Ilya Gorbunov 58b04c7974 Add remaining docs for Duration members, runnable samples for toString 2019-06-18 04:02:35 +03:00
Ilya Gorbunov ffd9d8c71d Remove unneeded buildString from Duration.toString 2019-06-18 04:02:35 +03:00
Ilya Gorbunov c66740a7ed Explicit public visibility, SinceKotlin and ExperimentalTime status
Use file level ExperimentalTime opt-in in tests.
2019-06-18 04:02:35 +03:00
Ilya Gorbunov 16111ab79f Opt-in for Experimental/UseExperimental annotation usage in tests 2019-06-18 04:02:34 +03:00
Ilya Gorbunov 3b989cc815 Avoid using 'D' component in ISO duration string representation
Days in ISO have nominal duration, they are not always equal to 24H
2019-06-18 04:02:34 +03:00
Ilya Gorbunov 6dbc2eeb90 Provide more efficient ClockMark implementation
Do not use default 'plus' operator implementation, that creates a wrapping
AdjustedClockMark instance, create instance of the same type instead.
2019-06-18 04:02:34 +03:00
Ilya Gorbunov 8c730e180c Make ClockMark an abstract class instead of an interface 2019-06-18 04:02:34 +03:00
Ilya Gorbunov 04ec90164e Use ThreadLocals to cache DecimalFormat instances 2019-06-18 04:02:34 +03:00
Ilya Gorbunov 368452748b Move convertDurationUnit into Duration companion 2019-06-18 04:02:33 +03:00
Ilya Gorbunov ca10d13f34 Rename Duration storage property to 'value' 2019-06-18 04:02:33 +03:00
Ilya Gorbunov 365cbb94cd Change Duration.absoluteValue to property 2019-06-18 04:02:33 +03:00
Ilya Gorbunov 3f7a0d0845 Rename DurationMeasured to TimedValue, withMeasureTime to measuredTimeValue
Add measureTime docs
2019-06-18 04:02:33 +03:00
Ilya Gorbunov 9deac2a591 Rename withComponents to toComponents and add two overloads of them 2019-06-18 04:02:33 +03:00
Ilya Gorbunov 796ad29637 Add shortcuts to convert duration to milliseconds and nanoseconds 2019-06-18 04:02:32 +03:00
Ilya Gorbunov 8004c34e44 Reduce Duration API surface, add top-level docs
- toDuration(unit) extension instead of constructors
- toDouble/Long/Int(unit) function instead of inUnits()
- remove static factory functions
- remove MIN_VALUE/MAX_VALUE constants
2019-06-18 04:02:32 +03:00
Ilya Gorbunov 682430766b Add ClockMark and measureTime tests with test clock 2019-06-18 04:02:32 +03:00
Ilya Gorbunov b5d16f1a9b Simplify Clock/ClockMark design
- Do not require initialElapsed parameter
- Introduce instead ClockMark +- Duration operators
- Do not require ClockMark to expose its originating Clock back
- Turn elapsedFrom property into elapsed() function
- Rename abstract clock classes
- Fix unit of abstract clocks when constructing them

Add top-level docs for Clocks
2019-06-18 04:02:32 +03:00
Ilya Gorbunov ca29cfb88d Implement MonoClock in JS
It uses either process.hrtime() in node.js or performance.now() in browser,
falling back to Date.now() if the latter is not available
2019-06-18 04:02:31 +03:00
Ilya Gorbunov b816f50d4d Implement and test default string formatting in JVM and JS
Relax Duration.toString tests for JS and Native rounding specifics
2019-06-18 04:01:55 +03:00
Ilya Gorbunov 804d2b2d8c Helper utilities to execute test code on particular platforms 2019-06-18 03:59:52 +03:00
Ilya Gorbunov c1f7fd0281 Duration: test toString in particular units 2019-06-18 03:59:52 +03:00
Ilya Gorbunov b9c56af9ba Change Duration value storage unit to ns 2019-06-18 03:59:52 +03:00
Ilya Gorbunov 690049c082 Duration unit tests 2019-06-18 03:59:52 +03:00
Ilya Gorbunov 7977b6cdb8 Implement DurationUnit in JS, add doc summary and conversion test 2019-06-18 03:59:51 +03:00
Ilya Gorbunov 37c5f2c54f Initial prototype of Duration and Clocks API 2019-06-18 03:59:51 +03:00
Roman Artemev 1f70284b18 [JS IR BE] Fix charSequenceLength function for JS IR 2019-06-17 18:10:53 +03:00