|
Lines 112-119
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec1
|
| 112 |
static const int DontBuildKeywords = 0; |
112 |
static const int DontBuildKeywords = 0; |
| 113 |
static const int DontBuildStrings = 0; |
113 |
static const int DontBuildStrings = 0; |
| 114 |
|
114 |
|
| 115 |
ExpressionNode* makeBinaryNode(int lineNumber, int token, std::pair<ExpressionNode*, BinaryOpInfo>, std::pair<ExpressionNode*, BinaryOpInfo>); |
115 |
ExpressionNode* makeBinaryNode(const JSTokenLocation&, int token, std::pair<ExpressionNode*, BinaryOpInfo>, std::pair<ExpressionNode*, BinaryOpInfo>); |
| 116 |
ExpressionNode* makeFunctionCallNode(int lineNumber, ExpressionNode* func, ArgumentsNode* args, int start, int divot, int end); |
116 |
ExpressionNode* makeFunctionCallNode(const JSTokenLocation&, ExpressionNode* func, ArgumentsNode* args, int start, int divot, int end); |
| 117 |
|
117 |
|
| 118 |
JSC::SourceElements* createSourceElements() { return new (m_globalData) JSC::SourceElements(); } |
118 |
JSC::SourceElements* createSourceElements() { return new (m_globalData) JSC::SourceElements(); } |
| 119 |
|
119 |
|
|
Lines 124-291
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec2
|
| 124 |
|
124 |
|
| 125 |
void appendToComma(CommaNode* commaNode, ExpressionNode* expr) { commaNode->append(expr); } |
125 |
void appendToComma(CommaNode* commaNode, ExpressionNode* expr) { commaNode->append(expr); } |
| 126 |
|
126 |
|
| 127 |
CommaNode* createCommaExpr(int lineNumber, ExpressionNode* lhs, ExpressionNode* rhs) { return new (m_globalData) CommaNode(lineNumber, lhs, rhs); } |
127 |
CommaNode* createCommaExpr(const JSTokenLocation& location, ExpressionNode* lhs, ExpressionNode* rhs) { return new (m_globalData) CommaNode(location, lhs, rhs); } |
| 128 |
|
128 |
|
| 129 |
ExpressionNode* makeAssignNode(int lineNumber, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end); |
129 |
ExpressionNode* makeAssignNode(const JSTokenLocation&, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end); |
| 130 |
ExpressionNode* makePrefixNode(int lineNumber, ExpressionNode*, Operator, int start, int divot, int end); |
130 |
ExpressionNode* makePrefixNode(const JSTokenLocation&, ExpressionNode*, Operator, int start, int divot, int end); |
| 131 |
ExpressionNode* makePostfixNode(int lineNumber, ExpressionNode*, Operator, int start, int divot, int end); |
131 |
ExpressionNode* makePostfixNode(const JSTokenLocation&, ExpressionNode*, Operator, int start, int divot, int end); |
| 132 |
ExpressionNode* makeTypeOfNode(int lineNumber, ExpressionNode*); |
132 |
ExpressionNode* makeTypeOfNode(const JSTokenLocation&, ExpressionNode*); |
| 133 |
ExpressionNode* makeDeleteNode(int lineNumber, ExpressionNode*, int start, int divot, int end); |
133 |
ExpressionNode* makeDeleteNode(const JSTokenLocation&, ExpressionNode*, int start, int divot, int end); |
| 134 |
ExpressionNode* makeNegateNode(int lineNumber, ExpressionNode*); |
134 |
ExpressionNode* makeNegateNode(const JSTokenLocation&, ExpressionNode*); |
| 135 |
ExpressionNode* makeBitwiseNotNode(int lineNumber, ExpressionNode*); |
135 |
ExpressionNode* makeBitwiseNotNode(const JSTokenLocation&, ExpressionNode*); |
| 136 |
ExpressionNode* makeMultNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
136 |
ExpressionNode* makeMultNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 137 |
ExpressionNode* makeDivNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
137 |
ExpressionNode* makeDivNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 138 |
ExpressionNode* makeModNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
138 |
ExpressionNode* makeModNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 139 |
ExpressionNode* makeAddNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
139 |
ExpressionNode* makeAddNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 140 |
ExpressionNode* makeSubNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
140 |
ExpressionNode* makeSubNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 141 |
ExpressionNode* makeBitXOrNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
141 |
ExpressionNode* makeBitXOrNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 142 |
ExpressionNode* makeBitAndNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
142 |
ExpressionNode* makeBitAndNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 143 |
ExpressionNode* makeBitOrNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
143 |
ExpressionNode* makeBitOrNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 144 |
ExpressionNode* makeLeftShiftNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
144 |
ExpressionNode* makeLeftShiftNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 145 |
ExpressionNode* makeRightShiftNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
145 |
ExpressionNode* makeRightShiftNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 146 |
ExpressionNode* makeURightShiftNode(int lineNumber, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
146 |
ExpressionNode* makeURightShiftNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); |
| 147 |
|
147 |
|
| 148 |
ExpressionNode* createLogicalNot(int lineNumber, ExpressionNode* expr) { return new (m_globalData) LogicalNotNode(lineNumber, expr); } |
148 |
ExpressionNode* createLogicalNot(const JSTokenLocation& location, ExpressionNode* expr) { return new (m_globalData) LogicalNotNode(location, expr); } |
| 149 |
ExpressionNode* createUnaryPlus(int lineNumber, ExpressionNode* expr) { return new (m_globalData) UnaryPlusNode(lineNumber, expr); } |
149 |
ExpressionNode* createUnaryPlus(const JSTokenLocation& location, ExpressionNode* expr) { return new (m_globalData) UnaryPlusNode(location, expr); } |
| 150 |
ExpressionNode* createVoid(int lineNumber, ExpressionNode* expr) |
150 |
ExpressionNode* createVoid(const JSTokenLocation& location, ExpressionNode* expr) |
| 151 |
{ |
151 |
{ |
| 152 |
incConstants(); |
152 |
incConstants(); |
| 153 |
return new (m_globalData) VoidNode(lineNumber, expr); |
153 |
return new (m_globalData) VoidNode(location, expr); |
| 154 |
} |
154 |
} |
| 155 |
ExpressionNode* thisExpr(int lineNumber) |
155 |
ExpressionNode* thisExpr(const JSTokenLocation& location) |
| 156 |
{ |
156 |
{ |
| 157 |
usesThis(); |
157 |
usesThis(); |
| 158 |
return new (m_globalData) ThisNode(lineNumber); |
158 |
return new (m_globalData) ThisNode(location); |
| 159 |
} |
159 |
} |
| 160 |
ExpressionNode* createResolve(int lineNumber, const Identifier* ident, int start) |
160 |
ExpressionNode* createResolve(const JSTokenLocation& location, const Identifier* ident, int start) |
| 161 |
{ |
161 |
{ |
| 162 |
if (m_globalData->propertyNames->arguments == *ident) |
162 |
if (m_globalData->propertyNames->arguments == *ident) |
| 163 |
usesArguments(); |
163 |
usesArguments(); |
| 164 |
return new (m_globalData) ResolveNode(lineNumber, *ident, start); |
164 |
return new (m_globalData) ResolveNode(location, *ident, start); |
| 165 |
} |
165 |
} |
| 166 |
ExpressionNode* createObjectLiteral(int lineNumber) { return new (m_globalData) ObjectLiteralNode(lineNumber); } |
166 |
ExpressionNode* createObjectLiteral(const JSTokenLocation& location) { return new (m_globalData) ObjectLiteralNode(location); } |
| 167 |
ExpressionNode* createObjectLiteral(int lineNumber, PropertyListNode* properties) { return new (m_globalData) ObjectLiteralNode(lineNumber, properties); } |
167 |
ExpressionNode* createObjectLiteral(const JSTokenLocation& location, PropertyListNode* properties) { return new (m_globalData) ObjectLiteralNode(location, properties); } |
| 168 |
|
168 |
|
| 169 |
ExpressionNode* createArray(int lineNumber, int elisions) |
169 |
ExpressionNode* createArray(const JSTokenLocation& location, int elisions) |
| 170 |
{ |
170 |
{ |
| 171 |
if (elisions) |
171 |
if (elisions) |
| 172 |
incConstants(); |
172 |
incConstants(); |
| 173 |
return new (m_globalData) ArrayNode(lineNumber, elisions); |
173 |
return new (m_globalData) ArrayNode(location, elisions); |
| 174 |
} |
174 |
} |
| 175 |
|
175 |
|
| 176 |
ExpressionNode* createArray(int lineNumber, ElementNode* elems) { return new (m_globalData) ArrayNode(lineNumber, elems); } |
176 |
ExpressionNode* createArray(const JSTokenLocation& location, ElementNode* elems) { return new (m_globalData) ArrayNode(location, elems); } |
| 177 |
ExpressionNode* createArray(int lineNumber, int elisions, ElementNode* elems) |
177 |
ExpressionNode* createArray(const JSTokenLocation& location, int elisions, ElementNode* elems) |
| 178 |
{ |
178 |
{ |
| 179 |
if (elisions) |
179 |
if (elisions) |
| 180 |
incConstants(); |
180 |
incConstants(); |
| 181 |
return new (m_globalData) ArrayNode(lineNumber, elisions, elems); |
181 |
return new (m_globalData) ArrayNode(location, elisions, elems); |
| 182 |
} |
182 |
} |
| 183 |
ExpressionNode* createNumberExpr(int lineNumber, double d) |
183 |
ExpressionNode* createNumberExpr(const JSTokenLocation& location, double d) |
| 184 |
{ |
184 |
{ |
| 185 |
incConstants(); |
185 |
incConstants(); |
| 186 |
return new (m_globalData) NumberNode(lineNumber, d); |
186 |
return new (m_globalData) NumberNode(location, d); |
| 187 |
} |
187 |
} |
| 188 |
|
188 |
|
| 189 |
ExpressionNode* createString(int lineNumber, const Identifier* string) |
189 |
ExpressionNode* createString(const JSTokenLocation& location, const Identifier* string) |
| 190 |
{ |
190 |
{ |
| 191 |
incConstants(); |
191 |
incConstants(); |
| 192 |
return new (m_globalData) StringNode(lineNumber, *string); |
192 |
return new (m_globalData) StringNode(location, *string); |
| 193 |
} |
193 |
} |
| 194 |
|
194 |
|
| 195 |
ExpressionNode* createBoolean(int lineNumber, bool b) |
195 |
ExpressionNode* createBoolean(const JSTokenLocation& location, bool b) |
| 196 |
{ |
196 |
{ |
| 197 |
incConstants(); |
197 |
incConstants(); |
| 198 |
return new (m_globalData) BooleanNode(lineNumber, b); |
198 |
return new (m_globalData) BooleanNode(location, b); |
| 199 |
} |
199 |
} |
| 200 |
|
200 |
|
| 201 |
ExpressionNode* createNull(int lineNumber) |
201 |
ExpressionNode* createNull(const JSTokenLocation& location) |
| 202 |
{ |
202 |
{ |
| 203 |
incConstants(); |
203 |
incConstants(); |
| 204 |
return new (m_globalData) NullNode(lineNumber); |
204 |
return new (m_globalData) NullNode(location); |
| 205 |
} |
205 |
} |
| 206 |
|
206 |
|
| 207 |
ExpressionNode* createBracketAccess(int lineNumber, ExpressionNode* base, ExpressionNode* property, bool propertyHasAssignments, int start, int divot, int end) |
207 |
ExpressionNode* createBracketAccess(const JSTokenLocation& location, ExpressionNode* base, ExpressionNode* property, bool propertyHasAssignments, int start, int divot, int end) |
| 208 |
{ |
208 |
{ |
| 209 |
BracketAccessorNode* node = new (m_globalData) BracketAccessorNode(lineNumber, base, property, propertyHasAssignments); |
209 |
BracketAccessorNode* node = new (m_globalData) BracketAccessorNode(location, base, property, propertyHasAssignments); |
| 210 |
setExceptionLocation(node, start, divot, end); |
210 |
setExceptionLocation(node, start, divot, end); |
| 211 |
return node; |
211 |
return node; |
| 212 |
} |
212 |
} |
| 213 |
|
213 |
|
| 214 |
ExpressionNode* createDotAccess(int lineNumber, ExpressionNode* base, const Identifier* property, int start, int divot, int end) |
214 |
ExpressionNode* createDotAccess(const JSTokenLocation& location, ExpressionNode* base, const Identifier* property, int start, int divot, int end) |
| 215 |
{ |
215 |
{ |
| 216 |
DotAccessorNode* node = new (m_globalData) DotAccessorNode(lineNumber, base, *property); |
216 |
DotAccessorNode* node = new (m_globalData) DotAccessorNode(location, base, *property); |
| 217 |
setExceptionLocation(node, start, divot, end); |
217 |
setExceptionLocation(node, start, divot, end); |
| 218 |
return node; |
218 |
return node; |
| 219 |
} |
219 |
} |
| 220 |
|
220 |
|
| 221 |
ExpressionNode* createRegExp(int lineNumber, const Identifier& pattern, const Identifier& flags, int start) |
221 |
ExpressionNode* createRegExp(const JSTokenLocation& location, const Identifier& pattern, const Identifier& flags, int start) |
| 222 |
{ |
222 |
{ |
| 223 |
if (Yarr::checkSyntax(pattern.ustring())) |
223 |
if (Yarr::checkSyntax(pattern.ustring())) |
| 224 |
return 0; |
224 |
return 0; |
| 225 |
RegExpNode* node = new (m_globalData) RegExpNode(lineNumber, pattern, flags); |
225 |
RegExpNode* node = new (m_globalData) RegExpNode(location, pattern, flags); |
| 226 |
int size = pattern.length() + 2; // + 2 for the two /'s |
226 |
int size = pattern.length() + 2; // + 2 for the two /'s |
| 227 |
setExceptionLocation(node, start, start + size, start + size); |
227 |
setExceptionLocation(node, start, start + size, start + size); |
| 228 |
return node; |
228 |
return node; |
| 229 |
} |
229 |
} |
| 230 |
|
230 |
|
| 231 |
ExpressionNode* createNewExpr(int lineNumber, ExpressionNode* expr, ArgumentsNode* arguments, int start, int divot, int end) |
231 |
ExpressionNode* createNewExpr(const JSTokenLocation& location, ExpressionNode* expr, ArgumentsNode* arguments, int start, int divot, int end) |
| 232 |
{ |
232 |
{ |
| 233 |
NewExprNode* node = new (m_globalData) NewExprNode(lineNumber, expr, arguments); |
233 |
NewExprNode* node = new (m_globalData) NewExprNode(location, expr, arguments); |
| 234 |
setExceptionLocation(node, start, divot, end); |
234 |
setExceptionLocation(node, start, divot, end); |
| 235 |
return node; |
235 |
return node; |
| 236 |
} |
236 |
} |
| 237 |
|
237 |
|
| 238 |
ExpressionNode* createNewExpr(int lineNumber, ExpressionNode* expr, int start, int end) |
238 |
ExpressionNode* createNewExpr(const JSTokenLocation& location, ExpressionNode* expr, int start, int end) |
| 239 |
{ |
239 |
{ |
| 240 |
NewExprNode* node = new (m_globalData) NewExprNode(lineNumber, expr); |
240 |
NewExprNode* node = new (m_globalData) NewExprNode(location, expr); |
| 241 |
setExceptionLocation(node, start, end, end); |
241 |
setExceptionLocation(node, start, end, end); |
| 242 |
return node; |
242 |
return node; |
| 243 |
} |
243 |
} |
| 244 |
|
244 |
|
| 245 |
ExpressionNode* createConditionalExpr(int lineNumber, ExpressionNode* condition, ExpressionNode* lhs, ExpressionNode* rhs) |
245 |
ExpressionNode* createConditionalExpr(const JSTokenLocation& location, ExpressionNode* condition, ExpressionNode* lhs, ExpressionNode* rhs) |
| 246 |
{ |
246 |
{ |
| 247 |
return new (m_globalData) ConditionalNode(lineNumber, condition, lhs, rhs); |
247 |
return new (m_globalData) ConditionalNode(location, condition, lhs, rhs); |
| 248 |
} |
248 |
} |
| 249 |
|
249 |
|
| 250 |
ExpressionNode* createAssignResolve(int lineNumber, const Identifier& ident, ExpressionNode* rhs, int start, int divot, int end) |
250 |
ExpressionNode* createAssignResolve(const JSTokenLocation& location, const Identifier& ident, ExpressionNode* rhs, int start, int divot, int end) |
| 251 |
{ |
251 |
{ |
| 252 |
if (rhs->isFuncExprNode()) |
252 |
if (rhs->isFuncExprNode()) |
| 253 |
static_cast<FuncExprNode*>(rhs)->body()->setInferredName(ident); |
253 |
static_cast<FuncExprNode*>(rhs)->body()->setInferredName(ident); |
| 254 |
AssignResolveNode* node = new (m_globalData) AssignResolveNode(lineNumber, ident, rhs); |
254 |
AssignResolveNode* node = new (m_globalData) AssignResolveNode(location, ident, rhs); |
| 255 |
setExceptionLocation(node, start, divot, end); |
255 |
setExceptionLocation(node, start, divot, end); |
| 256 |
return node; |
256 |
return node; |
| 257 |
} |
257 |
} |
| 258 |
|
258 |
|
| 259 |
ExpressionNode* createFunctionExpr(int lineNumber, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
259 |
ExpressionNode* createFunctionExpr(const JSTokenLocation& location, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
| 260 |
{ |
260 |
{ |
| 261 |
FuncExprNode* result = new (m_globalData) FuncExprNode(lineNumber, *name, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), parameters); |
261 |
FuncExprNode* result = new (m_globalData) FuncExprNode(location, *name, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), parameters); |
| 262 |
body->setLoc(bodyStartLine, bodyEndLine); |
262 |
body->setLoc(bodyStartLine, bodyEndLine, location.column); |
| 263 |
return result; |
263 |
return result; |
| 264 |
} |
264 |
} |
| 265 |
|
265 |
|
| 266 |
FunctionBodyNode* createFunctionBody(int lineNumber, bool inStrictContext) |
266 |
FunctionBodyNode* createFunctionBody(const JSTokenLocation& location, bool inStrictContext) |
| 267 |
{ |
267 |
{ |
| 268 |
return FunctionBodyNode::create(m_globalData, lineNumber, inStrictContext); |
268 |
return FunctionBodyNode::create(m_globalData, location, inStrictContext); |
| 269 |
} |
269 |
} |
| 270 |
|
270 |
|
| 271 |
template <bool> PropertyNode* createGetterOrSetterProperty(int lineNumber, PropertyNode::Type type, const Identifier* name, ParameterNode* params, FunctionBodyNode* body, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
271 |
template <bool> PropertyNode* createGetterOrSetterProperty(const JSTokenLocation& location, PropertyNode::Type type, const Identifier* name, ParameterNode* params, FunctionBodyNode* body, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
| 272 |
{ |
272 |
{ |
| 273 |
ASSERT(name); |
273 |
ASSERT(name); |
| 274 |
body->setLoc(bodyStartLine, bodyEndLine); |
274 |
body->setLoc(bodyStartLine, bodyEndLine, location.column); |
| 275 |
body->setInferredName(*name); |
275 |
body->setInferredName(*name); |
| 276 |
return new (m_globalData) PropertyNode(m_globalData, *name, new (m_globalData) FuncExprNode(lineNumber, m_globalData->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), params), type); |
276 |
return new (m_globalData) PropertyNode(m_globalData, *name, new (m_globalData) FuncExprNode(location, m_globalData->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), params), type); |
| 277 |
} |
277 |
} |
| 278 |
|
278 |
|
| 279 |
template <bool> PropertyNode* createGetterOrSetterProperty(JSGlobalData*, int lineNumber, PropertyNode::Type type, double name, ParameterNode* params, FunctionBodyNode* body, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
279 |
template <bool> PropertyNode* createGetterOrSetterProperty(JSGlobalData*, const JSTokenLocation& location, PropertyNode::Type type, double name, ParameterNode* params, FunctionBodyNode* body, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
| 280 |
{ |
280 |
{ |
| 281 |
body->setLoc(bodyStartLine, bodyEndLine); |
281 |
body->setLoc(bodyStartLine, bodyEndLine, location.column); |
| 282 |
return new (m_globalData) PropertyNode(m_globalData, name, new (m_globalData) FuncExprNode(lineNumber, m_globalData->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), params), type); |
282 |
return new (m_globalData) PropertyNode(m_globalData, name, new (m_globalData) FuncExprNode(location, m_globalData->propertyNames->nullIdentifier, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), params), type); |
| 283 |
} |
283 |
} |
| 284 |
|
284 |
|
| 285 |
ArgumentsNode* createArguments() { return new (m_globalData) ArgumentsNode(); } |
285 |
ArgumentsNode* createArguments() { return new (m_globalData) ArgumentsNode(); } |
| 286 |
ArgumentsNode* createArguments(ArgumentListNode* args) { return new (m_globalData) ArgumentsNode(args); } |
286 |
ArgumentsNode* createArguments(ArgumentListNode* args) { return new (m_globalData) ArgumentsNode(args); } |
| 287 |
ArgumentListNode* createArgumentsList(int lineNumber, ExpressionNode* arg) { return new (m_globalData) ArgumentListNode(lineNumber, arg); } |
287 |
ArgumentListNode* createArgumentsList(const JSTokenLocation& location, ExpressionNode* arg) { return new (m_globalData) ArgumentListNode(location, arg); } |
| 288 |
ArgumentListNode* createArgumentsList(int lineNumber, ArgumentListNode* args, ExpressionNode* arg) { return new (m_globalData) ArgumentListNode(lineNumber, args, arg); } |
288 |
ArgumentListNode* createArgumentsList(const JSTokenLocation& location, ArgumentListNode* args, ExpressionNode* arg) { return new (m_globalData) ArgumentListNode(location, args, arg); } |
| 289 |
|
289 |
|
| 290 |
template <bool> PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type) |
290 |
template <bool> PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type) |
| 291 |
{ |
291 |
{ |
|
Lines 294-301
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec3
|
| 294 |
return new (m_globalData) PropertyNode(m_globalData, *propertyName, node, type); |
294 |
return new (m_globalData) PropertyNode(m_globalData, *propertyName, node, type); |
| 295 |
} |
295 |
} |
| 296 |
template <bool> PropertyNode* createProperty(JSGlobalData*, double propertyName, ExpressionNode* node, PropertyNode::Type type) { return new (m_globalData) PropertyNode(m_globalData, propertyName, node, type); } |
296 |
template <bool> PropertyNode* createProperty(JSGlobalData*, double propertyName, ExpressionNode* node, PropertyNode::Type type) { return new (m_globalData) PropertyNode(m_globalData, propertyName, node, type); } |
| 297 |
PropertyListNode* createPropertyList(int lineNumber, PropertyNode* property) { return new (m_globalData) PropertyListNode(lineNumber, property); } |
297 |
PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property) { return new (m_globalData) PropertyListNode(location, property); } |
| 298 |
PropertyListNode* createPropertyList(int lineNumber, PropertyNode* property, PropertyListNode* tail) { return new (m_globalData) PropertyListNode(lineNumber, property, tail); } |
298 |
PropertyListNode* createPropertyList(const JSTokenLocation& location, PropertyNode* property, PropertyListNode* tail) { return new (m_globalData) PropertyListNode(location, property, tail); } |
| 299 |
|
299 |
|
| 300 |
ElementNode* createElementList(int elisions, ExpressionNode* expr) { return new (m_globalData) ElementNode(elisions, expr); } |
300 |
ElementNode* createElementList(int elisions, ExpressionNode* expr) { return new (m_globalData) ElementNode(elisions, expr); } |
| 301 |
ElementNode* createElementList(ElementNode* elems, int elisions, ExpressionNode* expr) { return new (m_globalData) ElementNode(elems, elisions, expr); } |
301 |
ElementNode* createElementList(ElementNode* elems, int elisions, ExpressionNode* expr) { return new (m_globalData) ElementNode(elems, elisions, expr); } |
|
Lines 309-499
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec4
|
| 309 |
|
309 |
|
| 310 |
void setUsesArguments(FunctionBodyNode* node) { node->setUsesArguments(); } |
310 |
void setUsesArguments(FunctionBodyNode* node) { node->setUsesArguments(); } |
| 311 |
|
311 |
|
| 312 |
StatementNode* createFuncDeclStatement(int lineNumber, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
312 |
StatementNode* createFuncDeclStatement(const JSTokenLocation& location, const Identifier* name, FunctionBodyNode* body, ParameterNode* parameters, int openBracePos, int closeBracePos, int bodyStartLine, int bodyEndLine) |
| 313 |
{ |
313 |
{ |
| 314 |
FuncDeclNode* decl = new (m_globalData) FuncDeclNode(lineNumber, *name, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), parameters); |
314 |
FuncDeclNode* decl = new (m_globalData) FuncDeclNode(location, *name, body, m_sourceCode->subExpression(openBracePos, closeBracePos, bodyStartLine), parameters); |
| 315 |
if (*name == m_globalData->propertyNames->arguments) |
315 |
if (*name == m_globalData->propertyNames->arguments) |
| 316 |
usesArguments(); |
316 |
usesArguments(); |
| 317 |
m_scope.m_funcDeclarations->data.append(decl->body()); |
317 |
m_scope.m_funcDeclarations->data.append(decl->body()); |
| 318 |
body->setLoc(bodyStartLine, bodyEndLine); |
318 |
body->setLoc(bodyStartLine, bodyEndLine, location.column); |
| 319 |
return decl; |
319 |
return decl; |
| 320 |
} |
320 |
} |
| 321 |
|
321 |
|
| 322 |
StatementNode* createBlockStatement(int lineNumber, JSC::SourceElements* elements, int startLine, int endLine) |
322 |
StatementNode* createBlockStatement(const JSTokenLocation& location, JSC::SourceElements* elements, int startLine, int endLine) |
| 323 |
{ |
323 |
{ |
| 324 |
BlockNode* block = new (m_globalData) BlockNode(lineNumber, elements); |
324 |
BlockNode* block = new (m_globalData) BlockNode(location, elements); |
| 325 |
block->setLoc(startLine, endLine); |
325 |
block->setLoc(startLine, endLine, location.column); |
| 326 |
return block; |
326 |
return block; |
| 327 |
} |
327 |
} |
| 328 |
|
328 |
|
| 329 |
StatementNode* createExprStatement(int lineNumber, ExpressionNode* expr, int start, int end) |
329 |
StatementNode* createExprStatement(const JSTokenLocation& location, ExpressionNode* expr, int start, int end) |
| 330 |
{ |
330 |
{ |
| 331 |
ExprStatementNode* result = new (m_globalData) ExprStatementNode(lineNumber, expr); |
331 |
ExprStatementNode* result = new (m_globalData) ExprStatementNode(location, expr); |
| 332 |
result->setLoc(start, end); |
332 |
result->setLoc(start, end, location.column); |
| 333 |
return result; |
333 |
return result; |
| 334 |
} |
334 |
} |
| 335 |
|
335 |
|
| 336 |
StatementNode* createIfStatement(int lineNumber, ExpressionNode* condition, StatementNode* trueBlock, int start, int end) |
336 |
StatementNode* createIfStatement(const JSTokenLocation& location, ExpressionNode* condition, StatementNode* trueBlock, int start, int end) |
| 337 |
{ |
337 |
{ |
| 338 |
IfNode* result = new (m_globalData) IfNode(lineNumber, condition, trueBlock); |
338 |
IfNode* result = new (m_globalData) IfNode(location, condition, trueBlock); |
| 339 |
result->setLoc(start, end); |
339 |
result->setLoc(start, end, location.column); |
| 340 |
return result; |
340 |
return result; |
| 341 |
} |
341 |
} |
| 342 |
|
342 |
|
| 343 |
StatementNode* createIfStatement(int lineNumber, ExpressionNode* condition, StatementNode* trueBlock, StatementNode* falseBlock, int start, int end) |
343 |
StatementNode* createIfStatement(const JSTokenLocation& location, ExpressionNode* condition, StatementNode* trueBlock, StatementNode* falseBlock, int start, int end) |
| 344 |
{ |
344 |
{ |
| 345 |
IfNode* result = new (m_globalData) IfElseNode(lineNumber, condition, trueBlock, falseBlock); |
345 |
IfNode* result = new (m_globalData) IfElseNode(location, condition, trueBlock, falseBlock); |
| 346 |
result->setLoc(start, end); |
346 |
result->setLoc(start, end, location.column); |
| 347 |
return result; |
347 |
return result; |
| 348 |
} |
348 |
} |
| 349 |
|
349 |
|
| 350 |
StatementNode* createForLoop(int lineNumber, ExpressionNode* initializer, ExpressionNode* condition, ExpressionNode* iter, StatementNode* statements, int start, int end) |
350 |
StatementNode* createForLoop(const JSTokenLocation& location, ExpressionNode* initializer, ExpressionNode* condition, ExpressionNode* iter, StatementNode* statements, int start, int end) |
| 351 |
{ |
351 |
{ |
| 352 |
ForNode* result = new (m_globalData) ForNode(lineNumber, initializer, condition, iter, statements); |
352 |
ForNode* result = new (m_globalData) ForNode(location, initializer, condition, iter, statements); |
| 353 |
result->setLoc(start, end); |
353 |
result->setLoc(start, end); |
| 354 |
return result; |
354 |
return result; |
| 355 |
} |
355 |
} |
| 356 |
|
356 |
|
| 357 |
StatementNode* createForInLoop(int lineNumber, const Identifier* ident, ExpressionNode* initializer, ExpressionNode* iter, StatementNode* statements, int start, int divot, int end, int initStart, int initEnd, int startLine, int endLine) |
357 |
StatementNode* createForInLoop(const JSTokenLocation& location, const Identifier* ident, ExpressionNode* initializer, ExpressionNode* iter, StatementNode* statements, int start, int divot, int end, int initStart, int initEnd, int startLine, int endLine) |
| 358 |
{ |
358 |
{ |
| 359 |
ForInNode* result = new (m_globalData) ForInNode(m_globalData, lineNumber, *ident, initializer, iter, statements, initStart, initStart - start, initEnd - initStart); |
359 |
ForInNode* result = new (m_globalData) ForInNode(m_globalData, location, *ident, initializer, iter, statements, initStart, initStart - start, initEnd - initStart); |
| 360 |
result->setLoc(startLine, endLine); |
360 |
result->setLoc(startLine, endLine, location.column); |
| 361 |
setExceptionLocation(result, start, divot + 1, end); |
361 |
setExceptionLocation(result, start, divot + 1, end); |
| 362 |
return result; |
362 |
return result; |
| 363 |
} |
363 |
} |
| 364 |
|
364 |
|
| 365 |
StatementNode* createForInLoop(int lineNumber, ExpressionNode* lhs, ExpressionNode* iter, StatementNode* statements, int eStart, int eDivot, int eEnd, int start, int end) |
365 |
StatementNode* createForInLoop(const JSTokenLocation& location, ExpressionNode* lhs, ExpressionNode* iter, StatementNode* statements, int eStart, int eDivot, int eEnd, int start, int end) |
| 366 |
{ |
366 |
{ |
| 367 |
ForInNode* result = new (m_globalData) ForInNode(lineNumber, lhs, iter, statements); |
367 |
ForInNode* result = new (m_globalData) ForInNode(location, lhs, iter, statements); |
| 368 |
result->setLoc(start, end); |
368 |
result->setLoc(start, end, location.column); |
| 369 |
setExceptionLocation(result, eStart, eDivot, eEnd); |
369 |
setExceptionLocation(result, eStart, eDivot, eEnd); |
| 370 |
return result; |
370 |
return result; |
| 371 |
} |
371 |
} |
| 372 |
|
372 |
|
| 373 |
StatementNode* createEmptyStatement(int lineNumber) { return new (m_globalData) EmptyStatementNode(lineNumber); } |
373 |
StatementNode* createEmptyStatement(const JSTokenLocation& location) { return new (m_globalData) EmptyStatementNode(location); } |
| 374 |
|
374 |
|
| 375 |
StatementNode* createVarStatement(int lineNumber, ExpressionNode* expr, int start, int end) |
375 |
StatementNode* createVarStatement(const JSTokenLocation& location, ExpressionNode* expr, int start, int end) |
| 376 |
{ |
376 |
{ |
| 377 |
StatementNode* result; |
377 |
StatementNode* result; |
| 378 |
if (!expr) |
378 |
if (!expr) |
| 379 |
result = new (m_globalData) EmptyStatementNode(lineNumber); |
379 |
result = new (m_globalData) EmptyStatementNode(location); |
| 380 |
else |
380 |
else |
| 381 |
result = new (m_globalData) VarStatementNode(lineNumber, expr); |
381 |
result = new (m_globalData) VarStatementNode(location, expr); |
| 382 |
result->setLoc(start, end); |
382 |
result->setLoc(start, end, location.column); |
| 383 |
return result; |
383 |
return result; |
| 384 |
} |
384 |
} |
| 385 |
|
385 |
|
| 386 |
StatementNode* createReturnStatement(int lineNumber, ExpressionNode* expression, int eStart, int eEnd, int startLine, int endLine) |
386 |
StatementNode* createReturnStatement(const JSTokenLocation& location, ExpressionNode* expression, int eStart, int eEnd, int startLine, int endLine) |
| 387 |
{ |
387 |
{ |
| 388 |
ReturnNode* result = new (m_globalData) ReturnNode(lineNumber, expression); |
388 |
ReturnNode* result = new (m_globalData) ReturnNode(location, expression); |
| 389 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
389 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
| 390 |
result->setLoc(startLine, endLine); |
390 |
result->setLoc(startLine, endLine, location.column); |
| 391 |
return result; |
391 |
return result; |
| 392 |
} |
392 |
} |
| 393 |
|
393 |
|
| 394 |
StatementNode* createBreakStatement(int lineNumber, int eStart, int eEnd, int startLine, int endLine) |
394 |
StatementNode* createBreakStatement(const JSTokenLocation& location, int eStart, int eEnd, int startLine, int endLine) |
| 395 |
{ |
395 |
{ |
| 396 |
BreakNode* result = new (m_globalData) BreakNode(m_globalData, lineNumber); |
396 |
BreakNode* result = new (m_globalData) BreakNode(m_globalData, location); |
| 397 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
397 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
| 398 |
result->setLoc(startLine, endLine); |
398 |
result->setLoc(startLine, endLine, location.column); |
| 399 |
return result; |
399 |
return result; |
| 400 |
} |
400 |
} |
| 401 |
|
401 |
|
| 402 |
StatementNode* createBreakStatement(int lineNumber, const Identifier* ident, int eStart, int eEnd, int startLine, int endLine) |
402 |
StatementNode* createBreakStatement(const JSTokenLocation& location, const Identifier* ident, int eStart, int eEnd, int startLine, int endLine) |
| 403 |
{ |
403 |
{ |
| 404 |
BreakNode* result = new (m_globalData) BreakNode(lineNumber, *ident); |
404 |
BreakNode* result = new (m_globalData) BreakNode(location, *ident); |
| 405 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
405 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
| 406 |
result->setLoc(startLine, endLine); |
406 |
result->setLoc(startLine, endLine, location.column); |
| 407 |
return result; |
407 |
return result; |
| 408 |
} |
408 |
} |
| 409 |
|
409 |
|
| 410 |
StatementNode* createContinueStatement(int lineNumber, int eStart, int eEnd, int startLine, int endLine) |
410 |
StatementNode* createContinueStatement(const JSTokenLocation& location, int eStart, int eEnd, int startLine, int endLine) |
| 411 |
{ |
411 |
{ |
| 412 |
ContinueNode* result = new (m_globalData) ContinueNode(m_globalData, lineNumber); |
412 |
ContinueNode* result = new (m_globalData) ContinueNode(m_globalData, location); |
| 413 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
413 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
| 414 |
result->setLoc(startLine, endLine); |
414 |
result->setLoc(startLine, endLine, location.column); |
| 415 |
return result; |
415 |
return result; |
| 416 |
} |
416 |
} |
| 417 |
|
417 |
|
| 418 |
StatementNode* createContinueStatement(int lineNumber, const Identifier* ident, int eStart, int eEnd, int startLine, int endLine) |
418 |
StatementNode* createContinueStatement(const JSTokenLocation& location, const Identifier* ident, int eStart, int eEnd, int startLine, int endLine) |
| 419 |
{ |
419 |
{ |
| 420 |
ContinueNode* result = new (m_globalData) ContinueNode(lineNumber, *ident); |
420 |
ContinueNode* result = new (m_globalData) ContinueNode(location, *ident); |
| 421 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
421 |
setExceptionLocation(result, eStart, eEnd, eEnd); |
| 422 |
result->setLoc(startLine, endLine); |
422 |
result->setLoc(startLine, endLine, location.column); |
| 423 |
return result; |
423 |
return result; |
| 424 |
} |
424 |
} |
| 425 |
|
425 |
|
| 426 |
StatementNode* createTryStatement(int lineNumber, StatementNode* tryBlock, const Identifier* ident, StatementNode* catchBlock, StatementNode* finallyBlock, int startLine, int endLine) |
426 |
StatementNode* createTryStatement(const JSTokenLocation& location, StatementNode* tryBlock, const Identifier* ident, StatementNode* catchBlock, StatementNode* finallyBlock, int startLine, int endLine) |
| 427 |
{ |
427 |
{ |
| 428 |
TryNode* result = new (m_globalData) TryNode(lineNumber, tryBlock, *ident, catchBlock, finallyBlock); |
428 |
TryNode* result = new (m_globalData) TryNode(location, tryBlock, *ident, catchBlock, finallyBlock); |
| 429 |
if (catchBlock) |
429 |
if (catchBlock) |
| 430 |
usesCatch(); |
430 |
usesCatch(); |
| 431 |
result->setLoc(startLine, endLine); |
431 |
result->setLoc(startLine, endLine, location.column); |
| 432 |
return result; |
432 |
return result; |
| 433 |
} |
433 |
} |
| 434 |
|
434 |
|
| 435 |
StatementNode* createSwitchStatement(int lineNumber, ExpressionNode* expr, ClauseListNode* firstClauses, CaseClauseNode* defaultClause, ClauseListNode* secondClauses, int startLine, int endLine) |
435 |
StatementNode* createSwitchStatement(const JSTokenLocation& location, ExpressionNode* expr, ClauseListNode* firstClauses, CaseClauseNode* defaultClause, ClauseListNode* secondClauses, int startLine, int endLine) |
| 436 |
{ |
436 |
{ |
| 437 |
CaseBlockNode* cases = new (m_globalData) CaseBlockNode(firstClauses, defaultClause, secondClauses); |
437 |
CaseBlockNode* cases = new (m_globalData) CaseBlockNode(firstClauses, defaultClause, secondClauses); |
| 438 |
SwitchNode* result = new (m_globalData) SwitchNode(lineNumber, expr, cases); |
438 |
SwitchNode* result = new (m_globalData) SwitchNode(location, expr, cases); |
| 439 |
result->setLoc(startLine, endLine); |
439 |
result->setLoc(startLine, endLine, location.column); |
| 440 |
return result; |
440 |
return result; |
| 441 |
} |
441 |
} |
| 442 |
|
442 |
|
| 443 |
StatementNode* createWhileStatement(int lineNumber, ExpressionNode* expr, StatementNode* statement, int startLine, int endLine) |
443 |
StatementNode* createWhileStatement(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement, int startLine, int endLine) |
| 444 |
{ |
444 |
{ |
| 445 |
WhileNode* result = new (m_globalData) WhileNode(lineNumber, expr, statement); |
445 |
WhileNode* result = new (m_globalData) WhileNode(location, expr, statement); |
| 446 |
result->setLoc(startLine, endLine); |
446 |
result->setLoc(startLine, endLine, location.column); |
| 447 |
return result; |
447 |
return result; |
| 448 |
} |
448 |
} |
| 449 |
|
449 |
|
| 450 |
StatementNode* createDoWhileStatement(int lineNumber, StatementNode* statement, ExpressionNode* expr, int startLine, int endLine) |
450 |
StatementNode* createDoWhileStatement(const JSTokenLocation& location, StatementNode* statement, ExpressionNode* expr, int startLine, int endLine) |
| 451 |
{ |
451 |
{ |
| 452 |
DoWhileNode* result = new (m_globalData) DoWhileNode(lineNumber, statement, expr); |
452 |
DoWhileNode* result = new (m_globalData) DoWhileNode(location, statement, expr); |
| 453 |
result->setLoc(startLine, endLine); |
453 |
result->setLoc(startLine, endLine, location.column); |
| 454 |
return result; |
454 |
return result; |
| 455 |
} |
455 |
} |
| 456 |
|
456 |
|
| 457 |
StatementNode* createLabelStatement(int lineNumber, const Identifier* ident, StatementNode* statement, int start, int end) |
457 |
StatementNode* createLabelStatement(const JSTokenLocation& location, const Identifier* ident, StatementNode* statement, int start, int end) |
| 458 |
{ |
458 |
{ |
| 459 |
LabelNode* result = new (m_globalData) LabelNode(lineNumber, *ident, statement); |
459 |
LabelNode* result = new (m_globalData) LabelNode(location, *ident, statement); |
| 460 |
setExceptionLocation(result, start, end, end); |
460 |
setExceptionLocation(result, start, end, end); |
| 461 |
return result; |
461 |
return result; |
| 462 |
} |
462 |
} |
| 463 |
|
463 |
|
| 464 |
StatementNode* createWithStatement(int lineNumber, ExpressionNode* expr, StatementNode* statement, int start, int end, int startLine, int endLine) |
464 |
StatementNode* createWithStatement(const JSTokenLocation& location, ExpressionNode* expr, StatementNode* statement, int start, int end, int startLine, int endLine) |
| 465 |
{ |
465 |
{ |
| 466 |
usesWith(); |
466 |
usesWith(); |
| 467 |
WithNode* result = new (m_globalData) WithNode(lineNumber, expr, statement, end, end - start); |
467 |
WithNode* result = new (m_globalData) WithNode(location, expr, statement, end, end - start); |
| 468 |
result->setLoc(startLine, endLine); |
468 |
result->setLoc(startLine, endLine, location.column); |
| 469 |
return result; |
469 |
return result; |
| 470 |
} |
470 |
} |
| 471 |
|
471 |
|
| 472 |
StatementNode* createThrowStatement(int lineNumber, ExpressionNode* expr, int start, int end, int startLine, int endLine) |
472 |
StatementNode* createThrowStatement(const JSTokenLocation& location, ExpressionNode* expr, int start, int end, int startLine, int endLine) |
| 473 |
{ |
473 |
{ |
| 474 |
ThrowNode* result = new (m_globalData) ThrowNode(lineNumber, expr); |
474 |
ThrowNode* result = new (m_globalData) ThrowNode(location, expr); |
| 475 |
result->setLoc(startLine, endLine); |
475 |
result->setLoc(startLine, endLine, location.column); |
| 476 |
setExceptionLocation(result, start, end, end); |
476 |
setExceptionLocation(result, start, end, end); |
| 477 |
return result; |
477 |
return result; |
| 478 |
} |
478 |
} |
| 479 |
|
479 |
|
| 480 |
StatementNode* createDebugger(int lineNumber, int startLine, int endLine) |
480 |
StatementNode* createDebugger(const JSTokenLocation& location, int startLine, int endLine) |
| 481 |
{ |
481 |
{ |
| 482 |
DebuggerStatementNode* result = new (m_globalData) DebuggerStatementNode(lineNumber); |
482 |
DebuggerStatementNode* result = new (m_globalData) DebuggerStatementNode(location); |
| 483 |
result->setLoc(startLine, endLine); |
483 |
result->setLoc(startLine, endLine, location.column); |
| 484 |
return result; |
484 |
return result; |
| 485 |
} |
485 |
} |
| 486 |
|
486 |
|
| 487 |
StatementNode* createConstStatement(int lineNumber, ConstDeclNode* decls, int startLine, int endLine) |
487 |
StatementNode* createConstStatement(const JSTokenLocation& location, ConstDeclNode* decls, int startLine, int endLine) |
| 488 |
{ |
488 |
{ |
| 489 |
ConstStatementNode* result = new (m_globalData) ConstStatementNode(lineNumber, decls); |
489 |
ConstStatementNode* result = new (m_globalData) ConstStatementNode(location, decls); |
| 490 |
result->setLoc(startLine, endLine); |
490 |
result->setLoc(startLine, endLine, location.column); |
| 491 |
return result; |
491 |
return result; |
| 492 |
} |
492 |
} |
| 493 |
|
493 |
|
| 494 |
ConstDeclNode* appendConstDecl(int lineNumber, ConstDeclNode* tail, const Identifier* name, ExpressionNode* initializer) |
494 |
ConstDeclNode* appendConstDecl(const JSTokenLocation& location, ConstDeclNode* tail, const Identifier* name, ExpressionNode* initializer) |
| 495 |
{ |
495 |
{ |
| 496 |
ConstDeclNode* result = new (m_globalData) ConstDeclNode(lineNumber, *name, initializer); |
496 |
ConstDeclNode* result = new (m_globalData) ConstDeclNode(location, *name, initializer); |
| 497 |
if (tail) |
497 |
if (tail) |
| 498 |
tail->m_next = result; |
498 |
tail->m_next = result; |
| 499 |
return result; |
499 |
return result; |
|
Lines 511-517
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec5
|
| 511 |
m_scope.m_varDeclarations->data.append(std::make_pair(ident, attrs)); |
511 |
m_scope.m_varDeclarations->data.append(std::make_pair(ident, attrs)); |
| 512 |
} |
512 |
} |
| 513 |
|
513 |
|
| 514 |
ExpressionNode* combineCommaNodes(int lineNumber, ExpressionNode* list, ExpressionNode* init) |
514 |
ExpressionNode* combineCommaNodes(const JSTokenLocation& location, ExpressionNode* list, ExpressionNode* init) |
| 515 |
{ |
515 |
{ |
| 516 |
if (!list) |
516 |
if (!list) |
| 517 |
return init; |
517 |
return init; |
|
Lines 519-525
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec6
|
| 519 |
static_cast<CommaNode*>(list)->append(init); |
519 |
static_cast<CommaNode*>(list)->append(init); |
| 520 |
return list; |
520 |
return list; |
| 521 |
} |
521 |
} |
| 522 |
return new (m_globalData) CommaNode(lineNumber, list, init); |
522 |
return new (m_globalData) CommaNode(location, list, init); |
| 523 |
} |
523 |
} |
| 524 |
|
524 |
|
| 525 |
int evalCount() const { return m_evalCount; } |
525 |
int evalCount() const { return m_evalCount; } |
|
Lines 547-556
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec7
|
| 547 |
ASSERT(operandStackDepth >= 0); |
547 |
ASSERT(operandStackDepth >= 0); |
| 548 |
m_binaryOperandStack.resize(m_binaryOperandStack.size() - amount); |
548 |
m_binaryOperandStack.resize(m_binaryOperandStack.size() - amount); |
| 549 |
} |
549 |
} |
| 550 |
void appendBinaryOperation(int lineNumber, int& operandStackDepth, int&, const BinaryOperand& lhs, const BinaryOperand& rhs) |
550 |
void appendBinaryOperation(const JSTokenLocation& location, int& operandStackDepth, int&, const BinaryOperand& lhs, const BinaryOperand& rhs) |
| 551 |
{ |
551 |
{ |
| 552 |
operandStackDepth++; |
552 |
operandStackDepth++; |
| 553 |
m_binaryOperandStack.append(std::make_pair(makeBinaryNode(lineNumber, m_binaryOperatorStack.last().first, lhs, rhs), BinaryOpInfo(lhs.second, rhs.second))); |
553 |
m_binaryOperandStack.append(std::make_pair(makeBinaryNode(location, m_binaryOperatorStack.last().first, lhs, rhs), BinaryOpInfo(lhs.second, rhs.second))); |
| 554 |
} |
554 |
} |
| 555 |
void operatorStackAppend(int& operatorStackDepth, int op, int precedence) |
555 |
void operatorStackAppend(int& operatorStackDepth, int op, int precedence) |
| 556 |
{ |
556 |
{ |
|
Lines 592-600
public:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec8
|
| 592 |
m_assignmentInfoStack.append(AssignmentInfo(node, start, divot, assignmentCount, op)); |
592 |
m_assignmentInfoStack.append(AssignmentInfo(node, start, divot, assignmentCount, op)); |
| 593 |
} |
593 |
} |
| 594 |
|
594 |
|
| 595 |
ExpressionNode* createAssignment(int lineNumber, int& assignmentStackDepth, ExpressionNode* rhs, int initialAssignmentCount, int currentAssignmentCount, int lastTokenEnd) |
595 |
ExpressionNode* createAssignment(const JSTokenLocation& location, int& assignmentStackDepth, ExpressionNode* rhs, int initialAssignmentCount, int currentAssignmentCount, int lastTokenEnd) |
| 596 |
{ |
596 |
{ |
| 597 |
ExpressionNode* result = makeAssignNode(lineNumber, m_assignmentInfoStack.last().m_node, m_assignmentInfoStack.last().m_op, rhs, m_assignmentInfoStack.last().m_initAssignments != initialAssignmentCount, m_assignmentInfoStack.last().m_initAssignments != currentAssignmentCount, m_assignmentInfoStack.last().m_start, m_assignmentInfoStack.last().m_divot + 1, lastTokenEnd); |
597 |
ExpressionNode* result = makeAssignNode(location, m_assignmentInfoStack.last().m_node, m_assignmentInfoStack.last().m_op, rhs, m_assignmentInfoStack.last().m_initAssignments != initialAssignmentCount, m_assignmentInfoStack.last().m_initAssignments != currentAssignmentCount, m_assignmentInfoStack.last().m_start, m_assignmentInfoStack.last().m_divot + 1, lastTokenEnd); |
| 598 |
m_assignmentInfoStack.removeLast(); |
598 |
m_assignmentInfoStack.removeLast(); |
| 599 |
assignmentStackDepth--; |
599 |
assignmentStackDepth--; |
| 600 |
return result; |
600 |
return result; |
|
Lines 635-643
private:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec9
|
| 635 |
m_evalCount++; |
635 |
m_evalCount++; |
| 636 |
m_scope.m_features |= EvalFeature; |
636 |
m_scope.m_features |= EvalFeature; |
| 637 |
} |
637 |
} |
| 638 |
ExpressionNode* createNumber(int lineNumber, double d) |
638 |
ExpressionNode* createNumber(const JSTokenLocation& location, double d) |
| 639 |
{ |
639 |
{ |
| 640 |
return new (m_globalData) NumberNode(lineNumber, d); |
640 |
return new (m_globalData) NumberNode(location, d); |
| 641 |
} |
641 |
} |
| 642 |
|
642 |
|
| 643 |
JSGlobalData* m_globalData; |
643 |
JSGlobalData* m_globalData; |
|
Lines 650-682
private:
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec10
|
| 650 |
int m_evalCount; |
650 |
int m_evalCount; |
| 651 |
}; |
651 |
}; |
| 652 |
|
652 |
|
| 653 |
ExpressionNode* ASTBuilder::makeTypeOfNode(int lineNumber, ExpressionNode* expr) |
653 |
ExpressionNode* ASTBuilder::makeTypeOfNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 654 |
{ |
654 |
{ |
| 655 |
if (expr->isResolveNode()) { |
655 |
if (expr->isResolveNode()) { |
| 656 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
656 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
| 657 |
return new (m_globalData) TypeOfResolveNode(lineNumber, resolve->identifier()); |
657 |
return new (m_globalData) TypeOfResolveNode(location, resolve->identifier()); |
| 658 |
} |
658 |
} |
| 659 |
return new (m_globalData) TypeOfValueNode(lineNumber, expr); |
659 |
return new (m_globalData) TypeOfValueNode(location, expr); |
| 660 |
} |
660 |
} |
| 661 |
|
661 |
|
| 662 |
ExpressionNode* ASTBuilder::makeDeleteNode(int lineNumber, ExpressionNode* expr, int start, int divot, int end) |
662 |
ExpressionNode* ASTBuilder::makeDeleteNode(const JSTokenLocation& location, ExpressionNode* expr, int start, int divot, int end) |
| 663 |
{ |
663 |
{ |
| 664 |
if (!expr->isLocation()) |
664 |
if (!expr->isLocation()) |
| 665 |
return new (m_globalData) DeleteValueNode(lineNumber, expr); |
665 |
return new (m_globalData) DeleteValueNode(location, expr); |
| 666 |
if (expr->isResolveNode()) { |
666 |
if (expr->isResolveNode()) { |
| 667 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
667 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
| 668 |
return new (m_globalData) DeleteResolveNode(lineNumber, resolve->identifier(), divot, divot - start, end - divot); |
668 |
return new (m_globalData) DeleteResolveNode(location, resolve->identifier(), divot, divot - start, end - divot); |
| 669 |
} |
669 |
} |
| 670 |
if (expr->isBracketAccessorNode()) { |
670 |
if (expr->isBracketAccessorNode()) { |
| 671 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); |
671 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); |
| 672 |
return new (m_globalData) DeleteBracketNode(lineNumber, bracket->base(), bracket->subscript(), divot, divot - start, end - divot); |
672 |
return new (m_globalData) DeleteBracketNode(location, bracket->base(), bracket->subscript(), divot, divot - start, end - divot); |
| 673 |
} |
673 |
} |
| 674 |
ASSERT(expr->isDotAccessorNode()); |
674 |
ASSERT(expr->isDotAccessorNode()); |
| 675 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); |
675 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); |
| 676 |
return new (m_globalData) DeleteDotNode(lineNumber, dot->base(), dot->identifier(), divot, divot - start, end - divot); |
676 |
return new (m_globalData) DeleteDotNode(location, dot->base(), dot->identifier(), divot, divot - start, end - divot); |
| 677 |
} |
677 |
} |
| 678 |
|
678 |
|
| 679 |
ExpressionNode* ASTBuilder::makeNegateNode(int lineNumber, ExpressionNode* n) |
679 |
ExpressionNode* ASTBuilder::makeNegateNode(const JSTokenLocation& location, ExpressionNode* n) |
| 680 |
{ |
680 |
{ |
| 681 |
if (n->isNumber()) { |
681 |
if (n->isNumber()) { |
| 682 |
NumberNode* numberNode = static_cast<NumberNode*>(n); |
682 |
NumberNode* numberNode = static_cast<NumberNode*>(n); |
|
Lines 684-811
ExpressionNode* ASTBuilder::makeNegateNode(int lineNumber, ExpressionNode* n)
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec11
|
| 684 |
return numberNode; |
684 |
return numberNode; |
| 685 |
} |
685 |
} |
| 686 |
|
686 |
|
| 687 |
return new (m_globalData) NegateNode(lineNumber, n); |
687 |
return new (m_globalData) NegateNode(location, n); |
| 688 |
} |
688 |
} |
| 689 |
|
689 |
|
| 690 |
ExpressionNode* ASTBuilder::makeBitwiseNotNode(int lineNumber, ExpressionNode* expr) |
690 |
ExpressionNode* ASTBuilder::makeBitwiseNotNode(const JSTokenLocation& location, ExpressionNode* expr) |
| 691 |
{ |
691 |
{ |
| 692 |
if (expr->isNumber()) |
692 |
if (expr->isNumber()) |
| 693 |
return createNumber(lineNumber, ~toInt32(static_cast<NumberNode*>(expr)->value())); |
693 |
return createNumber(location, ~toInt32(static_cast<NumberNode*>(expr)->value())); |
| 694 |
return new (m_globalData) BitwiseNotNode(lineNumber, expr); |
694 |
return new (m_globalData) BitwiseNotNode(location, expr); |
| 695 |
} |
695 |
} |
| 696 |
|
696 |
|
| 697 |
ExpressionNode* ASTBuilder::makeMultNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
697 |
ExpressionNode* ASTBuilder::makeMultNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 698 |
{ |
698 |
{ |
| 699 |
expr1 = expr1->stripUnaryPlus(); |
699 |
expr1 = expr1->stripUnaryPlus(); |
| 700 |
expr2 = expr2->stripUnaryPlus(); |
700 |
expr2 = expr2->stripUnaryPlus(); |
| 701 |
|
701 |
|
| 702 |
if (expr1->isNumber() && expr2->isNumber()) |
702 |
if (expr1->isNumber() && expr2->isNumber()) |
| 703 |
return createNumber(lineNumber, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value()); |
703 |
return createNumber(location, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value()); |
| 704 |
|
704 |
|
| 705 |
if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1) |
705 |
if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1) |
| 706 |
return new (m_globalData) UnaryPlusNode(lineNumber, expr2); |
706 |
return new (m_globalData) UnaryPlusNode(location, expr2); |
| 707 |
|
707 |
|
| 708 |
if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1) |
708 |
if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1) |
| 709 |
return new (m_globalData) UnaryPlusNode(lineNumber, expr1); |
709 |
return new (m_globalData) UnaryPlusNode(location, expr1); |
| 710 |
|
710 |
|
| 711 |
return new (m_globalData) MultNode(lineNumber, expr1, expr2, rightHasAssignments); |
711 |
return new (m_globalData) MultNode(location, expr1, expr2, rightHasAssignments); |
| 712 |
} |
712 |
} |
| 713 |
|
713 |
|
| 714 |
ExpressionNode* ASTBuilder::makeDivNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
714 |
ExpressionNode* ASTBuilder::makeDivNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 715 |
{ |
715 |
{ |
| 716 |
expr1 = expr1->stripUnaryPlus(); |
716 |
expr1 = expr1->stripUnaryPlus(); |
| 717 |
expr2 = expr2->stripUnaryPlus(); |
717 |
expr2 = expr2->stripUnaryPlus(); |
| 718 |
|
718 |
|
| 719 |
if (expr1->isNumber() && expr2->isNumber()) |
719 |
if (expr1->isNumber() && expr2->isNumber()) |
| 720 |
return createNumber(lineNumber, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value()); |
720 |
return createNumber(location, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value()); |
| 721 |
return new (m_globalData) DivNode(lineNumber, expr1, expr2, rightHasAssignments); |
721 |
return new (m_globalData) DivNode(location, expr1, expr2, rightHasAssignments); |
| 722 |
} |
722 |
} |
| 723 |
|
723 |
|
| 724 |
ExpressionNode* ASTBuilder::makeModNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
724 |
ExpressionNode* ASTBuilder::makeModNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 725 |
{ |
725 |
{ |
| 726 |
expr1 = expr1->stripUnaryPlus(); |
726 |
expr1 = expr1->stripUnaryPlus(); |
| 727 |
expr2 = expr2->stripUnaryPlus(); |
727 |
expr2 = expr2->stripUnaryPlus(); |
| 728 |
|
728 |
|
| 729 |
if (expr1->isNumber() && expr2->isNumber()) |
729 |
if (expr1->isNumber() && expr2->isNumber()) |
| 730 |
return createNumber(lineNumber, fmod(static_cast<NumberNode*>(expr1)->value(), static_cast<NumberNode*>(expr2)->value())); |
730 |
return createNumber(location, fmod(static_cast<NumberNode*>(expr1)->value(), static_cast<NumberNode*>(expr2)->value())); |
| 731 |
return new (m_globalData) ModNode(lineNumber, expr1, expr2, rightHasAssignments); |
731 |
return new (m_globalData) ModNode(location, expr1, expr2, rightHasAssignments); |
| 732 |
} |
732 |
} |
| 733 |
|
733 |
|
| 734 |
ExpressionNode* ASTBuilder::makeAddNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
734 |
ExpressionNode* ASTBuilder::makeAddNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 735 |
{ |
735 |
{ |
| 736 |
if (expr1->isNumber() && expr2->isNumber()) |
736 |
if (expr1->isNumber() && expr2->isNumber()) |
| 737 |
return createNumber(lineNumber, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value()); |
737 |
return createNumber(location, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value()); |
| 738 |
return new (m_globalData) AddNode(lineNumber, expr1, expr2, rightHasAssignments); |
738 |
return new (m_globalData) AddNode(location, expr1, expr2, rightHasAssignments); |
| 739 |
} |
739 |
} |
| 740 |
|
740 |
|
| 741 |
ExpressionNode* ASTBuilder::makeSubNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
741 |
ExpressionNode* ASTBuilder::makeSubNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 742 |
{ |
742 |
{ |
| 743 |
expr1 = expr1->stripUnaryPlus(); |
743 |
expr1 = expr1->stripUnaryPlus(); |
| 744 |
expr2 = expr2->stripUnaryPlus(); |
744 |
expr2 = expr2->stripUnaryPlus(); |
| 745 |
|
745 |
|
| 746 |
if (expr1->isNumber() && expr2->isNumber()) |
746 |
if (expr1->isNumber() && expr2->isNumber()) |
| 747 |
return createNumber(lineNumber, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value()); |
747 |
return createNumber(location, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value()); |
| 748 |
return new (m_globalData) SubNode(lineNumber, expr1, expr2, rightHasAssignments); |
748 |
return new (m_globalData) SubNode(location, expr1, expr2, rightHasAssignments); |
| 749 |
} |
749 |
} |
| 750 |
|
750 |
|
| 751 |
ExpressionNode* ASTBuilder::makeLeftShiftNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
751 |
ExpressionNode* ASTBuilder::makeLeftShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 752 |
{ |
752 |
{ |
| 753 |
if (expr1->isNumber() && expr2->isNumber()) |
753 |
if (expr1->isNumber() && expr2->isNumber()) |
| 754 |
return createNumber(lineNumber, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); |
754 |
return createNumber(location, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); |
| 755 |
return new (m_globalData) LeftShiftNode(lineNumber, expr1, expr2, rightHasAssignments); |
755 |
return new (m_globalData) LeftShiftNode(location, expr1, expr2, rightHasAssignments); |
| 756 |
} |
756 |
} |
| 757 |
|
757 |
|
| 758 |
ExpressionNode* ASTBuilder::makeRightShiftNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
758 |
ExpressionNode* ASTBuilder::makeRightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 759 |
{ |
759 |
{ |
| 760 |
if (expr1->isNumber() && expr2->isNumber()) |
760 |
if (expr1->isNumber() && expr2->isNumber()) |
| 761 |
return createNumber(lineNumber, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); |
761 |
return createNumber(location, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); |
| 762 |
return new (m_globalData) RightShiftNode(lineNumber, expr1, expr2, rightHasAssignments); |
762 |
return new (m_globalData) RightShiftNode(location, expr1, expr2, rightHasAssignments); |
| 763 |
} |
763 |
} |
| 764 |
|
764 |
|
| 765 |
ExpressionNode* ASTBuilder::makeURightShiftNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
765 |
ExpressionNode* ASTBuilder::makeURightShiftNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 766 |
{ |
766 |
{ |
| 767 |
if (expr1->isNumber() && expr2->isNumber()) |
767 |
if (expr1->isNumber() && expr2->isNumber()) |
| 768 |
return createNumber(lineNumber, toUInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); |
768 |
return createNumber(location, toUInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); |
| 769 |
return new (m_globalData) UnsignedRightShiftNode(lineNumber, expr1, expr2, rightHasAssignments); |
769 |
return new (m_globalData) UnsignedRightShiftNode(location, expr1, expr2, rightHasAssignments); |
| 770 |
} |
770 |
} |
| 771 |
|
771 |
|
| 772 |
ExpressionNode* ASTBuilder::makeBitOrNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
772 |
ExpressionNode* ASTBuilder::makeBitOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 773 |
{ |
773 |
{ |
| 774 |
if (expr1->isNumber() && expr2->isNumber()) |
774 |
if (expr1->isNumber() && expr2->isNumber()) |
| 775 |
return createNumber(lineNumber, toInt32(static_cast<NumberNode*>(expr1)->value()) | toInt32(static_cast<NumberNode*>(expr2)->value())); |
775 |
return createNumber(location, toInt32(static_cast<NumberNode*>(expr1)->value()) | toInt32(static_cast<NumberNode*>(expr2)->value())); |
| 776 |
return new (m_globalData) BitOrNode(lineNumber, expr1, expr2, rightHasAssignments); |
776 |
return new (m_globalData) BitOrNode(location, expr1, expr2, rightHasAssignments); |
| 777 |
} |
777 |
} |
| 778 |
|
778 |
|
| 779 |
ExpressionNode* ASTBuilder::makeBitAndNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
779 |
ExpressionNode* ASTBuilder::makeBitAndNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 780 |
{ |
780 |
{ |
| 781 |
if (expr1->isNumber() && expr2->isNumber()) |
781 |
if (expr1->isNumber() && expr2->isNumber()) |
| 782 |
return createNumber(lineNumber, toInt32(static_cast<NumberNode*>(expr1)->value()) & toInt32(static_cast<NumberNode*>(expr2)->value())); |
782 |
return createNumber(location, toInt32(static_cast<NumberNode*>(expr1)->value()) & toInt32(static_cast<NumberNode*>(expr2)->value())); |
| 783 |
return new (m_globalData) BitAndNode(lineNumber, expr1, expr2, rightHasAssignments); |
783 |
return new (m_globalData) BitAndNode(location, expr1, expr2, rightHasAssignments); |
| 784 |
} |
784 |
} |
| 785 |
|
785 |
|
| 786 |
ExpressionNode* ASTBuilder::makeBitXOrNode(int lineNumber, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
786 |
ExpressionNode* ASTBuilder::makeBitXOrNode(const JSTokenLocation& location, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) |
| 787 |
{ |
787 |
{ |
| 788 |
if (expr1->isNumber() && expr2->isNumber()) |
788 |
if (expr1->isNumber() && expr2->isNumber()) |
| 789 |
return createNumber(lineNumber, toInt32(static_cast<NumberNode*>(expr1)->value()) ^ toInt32(static_cast<NumberNode*>(expr2)->value())); |
789 |
return createNumber(location, toInt32(static_cast<NumberNode*>(expr1)->value()) ^ toInt32(static_cast<NumberNode*>(expr2)->value())); |
| 790 |
return new (m_globalData) BitXOrNode(lineNumber, expr1, expr2, rightHasAssignments); |
790 |
return new (m_globalData) BitXOrNode(location, expr1, expr2, rightHasAssignments); |
| 791 |
} |
791 |
} |
| 792 |
|
792 |
|
| 793 |
ExpressionNode* ASTBuilder::makeFunctionCallNode(int lineNumber, ExpressionNode* func, ArgumentsNode* args, int start, int divot, int end) |
793 |
ExpressionNode* ASTBuilder::makeFunctionCallNode(const JSTokenLocation& location, ExpressionNode* func, ArgumentsNode* args, int start, int divot, int end) |
| 794 |
{ |
794 |
{ |
| 795 |
if (!func->isLocation()) |
795 |
if (!func->isLocation()) |
| 796 |
return new (m_globalData) FunctionCallValueNode(lineNumber, func, args, divot, divot - start, end - divot); |
796 |
return new (m_globalData) FunctionCallValueNode(location, func, args, divot, divot - start, end - divot); |
| 797 |
if (func->isResolveNode()) { |
797 |
if (func->isResolveNode()) { |
| 798 |
ResolveNode* resolve = static_cast<ResolveNode*>(func); |
798 |
ResolveNode* resolve = static_cast<ResolveNode*>(func); |
| 799 |
const Identifier& identifier = resolve->identifier(); |
799 |
const Identifier& identifier = resolve->identifier(); |
| 800 |
if (identifier == m_globalData->propertyNames->eval) { |
800 |
if (identifier == m_globalData->propertyNames->eval) { |
| 801 |
usesEval(); |
801 |
usesEval(); |
| 802 |
return new (m_globalData) EvalFunctionCallNode(lineNumber, args, divot, divot - start, end - divot); |
802 |
return new (m_globalData) EvalFunctionCallNode(location, args, divot, divot - start, end - divot); |
| 803 |
} |
803 |
} |
| 804 |
return new (m_globalData) FunctionCallResolveNode(lineNumber, identifier, args, divot, divot - start, end - divot); |
804 |
return new (m_globalData) FunctionCallResolveNode(location, identifier, args, divot, divot - start, end - divot); |
| 805 |
} |
805 |
} |
| 806 |
if (func->isBracketAccessorNode()) { |
806 |
if (func->isBracketAccessorNode()) { |
| 807 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func); |
807 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func); |
| 808 |
FunctionCallBracketNode* node = new (m_globalData) FunctionCallBracketNode(lineNumber, bracket->base(), bracket->subscript(), args, divot, divot - start, end - divot); |
808 |
FunctionCallBracketNode* node = new (m_globalData) FunctionCallBracketNode(location, bracket->base(), bracket->subscript(), args, divot, divot - start, end - divot); |
| 809 |
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); |
809 |
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); |
| 810 |
return node; |
810 |
return node; |
| 811 |
} |
811 |
} |
|
Lines 813-930
ExpressionNode* ASTBuilder::makeFunctionCallNode(int lineNumber, ExpressionNode*
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec12
|
| 813 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(func); |
813 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(func); |
| 814 |
FunctionCallDotNode* node; |
814 |
FunctionCallDotNode* node; |
| 815 |
if (dot->identifier() == m_globalData->propertyNames->call) |
815 |
if (dot->identifier() == m_globalData->propertyNames->call) |
| 816 |
node = new (m_globalData) CallFunctionCallDotNode(lineNumber, dot->base(), dot->identifier(), args, divot, divot - start, end - divot); |
816 |
node = new (m_globalData) CallFunctionCallDotNode(location, dot->base(), dot->identifier(), args, divot, divot - start, end - divot); |
| 817 |
else if (dot->identifier() == m_globalData->propertyNames->apply) |
817 |
else if (dot->identifier() == m_globalData->propertyNames->apply) |
| 818 |
node = new (m_globalData) ApplyFunctionCallDotNode(lineNumber, dot->base(), dot->identifier(), args, divot, divot - start, end - divot); |
818 |
node = new (m_globalData) ApplyFunctionCallDotNode(location, dot->base(), dot->identifier(), args, divot, divot - start, end - divot); |
| 819 |
else |
819 |
else |
| 820 |
node = new (m_globalData) FunctionCallDotNode(lineNumber, dot->base(), dot->identifier(), args, divot, divot - start, end - divot); |
820 |
node = new (m_globalData) FunctionCallDotNode(location, dot->base(), dot->identifier(), args, divot, divot - start, end - divot); |
| 821 |
node->setSubexpressionInfo(dot->divot(), dot->endOffset()); |
821 |
node->setSubexpressionInfo(dot->divot(), dot->endOffset()); |
| 822 |
return node; |
822 |
return node; |
| 823 |
} |
823 |
} |
| 824 |
|
824 |
|
| 825 |
ExpressionNode* ASTBuilder::makeBinaryNode(int lineNumber, int token, pair<ExpressionNode*, BinaryOpInfo> lhs, pair<ExpressionNode*, BinaryOpInfo> rhs) |
825 |
ExpressionNode* ASTBuilder::makeBinaryNode(const JSTokenLocation& location, int token, pair<ExpressionNode*, BinaryOpInfo> lhs, pair<ExpressionNode*, BinaryOpInfo> rhs) |
| 826 |
{ |
826 |
{ |
| 827 |
switch (token) { |
827 |
switch (token) { |
| 828 |
case OR: |
828 |
case OR: |
| 829 |
return new (m_globalData) LogicalOpNode(lineNumber, lhs.first, rhs.first, OpLogicalOr); |
829 |
return new (m_globalData) LogicalOpNode(location, lhs.first, rhs.first, OpLogicalOr); |
| 830 |
|
830 |
|
| 831 |
case AND: |
831 |
case AND: |
| 832 |
return new (m_globalData) LogicalOpNode(lineNumber, lhs.first, rhs.first, OpLogicalAnd); |
832 |
return new (m_globalData) LogicalOpNode(location, lhs.first, rhs.first, OpLogicalAnd); |
| 833 |
|
833 |
|
| 834 |
case BITOR: |
834 |
case BITOR: |
| 835 |
return makeBitOrNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
835 |
return makeBitOrNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 836 |
|
836 |
|
| 837 |
case BITXOR: |
837 |
case BITXOR: |
| 838 |
return makeBitXOrNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
838 |
return makeBitXOrNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 839 |
|
839 |
|
| 840 |
case BITAND: |
840 |
case BITAND: |
| 841 |
return makeBitAndNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
841 |
return makeBitAndNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 842 |
|
842 |
|
| 843 |
case EQEQ: |
843 |
case EQEQ: |
| 844 |
return new (m_globalData) EqualNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
844 |
return new (m_globalData) EqualNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 845 |
|
845 |
|
| 846 |
case NE: |
846 |
case NE: |
| 847 |
return new (m_globalData) NotEqualNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
847 |
return new (m_globalData) NotEqualNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 848 |
|
848 |
|
| 849 |
case STREQ: |
849 |
case STREQ: |
| 850 |
return new (m_globalData) StrictEqualNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
850 |
return new (m_globalData) StrictEqualNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 851 |
|
851 |
|
| 852 |
case STRNEQ: |
852 |
case STRNEQ: |
| 853 |
return new (m_globalData) NotStrictEqualNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
853 |
return new (m_globalData) NotStrictEqualNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 854 |
|
854 |
|
| 855 |
case LT: |
855 |
case LT: |
| 856 |
return new (m_globalData) LessNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
856 |
return new (m_globalData) LessNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 857 |
|
857 |
|
| 858 |
case GT: |
858 |
case GT: |
| 859 |
return new (m_globalData) GreaterNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
859 |
return new (m_globalData) GreaterNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 860 |
|
860 |
|
| 861 |
case LE: |
861 |
case LE: |
| 862 |
return new (m_globalData) LessEqNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
862 |
return new (m_globalData) LessEqNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 863 |
|
863 |
|
| 864 |
case GE: |
864 |
case GE: |
| 865 |
return new (m_globalData) GreaterEqNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
865 |
return new (m_globalData) GreaterEqNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 866 |
|
866 |
|
| 867 |
case INSTANCEOF: { |
867 |
case INSTANCEOF: { |
| 868 |
InstanceOfNode* node = new (m_globalData) InstanceOfNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
868 |
InstanceOfNode* node = new (m_globalData) InstanceOfNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 869 |
setExceptionLocation(node, lhs.second.start, rhs.second.start, rhs.second.end); |
869 |
setExceptionLocation(node, lhs.second.start, rhs.second.start, rhs.second.end); |
| 870 |
return node; |
870 |
return node; |
| 871 |
} |
871 |
} |
| 872 |
|
872 |
|
| 873 |
case INTOKEN: { |
873 |
case INTOKEN: { |
| 874 |
InNode* node = new (m_globalData) InNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
874 |
InNode* node = new (m_globalData) InNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 875 |
setExceptionLocation(node, lhs.second.start, rhs.second.start, rhs.second.end); |
875 |
setExceptionLocation(node, lhs.second.start, rhs.second.start, rhs.second.end); |
| 876 |
return node; |
876 |
return node; |
| 877 |
} |
877 |
} |
| 878 |
|
878 |
|
| 879 |
case LSHIFT: |
879 |
case LSHIFT: |
| 880 |
return makeLeftShiftNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
880 |
return makeLeftShiftNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 881 |
|
881 |
|
| 882 |
case RSHIFT: |
882 |
case RSHIFT: |
| 883 |
return makeRightShiftNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
883 |
return makeRightShiftNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 884 |
|
884 |
|
| 885 |
case URSHIFT: |
885 |
case URSHIFT: |
| 886 |
return makeURightShiftNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
886 |
return makeURightShiftNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 887 |
|
887 |
|
| 888 |
case PLUS: |
888 |
case PLUS: |
| 889 |
return makeAddNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
889 |
return makeAddNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 890 |
|
890 |
|
| 891 |
case MINUS: |
891 |
case MINUS: |
| 892 |
return makeSubNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
892 |
return makeSubNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 893 |
|
893 |
|
| 894 |
case TIMES: |
894 |
case TIMES: |
| 895 |
return makeMultNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
895 |
return makeMultNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 896 |
|
896 |
|
| 897 |
case DIVIDE: |
897 |
case DIVIDE: |
| 898 |
return makeDivNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
898 |
return makeDivNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 899 |
|
899 |
|
| 900 |
case MOD: |
900 |
case MOD: |
| 901 |
return makeModNode(lineNumber, lhs.first, rhs.first, rhs.second.hasAssignment); |
901 |
return makeModNode(location, lhs.first, rhs.first, rhs.second.hasAssignment); |
| 902 |
} |
902 |
} |
| 903 |
CRASH(); |
903 |
CRASH(); |
| 904 |
return 0; |
904 |
return 0; |
| 905 |
} |
905 |
} |
| 906 |
|
906 |
|
| 907 |
ExpressionNode* ASTBuilder::makeAssignNode(int lineNumber, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end) |
907 |
ExpressionNode* ASTBuilder::makeAssignNode(const JSTokenLocation& location, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end) |
| 908 |
{ |
908 |
{ |
| 909 |
if (!loc->isLocation()) |
909 |
if (!loc->isLocation()) |
| 910 |
return new (m_globalData) AssignErrorNode(lineNumber, divot, divot - start, end - divot); |
910 |
return new (m_globalData) AssignErrorNode(location, divot, divot - start, end - divot); |
| 911 |
|
911 |
|
| 912 |
if (loc->isResolveNode()) { |
912 |
if (loc->isResolveNode()) { |
| 913 |
ResolveNode* resolve = static_cast<ResolveNode*>(loc); |
913 |
ResolveNode* resolve = static_cast<ResolveNode*>(loc); |
| 914 |
if (op == OpEqual) { |
914 |
if (op == OpEqual) { |
| 915 |
if (expr->isFuncExprNode()) |
915 |
if (expr->isFuncExprNode()) |
| 916 |
static_cast<FuncExprNode*>(expr)->body()->setInferredName(resolve->identifier()); |
916 |
static_cast<FuncExprNode*>(expr)->body()->setInferredName(resolve->identifier()); |
| 917 |
AssignResolveNode* node = new (m_globalData) AssignResolveNode(lineNumber, resolve->identifier(), expr); |
917 |
AssignResolveNode* node = new (m_globalData) AssignResolveNode(location, resolve->identifier(), expr); |
| 918 |
setExceptionLocation(node, start, divot, end); |
918 |
setExceptionLocation(node, start, divot, end); |
| 919 |
return node; |
919 |
return node; |
| 920 |
} |
920 |
} |
| 921 |
return new (m_globalData) ReadModifyResolveNode(lineNumber, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); |
921 |
return new (m_globalData) ReadModifyResolveNode(location, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); |
| 922 |
} |
922 |
} |
| 923 |
if (loc->isBracketAccessorNode()) { |
923 |
if (loc->isBracketAccessorNode()) { |
| 924 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc); |
924 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc); |
| 925 |
if (op == OpEqual) |
925 |
if (op == OpEqual) |
| 926 |
return new (m_globalData) AssignBracketNode(lineNumber, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot()); |
926 |
return new (m_globalData) AssignBracketNode(location, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot()); |
| 927 |
ReadModifyBracketNode* node = new (m_globalData) ReadModifyBracketNode(lineNumber, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot); |
927 |
ReadModifyBracketNode* node = new (m_globalData) ReadModifyBracketNode(location, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot); |
| 928 |
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); |
928 |
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); |
| 929 |
return node; |
929 |
return node; |
| 930 |
} |
930 |
} |
|
Lines 933-987
ExpressionNode* ASTBuilder::makeAssignNode(int lineNumber, ExpressionNode* loc,
a/Source/JavaScriptCore/parser/ASTBuilder.h_sec13
|
| 933 |
if (op == OpEqual) { |
933 |
if (op == OpEqual) { |
| 934 |
if (expr->isFuncExprNode()) |
934 |
if (expr->isFuncExprNode()) |
| 935 |
static_cast<FuncExprNode*>(expr)->body()->setInferredName(dot->identifier()); |
935 |
static_cast<FuncExprNode*>(expr)->body()->setInferredName(dot->identifier()); |
| 936 |
return new (m_globalData) AssignDotNode(lineNumber, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot()); |
936 |
return new (m_globalData) AssignDotNode(location, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot()); |
| 937 |
} |
937 |
} |
| 938 |
|
938 |
|
| 939 |
ReadModifyDotNode* node = new (m_globalData) ReadModifyDotNode(lineNumber, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); |
939 |
ReadModifyDotNode* node = new (m_globalData) ReadModifyDotNode(location, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); |
| 940 |
node->setSubexpressionInfo(dot->divot(), dot->endOffset()); |
940 |
node->setSubexpressionInfo(dot->divot(), dot->endOffset()); |
| 941 |
return node; |
941 |
return node; |
| 942 |
} |
942 |
} |
| 943 |
|
943 |
|
| 944 |
ExpressionNode* ASTBuilder::makePrefixNode(int lineNumber, ExpressionNode* expr, Operator op, int start, int divot, int end) |
944 |
ExpressionNode* ASTBuilder::makePrefixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator op, int start, int divot, int end) |
| 945 |
{ |
945 |
{ |
| 946 |
if (!expr->isLocation()) |
946 |
if (!expr->isLocation()) |
| 947 |
return new (m_globalData) PrefixErrorNode(lineNumber, op, divot, divot - start, end - divot); |
947 |
return new (m_globalData) PrefixErrorNode(location, op, divot, divot - start, end - divot); |
| 948 |
|
948 |
|
| 949 |
if (expr->isResolveNode()) { |
949 |
if (expr->isResolveNode()) { |
| 950 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
950 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
| 951 |
return new (m_globalData) PrefixResolveNode(lineNumber, resolve->identifier(), op, divot, divot - start, end - divot); |
951 |
return new (m_globalData) PrefixResolveNode(location, resolve->identifier(), op, divot, divot - start, end - divot); |
| 952 |
} |
952 |
} |
| 953 |
if (expr->isBracketAccessorNode()) { |
953 |
if (expr->isBracketAccessorNode()) { |
| 954 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); |
954 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); |
| 955 |
PrefixBracketNode* node = new (m_globalData) PrefixBracketNode(lineNumber, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); |
955 |
PrefixBracketNode* node = new (m_globalData) PrefixBracketNode(location, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); |
| 956 |
node->setSubexpressionInfo(bracket->divot(), bracket->startOffset()); |
956 |
node->setSubexpressionInfo(bracket->divot(), bracket->startOffset()); |
| 957 |
return node; |
957 |
return node; |
| 958 |
} |
958 |
} |
| 959 |
ASSERT(expr->isDotAccessorNode()); |
959 |
ASSERT(expr->isDotAccessorNode()); |
| 960 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); |
960 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); |
| 961 |
PrefixDotNode* node = new (m_globalData) PrefixDotNode(lineNumber, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); |
961 |
PrefixDotNode* node = new (m_globalData) PrefixDotNode(location, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); |
| 962 |
node->setSubexpressionInfo(dot->divot(), dot->startOffset()); |
962 |
node->setSubexpressionInfo(dot->divot(), dot->startOffset()); |
| 963 |
return node; |
963 |
return node; |
| 964 |
} |
964 |
} |
| 965 |
|
965 |
|
| 966 |
ExpressionNode* ASTBuilder::makePostfixNode(int lineNumber, ExpressionNode* expr, Operator op, int start, int divot, int end) |
966 |
ExpressionNode* ASTBuilder::makePostfixNode(const JSTokenLocation& location, ExpressionNode* expr, Operator op, int start, int divot, int end) |
| 967 |
{ |
967 |
{ |
| 968 |
if (!expr->isLocation()) |
968 |
if (!expr->isLocation()) |
| 969 |
return new (m_globalData) PostfixErrorNode(lineNumber, op, divot, divot - start, end - divot); |
969 |
return new (m_globalData) PostfixErrorNode(location, op, divot, divot - start, end - divot); |
| 970 |
|
970 |
|
| 971 |
if (expr->isResolveNode()) { |
971 |
if (expr->isResolveNode()) { |
| 972 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
972 |
ResolveNode* resolve = static_cast<ResolveNode*>(expr); |
| 973 |
return new (m_globalData) PostfixResolveNode(lineNumber, resolve->identifier(), op, divot, divot - start, end - divot); |
973 |
return new (m_globalData) PostfixResolveNode(location, resolve->identifier(), op, divot, divot - start, end - divot); |
| 974 |
} |
974 |
} |
| 975 |
if (expr->isBracketAccessorNode()) { |
975 |
if (expr->isBracketAccessorNode()) { |
| 976 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); |
976 |
BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); |
| 977 |
PostfixBracketNode* node = new (m_globalData) PostfixBracketNode(lineNumber, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); |
977 |
PostfixBracketNode* node = new (m_globalData) PostfixBracketNode(location, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); |
| 978 |
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); |
978 |
node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); |
| 979 |
return node; |
979 |
return node; |
| 980 |
|
980 |
|
| 981 |
} |
981 |
} |
| 982 |
ASSERT(expr->isDotAccessorNode()); |
982 |
ASSERT(expr->isDotAccessorNode()); |
| 983 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); |
983 |
DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); |
| 984 |
PostfixDotNode* node = new (m_globalData) PostfixDotNode(lineNumber, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); |
984 |
PostfixDotNode* node = new (m_globalData) PostfixDotNode(location, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); |
| 985 |
node->setSubexpressionInfo(dot->divot(), dot->endOffset()); |
985 |
node->setSubexpressionInfo(dot->divot(), dot->endOffset()); |
| 986 |
return node; |
986 |
return node; |
| 987 |
} |
987 |
} |