From 8f85674f61b98478a4ec5e4c26f5bdc18a3f642c Mon Sep 17 00:00:00 2001 From: Dima Granetchi Date: Sat, 22 Nov 2014 13:55:26 +0200 Subject: [PATCH] fix errors --- src/bindx/BindxExt.hx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bindx/BindxExt.hx b/src/bindx/BindxExt.hx index 0a18e88..42b48cf 100644 --- a/src/bindx/BindxExt.hx +++ b/src/bindx/BindxExt.hx @@ -132,13 +132,16 @@ class BindExt { switch (prevField.e.expr) { case ECall(e, params): field = Bind.checkField(e); - if (field.field == null) throw new FatalError('error parse fields ${e.toString()}', e.pos); + if (field.field == null) throw new FatalError('Error parse ${e.toString()}.', e.pos); fields.push( { e:field.e, field:field.field, params:params, bindable:field.error == null } ); end = false; case _: } if (end) break; } + else if (field.e == null) { + throw new FatalError('Error parse ${prevField.e.toString()}.', prevField.e.pos); + } prevField = field; } //for (it in fields) trace(printer.printExpr(it.e) + " -> " + it.field.name + (it.params != null ? '(${printer.printExprs(it.params, ",")})' : "") + " bind:" + it.bindable); @@ -149,7 +152,7 @@ class BindExt { var fields = checkFields(expr); if (fields.length == 0) { - throw new FatalError("can't bind empty expression: " + expr.toString(), expr.pos); + throw new FatalError('Can\'t bind empty expression: ${expr.toString()}', expr.pos); return null; } @@ -162,11 +165,11 @@ class BindExt { } var bindableNum = fields.fold(function (it, n) return n += it.bindable ? 1 : 0, 0); if (bindableNum == 0) { - throw new bindx.Error('expr is not bindable "${expr.toString()}".', expr.pos); + throw new bindx.Error('${expr.toString()} is not bindable.', expr.pos); return null; } if (first != null) - Context.warning('expr is not full bindable. Can bind only "${first.e.toString()}"', expr.pos); + Context.warning('${expr.toString()} is not full bindable. Can bind only "${first.e.toString()}".', expr.pos); return prepareChain(fields, macro listener, expr.pos, prefix); } @@ -234,7 +237,7 @@ class BindExt { } if (zeroListener == null || zeroListener.f.bindable == false) - Context.error("Chain is not bindable", pos); + throw new bindx.Error("Chain is not bindable.", pos); res.init.push(BindMacros.bindingSignalProvider.getClassFieldBindExpr(zeroListener.f.e, zeroListener.f.field, zeroListener.l )); res.unbind.push(BindMacros.bindingSignalProvider.getClassFieldUnbindExpr(zeroListener.f.e, zeroListener.f.field, zeroListener.l ));