Appearance
| 1 | namespace Syntax.Trees.Expressions is | |
| 2 | ||
| 3 | use Source; | |
| 4 | ||
| 5 | class NEW: Expression is | |
| 6 | type_expression: TypeExpressions.TypeExpression?; | |
| 7 | arguments: LIST; | |
| 8 | ||
| 9 | // Constraint pushed in by the parent context. For an explicit | |
| 10 | // `new T(args)` against `let b: T[Concrete]`, the visitor uses | |
| 11 | // the expected_type to bind owner generic arguments when they | |
| 12 | // can't be inferred from the supplied constructor arguments | |
| 13 | // alone. | |
| 14 | ||
| 15 | init(location: LOCATION, type_expression: TypeExpressions.TypeExpression?, arguments: LIST) is | |
| 16 | super.init(location); | |
| 17 | ||
| 18 | self.type_expression = type_expression; | |
| 19 | self.arguments = arguments; | |
| 20 | si | |
| 21 | ||
| 22 | set_expected_type(expected_type: Semantic.Types.Type?, error_message: string?) is | |
| 23 | compile_expressions_state.set_expected_type(expected_type, error_message); | |
| 24 | si | |
| 25 | ||
| 26 | accept(visitor: Visitor) is | |
| 27 | visitor.visit(self); | |
| 28 | si | |
| 29 | ||
| 30 | walk(visitor: Visitor) is | |
| 31 | if !visitor.pre(self) then | |
| 32 | if type_expression? then | |
| 33 | type_expression.walk(visitor); | |
| 34 | fi | |
| 35 | arguments.walk(visitor); | |
| 36 | fi | |
| 37 | ||
| 38 | accept(visitor); | |
| 39 | si | |
| 40 | si | |
| 41 | si |