Slightly better error reporting in build cache.

This commit is contained in:
Juraj Kirchheim
2016-10-06 10:39:33 +02:00
parent 92f60cbe4f
commit ba5349f55f
3 changed files with 6 additions and 2 deletions

View File

@@ -93,6 +93,10 @@ class BuildCache {
switch Context.getLocalType() {
case TInst(_.toString() == name => true, [v]):
type = v;
case TInst(_.toString() == name => true, _):
Context.fatalError('type parameter expected', pos);
case TInst(_.get() => { pos: pos }, _):
Context.fatalError('Expected $name', pos);
default:
throw 'assert';
}

View File

@@ -96,7 +96,7 @@ class Constructor {
case Success(member): member.addMeta(':isVar');
default:
}
addStatement(macro @:pos(pos) (cast this).$name = if (true) $e else this.$name, options.prepend);
addStatement(macro @:pos(pos) (cast this).$name = if (true) $e else this.$name, options.prepend);//TODO: this seems to report type errors here rather than at the declaration position
}
else
addStatement(macro @:pos(pos) this.$name = $e, options.prepend);

View File

@@ -35,7 +35,7 @@ class Positions {
return errorFunc(sanitize(pos), Std.string(error));
static function contextError(pos:Position, error:String):Dynamic
return Context.error(error, pos);
return Context.fatalError(error, pos);
static function abortTypeBuild(pos:Position, error:String):Dynamic
return throw new AbortBuild(error, pos);