OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 #define DECL_ACCEPT(type) \ | 42 #define DECL_ACCEPT(type) \ |
43 void type::Accept(AstVisitor* v) { v->Visit##type(this); } | 43 void type::Accept(AstVisitor* v) { v->Visit##type(this); } |
44 AST_NODE_LIST(DECL_ACCEPT) | 44 AST_NODE_LIST(DECL_ACCEPT) |
45 #undef DECL_ACCEPT | 45 #undef DECL_ACCEPT |
46 | 46 |
47 | 47 |
48 // ---------------------------------------------------------------------------- | 48 // ---------------------------------------------------------------------------- |
49 // Implementation of other node functionality. | 49 // Implementation of other node functionality. |
50 | 50 |
51 Assignment* ExpressionStatement::StatementAsSimpleAssignment() { | 51 |
52 return (expression()->AsAssignment() != NULL && | 52 bool Expression::IsSmiLiteral() { |
53 !expression()->AsAssignment()->is_compound()) | 53 return AsLiteral() != NULL && AsLiteral()->handle()->IsSmi(); |
54 ? expression()->AsAssignment() | |
55 : NULL; | |
56 } | 54 } |
57 | 55 |
58 | 56 |
59 CountOperation* ExpressionStatement::StatementAsCountOperation() { | 57 bool Expression::IsStringLiteral() { |
60 return expression()->AsCountOperation(); | 58 return AsLiteral() != NULL && AsLiteral()->handle()->IsString(); |
| 59 } |
| 60 |
| 61 |
| 62 bool Expression::IsNullLiteral() { |
| 63 return AsLiteral() != NULL && AsLiteral()->handle()->IsNull(); |
61 } | 64 } |
62 | 65 |
63 | 66 |
64 VariableProxy::VariableProxy(Isolate* isolate, Variable* var) | 67 VariableProxy::VariableProxy(Isolate* isolate, Variable* var) |
65 : Expression(isolate), | 68 : Expression(isolate), |
66 name_(var->name()), | 69 name_(var->name()), |
67 var_(NULL), // Will be set by the call to BindTo. | 70 var_(NULL), // Will be set by the call to BindTo. |
68 is_this_(var->is_this()), | 71 is_this_(var->is_this()), |
69 is_trivial_(false), | 72 is_trivial_(false), |
70 position_(RelocInfo::kNoPosition) { | 73 position_(RelocInfo::kNoPosition) { |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 int pos) | 1191 int pos) |
1189 : label_(label), | 1192 : label_(label), |
1190 statements_(statements), | 1193 statements_(statements), |
1191 position_(pos), | 1194 position_(pos), |
1192 compare_type_(NONE), | 1195 compare_type_(NONE), |
1193 compare_id_(AstNode::GetNextId(isolate)), | 1196 compare_id_(AstNode::GetNextId(isolate)), |
1194 entry_id_(AstNode::GetNextId(isolate)) { | 1197 entry_id_(AstNode::GetNextId(isolate)) { |
1195 } | 1198 } |
1196 | 1199 |
1197 } } // namespace v8::internal | 1200 } } // namespace v8::internal |
OLD | NEW |