Пример #1
0
func (v *AttributeCheck) CheckFunctionDecl(s *SemanticAnalyzer, n *parser.FunctionDecl) {
	v.CheckAttrsDistanceFromLine(s, n.Function.Type.Attrs(), n.Pos().Line, "function", n.Function.Name)

	for _, attr := range n.Function.Type.Attrs() {
		switch attr.Key {
		case "deprecated":
		case "unused":
		case "c":
		default:
			s.Err(attr, "Invalid function attribute key `%s`", attr.Key)
		}
	}
}
Пример #2
0
func (v *AttributeCheck) CheckFunctionDecl(s *SemanticAnalyzer, n *parser.FunctionDecl) {
	v.CheckAttrsDistanceFromLine(s, n.Function.Type.Attrs(), n.Pos().Line, "function", n.Function.Name)

	for _, attr := range n.Function.Type.Attrs() {
		switch attr.Key {
		case "deprecated":
		case "unused":
		case "c":
		case "call_conv":
		case "inline":
			switch attr.Value {
			case "always":
			case "never":
			case "maybe":
			default:
				s.Err(attr, "Invalid value `%s` for [inline] attribute", attr.Value)
			}
		default:
			s.Err(attr, "Invalid function attribute key `%s`", attr.Key)
		}
	}
}