ExitPrimitiveType 记录当前 ctx 的基本类型
(ctx *parser.PrimitiveTypeContext)
| 189 | |
| 190 | // ExitPrimitiveType 记录当前 ctx 的基本类型 |
| 191 | func (t *TypeResolver) ExitPrimitiveType(ctx *parser.PrimitiveTypeContext) { |
| 192 | var symbolType symbol.Type |
| 193 | if ctx.INT() != nil { |
| 194 | symbolType = symbol.Int |
| 195 | } |
| 196 | if ctx.STRING() != nil { |
| 197 | symbolType = symbol.String |
| 198 | } |
| 199 | if ctx.FLOAT() != nil { |
| 200 | symbolType = symbol.Float |
| 201 | } |
| 202 | if ctx.BOOLEAN() != nil { |
| 203 | symbolType = symbol.Bool |
| 204 | } |
| 205 | if ctx.ANY() != nil { |
| 206 | symbolType = symbol.Any |
| 207 | } |
| 208 | if ctx.BYTE() != nil { |
| 209 | symbolType = symbol.Byte |
| 210 | } |
| 211 | t.at.PutTypeOfNode(ctx, symbolType) |
| 212 | } |
| 213 | |
| 214 | // ExitFunctionType 函数类型 |
| 215 | func (t *TypeResolver) ExitFunctionType(ctx *parser.FunctionTypeContext) { |