src/jdk/nashorn/internal/ir/CallNode.java

changeset 57
59970b70ebb5
parent 7
5a1b0714df0e
child 90
5a820fb11814
equal deleted inserted replaced
56:755404d7d189 57:59970b70ebb5
26 package jdk.nashorn.internal.ir; 26 package jdk.nashorn.internal.ir;
27 27
28 import java.util.ArrayList; 28 import java.util.ArrayList;
29 import java.util.Collections; 29 import java.util.Collections;
30 import java.util.List; 30 import java.util.List;
31
31 import jdk.nashorn.internal.codegen.types.Type; 32 import jdk.nashorn.internal.codegen.types.Type;
33 import jdk.nashorn.internal.ir.annotations.Ignore;
32 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 34 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
33 import jdk.nashorn.internal.runtime.Source; 35 import jdk.nashorn.internal.runtime.Source;
34 36
35 /** 37 /**
36 * IR representation for a function call. 38 * IR representation for a function call.
55 /** 57 /**
56 * Arguments to be passed to builtin {@code eval} function 58 * Arguments to be passed to builtin {@code eval} function
57 */ 59 */
58 public static class EvalArgs { 60 public static class EvalArgs {
59 /** evaluated code */ 61 /** evaluated code */
60 public Node code; 62 private Node code;
63
61 /** 'this' passed to evaluated code */ 64 /** 'this' passed to evaluated code */
62 public Node evalThis; 65 private IdentNode evalThis;
66
63 /** location string for the eval call */ 67 /** location string for the eval call */
64 public String location; 68 final private String location;
69
65 /** is this call from a strict context? */ 70 /** is this call from a strict context? */
66 public boolean strictMode; 71 final private boolean strictMode;
72
73 /**
74 * Constructor
75 *
76 * @param code code to evaluate
77 * @param evalThis this node
78 * @param location location for the eval call
79 * @param strictMode is this a call from a strict context?
80 */
81 public EvalArgs(final Node code, final IdentNode evalThis, final String location, final boolean strictMode) {
82 this.code = code;
83 this.evalThis = evalThis;
84 this.location = location;
85 this.strictMode = strictMode;
86 }
87
88 /**
89 * Return the code that is to be eval:ed by this eval function
90 * @return code as an AST node
91 */
92 public Node getCode() {
93 return code;
94 }
95
96 /**
97 * Set the code that is to be eval.ed by this eval function
98 * @param code the code as an AST node
99 */
100 public void setCode(final Node code) {
101 this.code = code;
102 }
103
104 /**
105 * Get the {@code this} symbol used to invoke this eval call
106 * @return the {@code this} symbol
107 */
108 public IdentNode getThis() {
109 return this.evalThis;
110 }
111
112 /**
113 * Set the {@code this} symbol used to invoke this eval call
114 * @param evalThis the {@code this} symbol
115 */
116 public void setThis(final IdentNode evalThis) {
117 this.evalThis = evalThis;
118 }
119
120 /**
121 * Get the human readable location for this eval call
122 * @return the location
123 */
124 public String getLocation() {
125 return this.location;
126 }
127
128 /**
129 * Check whether this eval call is executed in strict mode
130 * @return true if executed in strict mode, false otherwise
131 */
132 public boolean getStrictMode() {
133 return this.strictMode;
134 }
67 } 135 }
68 136
69 /** arguments for 'eval' call. Non-null only if this call node is 'eval' */ 137 /** arguments for 'eval' call. Non-null only if this call node is 'eval' */
138 @Ignore
70 private EvalArgs evalArgs; 139 private EvalArgs evalArgs;
71 140
72 /** 141 /**
73 * Constructors 142 * Constructors
74 * 143 *

mercurial