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

Unified Diff: runtime/vm/ast.h

Issue 1644793002: Replace intptr_t with TokenDescriptor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/ast.h
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index 494d76876adec994bc17e4979625632a6cda15ea..f212a1592f98550d3fe060221d6f65d04f5f78c4 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -12,6 +12,7 @@
#include "vm/object.h"
#include "vm/native_entry.h"
#include "vm/token.h"
+#include "vm/token_position.h"
namespace dart {
@@ -97,14 +98,14 @@ class AstNodeVisitor : public ValueObject {
class AstNode : public ZoneAllocated {
public:
- explicit AstNode(intptr_t token_pos)
+ explicit AstNode(TokenPosition token_pos)
: token_pos_(token_pos) {
- ASSERT(!Token::IsClassifying(token_pos_) ||
- (token_pos_ == ClassifyingTokenPositions::kMethodExtractor));
+ ASSERT(!token_pos_.IsClassifying() ||
+ (token_pos_ == TokenPosition::kMethodExtractor));
}
virtual ~AstNode() { }
- intptr_t token_pos() const { return token_pos_; }
+ TokenPosition token_pos() const { return token_pos_; }
#define AST_TYPE_CHECK(BaseName) \
bool Is##BaseName##Node() { return As##BaseName##Node() != NULL; } \
@@ -153,14 +154,14 @@ class AstNode : public ZoneAllocated {
friend class ParsedFunction;
private:
- const intptr_t token_pos_;
+ const TokenPosition token_pos_;
DISALLOW_COPY_AND_ASSIGN(AstNode);
};
class AwaitNode : public AstNode {
public:
- AwaitNode(intptr_t token_pos,
+ AwaitNode(TokenPosition token_pos,
AstNode* expr,
LocalVariable* saved_try_ctx,
LocalVariable* async_saved_try_ctx,
@@ -215,7 +216,7 @@ class AwaitMarkerNode : public AstNode {
public:
AwaitMarkerNode(LocalScope* async_scope,
LocalScope* await_scope,
- intptr_t token_pos)
+ TokenPosition token_pos)
: AstNode(token_pos),
async_scope_(async_scope),
await_scope_(await_scope) {
@@ -241,7 +242,7 @@ class AwaitMarkerNode : public AstNode {
class SequenceNode : public AstNode {
public:
- SequenceNode(intptr_t token_pos, LocalScope* scope)
+ SequenceNode(TokenPosition token_pos, LocalScope* scope)
: AstNode(token_pos),
scope_(scope),
nodes_(4),
@@ -276,7 +277,7 @@ class SequenceNode : public AstNode {
class CloneContextNode : public AstNode {
public:
- explicit CloneContextNode(intptr_t token_pos)
+ explicit CloneContextNode(TokenPosition token_pos)
: AstNode(token_pos) {
}
@@ -291,7 +292,7 @@ class CloneContextNode : public AstNode {
class ArgumentListNode : public AstNode {
public:
- explicit ArgumentListNode(intptr_t token_pos)
+ explicit ArgumentListNode(TokenPosition token_pos)
: AstNode(token_pos),
nodes_(4),
names_(Array::ZoneHandle()) {
@@ -323,7 +324,7 @@ class ArgumentListNode : public AstNode {
class LetNode : public AstNode {
public:
- explicit LetNode(intptr_t token_pos);
+ explicit LetNode(TokenPosition token_pos);
LocalVariable* TempAt(intptr_t i) const { return vars_[i]; }
AstNode* InitializerAt(intptr_t i) const { return initializers_[i]; }
@@ -356,13 +357,13 @@ class LetNode : public AstNode {
class ArrayNode : public AstNode {
public:
- ArrayNode(intptr_t token_pos, const AbstractType& type)
+ ArrayNode(TokenPosition token_pos, const AbstractType& type)
: AstNode(token_pos),
type_(type),
elements_() {
CheckFields();
}
- ArrayNode(intptr_t token_pos,
+ ArrayNode(TokenPosition token_pos,
const AbstractType& type,
const GrowableArray<AstNode*>& elements)
: AstNode(token_pos),
@@ -407,7 +408,7 @@ class ArrayNode : public AstNode {
class StringInterpolateNode : public AstNode {
public:
- StringInterpolateNode(intptr_t token_pos, ArrayNode* value)
+ StringInterpolateNode(TokenPosition token_pos, ArrayNode* value)
: AstNode(token_pos), value_(value) { }
virtual void VisitChildren(AstNodeVisitor* visitor) const {
@@ -429,7 +430,7 @@ class StringInterpolateNode : public AstNode {
class LiteralNode : public AstNode {
public:
- LiteralNode(intptr_t token_pos, const Instance& literal)
+ LiteralNode(TokenPosition token_pos, const Instance& literal)
: AstNode(token_pos), literal_(literal) {
ASSERT(literal_.IsNotTemporaryScopedHandle());
ASSERT(literal_.IsSmi() || literal_.IsOld());
@@ -465,7 +466,7 @@ class LiteralNode : public AstNode {
class TypeNode : public AstNode {
public:
- TypeNode(intptr_t token_pos, const AbstractType& type)
+ TypeNode(TokenPosition token_pos, const AbstractType& type)
: AstNode(token_pos), type_(type) {
ASSERT(type_.IsZoneHandle());
ASSERT(!type_.IsNull());
@@ -500,7 +501,7 @@ class TypeNode : public AstNode {
class AssignableNode : public AstNode {
public:
- AssignableNode(intptr_t token_pos,
+ AssignableNode(TokenPosition token_pos,
AstNode* expr,
const AbstractType& type,
const String& dst_name)
@@ -533,7 +534,7 @@ class AssignableNode : public AstNode {
class ClosureNode : public AstNode {
public:
- ClosureNode(intptr_t token_pos,
+ ClosureNode(TokenPosition token_pos,
const Function& function,
AstNode* receiver, // Non-null for implicit instance closures.
LocalScope* scope) // Null for implicit closures.
@@ -585,7 +586,7 @@ class ClosureNode : public AstNode {
// field access nodes.
class PrimaryNode : public AstNode {
public:
- PrimaryNode(intptr_t token_pos, const Object& primary)
+ PrimaryNode(TokenPosition token_pos, const Object& primary)
: AstNode(token_pos),
primary_(primary),
is_deferred_reference_(false) {
@@ -631,13 +632,13 @@ class ReturnNode : public AstNode {
};
// Return from a void function returns the null object.
- explicit ReturnNode(intptr_t token_pos)
+ explicit ReturnNode(TokenPosition token_pos)
: AstNode(token_pos),
value_(new LiteralNode(token_pos, Instance::ZoneHandle())),
inlined_finally_list_(),
return_type_(kRegular) { }
// Return from a non-void function.
- ReturnNode(intptr_t token_pos,
+ ReturnNode(TokenPosition token_pos,
AstNode* value)
: AstNode(token_pos),
value_(value),
@@ -684,7 +685,7 @@ class ReturnNode : public AstNode {
class ComparisonNode : public AstNode {
public:
- ComparisonNode(intptr_t token_pos,
+ ComparisonNode(TokenPosition token_pos,
Token::Kind kind,
AstNode* left,
AstNode* right)
@@ -722,7 +723,7 @@ class ComparisonNode : public AstNode {
class BinaryOpNode : public AstNode {
public:
- BinaryOpNode(intptr_t token_pos,
+ BinaryOpNode(TokenPosition token_pos,
Token::Kind kind,
AstNode* left,
AstNode* right)
@@ -766,7 +767,7 @@ class BinaryOpNode : public AstNode {
class BinaryOpWithMask32Node : public BinaryOpNode {
public:
- BinaryOpWithMask32Node(intptr_t token_pos,
+ BinaryOpWithMask32Node(TokenPosition token_pos,
Token::Kind kind_value,
AstNode* left,
AstNode* right,
@@ -797,10 +798,10 @@ class BinaryOpWithMask32Node : public BinaryOpNode {
class UnaryOpNode : public AstNode {
public:
// Returns optimized version, e.g., for ('-' '1') ('-1') literal is returned.
- static AstNode* UnaryOpOrLiteral(intptr_t token_pos,
+ static AstNode* UnaryOpOrLiteral(TokenPosition token_pos,
Token::Kind kind,
AstNode* operand);
- UnaryOpNode(intptr_t token_pos,
+ UnaryOpNode(TokenPosition token_pos,
Token::Kind kind,
AstNode* operand)
: AstNode(token_pos), kind_(kind), operand_(operand) {
@@ -833,7 +834,7 @@ class UnaryOpNode : public AstNode {
class ConditionalExprNode : public AstNode {
public:
- ConditionalExprNode(intptr_t token_pos,
+ ConditionalExprNode(TokenPosition token_pos,
AstNode* condition,
AstNode* true_expr,
AstNode* false_expr)
@@ -881,7 +882,7 @@ class ConditionalExprNode : public AstNode {
class IfNode : public AstNode {
public:
- IfNode(intptr_t token_pos,
+ IfNode(TokenPosition token_pos,
AstNode* condition,
SequenceNode* true_branch,
SequenceNode* false_branch)
@@ -917,7 +918,7 @@ class IfNode : public AstNode {
class CaseNode : public AstNode {
public:
- CaseNode(intptr_t token_pos,
+ CaseNode(TokenPosition token_pos,
SourceLabel* label,
SequenceNode* case_expressions,
bool contains_default,
@@ -961,7 +962,7 @@ class CaseNode : public AstNode {
class SwitchNode : public AstNode {
public:
- SwitchNode(intptr_t token_pos,
+ SwitchNode(TokenPosition token_pos,
SourceLabel* label,
SequenceNode* body)
: AstNode(token_pos),
@@ -990,7 +991,7 @@ class SwitchNode : public AstNode {
class WhileNode : public AstNode {
public:
- WhileNode(intptr_t token_pos,
+ WhileNode(TokenPosition token_pos,
SourceLabel* label,
AstNode* condition,
SequenceNode* condition_preamble,
@@ -1032,7 +1033,7 @@ class WhileNode : public AstNode {
class DoWhileNode : public AstNode {
public:
- DoWhileNode(intptr_t token_pos,
+ DoWhileNode(TokenPosition token_pos,
SourceLabel* label,
AstNode* condition,
SequenceNode* body)
@@ -1068,7 +1069,7 @@ class DoWhileNode : public AstNode {
// The condition can be NULL.
class ForNode : public AstNode {
public:
- ForNode(intptr_t token_pos,
+ ForNode(TokenPosition token_pos,
SourceLabel* label,
SequenceNode* initializer,
AstNode* condition,
@@ -1124,7 +1125,7 @@ class ForNode : public AstNode {
class JumpNode : public AstNode {
public:
- JumpNode(intptr_t token_pos,
+ JumpNode(TokenPosition token_pos,
Token::Kind kind,
SourceLabel* label)
: AstNode(token_pos),
@@ -1165,7 +1166,7 @@ class JumpNode : public AstNode {
class StopNode : public AstNode {
public:
- StopNode(intptr_t token_pos, const char* message)
+ StopNode(TokenPosition token_pos, const char* message)
: AstNode(token_pos),
message_(message) {
ASSERT(message != NULL);
@@ -1186,7 +1187,7 @@ class StopNode : public AstNode {
class LoadLocalNode : public AstNode {
public:
- LoadLocalNode(intptr_t token_pos, const LocalVariable* local)
+ LoadLocalNode(TokenPosition token_pos, const LocalVariable* local)
: AstNode(token_pos), local_(*local) {
ASSERT(local != NULL);
}
@@ -1210,7 +1211,9 @@ class LoadLocalNode : public AstNode {
class StoreLocalNode : public AstNode {
public:
- StoreLocalNode(intptr_t token_pos, const LocalVariable* local, AstNode* value)
+ StoreLocalNode(TokenPosition token_pos,
+ const LocalVariable* local,
+ AstNode* value)
: AstNode(token_pos), local_(*local), value_(value) {
ASSERT(local != NULL);
ASSERT(value_ != NULL);
@@ -1235,7 +1238,7 @@ class StoreLocalNode : public AstNode {
class LoadInstanceFieldNode : public AstNode {
public:
- LoadInstanceFieldNode(intptr_t token_pos,
+ LoadInstanceFieldNode(TokenPosition token_pos,
AstNode* instance,
const Field& field)
: AstNode(token_pos), instance_(instance), field_(field) {
@@ -1262,7 +1265,7 @@ class LoadInstanceFieldNode : public AstNode {
class StoreInstanceFieldNode : public AstNode {
public:
- StoreInstanceFieldNode(intptr_t token_pos,
+ StoreInstanceFieldNode(TokenPosition token_pos,
AstNode* instance,
const Field& field,
AstNode* value)
@@ -1297,7 +1300,7 @@ class StoreInstanceFieldNode : public AstNode {
class LoadStaticFieldNode : public AstNode {
public:
- LoadStaticFieldNode(intptr_t token_pos, const Field& field)
+ LoadStaticFieldNode(TokenPosition token_pos, const Field& field)
: AstNode(token_pos), field_(field), is_deferred_reference_(false) {
ASSERT(field_.IsZoneHandle());
}
@@ -1333,7 +1336,9 @@ class LoadStaticFieldNode : public AstNode {
class StoreStaticFieldNode : public AstNode {
public:
- StoreStaticFieldNode(intptr_t token_pos, const Field& field, AstNode* value)
+ StoreStaticFieldNode(TokenPosition token_pos,
+ const Field& field,
+ AstNode* value)
: AstNode(token_pos), field_(field), value_(value) {
ASSERT(field_.IsZoneHandle());
ASSERT(value_ != NULL);
@@ -1358,7 +1363,7 @@ class StoreStaticFieldNode : public AstNode {
class LoadIndexedNode : public AstNode {
public:
- LoadIndexedNode(intptr_t token_pos,
+ LoadIndexedNode(TokenPosition token_pos,
AstNode* array,
AstNode* index,
const Class& super_class)
@@ -1395,7 +1400,7 @@ class LoadIndexedNode : public AstNode {
class StoreIndexedNode : public AstNode {
public:
- StoreIndexedNode(intptr_t token_pos,
+ StoreIndexedNode(TokenPosition token_pos,
AstNode* array,
AstNode* index,
AstNode* value,
@@ -1436,7 +1441,7 @@ class StoreIndexedNode : public AstNode {
class InstanceCallNode : public AstNode {
public:
- InstanceCallNode(intptr_t token_pos,
+ InstanceCallNode(TokenPosition token_pos,
AstNode* receiver,
const String& function_name,
ArgumentListNode* arguments,
@@ -1476,7 +1481,7 @@ class InstanceCallNode : public AstNode {
class InstanceGetterNode : public AstNode {
public:
- InstanceGetterNode(intptr_t token_pos,
+ InstanceGetterNode(TokenPosition token_pos,
AstNode* receiver,
const String& field_name,
bool is_conditional = false)
@@ -1515,7 +1520,7 @@ class InstanceGetterNode : public AstNode {
class InstanceSetterNode : public AstNode {
public:
- InstanceSetterNode(intptr_t token_pos,
+ InstanceSetterNode(TokenPosition token_pos,
AstNode* receiver,
const String& field_name,
AstNode* value,
@@ -1555,7 +1560,7 @@ class InstanceSetterNode : public AstNode {
class InitStaticFieldNode : public AstNode {
public:
- InitStaticFieldNode(intptr_t token_pos, const Field& field)
+ InitStaticFieldNode(TokenPosition token_pos, const Field& field)
: AstNode(token_pos), field_(field) {
ASSERT(field_.IsZoneHandle());
}
@@ -1575,7 +1580,7 @@ class InitStaticFieldNode : public AstNode {
class StaticGetterNode : public AstNode {
public:
- StaticGetterNode(intptr_t token_pos,
+ StaticGetterNode(TokenPosition token_pos,
AstNode* receiver,
const Class& cls,
const String& field_name)
@@ -1632,7 +1637,7 @@ class StaticGetterNode : public AstNode {
class StaticSetterNode : public AstNode {
public:
// Static setter with resolved setter function.
- StaticSetterNode(intptr_t token_pos,
+ StaticSetterNode(TokenPosition token_pos,
AstNode* receiver,
const String& field_name,
const Function& function,
@@ -1650,7 +1655,7 @@ class StaticSetterNode : public AstNode {
}
// For unresolved setters.
- StaticSetterNode(intptr_t token_pos,
+ StaticSetterNode(TokenPosition token_pos,
AstNode* receiver,
const Class& cls,
const String& field_name,
@@ -1694,7 +1699,7 @@ class StaticSetterNode : public AstNode {
class StaticCallNode : public AstNode {
public:
- StaticCallNode(intptr_t token_pos,
+ StaticCallNode(TokenPosition token_pos,
const Function& function,
ArgumentListNode* arguments)
: AstNode(token_pos),
@@ -1725,7 +1730,7 @@ class StaticCallNode : public AstNode {
class ClosureCallNode : public AstNode {
public:
- ClosureCallNode(intptr_t token_pos,
+ ClosureCallNode(TokenPosition token_pos,
AstNode* closure,
ArgumentListNode* arguments)
: AstNode(token_pos),
@@ -1781,7 +1786,7 @@ class ClosureCallNode : public AstNode {
// instantiator_class.
class ConstructorCallNode : public AstNode {
public:
- ConstructorCallNode(intptr_t token_pos,
+ ConstructorCallNode(TokenPosition token_pos,
const TypeArguments& type_arguments,
const Function& constructor,
ArgumentListNode* arguments)
@@ -1818,7 +1823,7 @@ class ConstructorCallNode : public AstNode {
// The body of a Dart function marked as 'native' consists of this node.
class NativeBodyNode : public AstNode {
public:
- NativeBodyNode(intptr_t token_pos,
+ NativeBodyNode(TokenPosition token_pos,
const Function& function,
const String& native_c_function_name,
LocalScope* scope,
@@ -1859,7 +1864,7 @@ class CatchClauseNode : public AstNode {
public:
static const intptr_t kInvalidTryIndex = -1;
- CatchClauseNode(intptr_t token_pos,
+ CatchClauseNode(TokenPosition token_pos,
SequenceNode* catch_block,
const Array& handler_types,
const LocalVariable* context_var,
@@ -1922,7 +1927,7 @@ class CatchClauseNode : public AstNode {
class TryCatchNode : public AstNode {
public:
- TryCatchNode(intptr_t token_pos,
+ TryCatchNode(TokenPosition token_pos,
SequenceNode* try_block,
const LocalVariable* context_var,
CatchClauseNode* catch_block,
@@ -1975,7 +1980,7 @@ class TryCatchNode : public AstNode {
class ThrowNode : public AstNode {
public:
- ThrowNode(intptr_t token_pos, AstNode* exception, AstNode* stacktrace)
+ ThrowNode(TokenPosition token_pos, AstNode* exception, AstNode* stacktrace)
: AstNode(token_pos), exception_(exception), stacktrace_(stacktrace) {
ASSERT(exception_ != NULL);
}
@@ -2002,7 +2007,7 @@ class ThrowNode : public AstNode {
class InlinedFinallyNode : public AstNode {
public:
- InlinedFinallyNode(intptr_t token_pos,
+ InlinedFinallyNode(TokenPosition token_pos,
SequenceNode* finally_block,
const LocalVariable* context_var,
intptr_t try_index)
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698