|
1 | 1 | /* |
2 | | - * Copyright 2010-2017 JetBrains s.r.o. |
3 | | - * |
4 | | - * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | - * you may not use this file except in compliance with the License. |
6 | | - * You may obtain a copy of the License at |
7 | | - * |
8 | | - * http://www.apache.org/licenses/LICENSE-2.0 |
9 | | - * |
10 | | - * Unless required by applicable law or agreed to in writing, software |
11 | | - * distributed under the License is distributed on an "AS IS" BASIS, |
12 | | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | - * See the License for the specific language governing permissions and |
14 | | - * limitations under the License. |
| 2 | + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. |
| 3 | + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. |
15 | 4 | */ |
16 | 5 |
|
17 | 6 | package org.jetbrains.kotlinx.serialization.compiler.backend.js |
@@ -50,7 +39,8 @@ class SerializableJsTranslator( |
50 | 39 | override fun generateInternalConstructor(constructorDescriptor: ClassConstructorDescriptor) { |
51 | 40 |
|
52 | 41 | val missingExceptionClassRef = serializableDescriptor.getClassFromSerializationPackage(MISSING_FIELD_EXC) |
53 | | - .let { context.translateQualifiedReference(it) } |
| 42 | + .constructors.single { it.valueParameters.size == 1 } |
| 43 | + .let { context.getInnerNameForDescriptor(it).makeRef() } |
54 | 44 |
|
55 | 45 | val f = context.buildFunction(constructorDescriptor) { jsFun, context -> |
56 | 46 | val thiz = jsFun.scope.declareName(Namer.ANOTHER_THIS_PARAMETER_NAME).makeRef() |
@@ -98,7 +88,7 @@ class SerializableJsTranslator( |
98 | 88 | val initExpr = Translation.translateAsExpression(initializer, context) |
99 | 89 | TranslationUtils.assignmentToBackingField(context, prop.descriptor, initExpr).makeStmt() |
100 | 90 | } else { |
101 | | - JsThrow(JsNew(missingExceptionClassRef, listOf(JsStringLiteral(prop.name)))) |
| 91 | + JsThrow(JsInvocation(missingExceptionClassRef, listOf(JsStringLiteral(prop.name)))) |
102 | 92 | } |
103 | 93 | // (seen & 1 << i == 0) -- not seen |
104 | 94 | val notSeenTest = propNotSeenTest(seenVars[bitMaskSlotAt(index)], index) |
|
0 commit comments