Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: runtime/vm/token.h

Issue 10659005: Implement type cast in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/parser.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_TOKEN_H_ 5 #ifndef VM_TOKEN_H_
6 #define VM_TOKEN_H_ 6 #define VM_TOKEN_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 // Operator precedence table 12 // Operator precedence table
13 // 13 //
14 // 13 multiplicative * / ~/ % 14 // 13 multiplicative * / ~/ %
15 // 12 additive + - 15 // 12 additive + -
16 // 11 shift << >> 16 // 11 shift << >>
17 // 10 relational >= > <= < is 17 // 10 relational >= > <= < is as
18 // 9 equality == != === !== 18 // 9 equality == != === !==
19 // 8 bitwise and & 19 // 8 bitwise and &
20 // 7 bitwise xor ^ 20 // 7 bitwise xor ^
21 // 6 bitwise or | 21 // 6 bitwise or |
22 // 5 logical and && 22 // 5 logical and &&
23 // 4 logical or || 23 // 4 logical or ||
24 // 3 conditional ? 24 // 3 conditional ?
25 // 2 assignment = *= /= ~/= %= += -= <<= >>= &= ^= |= 25 // 2 assignment = *= /= ~/= %= += -= <<= >>= &= ^= |=
26 // 1 comma , 26 // 1 comma ,
27 27
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 \ 99 \
100 /* Relational operators. */ \ 100 /* Relational operators. */ \
101 /* Please update IsRelationalOperator() if you make */ \ 101 /* Please update IsRelationalOperator() if you make */ \
102 /* any changes to this block. */ \ 102 /* any changes to this block. */ \
103 TOK(kLT, "<", 10, kNoAttribute) \ 103 TOK(kLT, "<", 10, kNoAttribute) \
104 TOK(kGT, ">", 10, kNoAttribute) \ 104 TOK(kGT, ">", 10, kNoAttribute) \
105 TOK(kLTE, "<=", 10, kNoAttribute) \ 105 TOK(kLTE, "<=", 10, kNoAttribute) \
106 TOK(kGTE, ">=", 10, kNoAttribute) \ 106 TOK(kGTE, ">=", 10, kNoAttribute) \
107 \ 107 \
108 /* Internal token for !(expr is Type) negative type test operator */ \ 108 /* Internal token for !(expr is Type) negative type test operator */ \
109 TOK(kISNOT, "", 0, kNoAttribute) \ 109 TOK(kISNOT, "", 10, kNoAttribute) \
110 \
111 /* Internal token for (expr as Type) type cast operator */ \
112 TOK(kAS, "", 10, kNoAttribute) \
110 \ 113 \
111 TOK(kINDEX, "[]", 0, kNoAttribute) \ 114 TOK(kINDEX, "[]", 0, kNoAttribute) \
112 TOK(kASSIGN_INDEX, "[]=", 0, kNoAttribute) \ 115 TOK(kASSIGN_INDEX, "[]=", 0, kNoAttribute) \
113 \ 116 \
114 TOK(kIDENT, "", 0, kNoAttribute) \ 117 TOK(kIDENT, "", 0, kNoAttribute) \
115 TOK(kSTRING, "", 0, kNoAttribute) \ 118 TOK(kSTRING, "", 0, kNoAttribute) \
116 TOK(kINTEGER, "", 0, kNoAttribute) \ 119 TOK(kINTEGER, "", 0, kNoAttribute) \
117 TOK(kDOUBLE, "", 0, kNoAttribute) \ 120 TOK(kDOUBLE, "", 0, kNoAttribute) \
118 \ 121 \
119 TOK(kINTERPOL_VAR, "", 0, kNoAttribute) \ 122 TOK(kINTERPOL_VAR, "", 0, kNoAttribute) \
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 208 }
206 209
207 static bool IsRelationalOperator(Kind tok) { 210 static bool IsRelationalOperator(Kind tok) {
208 return kLT <= tok && tok <= kGTE; 211 return kLT <= tok && tok <= kGTE;
209 } 212 }
210 213
211 static bool IsEqualityOperator(Kind tok) { 214 static bool IsEqualityOperator(Kind tok) {
212 return kEQ <= tok && tok <= kNE_STRICT; 215 return kEQ <= tok && tok <= kNE_STRICT;
213 } 216 }
214 217
215 static bool IsInstanceofOperator(Kind tok) { 218 static bool IsTypeTestOperator(Kind tok) {
216 return (tok == kIS) || (tok == kISNOT); 219 return (tok == kIS) || (tok == kISNOT);
217 } 220 }
218 221
222 static bool IsTypeCastOperator(Kind tok) {
223 return tok == kAS;
224 }
225
219 static bool IsPseudoKeyword(Kind tok) { 226 static bool IsPseudoKeyword(Kind tok) {
220 return (Attributes(tok) & kPseudoKeyword) != 0; 227 return (Attributes(tok) & kPseudoKeyword) != 0;
221 } 228 }
222 229
223 static bool IsKeyword(Kind tok) { 230 static bool IsKeyword(Kind tok) {
224 return (Attributes(tok) & kKeyword) != 0; 231 return (Attributes(tok) & kKeyword) != 0;
225 } 232 }
226 233
227 static bool IsIdentifier(Kind tok) { 234 static bool IsIdentifier(Kind tok) {
228 return (tok == kIDENT) || IsPseudoKeyword(tok); 235 return (tok == kIDENT) || IsPseudoKeyword(tok);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 static const char* name_[]; 282 static const char* name_[];
276 static const char* tok_str_[]; 283 static const char* tok_str_[];
277 static const uint8_t precedence_[]; 284 static const uint8_t precedence_[];
278 static const Attribute attributes_[]; 285 static const Attribute attributes_[];
279 }; 286 };
280 287
281 288
282 } // namespace dart 289 } // namespace dart
283 290
284 #endif // VM_TOKEN_H_ 291 #endif // VM_TOKEN_H_
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698