Make project compilable after types enhancement

This commit is contained in:
Denis Zharkov
2015-07-08 12:13:24 +03:00
parent 4479c215d4
commit 0a19fb7df2
139 changed files with 227 additions and 212 deletions
@@ -31,7 +31,7 @@ object RenderFirstLineOfElementText : Renderer<PsiElement> {
abstract class JsCallDataRenderer : Renderer<JsCallData> {
protected abstract fun format(data: JsCallDataWithCode): String
override fun render(data: JsCallData?): String =
override fun render(data: JsCallData): String =
when (data) {
is JsCallDataWithCode -> format(data)
is JsCallData -> data.message
@@ -123,8 +123,8 @@ public class FunctionReader(private val context: TranslationContext) {
val moduleNameLiteral = context.program().getStringLiteral(moduleName)
val moduleReference = context.namer().getModuleReference(moduleNameLiteral)
val replacements = hashMapOf(moduleRootVariable[moduleName] to moduleReference,
moduleKotlinVariable[moduleName] to Namer.KOTLIN_OBJECT_REF)
val replacements = hashMapOf(moduleRootVariable[moduleName]!! to moduleReference,
moduleKotlinVariable[moduleName]!! to Namer.KOTLIN_OBJECT_REF)
replaceExternalNames(function, replacements)
return function
}
@@ -51,7 +51,7 @@ private class UnusedInstanceCollector : JsVisitorWithContextImpl() {
val name = x.getName()!!
val statementContext = getLastStatementLevelContext()
val currentStatement = statementContext.getCurrentNode()
tracker.addCandidateForRemoval(name, currentStatement)
tracker.addCandidateForRemoval(name, currentStatement!!)
val references = collectReferencesInside(x)
references.filterNotNull()
@@ -60,8 +60,8 @@ private class UnusedInstanceCollector : JsVisitorWithContextImpl() {
return false
}
override fun visit(x: JsNameRef?, ctx: JsContext<*>?): Boolean {
val name = x?.getName()
override fun visit(x: JsNameRef, ctx: JsContext<*>): Boolean {
val name = x.getName()
if (name != null) {
tracker.markReachable(name)
@@ -56,7 +56,7 @@ fun VariableAccessInfo.getAccessFunctionName(): String {
val descriptor = variableDescriptor
if (descriptor is PropertyDescriptor && descriptor.isExtension) {
val propertyAccessorDescriptor = if (isGetAccess()) descriptor.getGetter() else descriptor.getSetter()
return context.getNameForDescriptor(propertyAccessorDescriptor).getIdent()
return context.getNameForDescriptor(propertyAccessorDescriptor!!).getIdent()
}
else {
return Namer.getNameForAccessor(variableName.getIdent()!!, isGetAccess(), false)
@@ -179,7 +179,7 @@ object InvokeIntrinsic : FunctionCallCase {
}
override fun FunctionCallInfo.dispatchReceiver(): JsExpression {
return JsInvocation(dispatchReceiver, argumentsInfo.translateArguments)
return JsInvocation(dispatchReceiver!!, argumentsInfo.translateArguments)
}
/**
@@ -242,7 +242,7 @@ object DynamicInvokeAndBracketAccessCallCase : FunctionCallCase {
val callType = resolvedCall.getCall().getCallType()
return when (callType) {
Call.CallType.INVOKE ->
JsInvocation(dispatchReceiver, arguments)
JsInvocation(dispatchReceiver!!, arguments)
Call.CallType.ARRAY_GET_METHOD ->
JsArrayAccess(dispatchReceiver, arguments[0])
Call.CallType.ARRAY_SET_METHOD ->
@@ -204,6 +204,7 @@ public class CallArgumentTranslator private constructor(
val argumentExpression = valueArguments.get(0).getArgumentExpression()
assert(argumentExpression != null)
argumentExpression!!
val jsExpression = Translation.translateAsExpression(argumentExpression, context)
result.add(jsExpression)
@@ -250,6 +251,7 @@ public class CallArgumentTranslator private constructor(
for (argument in arguments) {
val argumentExpression = argument.getArgumentExpression()
assert(argumentExpression != null)
argumentExpression!!
val argContext = context.innerBlock()
val argExpression = Translation.translateAsExpression(argumentExpression, argContext)
list.add(argExpression)