ripple 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -77,6 +77,20 @@ function RipplePlugin(config) {
|
|
|
77
77
|
return this.finishNode(node, 'JSXExpressionContainer');
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
jsx_parseBindingExpression() {
|
|
81
|
+
let node = this.startNode();
|
|
82
|
+
this.next();
|
|
83
|
+
|
|
84
|
+
if (this.type === tt.bracketR) {
|
|
85
|
+
this.raise(node.start, 'bindings must only be assigned a non-empty expression');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
node.expression = this.parseExpression();
|
|
89
|
+
|
|
90
|
+
this.expect(tt.bracketR);
|
|
91
|
+
return this.finishNode(node, 'BindingExpression');
|
|
92
|
+
}
|
|
93
|
+
|
|
80
94
|
jsx_parseTupleContainer() {
|
|
81
95
|
var t = this.startNode();
|
|
82
96
|
return (
|
|
@@ -90,6 +104,7 @@ function RipplePlugin(config) {
|
|
|
90
104
|
|
|
91
105
|
jsx_parseAttribute() {
|
|
92
106
|
let node = this.startNode();
|
|
107
|
+
|
|
93
108
|
if (this.eat(tt.braceL)) {
|
|
94
109
|
if (this.type.label === '@') {
|
|
95
110
|
this.next();
|
|
@@ -129,6 +144,9 @@ function RipplePlugin(config) {
|
|
|
129
144
|
const tok = this.acornTypeScript.tokTypes;
|
|
130
145
|
|
|
131
146
|
switch (this.type) {
|
|
147
|
+
case tt.bracketL:
|
|
148
|
+
var t = this.jsx_parseBindingExpression();
|
|
149
|
+
return t;
|
|
132
150
|
case tt.braceL:
|
|
133
151
|
var t = this.jsx_parseExpressionContainer();
|
|
134
152
|
return (
|
|
@@ -179,6 +197,20 @@ function RipplePlugin(config) {
|
|
|
179
197
|
return this.finishNode(node, 'TryStatement');
|
|
180
198
|
}
|
|
181
199
|
|
|
200
|
+
// updateContext(e) {
|
|
201
|
+
// const s = this.type;
|
|
202
|
+
// const context = this.curContext();
|
|
203
|
+
// const tokContexts = this.acornTypeScript.tokContexts;
|
|
204
|
+
|
|
205
|
+
// if (s == tt.bracketL && context == tokContexts.tc_oTag) {
|
|
206
|
+
// this.context.push(tc.b_expr);
|
|
207
|
+
// } else if (s == tt.bracketR && context == tc.b_expr) {
|
|
208
|
+
// this.context.pop();
|
|
209
|
+
// }
|
|
210
|
+
|
|
211
|
+
// return super.updateContext(e);
|
|
212
|
+
// }
|
|
213
|
+
|
|
182
214
|
jsx_readToken() {
|
|
183
215
|
let out = '',
|
|
184
216
|
chunkStart = this.pos;
|
|
@@ -198,7 +230,6 @@ function RipplePlugin(config) {
|
|
|
198
230
|
if (ch === 123 && this.exprAllowed) {
|
|
199
231
|
return this.getTokenFromCode(ch);
|
|
200
232
|
}
|
|
201
|
-
debugger;
|
|
202
233
|
throw new Error('TODO: Invalid syntax');
|
|
203
234
|
|
|
204
235
|
case 47: // '/'
|
|
@@ -662,7 +693,6 @@ function get_comment_handlers(source, comments, index = 0) {
|
|
|
662
693
|
// Special case: Trailing comments after the root node (which can only happen for expression tags or for Program nodes).
|
|
663
694
|
// Adding them ensures that we can later detect the end of the expression tag correctly.
|
|
664
695
|
if (comments.length > 0 && (comments[0].start >= ast.end || ast.type === 'Program')) {
|
|
665
|
-
debugger;
|
|
666
696
|
(ast.trailingComments ||= []).push(...comments.splice(0));
|
|
667
697
|
}
|
|
668
698
|
},
|