MCPcopy Create free account
hub / github.com/dynjs/dynjs / FunctionDeclaration

Class FunctionDeclaration

src/main/java/org/dynjs/parser/ast/FunctionDeclaration.java:26–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24import org.dynjs.runtime.ExecutionContext;
25
26public class FunctionDeclaration extends AbstractStatement {
27 public static final List<FunctionDeclaration> EMPTY_LIST = new ArrayList<>();
28
29 private FunctionDescriptor descriptor;
30
31 public FunctionDeclaration(FunctionDescriptor descriptor) {
32 this.descriptor = descriptor;
33 }
34
35 public Position getPosition() {
36 return this.descriptor.getPosition();
37 }
38
39 public String getIdentifier() {
40 return this.descriptor.getIdentifier();
41 }
42
43 public String[] getFormalParameters() {
44 return this.descriptor.getFormalParameterNames();
45 }
46
47 public BlockStatement getBlock() {
48 return this.descriptor.getBlock();
49 }
50
51 public boolean isStrict() {
52 return this.descriptor.isStrict();
53 }
54
55 public int getSizeMetric() {
56 return this.descriptor.getSizeMetric();
57 }
58
59 @Override
60 public Completion interpret(ExecutionContext context) {
61 return Completion.createNormal();
62 }
63
64 public String toString() {
65 return this.descriptor.toString();
66 }
67
68 public List<FunctionDeclaration> getFunctionDeclarations() {
69 return descriptor.getBlock().getFunctionDeclarations();
70 }
71
72 public String dump(String indent) {
73 return super.dump(indent) + this.descriptor.getBlock().dump(indent + " ");
74 }
75
76 public String dumpData() {
77 return this.getIdentifier() + "(" + this.descriptor.getFormalParametersAsString() + ")";
78 }
79
80
81 public String toIndentedString(String indent) {
82 StringBuilder buf = new StringBuilder();
83 buf.append(indent).append("function").append(this.descriptor.getIdentifier() == null ? "" : " " + this.descriptor.getIdentifier()).append("(");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected