Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 711 Bytes

Notes.md

File metadata and controls

22 lines (14 loc) · 711 Bytes

Notes on AST Parsing

Generics

Generics will always look like this: AST Parsing for ItemViewModel

CallConstructor(type=Simple(pieces=[Piece(name=ItemViewModel, typeParams=[Type(mods=[], ref=Simple(pieces=[Piece(name=CatSchedule, typeParams=[])]))])]), typeArgs=[Type(mods=[], ref=Simple(pieces=[Piece(name=CatSchedule, typeParams=[])]))], args=[], lambda=null)

Getting the generic type:

"List<" + node.expr().typeArgs().getObject(0).ref().getType() + ">"
Difference between Type Parameter and Type Argument

Type parameter is blueprint or placeholder for a type declared in generic.

Type argument is actual type used to parametrize generic.