/source/core/ast/Call.ooc
http://github.com/nddrylliog/oc · Unknown · 36 lines · 27 code · 9 blank · 0 comment · 0 complexity · 51f1a539b755f65a3670f086eb4f07fb MD5 · raw file
- import structs/[List, ArrayList]
- import middle/Resolver
- import FuncDecl, Expression, Access, Type
- Call: class extends Expression {
- subject: Access { get set }
- args: List<Expression> { get set }
- init: func (=subject) {
- args = ArrayList<Expression> new()
- }
- resolve: func (task: Task) {
- task queueList(args)
- task queue(subject)
- }
- toString: func -> String {
- subject toString() + "(" + args map(|x| x toString()) join(", ") + ")"
- }
-
- getType: func -> Type {
- sType := subject getType()
- if(sType) match (sType) {
- case ft: FuncType =>
- return ft proto retType
- case =>
- Exception new("Trying to call something that's not a function! " + sType toString())
- }
- null
- }
- }