File tree 3 files changed +14
-1
lines changed
eu.numberfour.n4js/src/eu/numberfour/n4js/utils
eu.numberfour.n4js.transpiler/src/eu/numberfour/n4js/transpiler/print
eu.numberfour.n4js.transpiler.es/src/eu/numberfour/n4js/transpiler/es/transform
3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import eu.numberfour.n4jsx.n4JSX.JSXPropertyAttribute
23
23
import eu.numberfour.n4jsx.n4JSX.JSXSpreadAttribute
24
24
25
25
import static eu.numberfour.n4js.transpiler.TranspilerBuilderBlocks.*
26
+ import eu.numberfour.n4js.utils.N4JSLanguageUtils
26
27
27
28
/**
28
29
*
@@ -81,7 +82,7 @@ class JSXTransformation extends Transformation {
81
82
attr. valueExpressionFromPropertyAttribute)
82
83
}
83
84
JSXSpreadAttribute :
84
- throw new UnsupportedOperationException
85
+ _PropertyNameValuePair( N4JSLanguageUtils . SPREAD_IN_OJECT_LITERAL_WORK_AROUND , attr . expression)
85
86
}
86
87
}
87
88
Original file line number Diff line number Diff line change @@ -659,6 +659,11 @@ public Boolean casePropertyAssignmentAnnotationList(PropertyAssignmentAnnotation
659
659
660
660
@ Override
661
661
public Boolean casePropertyNameValuePair (PropertyNameValuePair original ) {
662
+ if (N4JSLanguageUtils .SPREAD_IN_OJECT_LITERAL_WORK_AROUND .equals (original .getName ())) {
663
+ write ("... " );
664
+ process (original .getExpression ());
665
+ return DONE ;
666
+ }
662
667
processPropertyName (original );
663
668
write (": " );
664
669
process (original .getExpression ());
Original file line number Diff line number Diff line change @@ -102,6 +102,13 @@ class N4JSLanguageUtils {
102
102
*/
103
103
public static final String SYMBOL_IDENTIFIER_PREFIX = ComputedPropertyNameValueConverter . SYMBOL_IDENTIFIER_PREFIX ;
104
104
105
+ /**
106
+ * Temporary hack to be able to support spread operator in the JSX transpiler support.
107
+ * This is required, because the ES6 spread operator is not yet supported in the N4JS grammar.
108
+ * TODO IDE-2471 remove this and add proper support for spread in object literals to grammar/parser
109
+ */
110
+ public static final String SPREAD_IN_OJECT_LITERAL_WORK_AROUND = " MISSING_SPREAD_WORK_AROUND" ;
111
+
105
112
/**
106
113
* If the given function definition is asynchronous, will wrap given return type into a Promise.
107
114
* Otherwise, returns given return type unchanged. A return type of <code >void</code> is changed to
You can’t perform that action at this time.
0 commit comments