示例#1
0
func (pp *packageParser) tParseArrayType(t *ast.ArrayType) (result *st.ArrayTypeSymbol) {
	result = st.MakeArrayType(st.NO_NAME, pp.CurrentSymbolTable, pp.parseTypeSymbol(t.Elt), 0)
	if t.Len == nil {
		result.Len = st.SLICE
	} else {
		switch tt := t.Len.(type) {
		case *ast.Ellipsis:
			result.Len = st.ELLIPSIS
		case *ast.BasicLit:
			l, _ := strconv.Atoi(string(tt.Value))
			result.Len = l
		}
	}
	return
}
示例#2
0
// for function types
func (pp *packageParser) tParseEllipsis(t *ast.Ellipsis) (result *st.ArrayTypeSymbol) {
	elt := pp.parseTypeSymbol(t.Elt)
	result = st.MakeArrayType(st.NO_NAME, pp.CurrentSymbolTable, elt, st.SLICE)
	return
}