| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package com.google.dart.compiler.ast; | 5 package com.google.dart.compiler.ast; |
| 6 | 6 |
| 7 import java.util.List; | 7 import java.util.List; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Represents a Dart function. | 10 * Represents a Dart function. |
| 11 */ | 11 */ |
| 12 public class DartFunction extends DartNode { | 12 public class DartFunction extends DartNode { |
| 13 | 13 |
| 14 private final NodeList<DartParameter> parameters = NodeList.create(this); | 14 private final NodeList<DartParameter> parameters = NodeList.create(this); |
| 15 private final int parametersCloseParen; |
| 15 private DartBlock body; | 16 private DartBlock body; |
| 16 private DartTypeNode returnTypeNode; | 17 private DartTypeNode returnTypeNode; |
| 17 | 18 |
| 18 public DartFunction(List<DartParameter> parameters, DartBlock body, DartTypeNo
de returnTypeNode) { | 19 public DartFunction(List<DartParameter> parameters, int parametersCloseParen,
DartBlock body, DartTypeNode returnTypeNode) { |
| 19 this.parameters.addAll(parameters); | 20 this.parameters.addAll(parameters); |
| 21 this.parametersCloseParen = parametersCloseParen; |
| 20 this.body = becomeParentOf(body); | 22 this.body = becomeParentOf(body); |
| 21 this.returnTypeNode = becomeParentOf(returnTypeNode); | 23 this.returnTypeNode = becomeParentOf(returnTypeNode); |
| 22 } | 24 } |
| 23 | 25 |
| 24 public DartBlock getBody() { | 26 public DartBlock getBody() { |
| 25 return body; | 27 return body; |
| 26 } | 28 } |
| 27 | 29 |
| 28 public List<DartParameter> getParameters() { | 30 public List<DartParameter> getParameters() { |
| 29 return parameters; | 31 return parameters; |
| 30 } | 32 } |
| 33 |
| 34 public int getParametersCloseParen() { |
| 35 return parametersCloseParen; |
| 36 } |
| 31 | 37 |
| 32 public DartTypeNode getReturnTypeNode() { | 38 public DartTypeNode getReturnTypeNode() { |
| 33 return returnTypeNode; | 39 return returnTypeNode; |
| 34 } | 40 } |
| 35 | 41 |
| 36 @Override | 42 @Override |
| 37 public void visitChildren(ASTVisitor<?> visitor) { | 43 public void visitChildren(ASTVisitor<?> visitor) { |
| 38 parameters.accept(visitor); | 44 parameters.accept(visitor); |
| 39 safelyVisitChild(body, visitor); | 45 safelyVisitChild(body, visitor); |
| 40 safelyVisitChild(returnTypeNode, visitor); | 46 safelyVisitChild(returnTypeNode, visitor); |
| 41 } | 47 } |
| 42 | 48 |
| 43 @Override | 49 @Override |
| 44 public <R> R accept(ASTVisitor<R> visitor) { | 50 public <R> R accept(ASTVisitor<R> visitor) { |
| 45 return visitor.visitFunction(this); | 51 return visitor.visitFunction(this); |
| 46 } | 52 } |
| 47 } | 53 } |
| OLD | NEW |