Add helper for getting field suggestions.

This commit is contained in:
Juraj Kirchheim
2018-10-01 16:10:34 +02:00
parent 13d11f4f66
commit e398d0e694

View File

@@ -239,4 +239,12 @@ class Types {
}
}
static var SUGGESTIONS = ~/ \(Suggestions?: .*\)$/;
static public function getFieldSuggestions(type:ComplexType, name:String):String
return switch (macro (null : $type).$name).typeof() {
case Failure(SUGGESTIONS.match(_.message) => true): SUGGESTIONS.matched(0);
default: '';
}
}