refactor and improve. Adopt standard class array implementation
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0" is_locked="false">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<option name="myLocal" value="false" />
|
||||||
|
<inspection_tool class="SimplifiableIfStatement" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
Generated
+327
-360
@@ -5,12 +5,36 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="f02ef53d-47a4-4f5e-a1aa-3df68aae9b20" name="Default" comment="">
|
<list default="true" id="f02ef53d-47a4-4f5e-a1aa-3df68aae9b20" name="Default" comment="">
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/translator/testFiles/expression/function/cases/enclosingThis.jet" />
|
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/../WebView/.idea/workspace.xml" afterPath="$PROJECT_DIR$/../WebView/.idea/workspace.xml" />
|
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" />
|
||||||
|
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/array/ArrayGetIntrinsic.java" />
|
||||||
|
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/array/ArrayNullConstructorIntrinsic.java" />
|
||||||
|
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/array/ArraySetIntrinsic.java" />
|
||||||
|
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/array/IntrinsicArrayUtils.java" />
|
||||||
|
<change type="MOVED" beforePath="C:\Dev\Projects\jet-contrib\k2js\translator\src\org\jetbrains\k2js\translate\intrinsic\BinaryOperationIntrinsic.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/primitive/PrimitiveBinaryOperationIntrinsic.java" />
|
||||||
|
<change type="MOVED" beforePath="C:\Dev\Projects\jet-contrib\k2js\translator\src\org\jetbrains\k2js\translate\intrinsic\PrimitiveCompareToIntrinsic.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/primitive/PrimitiveCompareToIntrinsic.java" />
|
||||||
|
<change type="MOVED" beforePath="C:\Dev\Projects\jet-contrib\k2js\translator\src\org\jetbrains\k2js\translate\intrinsic\PrimitiveEqualsIntrinsic.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/primitive/PrimitiveEqualsIntrinsic.java" />
|
||||||
|
<change type="MOVED" beforePath="C:\Dev\Projects\jet-contrib\k2js\translator\src\org\jetbrains\k2js\translate\intrinsic\UnaryOperationIntrinsic.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/primitive/PrimitiveUnaryOperationIntrinsic.java" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/Aliaser.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/Aliaser.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/Namer.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/Namer.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/ClassTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/ClassTranslator.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/FunctionIntrinsic.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/FunctionIntrinsic.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/IntrinsicDeclarationVisitor.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/IntrinsicDeclarationVisitor.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/Intrinsics.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/Intrinsics.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/operation/CompareToTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/operation/CompareToTranslator.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ArrayAccessTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ArrayAccessTranslator.java" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/FunctionTest.java" afterPath="$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/FunctionTest.java" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/DescriptorUtils.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/DescriptorUtils.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/PsiUtils.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/PsiUtils.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java" afterPath="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/testFiles/kotlinLib/cases/array.js" afterPath="$PROJECT_DIR$/translator/testFiles/kotlinLib/cases/array.js" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/testFiles/kotlin_lib.js" afterPath="$PROJECT_DIR$/translator/testFiles/kotlin_lib.js" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java" afterPath="$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="k2js.iws" />
|
<ignored path="k2js.iws" />
|
||||||
<ignored path=".idea/workspace.xml" />
|
<ignored path=".idea/workspace.xml" />
|
||||||
@@ -108,7 +132,7 @@
|
|||||||
<option name="CONDITION" value="" />
|
<option name="CONDITION" value="" />
|
||||||
<option name="LOG_MESSAGE" value="" />
|
<option name="LOG_MESSAGE" value="" />
|
||||||
</breakpoint>
|
</breakpoint>
|
||||||
<breakpoint url="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java" line="225" class="org.jetbrains.k2js.translate.utils.BindingUtils" package="org.jetbrains.k2js.translate.utils">
|
<breakpoint url="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java" line="154" class="org.jetbrains.k2js.translate.utils.TranslationUtils" package="org.jetbrains.k2js.translate.utils">
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
<option name="LOG_ENABLED" value="false" />
|
<option name="LOG_ENABLED" value="false" />
|
||||||
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||||
@@ -121,20 +145,20 @@
|
|||||||
<option name="CONDITION" value="" />
|
<option name="CONDITION" value="" />
|
||||||
<option name="LOG_MESSAGE" value="" />
|
<option name="LOG_MESSAGE" value="" />
|
||||||
</breakpoint>
|
</breakpoint>
|
||||||
<breakpoint url="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java" line="40" class="org.jetbrains.k2js.translate.reference.ReferenceTranslator" package="org.jetbrains.k2js.translate.reference">
|
<breakpoint url="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java" line="258" class="org.jetbrains.k2js.translate.expression.ExpressionVisitor" package="org.jetbrains.k2js.translate.expression">
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
<option name="LOG_ENABLED" value="false" />
|
<option name="LOG_ENABLED" value="false" />
|
||||||
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||||
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
<option name="SUSPEND_POLICY" value="SuspendAll" />
|
||||||
<option name="COUNT_FILTER_ENABLED" value="false" />
|
<option name="COUNT_FILTER_ENABLED" value="false" />
|
||||||
<option name="COUNT_FILTER" value="0" />
|
<option name="COUNT_FILTER" value="0" />
|
||||||
<option name="CONDITION_ENABLED" value="true" />
|
<option name="CONDITION_ENABLED" value="false" />
|
||||||
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
<option name="CLASS_FILTERS_ENABLED" value="false" />
|
||||||
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
|
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
|
||||||
<option name="CONDITION" value="simpleName.getReferencedName().equals("m") JAVA" />
|
<option name="CONDITION" value="" />
|
||||||
<option name="LOG_MESSAGE" value=" JAVA" />
|
<option name="LOG_MESSAGE" value="" />
|
||||||
</breakpoint>
|
</breakpoint>
|
||||||
<breakpoint url="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java" line="163" class="org.jetbrains.k2js.translate.utils.TranslationUtils" package="org.jetbrains.k2js.translate.utils">
|
<breakpoint url="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java" line="259" class="org.jetbrains.k2js.translate.expression.ExpressionVisitor" package="org.jetbrains.k2js.translate.expression">
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
<option name="LOG_ENABLED" value="false" />
|
<option name="LOG_ENABLED" value="false" />
|
||||||
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
<option name="LOG_EXPRESSION_ENABLED" value="false" />
|
||||||
@@ -204,76 +228,49 @@
|
|||||||
<favorites_list name="k2js" />
|
<favorites_list name="k2js" />
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<splitter split-orientation="horizontal" split-proportion="0.27758008">
|
<splitter split-orientation="horizontal" split-proportion="0.57962215">
|
||||||
<split-first>
|
<split-first>
|
||||||
<leaf>
|
<leaf>
|
||||||
<file leaf-file-name="TranslationContext.java" pinned="false" current="false" current-in-tab="true">
|
<file leaf-file-name="postfixIntOperations.kt" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/TranslationContext.java">
|
<entry file="file://$PROJECT_DIR$/translator/testFiles/expression/operation/cases/postfixIntOperations.kt">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="79" column="27" selection-start="3132" selection-end="3132" vertical-scroll-proportion="0.3859649">
|
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="DeclarationBodyVisitor.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="positiveAndNegativeNumbers.kt" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/DeclarationBodyVisitor.java">
|
<entry file="file://$PROJECT_DIR$/translator/testFiles/expression/operation/cases/positiveAndNegativeNumbers.kt">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="19" column="19" selection-start="662" selection-end="662" vertical-scroll-proportion="0.0">
|
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="TemporaryVariable.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="comparison.kt" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/TemporaryVariable.java">
|
<entry file="file://$PROJECT_DIR$/translator/testFiles/expression/operation/cases/comparison.kt">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="29" column="17" selection-start="884" selection-end="884" vertical-scroll-proportion="0.0">
|
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="NamingScope.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="comparison.js" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/NamingScope.java">
|
<entry file="file://$PROJECT_DIR$/translator/testFiles/expression/operation/out/comparison.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="72" column="48" selection-start="2197" selection-end="2197" vertical-scroll-proportion="0.0">
|
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="DynamicContext.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="PrimitiveUnaryOperationIntrinsic.java" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/DynamicContext.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/primitive/PrimitiveUnaryOperationIntrinsic.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="49" column="48" selection-start="1709" selection-end="1709" vertical-scroll-proportion="0.0">
|
<state line="19" column="10" selection-start="688" selection-end="688" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="Translation.java" pinned="false" current="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/general/Translation.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="98" column="57" selection-start="5018" selection-end="5018" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="CompareToIntrinsic.java" pinned="false" current="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/CompareToIntrinsic.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="9" column="62" selection-start="297" selection-end="297" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="BinaryOperationIntrinsic.java" pinned="false" current="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/BinaryOperationIntrinsic.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="15" column="13" selection-start="520" selection-end="520" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -282,10 +279,17 @@
|
|||||||
<file leaf-file-name="DescriptorUtils.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="DescriptorUtils.java" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/DescriptorUtils.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/DescriptorUtils.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="13" column="52" selection-start="492" selection-end="492" vertical-scroll-proportion="0.0">
|
<state line="93" column="13" selection-start="3662" selection-end="3662" vertical-scroll-proportion="0.0">
|
||||||
<folding>
|
<folding />
|
||||||
<element signature="e#2087#2110#0" expanded="true" />
|
</state>
|
||||||
</folding>
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="StandardClassesTest.java" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="16" column="16" selection-start="317" selection-end="317" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@@ -299,23 +303,19 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
</leaf>
|
<file leaf-file-name="PsiUtils.java" pinned="false" current="false" current-in-tab="false">
|
||||||
</split-first>
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/PsiUtils.java">
|
||||||
<split-second>
|
|
||||||
<leaf>
|
|
||||||
<file leaf-file-name="ReferenceTranslator.java" pinned="false" current="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="40" column="0" selection-start="1492" selection-end="1492" vertical-scroll-proportion="0.0">
|
<state line="27" column="23" selection-start="858" selection-end="858" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="ExpressionVisitor.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="ClassTranslator.java" pinned="false" current="true" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/ClassTranslator.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="115" column="21" selection-start="5098" selection-end="5098" vertical-scroll-proportion="0.0">
|
<state line="116" column="52" selection-start="4976" selection-end="4976" vertical-scroll-proportion="0.4501385">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@@ -323,46 +323,14 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="CallTranslator.java" pinned="false" current="false" current-in-tab="false">
|
</leaf>
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java">
|
</split-first>
|
||||||
|
<split-second>
|
||||||
|
<leaf>
|
||||||
|
<file leaf-file-name="ReferenceTranslator.java" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="117" column="24" selection-start="5841" selection-end="5841" vertical-scroll-proportion="0.0">
|
<state line="105" column="5" selection-start="4180" selection-end="4180" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="FunctionTest.java" pinned="false" current="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/FunctionTest.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="57" column="16" selection-start="1355" selection-end="1355" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="PropertyAccessorDescriptor.java" pinned="false" current="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertyAccessorDescriptor.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="15" column="22" selection-start="457" selection-end="457" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="TranslationUtils.java" pinned="false" current="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="163" column="0" selection-start="7301" selection-end="7301" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="PropertyAccessTranslator.java" pinned="false" current="true" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="152" column="83" selection-start="6581" selection-end="6581" vertical-scroll-proportion="0.28424153">
|
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -371,25 +339,81 @@
|
|||||||
<file leaf-file-name="BindingUtils.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="BindingUtils.java" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="225" column="0" selection-start="10552" selection-end="10552" vertical-scroll-proportion="0.0">
|
<state line="150" column="42" selection-start="7097" selection-end="7097" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="VariableAsFunctionDescriptor.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="TranslationUtils.java" pinned="false" current="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableAsFunctionDescriptor.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="11" column="40" selection-start="308" selection-end="308" vertical-scroll-proportion="0.0">
|
<state line="77" column="0" selection-start="3549" selection-end="3549" vertical-scroll-proportion="0.44412607">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="PropertyDescriptor.java" pinned="false" current="false" current-in-tab="false">
|
<file leaf-file-name="PropertyAccessTranslator.java" pinned="false" current="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertyDescriptor.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="33" column="12" selection-start="1331" selection-end="1331" vertical-scroll-proportion="0.0">
|
<state line="81" column="0" selection-start="3846" selection-end="3846" vertical-scroll-proportion="0.0">
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="BasicClassTest.java" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/BasicClassTest.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="37" column="16" selection-start="861" selection-end="861" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="JetSimpleNameExpression.java" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetSimpleNameExpression.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="45" column="24" selection-start="1606" selection-end="1606" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="CallTranslator.java" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="28" column="58" selection-start="1275" selection-end="1275" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="PropertyAccessTest.java" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/PropertyAccessTest.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="37" column="16" selection-start="826" selection-end="826" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="OperatorOverloadingTest.java" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="47" column="16" selection-start="1070" selection-end="1070" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="operatorOverloadOnPropertyCallGetterAndSetterOnlyOnce.js" pinned="false" current="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/testFiles/operatorOverloading/out/operatorOverloadOnPropertyCallGetterAndSetterOnlyOnce.js">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -416,22 +440,22 @@
|
|||||||
<component name="IdeDocumentHistory">
|
<component name="IdeDocumentHistory">
|
||||||
<option name="changedFiles">
|
<option name="changedFiles">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java" />
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/operation/CompareToTranslator.java" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/PropertyTranslator.java" />
|
<option value="$PROJECT_DIR$/translator/testFiles/kotlin_lib.js" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/initializer/AbstractInitializerTranslator.java" />
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/Namer.java" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/initializer/NamespaceInitializerTranslator.java" />
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/Intrinsics.java" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/TranslationContext.java" />
|
<option value="$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/initializer/ClassInitializerTranslator.java" />
|
<option value="$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/KotlinLibTest.java" />
|
||||||
|
<option value="$PROJECT_DIR$/translator/testFiles/kotlinLib/cases/array.js" />
|
||||||
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/Aliaser.java" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java" />
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/expression/FunctionTranslator.java" />
|
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/ClassTranslator.java" />
|
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/NamingScope.java" />
|
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/DynamicContext.java" />
|
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/DescriptorUtils.java" />
|
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/DeclarationVisitor.java" />
|
|
||||||
<option value="$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/FunctionTest.java" />
|
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java" />
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java" />
|
||||||
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java" />
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java" />
|
||||||
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/DescriptorUtils.java" />
|
||||||
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/PsiUtils.java" />
|
||||||
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java" />
|
||||||
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java" />
|
||||||
|
<option value="$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/ClassTranslator.java" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@@ -521,6 +545,7 @@
|
|||||||
<sortByType />
|
<sortByType />
|
||||||
</navigator>
|
</navigator>
|
||||||
<panes>
|
<panes>
|
||||||
|
<pane id="Scope" />
|
||||||
<pane id="PackagesPane">
|
<pane id="PackagesPane">
|
||||||
<subPane>
|
<subPane>
|
||||||
<PATH>
|
<PATH>
|
||||||
@@ -535,7 +560,6 @@
|
|||||||
</PATH>
|
</PATH>
|
||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
<pane id="Scope" />
|
|
||||||
<pane id="ProjectPane">
|
<pane id="ProjectPane">
|
||||||
<subPane>
|
<subPane>
|
||||||
<PATH>
|
<PATH>
|
||||||
@@ -582,7 +606,11 @@
|
|||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
<PATH_ELEMENT>
|
<PATH_ELEMENT>
|
||||||
<option name="myItemId" value="trait" />
|
<option name="myItemId" value="standardClasses" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="out" />
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
</PATH>
|
</PATH>
|
||||||
@@ -600,7 +628,7 @@
|
|||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
<PATH_ELEMENT>
|
<PATH_ELEMENT>
|
||||||
<option name="myItemId" value="trait" />
|
<option name="myItemId" value="standardClasses" />
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
<PATH_ELEMENT>
|
<PATH_ELEMENT>
|
||||||
@@ -636,139 +664,11 @@
|
|||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
<PATH_ELEMENT>
|
<PATH_ELEMENT>
|
||||||
<option name="myItemId" value="testFiles" />
|
<option name="myItemId" value="src" />
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="expression" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
<PATH_ELEMENT>
|
||||||
<option name="myItemId" value="k2js" />
|
<option name="myItemId" value="k2js" />
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="translator" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="testFiles" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="expression" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="function" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="out" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="k2js" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="translator" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="testFiles" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="expression" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="function" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="cases" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="k2js" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="translator" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="testFiles" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="examples" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="sortedTests" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="k2js" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="translator" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="testFiles" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="examples" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="k2js" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="translator" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="testFiles" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="examples" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="cases" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
</PATH>
|
|
||||||
<PATH>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="k2js" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="translator" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
|
||||||
</PATH_ELEMENT>
|
|
||||||
<PATH_ELEMENT>
|
|
||||||
<option name="myItemId" value="test" />
|
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
</PATH>
|
</PATH>
|
||||||
@@ -789,6 +689,36 @@
|
|||||||
<option name="myItemId" value="k2js" />
|
<option name="myItemId" value="k2js" />
|
||||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="translate" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="utils" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="k2js" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="translator" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="src" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="k2js" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT>
|
||||||
|
<option name="myItemId" value="translate" />
|
||||||
|
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
</PATH>
|
</PATH>
|
||||||
<PATH>
|
<PATH>
|
||||||
<PATH_ELEMENT>
|
<PATH_ELEMENT>
|
||||||
@@ -883,13 +813,6 @@
|
|||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="JUnit.tests">
|
<component name="RunManager" selected="JUnit.tests">
|
||||||
<configuration default="false" name="compareTo.js" type="JavascriptDebugSession" factoryName="Local" temporary="true">
|
|
||||||
<JSDebuggerConfigurationSettings>
|
|
||||||
<option name="engineId" value="embedded" />
|
|
||||||
<option name="fileUrl" value="file://$PROJECT_DIR$/translator/testFiles/operatorOverloading/out/compareTo.js" />
|
|
||||||
</JSDebuggerConfigurationSettings>
|
|
||||||
<method />
|
|
||||||
</configuration>
|
|
||||||
<configuration default="false" name="TraitTest.traitAddsFunctionsToClass" type="JUnit" factoryName="JUnit" temporary="true">
|
<configuration default="false" name="TraitTest.traitAddsFunctionsToClass" type="JUnit" factoryName="JUnit" temporary="true">
|
||||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true">
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true">
|
||||||
<pattern>
|
<pattern>
|
||||||
@@ -1013,6 +936,41 @@
|
|||||||
<ConfigurationWrapper RunnerId="Run" />
|
<ConfigurationWrapper RunnerId="Run" />
|
||||||
<method />
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration default="false" name="StandardClassesTest.array" type="JUnit" factoryName="JUnit" temporary="true">
|
||||||
|
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="org.jetbrains.k2js.test.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<module name="translator" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||||
|
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||||
|
<option name="PACKAGE_NAME" value="org.jetbrains.k2js.test" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="org.jetbrains.k2js.test.StandardClassesTest" />
|
||||||
|
<option name="METHOD_NAME" value="array" />
|
||||||
|
<option name="TEST_OBJECT" value="method" />
|
||||||
|
<option name="VM_PARAMETERS" value="-ea" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||||
|
<option name="ENV_VARIABLES" />
|
||||||
|
<option name="PASS_PARENT_ENVS" value="true" />
|
||||||
|
<option name="TEST_SEARCH_SCOPE">
|
||||||
|
<value defaultName="singleModule" />
|
||||||
|
</option>
|
||||||
|
<envs />
|
||||||
|
<dir value="$PROJECT_DIR$/translator" />
|
||||||
|
<patterns />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="" />
|
||||||
|
<option name="TRANSPORT" value="0" />
|
||||||
|
<option name="LOCAL" value="true" />
|
||||||
|
</RunnerSettings>
|
||||||
|
<RunnerSettings RunnerId="Run" />
|
||||||
|
<ConfigurationWrapper RunnerId="Debug" />
|
||||||
|
<ConfigurationWrapper RunnerId="Run" />
|
||||||
|
<method />
|
||||||
|
</configuration>
|
||||||
<configuration default="true" type="Remote" factoryName="Remote">
|
<configuration default="true" type="Remote" factoryName="Remote">
|
||||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||||
<option name="SERVER_MODE" value="false" />
|
<option name="SERVER_MODE" value="false" />
|
||||||
@@ -1128,17 +1086,23 @@
|
|||||||
<envs />
|
<envs />
|
||||||
<dir value="$PROJECT_DIR$/translator" />
|
<dir value="$PROJECT_DIR$/translator" />
|
||||||
<patterns />
|
<patterns />
|
||||||
|
<RunnerSettings RunnerId="Debug">
|
||||||
|
<option name="DEBUG_PORT" value="" />
|
||||||
|
<option name="TRANSPORT" value="0" />
|
||||||
|
<option name="LOCAL" value="true" />
|
||||||
|
</RunnerSettings>
|
||||||
<RunnerSettings RunnerId="Run" />
|
<RunnerSettings RunnerId="Run" />
|
||||||
|
<ConfigurationWrapper RunnerId="Debug" />
|
||||||
<ConfigurationWrapper RunnerId="Run" />
|
<ConfigurationWrapper RunnerId="Run" />
|
||||||
<method />
|
<method />
|
||||||
</configuration>
|
</configuration>
|
||||||
<list size="6">
|
<list size="6">
|
||||||
<item index="0" class="java.lang.String" itemvalue="JUnit.tests" />
|
<item index="0" class="java.lang.String" itemvalue="JUnit.tests" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="JavaScript Debug.compareTo.js" />
|
<item index="1" class="java.lang.String" itemvalue="JUnit.TraitTest.traitAddsFunctionsToClass" />
|
||||||
<item index="2" class="java.lang.String" itemvalue="JUnit.TraitTest.traitAddsFunctionsToClass" />
|
<item index="2" class="java.lang.String" itemvalue="JUnit.TraitTest.classDerivesFromClassAndTrait" />
|
||||||
<item index="3" class="java.lang.String" itemvalue="JUnit.TraitTest.classDerivesFromClassAndTrait" />
|
<item index="3" class="java.lang.String" itemvalue="JUnit.All in jetTests" />
|
||||||
<item index="4" class="java.lang.String" itemvalue="JUnit.All in jetTests" />
|
<item index="4" class="java.lang.String" itemvalue="JUnit.FunctionTest.enclosingThis" />
|
||||||
<item index="5" class="java.lang.String" itemvalue="JUnit.FunctionTest.enclosingThis" />
|
<item index="5" class="java.lang.String" itemvalue="JUnit.StandardClassesTest.array" />
|
||||||
</list>
|
</list>
|
||||||
<configuration name="<template>" type="WebApp" default="true" selected="false">
|
<configuration name="<template>" type="WebApp" default="true" selected="false">
|
||||||
<Host>localhost</Host>
|
<Host>localhost</Host>
|
||||||
@@ -1196,6 +1160,7 @@
|
|||||||
<frame x="-8" y="-8" width="1936" height="1176" extended-state="6" />
|
<frame x="-8" y="-8" width="1936" height="1176" extended-state="6" />
|
||||||
<editor active="true" />
|
<editor active="true" />
|
||||||
<layout>
|
<layout>
|
||||||
|
<window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32853025" sideWeight="0.49812934" order="7" side_tool="false" content_ui="tabs" />
|
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32853025" sideWeight="0.49812934" order="7" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756963" sideWeight="0.46606094" order="1" side_tool="false" content_ui="tabs" />
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756963" sideWeight="0.46606094" order="1" side_tool="false" content_ui="tabs" />
|
||||||
@@ -1206,14 +1171,14 @@
|
|||||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||||
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977018" sideWeight="0.6705091" order="3" side_tool="false" content_ui="tabs" />
|
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977018" sideWeight="0.6705091" order="3" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32854405" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" />
|
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32854405" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.22382325" sideWeight="0.45750934" order="9" side_tool="false" content_ui="tabs" />
|
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.22382325" sideWeight="0.45750934" order="9" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32949087" sideWeight="0.49812934" order="6" side_tool="false" content_ui="tabs" />
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32949087" sideWeight="0.49812934" order="6" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Metrics" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756963" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
<window_info id="Metrics" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32756963" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20363443" sideWeight="0.284342" order="1" side_tool="true" content_ui="tabs" />
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20363443" sideWeight="0.284342" order="1" side_tool="true" content_ui="tabs" />
|
||||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977018" sideWeight="0.728146" order="4" side_tool="false" content_ui="tabs" />
|
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32977018" sideWeight="0.728146" order="4" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3997862" sideWeight="0.6705998" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3997862" sideWeight="0.6705998" order="0" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24906467" sideWeight="0.6993276" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20791021" sideWeight="0.77617675" order="0" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.30067244" sideWeight="0.64190274" order="2" side_tool="false" content_ui="tabs" />
|
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.29971182" sideWeight="0.64190274" order="2" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||||
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
|
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
|
||||||
@@ -1256,7 +1221,7 @@
|
|||||||
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
|
<option name="INCLUDE_TEXT_INTO_SHELF" value="false" />
|
||||||
<option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
|
<option name="CREATE_PATCH_EXPAND_DETAILS_DEFAULT" value="true" />
|
||||||
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Reorganise context structure, refactor" />
|
<option name="LAST_COMMIT_MESSAGE" value="fix "enclosingThis" bug" />
|
||||||
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
|
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
|
||||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||||
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
|
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
|
||||||
@@ -1269,7 +1234,6 @@
|
|||||||
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
|
<option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
|
||||||
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
|
||||||
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
|
||||||
<MESSAGE value="Corrected class declaration logic." />
|
|
||||||
<MESSAGE value="Supported single file without namespace." />
|
<MESSAGE value="Supported single file without namespace." />
|
||||||
<MESSAGE value="Added array basic class." />
|
<MESSAGE value="Added array basic class." />
|
||||||
<MESSAGE value="Added and sorted tests from jet repository. Fixed a bug with custom setter." />
|
<MESSAGE value="Added and sorted tests from jet repository. Fixed a bug with custom setter." />
|
||||||
@@ -1294,6 +1258,7 @@
|
|||||||
<MESSAGE value="refactor and fix assignment operator on property bug" />
|
<MESSAGE value="refactor and fix assignment operator on property bug" />
|
||||||
<MESSAGE value="intrinsics refactor" />
|
<MESSAGE value="intrinsics refactor" />
|
||||||
<MESSAGE value="Reorganise context structure, refactor" />
|
<MESSAGE value="Reorganise context structure, refactor" />
|
||||||
|
<MESSAGE value="fix "enclosingThis" bug" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager />
|
<breakpoint-manager />
|
||||||
@@ -1303,120 +1268,122 @@
|
|||||||
<option name="FILTER_TARGETS" value="false" />
|
<option name="FILTER_TARGETS" value="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="file://$PROJECT_DIR$/translator/testFiles/examples/cases/enclosingThis.jet">
|
<entry file="jar://$PROJECT_DIR$/translator/lib/js.jar!/org/mozilla/javascript/ScriptableObject.class">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="308" column="80" selection-start="19091" selection-end="19091" vertical-scroll-proportion="-18.64">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="47" column="16" selection-start="1070" selection-end="1070" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/testFiles/operatorOverloading/out/operatorOverloadOnPropertyCallGetterAndSetterOnlyOnce.js">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/general/AbstractTranslator.java">
|
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetSimpleNameExpression.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="26" column="0" selection-start="670" selection-end="670" vertical-scroll-proportion="0.0">
|
<state line="45" column="24" selection-start="1606" selection-end="1606" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/testFiles/expression/function/cases/enclosingThis.jet">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableDescriptor.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="10" column="17" selection-start="274" selection-end="274" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/testFiles/expression/function/out/enclosingThis.js">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="11" column="37" selection-start="237" selection-end="237" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/VariableAsFunctionDescriptor.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="11" column="40" selection-start="308" selection-end="308" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="225" column="0" selection-start="10552" selection-end="10552" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="40" column="0" selection-start="1492" selection-end="1492" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="115" column="21" selection-start="5098" selection-end="5098" vertical-scroll-proportion="0.0">
|
|
||||||
<folding>
|
|
||||||
<element signature="imports" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="163" column="0" selection-start="7301" selection-end="7301" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/context/TranslationContext.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="79" column="27" selection-start="3132" selection-end="3132" vertical-scroll-proportion="0.3859649">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertyAccessorDescriptor.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="15" column="22" selection-start="457" selection-end="457" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/FunctionTest.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="57" column="16" selection-start="1355" selection-end="1355" vertical-scroll-proportion="0.0">
|
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/CallTranslator.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="117" column="24" selection-start="5841" selection-end="5841" vertical-scroll-proportion="0.0">
|
<state line="28" column="58" selection-start="1275" selection-end="1275" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/PropertyDescriptor.java">
|
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/PropertyAccessTest.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="33" column="12" selection-start="1331" selection-end="1331" vertical-scroll-proportion="0.0">
|
<state line="37" column="16" selection-start="826" selection-end="826" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/test/org/jetbrains/k2js/test/BasicClassTest.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="37" column="16" selection-start="861" selection-end="861" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java">
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/PropertyAccessTranslator.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="152" column="83" selection-start="6581" selection-end="6581" vertical-scroll-proportion="0.28424153">
|
<state line="81" column="0" selection-start="3846" selection-end="3846" vertical-scroll-proportion="0.0">
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/DescriptorUtils.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="93" column="13" selection-start="3662" selection-end="3662" vertical-scroll-proportion="0.0">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/reference/ReferenceTranslator.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="105" column="5" selection-start="4180" selection-end="4180" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/FunctionIntrinsic.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="5" column="43" selection-start="125" selection-end="125" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/BindingUtils.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="150" column="42" selection-start="7097" selection-end="7097" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/TranslationUtils.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="77" column="0" selection-start="3549" selection-end="3549" vertical-scroll-proportion="0.44412607">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/utils/PsiUtils.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="27" column="23" selection-start="858" selection-end="858" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/intrinsic/CompareToIntrinsic.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="9" column="22" selection-start="257" selection-end="257" vertical-scroll-proportion="0.0">
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/translator/src/org/jetbrains/k2js/translate/declaration/ClassTranslator.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="116" column="52" selection-start="4976" selection-end="4976" vertical-scroll-proportion="0.4501385">
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
</component>
|
</component>
|
||||||
<component name="masterDetails">
|
<component name="masterDetails">
|
||||||
<states>
|
<states>
|
||||||
|
|||||||
@@ -5,18 +5,24 @@ import com.google.dart.compiler.backend.js.ast.JsNameRef;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.jetbrains.k2js.translate.utils.DescriptorUtils.getFunctionByName;
|
||||||
|
|
||||||
//TODO: implement aliases stack for this
|
//TODO: implement aliases stack for this
|
||||||
public class Aliaser {
|
public class Aliaser {
|
||||||
|
|
||||||
static public Aliaser aliasesForStandardClasses(@NotNull JetStandardLibrary standardLibrary,
|
static public Aliaser aliasesForStandardClasses(@NotNull JetStandardLibrary standardLibrary,
|
||||||
@NotNull Namer namer) {
|
@NotNull Namer namer) {
|
||||||
//TODO: decide if this aliases are needed
|
Aliaser aliaser = new Aliaser();
|
||||||
return new Aliaser();
|
aliaser.setAliasForDescriptor(standardLibrary.getArray(), namer.libraryObject("Array"));
|
||||||
|
FunctionDescriptor nullConstructorFunction = getFunctionByName(standardLibrary.getLibraryScope(), "Array");
|
||||||
|
aliaser.setAliasForDescriptor(nullConstructorFunction, namer.libraryObject("array"));
|
||||||
|
return aliaser;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -46,23 +52,23 @@ public class Aliaser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAliasForDeclaration(@NotNull DeclarationDescriptor declaration) {
|
public boolean hasAliasForDeclaration(@NotNull DeclarationDescriptor declaration) {
|
||||||
return aliases.containsKey(declaration);
|
return aliases.containsKey(declaration.getOriginal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JsNameRef getAliasForDeclaration(@NotNull DeclarationDescriptor declaration) {
|
public JsNameRef getAliasForDeclaration(@NotNull DeclarationDescriptor declaration) {
|
||||||
JsName alias = aliases.get(declaration);
|
JsName alias = aliases.get(declaration.getOriginal());
|
||||||
assert alias != null : "Use has alias for declaration to check.";
|
assert alias != null : "Use has alias for declaration to check.";
|
||||||
return alias.makeRef();
|
return alias.makeRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAliasForDescriptor(@NotNull DeclarationDescriptor declaration, @NotNull JsName alias) {
|
public void setAliasForDescriptor(@NotNull DeclarationDescriptor declaration, @NotNull JsName alias) {
|
||||||
assert (!hasAliasForDeclaration(declaration)) : "This declaration already has an alias!";
|
assert (!hasAliasForDeclaration(declaration.getOriginal())) : "This declaration already has an alias!";
|
||||||
aliases.put(declaration, alias);
|
aliases.put(declaration.getOriginal(), alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAliasForDescriptor(@NotNull DeclarationDescriptor declaration) {
|
public void removeAliasForDescriptor(@NotNull DeclarationDescriptor declaration) {
|
||||||
assert (hasAliasForDeclaration(declaration)) : "This declaration does not has an alias!";
|
assert (hasAliasForDeclaration(declaration.getOriginal())) : "This declaration does not has an alias!";
|
||||||
aliases.remove(declaration);
|
aliases.remove(declaration.getOriginal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,6 +124,11 @@ public final class Namer {
|
|||||||
return reference;
|
return reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public JsName libraryObject(@NotNull String name) {
|
||||||
|
return kotlinScope.declareName(name);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public JsNameRef kotlinObject() {
|
public JsNameRef kotlinObject() {
|
||||||
return kotlinName.makeRef();
|
return kotlinName.makeRef();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.jetbrains.k2js.translate.utils.BindingUtils.getPropertyDescriptorForConstructorParameter;
|
import static org.jetbrains.k2js.translate.utils.BindingUtils.getPropertyDescriptorForConstructorParameter;
|
||||||
|
import static org.jetbrains.k2js.translate.utils.DescriptorUtils.findAncestorClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
@@ -108,7 +109,7 @@ public final class ClassTranslator extends AbstractTranslator {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private ClassDescriptor findAndRemoveAncestorClass(@NotNull List<ClassDescriptor> superclassDescriptors) {
|
private ClassDescriptor findAndRemoveAncestorClass(@NotNull List<ClassDescriptor> superclassDescriptors) {
|
||||||
ClassDescriptor ancestorClass = BindingUtils.findAncestorClass(superclassDescriptors);
|
ClassDescriptor ancestorClass = findAncestorClass(superclassDescriptors);
|
||||||
superclassDescriptors.remove(ancestorClass);
|
superclassDescriptors.remove(ancestorClass);
|
||||||
return ancestorClass;
|
return ancestorClass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,9 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public JsNode visitDotQualifiedExpression(@NotNull JetDotQualifiedExpression expression,
|
public JsNode visitDotQualifiedExpression(@NotNull JetDotQualifiedExpression expression,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
|
if (expression.getSelectorExpression() instanceof JetCallExpression) {
|
||||||
|
return CallTranslator.translate(expression, context);
|
||||||
|
}
|
||||||
return translateQualifiedExpression(expression, context);
|
return translateQualifiedExpression(expression, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ package org.jetbrains.k2js.translate.intrinsic;
|
|||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
*/
|
*/
|
||||||
public abstract class FunctionIntrinsic implements Intrinsic {
|
public interface FunctionIntrinsic extends Intrinsic {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ public final class IntrinsicDeclarationVisitor extends DeclarationDescriptorVisi
|
|||||||
@Override
|
@Override
|
||||||
public Void visitFunctionDescriptor(@NotNull FunctionDescriptor descriptor, @Nullable Void nothing) {
|
public Void visitFunctionDescriptor(@NotNull FunctionDescriptor descriptor, @Nullable Void nothing) {
|
||||||
if (!intrinsics.isIntrinsic(descriptor)) {
|
if (!intrinsics.isIntrinsic(descriptor)) {
|
||||||
intrinsics.declareIntrinsic(descriptor);
|
intrinsics.declareOperatorIntrinsic(descriptor);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,24 @@ import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
|||||||
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
import org.jetbrains.jet.lang.types.JetStandardLibrary;
|
||||||
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||||
import org.jetbrains.jet.lexer.JetToken;
|
import org.jetbrains.jet.lexer.JetToken;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.array.ArrayGetIntrinsic;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.array.ArrayNullConstructorIntrinsic;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.array.ArraySetIntrinsic;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.primitive.PrimitiveBinaryOperationIntrinsic;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.primitive.PrimitiveCompareToIntrinsic;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.primitive.PrimitiveEqualsIntrinsic;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.primitive.PrimitiveUnaryOperationIntrinsic;
|
||||||
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
||||||
import org.jetbrains.k2js.translate.utils.DescriptorUtils;
|
import org.jetbrains.k2js.translate.utils.DescriptorUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.jetbrains.k2js.translate.utils.DescriptorUtils.getFunctionByName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
*/
|
*/
|
||||||
//TODO: different maps for different kinds of intrinsics
|
|
||||||
public final class Intrinsics {
|
public final class Intrinsics {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@@ -26,7 +34,6 @@ public final class Intrinsics {
|
|||||||
private final Map<FunctionDescriptor, EqualsIntrinsic> equalsIntrinsics =
|
private final Map<FunctionDescriptor, EqualsIntrinsic> equalsIntrinsics =
|
||||||
new HashMap<FunctionDescriptor, EqualsIntrinsic>();
|
new HashMap<FunctionDescriptor, EqualsIntrinsic>();
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Map<FunctionDescriptor, CompareToIntrinsic> compareToIntrinsics =
|
private final Map<FunctionDescriptor, CompareToIntrinsic> compareToIntrinsics =
|
||||||
new HashMap<FunctionDescriptor, CompareToIntrinsic>();
|
new HashMap<FunctionDescriptor, CompareToIntrinsic>();
|
||||||
@@ -35,14 +42,35 @@ public final class Intrinsics {
|
|||||||
return new Intrinsics(library);
|
return new Intrinsics(library);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final JetStandardLibrary library;
|
||||||
|
|
||||||
private Intrinsics(@NotNull JetStandardLibrary library) {
|
private Intrinsics(@NotNull JetStandardLibrary library) {
|
||||||
|
this.library = library;
|
||||||
|
declareOperatorIntrinsics();
|
||||||
|
//TODO: array intrinsic are under consideration
|
||||||
|
//declareArrayIntrinsics();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void declareOperatorIntrinsics() {
|
||||||
IntrinsicDeclarationVisitor visitor = new IntrinsicDeclarationVisitor(this);
|
IntrinsicDeclarationVisitor visitor = new IntrinsicDeclarationVisitor(this);
|
||||||
for (DeclarationDescriptor descriptor : library.getLibraryScope().getAllDescriptors()) {
|
for (DeclarationDescriptor descriptor : library.getLibraryScope().getAllDescriptors()) {
|
||||||
descriptor.accept(visitor, null);
|
descriptor.accept(visitor, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*package*/ void declareIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
private void declareArrayIntrinsics() {
|
||||||
|
FunctionDescriptor constructorFunction = getFunctionByName(library.getLibraryScope(), "Array");
|
||||||
|
functionIntrinsics.put(constructorFunction, ArrayNullConstructorIntrinsic.INSTANCE);
|
||||||
|
|
||||||
|
FunctionDescriptor getFunction = getFunctionByName(library.getArray(), "get");
|
||||||
|
functionIntrinsics.put(getFunction, ArrayGetIntrinsic.INSTANCE);
|
||||||
|
|
||||||
|
FunctionDescriptor setFunction = getFunctionByName(library.getArray(), "set");
|
||||||
|
functionIntrinsics.put(setFunction, ArraySetIntrinsic.INSTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*package*/ void declareOperatorIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
||||||
addCompareToIntrinsics(descriptor);
|
addCompareToIntrinsics(descriptor);
|
||||||
addEqualsIntrinsics(descriptor);
|
addEqualsIntrinsics(descriptor);
|
||||||
addUnaryIntrinsics(descriptor);
|
addUnaryIntrinsics(descriptor);
|
||||||
@@ -69,9 +97,10 @@ public final class Intrinsics {
|
|||||||
if (token == null) return;
|
if (token == null) return;
|
||||||
boolean isUnary = !DescriptorUtils.hasParameters(descriptor);
|
boolean isUnary = !DescriptorUtils.hasParameters(descriptor);
|
||||||
if (!isUnary) return;
|
if (!isUnary) return;
|
||||||
functionIntrinsics.put(descriptor, UnaryOperationIntrinsic.newInstance(token));
|
functionIntrinsics.put(descriptor, PrimitiveUnaryOperationIntrinsic.newInstance(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: refactor
|
||||||
private void addBinaryIntrinsics(@NotNull FunctionDescriptor descriptor) {
|
private void addBinaryIntrinsics(@NotNull FunctionDescriptor descriptor) {
|
||||||
String functionName = descriptor.getName();
|
String functionName = descriptor.getName();
|
||||||
boolean isUnary = !DescriptorUtils.hasParameters(descriptor);
|
boolean isUnary = !DescriptorUtils.hasParameters(descriptor);
|
||||||
@@ -80,7 +109,7 @@ public final class Intrinsics {
|
|||||||
if (token == null) return;
|
if (token == null) return;
|
||||||
//TODO: implement range and contains intrinsic
|
//TODO: implement range and contains intrinsic
|
||||||
if (!OperatorTable.hasCorrespondingBinaryOperator(token)) return;
|
if (!OperatorTable.hasCorrespondingBinaryOperator(token)) return;
|
||||||
functionIntrinsics.put(descriptor, BinaryOperationIntrinsic.newInstance(token));
|
functionIntrinsics.put(descriptor, PrimitiveBinaryOperationIntrinsic.newInstance(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIntrinsic(@NotNull DeclarationDescriptor descriptor) {
|
public boolean isIntrinsic(@NotNull DeclarationDescriptor descriptor) {
|
||||||
@@ -96,16 +125,16 @@ public final class Intrinsics {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public FunctionIntrinsic getFunctionIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
public FunctionIntrinsic getFunctionIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
||||||
return functionIntrinsics.get(descriptor);
|
return functionIntrinsics.get(descriptor.getOriginal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public CompareToIntrinsic getCompareToIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
public CompareToIntrinsic getCompareToIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
||||||
return compareToIntrinsics.get(descriptor);
|
return compareToIntrinsics.get(descriptor.getOriginal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public EqualsIntrinsic getEqualsIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
public EqualsIntrinsic getEqualsIntrinsic(@NotNull FunctionDescriptor descriptor) {
|
||||||
return equalsIntrinsics.get(descriptor);
|
return equalsIntrinsics.get(descriptor.getOriginal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package org.jetbrains.k2js.translate.intrinsic.array;
|
||||||
|
|
||||||
|
import com.google.dart.compiler.backend.js.ast.JsConditional;
|
||||||
|
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||||
|
import com.google.dart.compiler.util.AstUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.k2js.translate.context.TemporaryVariable;
|
||||||
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.FunctionIntrinsic;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Talanov Pavel
|
||||||
|
*/
|
||||||
|
public enum ArrayGetIntrinsic implements FunctionIntrinsic {
|
||||||
|
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public JsExpression apply(@NotNull JsExpression receiver, @NotNull List<JsExpression> arguments,
|
||||||
|
@NotNull TranslationContext context) {
|
||||||
|
assert arguments.size() == 1 : "Array get expression must have one argument.";
|
||||||
|
JsExpression indexExpression = arguments.get(0);
|
||||||
|
TemporaryVariable arrayExpression = context.declareTemporary(receiver);
|
||||||
|
JsConditional indexInBoundsCheck =
|
||||||
|
IntrinsicArrayUtils.indexInBoundsCheck(indexExpression, arrayExpression, context);
|
||||||
|
return AstUtil.newSequence(arrayExpression.assignmentExpression(), AstUtil.newArrayAccess(receiver, indexExpression));
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package org.jetbrains.k2js.translate.intrinsic.array;
|
||||||
|
|
||||||
|
import com.google.dart.compiler.backend.js.ast.JsArrayLiteral;
|
||||||
|
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.FunctionIntrinsic;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Talanov Pavel
|
||||||
|
*/
|
||||||
|
public enum ArrayNullConstructorIntrinsic implements FunctionIntrinsic {
|
||||||
|
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
//TODO: implement function passing to array constructor
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public JsExpression apply(@NotNull JsExpression receiver, @NotNull List<JsExpression> arguments,
|
||||||
|
@NotNull TranslationContext context) {
|
||||||
|
return new JsArrayLiteral();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package org.jetbrains.k2js.translate.intrinsic.array;
|
||||||
|
|
||||||
|
import com.google.dart.compiler.backend.js.ast.JsArrayAccess;
|
||||||
|
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||||
|
import com.google.dart.compiler.util.AstUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.FunctionIntrinsic;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Talanov Pavel
|
||||||
|
*/
|
||||||
|
public enum ArraySetIntrinsic implements FunctionIntrinsic {
|
||||||
|
|
||||||
|
INSTANCE;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public JsExpression apply(@NotNull JsExpression receiver, @NotNull List<JsExpression> arguments,
|
||||||
|
@NotNull TranslationContext context) {
|
||||||
|
assert arguments.size() == 2 : "Array set expression must have two arguments.";
|
||||||
|
JsExpression indexExpression = arguments.get(0);
|
||||||
|
JsExpression value = arguments.get(1);
|
||||||
|
JsArrayAccess arrayAccess = AstUtil.newArrayAccess(receiver, indexExpression);
|
||||||
|
return AstUtil.newAssignment(arrayAccess, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package org.jetbrains.k2js.translate.intrinsic.array;
|
||||||
|
|
||||||
|
import com.google.dart.compiler.backend.js.ast.*;
|
||||||
|
import com.google.dart.compiler.util.AstUtil;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.k2js.translate.context.TemporaryVariable;
|
||||||
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
|
||||||
|
import static org.jetbrains.k2js.translate.utils.TranslationUtils.zeroLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Talanov Pavel
|
||||||
|
*/
|
||||||
|
public final class IntrinsicArrayUtils {
|
||||||
|
|
||||||
|
private IntrinsicArrayUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static JsConditional indexInBoundsCheck(@NotNull JsExpression indexExpression,
|
||||||
|
@NotNull TemporaryVariable arrayTemporary,
|
||||||
|
@NotNull TranslationContext context) {
|
||||||
|
JsExpression positiveOrZero = new JsBinaryOperation
|
||||||
|
(JsBinaryOperator.GTE, indexExpression, zeroLiteral(context));
|
||||||
|
JsNameRef lengthExpression = AstUtil.newQualifiedNameRef("length");
|
||||||
|
lengthExpression.setQualifier(arrayTemporary.nameReference());
|
||||||
|
JsExpression lessThanLength = new JsBinaryOperation
|
||||||
|
(JsBinaryOperator.LT, indexExpression, lengthExpression);
|
||||||
|
JsExpression indexInBounds = AstUtil.and(positiveOrZero, lessThanLength);
|
||||||
|
JsConditional indexCheck = new JsConditional();
|
||||||
|
indexCheck.setTestExpression(indexInBounds);
|
||||||
|
indexCheck.setElseExpression(throwOutOfBoundsException());
|
||||||
|
return indexCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static JsExpression throwOutOfBoundsException() {
|
||||||
|
//TODO: think about exception
|
||||||
|
return new JsThisRef();
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-5
@@ -1,4 +1,4 @@
|
|||||||
package org.jetbrains.k2js.translate.intrinsic;
|
package org.jetbrains.k2js.translate.intrinsic.primitive;
|
||||||
|
|
||||||
import com.google.dart.compiler.backend.js.ast.JsBinaryOperation;
|
import com.google.dart.compiler.backend.js.ast.JsBinaryOperation;
|
||||||
import com.google.dart.compiler.backend.js.ast.JsBinaryOperator;
|
import com.google.dart.compiler.backend.js.ast.JsBinaryOperator;
|
||||||
@@ -6,6 +6,7 @@ import com.google.dart.compiler.backend.js.ast.JsExpression;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lexer.JetToken;
|
import org.jetbrains.jet.lexer.JetToken;
|
||||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.FunctionIntrinsic;
|
||||||
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -13,18 +14,18 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
*/
|
*/
|
||||||
public class BinaryOperationIntrinsic extends FunctionIntrinsic {
|
public final class PrimitiveBinaryOperationIntrinsic implements FunctionIntrinsic {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
/*package*/ static BinaryOperationIntrinsic newInstance(@NotNull JetToken token) {
|
public static PrimitiveBinaryOperationIntrinsic newInstance(@NotNull JetToken token) {
|
||||||
JsBinaryOperator operator = OperatorTable.getBinaryOperator(token);
|
JsBinaryOperator operator = OperatorTable.getBinaryOperator(token);
|
||||||
return new BinaryOperationIntrinsic(operator);
|
return new PrimitiveBinaryOperationIntrinsic(operator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final JsBinaryOperator operator;
|
private final JsBinaryOperator operator;
|
||||||
|
|
||||||
private BinaryOperationIntrinsic(@NotNull JsBinaryOperator operator) {
|
private PrimitiveBinaryOperationIntrinsic(@NotNull JsBinaryOperator operator) {
|
||||||
this.operator = operator;
|
this.operator = operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
+3
-2
@@ -1,10 +1,11 @@
|
|||||||
package org.jetbrains.k2js.translate.intrinsic;
|
package org.jetbrains.k2js.translate.intrinsic.primitive;
|
||||||
|
|
||||||
import com.google.dart.compiler.backend.js.ast.JsBinaryOperation;
|
import com.google.dart.compiler.backend.js.ast.JsBinaryOperation;
|
||||||
import com.google.dart.compiler.backend.js.ast.JsBinaryOperator;
|
import com.google.dart.compiler.backend.js.ast.JsBinaryOperator;
|
||||||
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.CompareToIntrinsic;
|
||||||
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,7 +16,7 @@ import java.util.List;
|
|||||||
public final class PrimitiveCompareToIntrinsic extends CompareToIntrinsic {
|
public final class PrimitiveCompareToIntrinsic extends CompareToIntrinsic {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
/*package*/ static PrimitiveCompareToIntrinsic newInstance() {
|
public static PrimitiveCompareToIntrinsic newInstance() {
|
||||||
return new PrimitiveCompareToIntrinsic();
|
return new PrimitiveCompareToIntrinsic();
|
||||||
}
|
}
|
||||||
|
|
||||||
+3
-2
@@ -1,9 +1,10 @@
|
|||||||
package org.jetbrains.k2js.translate.intrinsic;
|
package org.jetbrains.k2js.translate.intrinsic.primitive;
|
||||||
|
|
||||||
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||||
import com.google.dart.compiler.util.AstUtil;
|
import com.google.dart.compiler.util.AstUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.EqualsIntrinsic;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ import java.util.List;
|
|||||||
public final class PrimitiveEqualsIntrinsic extends EqualsIntrinsic {
|
public final class PrimitiveEqualsIntrinsic extends EqualsIntrinsic {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
/*package*/ static PrimitiveEqualsIntrinsic newInstance() {
|
public static PrimitiveEqualsIntrinsic newInstance() {
|
||||||
return new PrimitiveEqualsIntrinsic();
|
return new PrimitiveEqualsIntrinsic();
|
||||||
}
|
}
|
||||||
|
|
||||||
+6
-5
@@ -1,4 +1,4 @@
|
|||||||
package org.jetbrains.k2js.translate.intrinsic;
|
package org.jetbrains.k2js.translate.intrinsic.primitive;
|
||||||
|
|
||||||
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||||
import com.google.dart.compiler.backend.js.ast.JsPrefixOperation;
|
import com.google.dart.compiler.backend.js.ast.JsPrefixOperation;
|
||||||
@@ -6,6 +6,7 @@ import com.google.dart.compiler.backend.js.ast.JsUnaryOperator;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lexer.JetToken;
|
import org.jetbrains.jet.lexer.JetToken;
|
||||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.FunctionIntrinsic;
|
||||||
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
import org.jetbrains.k2js.translate.operation.OperatorTable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -13,18 +14,18 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
*/
|
*/
|
||||||
public class UnaryOperationIntrinsic extends FunctionIntrinsic {
|
public final class PrimitiveUnaryOperationIntrinsic implements FunctionIntrinsic {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
/*package*/ static UnaryOperationIntrinsic newInstance(@NotNull JetToken token) {
|
public static PrimitiveUnaryOperationIntrinsic newInstance(@NotNull JetToken token) {
|
||||||
JsUnaryOperator operator = OperatorTable.getUnaryOperator(token);
|
JsUnaryOperator operator = OperatorTable.getUnaryOperator(token);
|
||||||
return new UnaryOperationIntrinsic(operator);
|
return new PrimitiveUnaryOperationIntrinsic(operator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private final JsUnaryOperator operator;
|
private final JsUnaryOperator operator;
|
||||||
|
|
||||||
private UnaryOperationIntrinsic(@NotNull JsUnaryOperator operator) {
|
private PrimitiveUnaryOperationIntrinsic(@NotNull JsUnaryOperator operator) {
|
||||||
this.operator = operator;
|
this.operator = operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3,7 +3,6 @@ package org.jetbrains.k2js.translate.operation;
|
|||||||
import com.google.dart.compiler.backend.js.ast.JsBinaryOperation;
|
import com.google.dart.compiler.backend.js.ast.JsBinaryOperation;
|
||||||
import com.google.dart.compiler.backend.js.ast.JsBinaryOperator;
|
import com.google.dart.compiler.backend.js.ast.JsBinaryOperator;
|
||||||
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
import com.google.dart.compiler.backend.js.ast.JsExpression;
|
||||||
import com.google.dart.compiler.backend.js.ast.JsNumberLiteral;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||||
import org.jetbrains.jet.lang.psi.JetBinaryExpression;
|
import org.jetbrains.jet.lang.psi.JetBinaryExpression;
|
||||||
@@ -13,6 +12,7 @@ import org.jetbrains.k2js.translate.context.TranslationContext;
|
|||||||
import org.jetbrains.k2js.translate.general.AbstractTranslator;
|
import org.jetbrains.k2js.translate.general.AbstractTranslator;
|
||||||
import org.jetbrains.k2js.translate.intrinsic.CompareToIntrinsic;
|
import org.jetbrains.k2js.translate.intrinsic.CompareToIntrinsic;
|
||||||
import org.jetbrains.k2js.translate.reference.CallTranslator;
|
import org.jetbrains.k2js.translate.reference.CallTranslator;
|
||||||
|
import org.jetbrains.k2js.translate.utils.TranslationUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -73,10 +73,9 @@ public final class CompareToTranslator extends AbstractTranslator {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JsExpression overloadedCompareTo() {
|
private JsExpression overloadedCompareTo() {
|
||||||
JsNumberLiteral zeroLiteral = program().getNumberLiteral(0);
|
|
||||||
JsBinaryOperator correspondingOperator = OperatorTable.getBinaryOperator(operationToken);
|
JsBinaryOperator correspondingOperator = OperatorTable.getBinaryOperator(operationToken);
|
||||||
JsExpression methodCall = CallTranslator.translate(expression, context());
|
JsExpression methodCall = CallTranslator.translate(expression, context());
|
||||||
return new JsBinaryOperation(correspondingOperator, methodCall, zeroLiteral);
|
return new JsBinaryOperation(correspondingOperator, methodCall, TranslationUtils.zeroLiteral(context()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
|||||||
import org.jetbrains.jet.lang.psi.JetArrayAccessExpression;
|
import org.jetbrains.jet.lang.psi.JetArrayAccessExpression;
|
||||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
import org.jetbrains.k2js.translate.general.Translation;
|
import org.jetbrains.k2js.translate.general.Translation;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.array.ArrayGetIntrinsic;
|
||||||
|
import org.jetbrains.k2js.translate.intrinsic.array.ArraySetIntrinsic;
|
||||||
import org.jetbrains.k2js.translate.utils.BindingUtils;
|
import org.jetbrains.k2js.translate.utils.BindingUtils;
|
||||||
import org.jetbrains.k2js.translate.utils.TranslationUtils;
|
import org.jetbrains.k2js.translate.utils.TranslationUtils;
|
||||||
|
|
||||||
@@ -41,19 +43,47 @@ public final class ArrayAccessTranslator extends AccessTranslator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public JsInvocation translateAsGet() {
|
public JsExpression translateAsGet() {
|
||||||
return translateAsArrayAccessWithIndices();
|
if (intrinsicCall()) {
|
||||||
|
return intrinsicGet();
|
||||||
|
}
|
||||||
|
return translateAsAccessMethodCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean intrinsicCall() {
|
||||||
|
return context().intrinsics().isIntrinsic(methodDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JsExpression intrinsicGet() {
|
||||||
|
return ArrayGetIntrinsic.INSTANCE.apply(translateArrayExpression(), translateIndexExpressions(), context());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public JsExpression translateAsSet(@NotNull JsExpression expression) {
|
public JsExpression translateAsSet(@NotNull JsExpression expression) {
|
||||||
JsInvocation setCall = translateAsArrayAccessWithIndices();
|
if (intrinsicCall()) {
|
||||||
|
return intrinsicSet(expression);
|
||||||
|
}
|
||||||
|
return overloadedSet(expression);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JsExpression intrinsicSet(@NotNull JsExpression expression) {
|
||||||
|
List<JsExpression> arguments = translateIndexExpressions();
|
||||||
|
arguments.add(expression);
|
||||||
|
return ArraySetIntrinsic.INSTANCE.apply(translateArrayExpression(), arguments, context());
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JsExpression overloadedSet(@NotNull JsExpression expression) {
|
||||||
|
JsInvocation setCall = translateAsAccessMethodCall();
|
||||||
setCall.getArguments().add(expression);
|
setCall.getArguments().add(expression);
|
||||||
return setCall;
|
return setCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JsInvocation translateAsArrayAccessWithIndices() {
|
@NotNull
|
||||||
|
private JsInvocation translateAsAccessMethodCall() {
|
||||||
JsNameRef accessMethodReference = getAccessMethodReference();
|
JsNameRef accessMethodReference = getAccessMethodReference();
|
||||||
AstUtil.setQualifier(accessMethodReference, translateArrayExpression());
|
AstUtil.setQualifier(accessMethodReference, translateArrayExpression());
|
||||||
return AstUtil.newInvocation(accessMethodReference, translateIndexExpressions());
|
return AstUtil.newInvocation(accessMethodReference, translateIndexExpressions());
|
||||||
|
|||||||
@@ -26,18 +26,9 @@ import static org.jetbrains.k2js.translate.utils.TranslationUtils.*;
|
|||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
*/
|
*/
|
||||||
|
//TODO: write tests on calling backing fields as functions
|
||||||
public final class CallTranslator extends AbstractTranslator {
|
public final class CallTranslator extends AbstractTranslator {
|
||||||
|
|
||||||
|
|
||||||
//TODO: remove?
|
|
||||||
|
|
||||||
// public static boolean isFunctionCall(@NotNull JetOperationExpression expression,
|
|
||||||
// @NotNull TranslationContext context) {
|
|
||||||
// DeclarationDescriptor descriptor = getDescriptorForReferenceExpression
|
|
||||||
// (context.bindingContext(), expression.getOperation());
|
|
||||||
// return (descriptor instanceof FunctionDescriptor);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static JsExpression translate(@NotNull JetUnaryExpression unaryExpression,
|
public static JsExpression translate(@NotNull JetUnaryExpression unaryExpression,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
JsExpression receiver = TranslationUtils.translateBaseExpression(context, unaryExpression);
|
JsExpression receiver = TranslationUtils.translateBaseExpression(context, unaryExpression);
|
||||||
@@ -48,6 +39,7 @@ public final class CallTranslator extends AbstractTranslator {
|
|||||||
return (new CallTranslator(receiver, arguments, (FunctionDescriptor) descriptor, context)).translate();
|
return (new CallTranslator(receiver, arguments, (FunctionDescriptor) descriptor, context)).translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: method too long
|
||||||
public static JsExpression translate(@NotNull JetDotQualifiedExpression dotExpression,
|
public static JsExpression translate(@NotNull JetDotQualifiedExpression dotExpression,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
//TODO: look for duplication
|
//TODO: look for duplication
|
||||||
|
|||||||
+46
-8
@@ -7,6 +7,7 @@ import com.google.dart.compiler.backend.js.ast.JsNameRef;
|
|||||||
import com.google.dart.compiler.util.AstUtil;
|
import com.google.dart.compiler.util.AstUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.PropertyGetterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.PropertyGetterDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.PropertySetterDescriptor;
|
import org.jetbrains.jet.lang.descriptors.PropertySetterDescriptor;
|
||||||
@@ -15,9 +16,11 @@ import org.jetbrains.jet.lang.psi.JetQualifiedExpression;
|
|||||||
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
|
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
|
||||||
import org.jetbrains.k2js.translate.context.TranslationContext;
|
import org.jetbrains.k2js.translate.context.TranslationContext;
|
||||||
import org.jetbrains.k2js.translate.general.Translation;
|
import org.jetbrains.k2js.translate.general.Translation;
|
||||||
import org.jetbrains.k2js.translate.utils.BindingUtils;
|
|
||||||
|
|
||||||
|
import static org.jetbrains.k2js.translate.utils.BindingUtils.getDescriptorForReferenceExpression;
|
||||||
import static org.jetbrains.k2js.translate.utils.PsiUtils.getSelectorAsSimpleName;
|
import static org.jetbrains.k2js.translate.utils.PsiUtils.getSelectorAsSimpleName;
|
||||||
|
import static org.jetbrains.k2js.translate.utils.PsiUtils.isBackingFieldReference;
|
||||||
|
import static org.jetbrains.k2js.translate.utils.TranslationUtils.backingFieldReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
@@ -85,7 +88,8 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
|
|
||||||
public static boolean canBePropertyGetterCall(@NotNull JetSimpleNameExpression expression,
|
public static boolean canBePropertyGetterCall(@NotNull JetSimpleNameExpression expression,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
return (BindingUtils.getPropertyDescriptorForSimpleName(context.bindingContext(), expression) != null);
|
return (getDescriptorForReferenceExpression
|
||||||
|
(context.bindingContext(), expression) instanceof PropertyDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canBePropertyGetterCall(@NotNull JetExpression expression,
|
public static boolean canBePropertyGetterCall(@NotNull JetExpression expression,
|
||||||
@@ -108,19 +112,23 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
private final JetExpression qualifier;
|
private final JetExpression qualifier;
|
||||||
@NotNull
|
@NotNull
|
||||||
private final PropertyDescriptor propertyDescriptor;
|
private final PropertyDescriptor propertyDescriptor;
|
||||||
|
private final boolean isBackingFieldAccess;
|
||||||
|
|
||||||
private PropertyAccessTranslator(@NotNull JetSimpleNameExpression simpleName,
|
private PropertyAccessTranslator(@NotNull JetSimpleNameExpression simpleName,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
super(context);
|
super(context);
|
||||||
this.qualifier = null;
|
this.qualifier = null;
|
||||||
this.propertyDescriptor = getPropertyDescriptor(simpleName);
|
this.propertyDescriptor = getPropertyDescriptor(simpleName);
|
||||||
|
this.isBackingFieldAccess = isBackingFieldReference(simpleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PropertyAccessTranslator(@NotNull JetQualifiedExpression qualifiedExpression,
|
private PropertyAccessTranslator(@NotNull JetQualifiedExpression qualifiedExpression,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
super(context);
|
super(context);
|
||||||
this.qualifier = qualifiedExpression.getReceiverExpression();
|
this.qualifier = qualifiedExpression.getReceiverExpression();
|
||||||
this.propertyDescriptor = getPropertyDescriptor(getNotNullSelector(qualifiedExpression));
|
JetSimpleNameExpression selector = getNotNullSelector(qualifiedExpression);
|
||||||
|
this.propertyDescriptor = getPropertyDescriptor(selector);
|
||||||
|
this.isBackingFieldAccess = isBackingFieldReference(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PropertyAccessTranslator(@NotNull PropertyDescriptor descriptor,
|
private PropertyAccessTranslator(@NotNull PropertyDescriptor descriptor,
|
||||||
@@ -128,11 +136,26 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
super(context);
|
super(context);
|
||||||
this.qualifier = null;
|
this.qualifier = null;
|
||||||
this.propertyDescriptor = descriptor;
|
this.propertyDescriptor = descriptor;
|
||||||
|
this.isBackingFieldAccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public JsExpression translateAsGet() {
|
public JsExpression translateAsGet() {
|
||||||
|
if (isBackingFieldAccess) {
|
||||||
|
return backingFieldGet();
|
||||||
|
} else {
|
||||||
|
return getterCall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JsExpression backingFieldGet() {
|
||||||
|
return backingFieldReference(context(), propertyDescriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JsExpression getterCall() {
|
||||||
JsName getterName = getGetterName();
|
JsName getterName = getGetterName();
|
||||||
return qualifiedAccessorInvocation(getterName);
|
return qualifiedAccessorInvocation(getterName);
|
||||||
}
|
}
|
||||||
@@ -140,12 +163,27 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public JsExpression translateAsSet(@NotNull JsExpression toSetTo) {
|
public JsExpression translateAsSet(@NotNull JsExpression toSetTo) {
|
||||||
|
if (isBackingFieldAccess) {
|
||||||
|
return backingFieldAssignment(toSetTo);
|
||||||
|
} else {
|
||||||
|
return setterCall(toSetTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JsExpression setterCall(@NotNull JsExpression toSetTo) {
|
||||||
JsName setterName = getSetterName();
|
JsName setterName = getSetterName();
|
||||||
JsInvocation setterCall = qualifiedAccessorInvocation(setterName);
|
JsInvocation setterCall = qualifiedAccessorInvocation(setterName);
|
||||||
setterCall.getArguments().add(toSetTo);
|
setterCall.getArguments().add(toSetTo);
|
||||||
return setterCall;
|
return setterCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private JsExpression backingFieldAssignment(@NotNull JsExpression toSetTo) {
|
||||||
|
JsNameRef backingFieldReference = backingFieldReference(context(), propertyDescriptor);
|
||||||
|
return AstUtil.newAssignment(backingFieldReference, toSetTo);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private JsInvocation qualifiedAccessorInvocation(@NotNull JsName accessorName) {
|
private JsInvocation qualifiedAccessorInvocation(@NotNull JsName accessorName) {
|
||||||
JsNameRef accessorReference = accessorName.makeRef();
|
JsNameRef accessorReference = accessorName.makeRef();
|
||||||
@@ -197,12 +235,12 @@ public final class PropertyAccessTranslator extends AccessTranslator {
|
|||||||
return setter;
|
return setter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private PropertyDescriptor getPropertyDescriptor(@NotNull JetSimpleNameExpression expression) {
|
private PropertyDescriptor getPropertyDescriptor(@NotNull JetSimpleNameExpression expression) {
|
||||||
PropertyDescriptor propertyDescriptor =
|
DeclarationDescriptor descriptor =
|
||||||
BindingUtils.getPropertyDescriptorForSimpleName(context().bindingContext(), expression);
|
getDescriptorForReferenceExpression(context().bindingContext(), expression);
|
||||||
assert propertyDescriptor != null;
|
//TODO
|
||||||
return propertyDescriptor;
|
assert descriptor instanceof PropertyDescriptor;
|
||||||
|
return (PropertyDescriptor) descriptor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,61 +12,14 @@ import org.jetbrains.k2js.translate.general.AbstractTranslator;
|
|||||||
import org.jetbrains.k2js.translate.utils.BindingUtils;
|
import org.jetbrains.k2js.translate.utils.BindingUtils;
|
||||||
import org.jetbrains.k2js.translate.utils.TranslationUtils;
|
import org.jetbrains.k2js.translate.utils.TranslationUtils;
|
||||||
|
|
||||||
|
import static org.jetbrains.k2js.translate.utils.BindingUtils.getDescriptorForReferenceExpression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
*/
|
*/
|
||||||
public class ReferenceTranslator extends AbstractTranslator {
|
public class ReferenceTranslator extends AbstractTranslator {
|
||||||
|
|
||||||
@NotNull
|
// TODO: move to other util
|
||||||
private final JetSimpleNameExpression simpleName;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private JsExpression result;
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static JsExpression translateSimpleName(@NotNull JetSimpleNameExpression expression,
|
|
||||||
@NotNull TranslationContext context) {
|
|
||||||
return (new ReferenceTranslator(expression, context)).translateSimpleName();
|
|
||||||
}
|
|
||||||
|
|
||||||
private ReferenceTranslator(@NotNull JetSimpleNameExpression expression, @NotNull TranslationContext context) {
|
|
||||||
super(context);
|
|
||||||
this.simpleName = expression;
|
|
||||||
this.result = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
//TODO: make this process simpler and clearer
|
|
||||||
public JsExpression translateSimpleName() {
|
|
||||||
tryResolveAsAlias();
|
|
||||||
tryResolveAsPropertyAccess();
|
|
||||||
tryResolveAsReference();
|
|
||||||
if (result != null) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
throw new AssertionError("Undefined name in this scope: " + simpleName.getReferencedName());
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: refactor
|
|
||||||
private void tryResolveAsReference() {
|
|
||||||
if (alreadyResolved()) return;
|
|
||||||
|
|
||||||
DeclarationDescriptor referencedDescriptor =
|
|
||||||
BindingUtils.getDescriptorForReferenceExpression(context().bindingContext(), simpleName);
|
|
||||||
|
|
||||||
if (referencedDescriptor == null) return;
|
|
||||||
if (!context().isDeclared(referencedDescriptor)) return;
|
|
||||||
|
|
||||||
JsName referencedName = context().getNameForDescriptor(referencedDescriptor);
|
|
||||||
JsExpression implicitReceiver = getImplicitReceiver(referencedDescriptor, context());
|
|
||||||
|
|
||||||
if (implicitReceiver != null) {
|
|
||||||
result = AstUtil.qualified(referencedName, implicitReceiver);
|
|
||||||
} else {
|
|
||||||
result = context().getNameForDescriptor(referencedDescriptor).makeRef();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static JsExpression getImplicitReceiver(@NotNull DeclarationDescriptor referencedDescriptor,
|
public static JsExpression getImplicitReceiver(@NotNull DeclarationDescriptor referencedDescriptor,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
@@ -80,28 +33,74 @@ public class ReferenceTranslator extends AbstractTranslator {
|
|||||||
return context.declarations().getQualifier(referencedDescriptor);
|
return context.declarations().getQualifier(referencedDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static JsExpression translateSimpleName(@NotNull JetSimpleNameExpression expression,
|
||||||
|
@NotNull TranslationContext context) {
|
||||||
|
if (PropertyAccessTranslator.canBePropertyAccess(expression, context)) {
|
||||||
|
return PropertyAccessTranslator.translateAsPropertyGetterCall(expression, context);
|
||||||
|
}
|
||||||
|
DeclarationDescriptor referencedDescriptor =
|
||||||
|
getDescriptorForReferenceExpression(context.bindingContext(), expression);
|
||||||
|
return (new ReferenceTranslator(referencedDescriptor, context)).translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static JsExpression translateReference(@NotNull DeclarationDescriptor referencedDescriptor,
|
||||||
|
@NotNull TranslationContext context) {
|
||||||
|
return (new ReferenceTranslator(referencedDescriptor, context)).translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private final DeclarationDescriptor referencedDescriptor;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private JsExpression result;
|
||||||
|
|
||||||
|
private ReferenceTranslator(@NotNull DeclarationDescriptor referencedDescriptor, @NotNull TranslationContext context) {
|
||||||
|
super(context);
|
||||||
|
this.referencedDescriptor = referencedDescriptor;
|
||||||
|
this.result = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public JsExpression translate() {
|
||||||
|
tryResolveAsAlias();
|
||||||
|
tryResolveAsReference();
|
||||||
|
if (result != null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
throw new AssertionError("Undefined name in this scope: " + referencedDescriptor.getName());
|
||||||
|
}
|
||||||
|
|
||||||
private void tryResolveAsAlias() {
|
private void tryResolveAsAlias() {
|
||||||
//TODO: decide if this code is meaningful
|
|
||||||
if (alreadyResolved()) return;
|
if (alreadyResolved()) return;
|
||||||
|
|
||||||
DeclarationDescriptor referencedDescriptor =
|
|
||||||
BindingUtils.getDescriptorForReferenceExpression(context().bindingContext(), simpleName);
|
|
||||||
|
|
||||||
if (referencedDescriptor == null) return;
|
|
||||||
if (!context().aliaser().hasAliasForDeclaration(referencedDescriptor)) return;
|
if (!context().aliaser().hasAliasForDeclaration(referencedDescriptor)) return;
|
||||||
|
|
||||||
result = context().aliaser().getAliasForDeclaration(referencedDescriptor);
|
result = context().aliaser().getAliasForDeclaration(referencedDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void tryResolveAsReference() {
|
||||||
|
if (alreadyResolved()) return;
|
||||||
|
|
||||||
|
if (!context().isDeclared(referencedDescriptor)) return;
|
||||||
|
|
||||||
|
JsName referencedName = context().getNameForDescriptor(referencedDescriptor);
|
||||||
|
JsExpression implicitReceiver = getImplicitReceiver(referencedDescriptor, context());
|
||||||
|
|
||||||
|
generateReference(referencedName, implicitReceiver);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateReference(@NotNull JsName referencedName, @Nullable JsExpression implicitReceiver) {
|
||||||
|
if (implicitReceiver != null) {
|
||||||
|
result = AstUtil.qualified(referencedName, implicitReceiver);
|
||||||
|
} else {
|
||||||
|
result = context().getNameForDescriptor(referencedDescriptor).makeRef();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean alreadyResolved() {
|
private boolean alreadyResolved() {
|
||||||
return result != null;
|
return result != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryResolveAsPropertyAccess() {
|
|
||||||
if (alreadyResolved()) return;
|
|
||||||
|
|
||||||
if (!PropertyAccessTranslator.canBePropertyGetterCall(simpleName, context())) return;
|
|
||||||
|
|
||||||
result = PropertyAccessTranslator.translateAsPropertyGetterCall(simpleName, context());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.jetbrains.k2js.translate.utils.DescriptorUtils.getVariableDescriptorForVariableAsFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
* <p/>
|
* <p/>
|
||||||
@@ -32,6 +34,7 @@ public final class BindingUtils {
|
|||||||
assert descriptor != null;
|
assert descriptor != null;
|
||||||
assert descriptorClass.isInstance(descriptor)
|
assert descriptorClass.isInstance(descriptor)
|
||||||
: expression.toString() + " expected to have of type" + descriptorClass.toString();
|
: expression.toString() + " expected to have of type" + descriptorClass.toString();
|
||||||
|
//noinspection unchecked
|
||||||
return (D) descriptor;
|
return (D) descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,23 +67,6 @@ public final class BindingUtils {
|
|||||||
return getDescriptorForExpression(context, declaration, PropertyDescriptor.class);
|
return getDescriptorForExpression(context, declaration, PropertyDescriptor.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: possibly remove
|
|
||||||
// @NotNull
|
|
||||||
// public static PropertySetterDescriptor getPropertySetterDescriptorForProperty(@NotNull BindingContext context,
|
|
||||||
// @NotNull JetProperty property) {
|
|
||||||
// PropertySetterDescriptor result = getPropertyDescriptor(context, property).getSetter();
|
|
||||||
// assert result != null : "Property should have a setter descriptor";
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @NotNull
|
|
||||||
// public static PropertyGetterDescriptor getPropertyGetterDescriptorForProperty(@NotNull BindingContext context,
|
|
||||||
// @NotNull JetProperty property) {
|
|
||||||
// PropertyGetterDescriptor result = getPropertyDescriptor(context, property).getGetter();
|
|
||||||
// assert result != null : "Property should have a getter descriptor";
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetClass getClassForDescriptor(@NotNull BindingContext context,
|
public static JetClass getClassForDescriptor(@NotNull BindingContext context,
|
||||||
@NotNull ClassDescriptor descriptor) {
|
@NotNull ClassDescriptor descriptor) {
|
||||||
@@ -89,17 +75,6 @@ public final class BindingUtils {
|
|||||||
return (JetClass) result;
|
return (JetClass) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: delete?
|
|
||||||
@Nullable
|
|
||||||
public static JetDeclaration getDeclarationForDescriptor(@NotNull BindingContext context,
|
|
||||||
@NotNull DeclarationDescriptor descriptor) {
|
|
||||||
PsiElement result = context.get(BindingContext.DESCRIPTOR_TO_DECLARATION, descriptor);
|
|
||||||
if (!(result instanceof JetDeclaration)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (JetDeclaration) result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static List<ClassDescriptor> getSuperclassDescriptors(@NotNull BindingContext context,
|
public static List<ClassDescriptor> getSuperclassDescriptors(@NotNull BindingContext context,
|
||||||
@NotNull JetClass classDeclaration) {
|
@NotNull JetClass classDeclaration) {
|
||||||
@@ -131,7 +106,7 @@ public final class BindingUtils {
|
|||||||
|
|
||||||
public static boolean hasAncestorClass(@NotNull BindingContext context, @NotNull JetClass classDeclaration) {
|
public static boolean hasAncestorClass(@NotNull BindingContext context, @NotNull JetClass classDeclaration) {
|
||||||
List<ClassDescriptor> superclassDescriptors = getSuperclassDescriptors(context, classDeclaration);
|
List<ClassDescriptor> superclassDescriptors = getSuperclassDescriptors(context, classDeclaration);
|
||||||
return (findAncestorClass(superclassDescriptors) != null);
|
return (DescriptorUtils.findAncestorClass(superclassDescriptors) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isStatement(@NotNull BindingContext context, @NotNull JetExpression expression) {
|
public static boolean isStatement(@NotNull BindingContext context, @NotNull JetExpression expression) {
|
||||||
@@ -170,25 +145,26 @@ public final class BindingUtils {
|
|||||||
return (JetProperty) result;
|
return (JetProperty) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@NotNull
|
||||||
public static DeclarationDescriptor getDescriptorForReferenceExpression(@NotNull BindingContext context,
|
public static DeclarationDescriptor getDescriptorForReferenceExpression(@NotNull BindingContext context,
|
||||||
@NotNull JetReferenceExpression reference) {
|
@NotNull JetReferenceExpression reference) {
|
||||||
return context.get(BindingContext.REFERENCE_TARGET, reference);
|
DeclarationDescriptor referencedDescriptor = getNullableDescriptorForReferenceExpression(context, reference);
|
||||||
|
assert referencedDescriptor != null : "Reference expression must reference a descriptor.";
|
||||||
|
return referencedDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static private boolean isNotAny(@NotNull DeclarationDescriptor superClassDescriptor) {
|
|
||||||
return !superClassDescriptor.equals(JetStandardClasses.getAny());
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO move unrelated utils to other class
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ClassDescriptor findAncestorClass(@NotNull List<ClassDescriptor> superclassDescriptors) {
|
private static DeclarationDescriptor getNullableDescriptorForReferenceExpression(@NotNull BindingContext context,
|
||||||
for (ClassDescriptor descriptor : superclassDescriptors) {
|
@NotNull JetReferenceExpression reference) {
|
||||||
if (descriptor.getKind() == ClassKind.CLASS) {
|
DeclarationDescriptor referencedDescriptor = context.get(BindingContext.REFERENCE_TARGET, reference);
|
||||||
return descriptor;
|
if (referencedDescriptor instanceof VariableAsFunctionDescriptor) {
|
||||||
}
|
return getVariableDescriptorForVariableAsFunction((VariableAsFunctionDescriptor) referencedDescriptor);
|
||||||
}
|
}
|
||||||
return null;
|
return referencedDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isNotAny(@NotNull DeclarationDescriptor superClassDescriptor) {
|
||||||
|
return !superClassDescriptor.equals(JetStandardClasses.getAny());
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: duplication
|
//TODO: duplication
|
||||||
@@ -210,48 +186,30 @@ public final class BindingUtils {
|
|||||||
return (descriptor.getContainingDeclaration() instanceof ClassDescriptor);
|
return (descriptor.getContainingDeclaration() instanceof ClassDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
//TODO: refactor, check with getDescriptorForReferenceExpression
|
|
||||||
@Nullable
|
|
||||||
public static PropertyDescriptor getPropertyDescriptorForSimpleName(@NotNull BindingContext context,
|
|
||||||
@NotNull JetSimpleNameExpression expression) {
|
|
||||||
ResolvedCall<?> resolvedCall = BindingUtils.getResolvedCall(context, expression);
|
|
||||||
if (resolvedCall == null) return null;
|
|
||||||
|
|
||||||
DeclarationDescriptor descriptor = resolvedCall.getCandidateDescriptor();
|
|
||||||
if (descriptor instanceof PropertyDescriptor) {
|
|
||||||
return (PropertyDescriptor) descriptor;
|
|
||||||
}
|
|
||||||
if (descriptor instanceof VariableAsFunctionDescriptor) {
|
|
||||||
VariableAsFunctionDescriptor functionVariable = (VariableAsFunctionDescriptor) descriptor;
|
|
||||||
VariableDescriptor variableDescriptor = functionVariable.getVariableDescriptor();
|
|
||||||
if (variableDescriptor instanceof PropertyDescriptor) {
|
|
||||||
return (PropertyDescriptor) variableDescriptor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static ResolvedCall<?> getResolvedCall(@NotNull BindingContext context,
|
public static ResolvedCall<?> getResolvedCall(@NotNull BindingContext context,
|
||||||
@NotNull JetExpression expression) {
|
@NotNull JetExpression expression) {
|
||||||
return (context.get(BindingContext.RESOLVED_CALL, expression));
|
ResolvedCall<? extends CallableDescriptor> resolvedCall = context.get(BindingContext.RESOLVED_CALL, expression);
|
||||||
|
assert resolvedCall != null : "Must resolve to a call.";
|
||||||
|
return resolvedCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static FunctionDescriptor getFunctionDescriptorForCallExpression(@NotNull BindingContext context,
|
public static FunctionDescriptor getFunctionDescriptorForCallExpression(@NotNull BindingContext context,
|
||||||
@NotNull JetCallExpression expression) {
|
@NotNull JetCallExpression expression) {
|
||||||
//TODO: move to PSI utils
|
JetExpression calleeExpression = PsiUtils.getCallee(expression);
|
||||||
JetExpression calleeExpression = expression.getCalleeExpression();
|
|
||||||
assert calleeExpression != null;
|
|
||||||
ResolvedCall<?> resolvedCall = getResolvedCall(context, calleeExpression);
|
ResolvedCall<?> resolvedCall = getResolvedCall(context, calleeExpression);
|
||||||
//TODO
|
CallableDescriptor descriptor = getDescriptorForResolvedCall(resolvedCall);
|
||||||
CallableDescriptor descriptor = resolvedCall.getCandidateDescriptor();
|
|
||||||
assert descriptor instanceof FunctionDescriptor :
|
assert descriptor instanceof FunctionDescriptor :
|
||||||
"Callee expression must have resolved call with descriptor of type FunctionDescriptor";
|
"Callee expression must have resolved call with descriptor of type FunctionDescriptor";
|
||||||
return (FunctionDescriptor) descriptor;
|
return (FunctionDescriptor) descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static CallableDescriptor getDescriptorForResolvedCall(@NotNull ResolvedCall<?> resolvedCall) {
|
||||||
|
return resolvedCall.getCandidateDescriptor();
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isVariableReassignment(@NotNull BindingContext context, @NotNull JetExpression expression) {
|
public static boolean isVariableReassignment(@NotNull BindingContext context, @NotNull JetExpression expression) {
|
||||||
Boolean result = context.get(BindingContext.VARIABLE_REASSIGNMENT, expression);
|
Boolean result = context.get(BindingContext.VARIABLE_REASSIGNMENT, expression);
|
||||||
assert result != null;
|
assert result != null;
|
||||||
@@ -262,7 +220,7 @@ public final class BindingUtils {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public static FunctionDescriptor getFunctionDescriptorForOperationExpression(@NotNull BindingContext context,
|
public static FunctionDescriptor getFunctionDescriptorForOperationExpression(@NotNull BindingContext context,
|
||||||
@NotNull JetOperationExpression expression) {
|
@NotNull JetOperationExpression expression) {
|
||||||
DeclarationDescriptor descriptorForReferenceExpression = getDescriptorForReferenceExpression
|
DeclarationDescriptor descriptorForReferenceExpression = getNullableDescriptorForReferenceExpression
|
||||||
(context, expression.getOperation());
|
(context, expression.getOperation());
|
||||||
|
|
||||||
if (descriptorForReferenceExpression == null) return null;
|
if (descriptorForReferenceExpression == null) return null;
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package org.jetbrains.k2js.translate.utils;
|
package org.jetbrains.k2js.translate.utils;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
import org.jetbrains.jet.lang.types.expressions.OperatorConventions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
@@ -58,4 +58,43 @@ public final class DescriptorUtils {
|
|||||||
}
|
}
|
||||||
return resultingList;
|
return resultingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static FunctionDescriptor getFunctionByName(@NotNull ClassDescriptor classDescriptor,
|
||||||
|
@NotNull String name) {
|
||||||
|
JetScope scope = classDescriptor.getDefaultType().getMemberScope();
|
||||||
|
return getFunctionByName(scope, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static FunctionDescriptor getFunctionByName(@NotNull JetScope scope,
|
||||||
|
@NotNull String name) {
|
||||||
|
Set<FunctionDescriptor> functionDescriptors = scope.getFunctions(name);
|
||||||
|
assert functionDescriptors.size() == 1 :
|
||||||
|
"In scope " + scope + " supposed to be exactly one " + name + " function.";
|
||||||
|
//noinspection LoopStatementThatDoesntLoop
|
||||||
|
for (FunctionDescriptor descriptor : functionDescriptors) {
|
||||||
|
return descriptor;
|
||||||
|
}
|
||||||
|
throw new AssertionError("In scope " + scope
|
||||||
|
+ " supposed to be exactly one " + name + " function.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static ClassDescriptor findAncestorClass(@NotNull List<ClassDescriptor> superclassDescriptors) {
|
||||||
|
for (ClassDescriptor descriptor : superclassDescriptors) {
|
||||||
|
if (descriptor.getKind() == ClassKind.CLASS) {
|
||||||
|
return descriptor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
/*package*/ static VariableDescriptor getVariableDescriptorForVariableAsFunction
|
||||||
|
(@NotNull VariableAsFunctionDescriptor descriptor) {
|
||||||
|
VariableDescriptor functionVariable = descriptor.getVariableDescriptor();
|
||||||
|
assert functionVariable != null;
|
||||||
|
return functionVariable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,4 +47,15 @@ public final class PsiUtils {
|
|||||||
public static boolean isAssignment(JetToken token) {
|
public static boolean isAssignment(JetToken token) {
|
||||||
return (token == JetTokens.EQ);
|
return (token == JetTokens.EQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isBackingFieldReference(@NotNull JetSimpleNameExpression expression) {
|
||||||
|
return expression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
/*package*/ static JetExpression getCallee(@NotNull JetCallExpression expression) {
|
||||||
|
JetExpression calleeExpression = expression.getCalleeExpression();
|
||||||
|
assert calleeExpression != null;
|
||||||
|
return calleeExpression;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,15 +76,6 @@ public final class TranslationUtils {
|
|||||||
return AstUtil.qualified(backingFieldName, qualifier);
|
return AstUtil.qualified(backingFieldName, qualifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static String getPropertyName(@NotNull JetProperty expression) {
|
|
||||||
String propertyName = expression.getName();
|
|
||||||
if (propertyName == null) {
|
|
||||||
throw new AssertionError("Property with no name encountered!");
|
|
||||||
}
|
|
||||||
return propertyName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static JsExpression translateInitializerForProperty(@NotNull JetProperty declaration,
|
public static JsExpression translateInitializerForProperty(@NotNull JetProperty declaration,
|
||||||
@NotNull TranslationContext context) {
|
@NotNull TranslationContext context) {
|
||||||
@@ -212,4 +203,9 @@ public final class TranslationUtils {
|
|||||||
return JsFunction.getAnonymousFunctionWithScope(scope.jsScope());
|
return JsFunction.getAnonymousFunctionWithScope(scope.jsScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static JsNumberLiteral zeroLiteral(@NotNull TranslationContext context) {
|
||||||
|
return context.program().getNumberLiteral(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package org.jetbrains.k2js.test;
|
package org.jetbrains.k2js.test;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Talanov Pavel
|
* @author Talanov Pavel
|
||||||
*/
|
*/
|
||||||
@@ -11,14 +13,13 @@ public class StandardClassesTest extends TranslationTest {
|
|||||||
return MAIN;
|
return MAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: implement via intrinsics
|
@Test
|
||||||
// @Test
|
public void array() throws Exception {
|
||||||
// public void array() throws Exception {
|
testFooBoxIsTrue("array.kt");
|
||||||
// testFooBoxIsTrue("array.kt");
|
}
|
||||||
// }
|
|
||||||
//
|
@Test
|
||||||
// @Test
|
public void arrayAccess() throws Exception {
|
||||||
// public void arrayAccess() throws Exception {
|
testFooBoxIsTrue("arrayAccess.kt");
|
||||||
// testFooBoxIsTrue("arrayAccess.kt");
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
function test() {
|
function test() {
|
||||||
var a = new Kotlin.Array();
|
var a = new Kotlin.Array(3, function () {
|
||||||
|
return 3
|
||||||
|
});
|
||||||
a.set(0, "1")
|
a.set(0, "1")
|
||||||
a.set(2, "4")
|
a.set(2, "4")
|
||||||
return (a.get(0) == "1") && (a.get(2) == "4") && (a.get(1) == undefined);
|
return (a.get(0) == "1") && (a.get(2) == "4") && (a.get(1) == 3);
|
||||||
}
|
}
|
||||||
@@ -447,17 +447,35 @@ Object.extend(Function.prototype, (function () {
|
|||||||
})());
|
})());
|
||||||
|
|
||||||
Kotlin = {}
|
Kotlin = {}
|
||||||
|
Kotlin.Exceptions = {}
|
||||||
|
Kotlin.Exceptions.IndexOutOfBounds = {}
|
||||||
|
Kotlin.array = function (len) {
|
||||||
|
return new Kotlin.Array(len, function () {
|
||||||
|
return null
|
||||||
|
});
|
||||||
|
}
|
||||||
Kotlin.Array = Class.create({
|
Kotlin.Array = Class.create({
|
||||||
initialize:function () {
|
initialize:function (len, f) {
|
||||||
this.array = [];
|
this.array = [];
|
||||||
|
var i = 0;
|
||||||
|
while (i < len) {
|
||||||
|
this.array.push(f(i));
|
||||||
|
++i;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
get:function (index) {
|
get:function (index) {
|
||||||
|
if ((index < 0) || (index > this.array.length)) {
|
||||||
|
throw Kotlin.Exceptions.IndexOutOfBounds;
|
||||||
|
}
|
||||||
return (this.array)[index];
|
return (this.array)[index];
|
||||||
},
|
},
|
||||||
set:function (index, value) {
|
set:function (index, value) {
|
||||||
|
if ((index < 0) || (index > this.array.length)) {
|
||||||
|
throw Kotlin.Exceptions.IndexOutOfBounds;
|
||||||
|
}
|
||||||
(this.array)[index] = value;
|
(this.array)[index] = value;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
Kotlin.Class = Class
|
Kotlin.Class = Class
|
||||||
Kotlin.Namespace = Namespace
|
Kotlin.Namespace = Namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user