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

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

Issue 2859673002: Pass type argument vector to generic functions (if --reify-generic-functions is (Closed)
Patch Set: address review comments and sync Created 3 years, 7 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
« no previous file with comments | « runtime/vm/assembler_dbc_test.cc ('k') | runtime/vm/code_patcher_arm64_test.cc » ('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 RUNTIME_VM_AST_H_ 5 #ifndef RUNTIME_VM_AST_H_
6 #define RUNTIME_VM_AST_H_ 6 #define RUNTIME_VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode); 278 DECLARE_COMMON_NODE_FUNCTIONS(CloneContextNode);
279 279
280 private: 280 private:
281 DISALLOW_COPY_AND_ASSIGN(CloneContextNode); 281 DISALLOW_COPY_AND_ASSIGN(CloneContextNode);
282 }; 282 };
283 283
284 284
285 class ArgumentListNode : public AstNode { 285 class ArgumentListNode : public AstNode {
286 public: 286 public:
287 explicit ArgumentListNode(TokenPosition token_pos) 287 explicit ArgumentListNode(TokenPosition token_pos)
288 : AstNode(token_pos), nodes_(4), names_(Array::ZoneHandle()) {} 288 : AstNode(token_pos),
289 type_args_var_(NULL),
290 type_arguments_(TypeArguments::ZoneHandle()),
291 type_args_len_(0),
292 nodes_(4),
293 names_(Array::ZoneHandle()) {}
294
295 ArgumentListNode(TokenPosition token_pos, const TypeArguments& type_arguments)
296 : AstNode(token_pos),
297 type_args_var_(NULL),
298 type_arguments_(type_arguments),
299 type_args_len_(type_arguments.Length()),
300 nodes_(4),
301 names_(Array::ZoneHandle()) {
302 ASSERT(type_arguments_.IsZoneHandle());
303 }
304
305 ArgumentListNode(TokenPosition token_pos,
306 LocalVariable* type_args_var,
307 intptr_t type_args_len)
308 : AstNode(token_pos),
309 type_args_var_(type_args_var),
310 type_arguments_(TypeArguments::ZoneHandle()),
311 type_args_len_(type_args_len),
312 nodes_(4),
313 names_(Array::ZoneHandle()) {
314 ASSERT((type_args_var_ == NULL) == (type_args_len_ == 0));
315 }
289 316
290 void VisitChildren(AstNodeVisitor* visitor) const; 317 void VisitChildren(AstNodeVisitor* visitor) const;
291 318
319 LocalVariable* type_args_var() const { return type_args_var_; }
320 const TypeArguments& type_arguments() const { return type_arguments_; }
321 intptr_t type_args_len() const { return type_args_len_; }
292 void Add(AstNode* node) { nodes_.Add(node); } 322 void Add(AstNode* node) { nodes_.Add(node); }
293 intptr_t length() const { return nodes_.length(); } 323 intptr_t length() const { return nodes_.length(); }
324 intptr_t LengthWithTypeArgs() const {
325 return length() + (type_args_len() > 0 ? 1 : 0);
326 }
294 AstNode* NodeAt(intptr_t index) const { return nodes_[index]; } 327 AstNode* NodeAt(intptr_t index) const { return nodes_[index]; }
295 void SetNodeAt(intptr_t index, AstNode* node) { nodes_[index] = node; } 328 void SetNodeAt(intptr_t index, AstNode* node) { nodes_[index] = node; }
296 const Array& names() const { return names_; } 329 const Array& names() const { return names_; }
297 void set_names(const Array& names) { names_ = names.raw(); } 330 void set_names(const Array& names) { names_ = names.raw(); }
298 const GrowableArray<AstNode*>& nodes() const { return nodes_; } 331 const GrowableArray<AstNode*>& nodes() const { return nodes_; }
299 332
300 DECLARE_COMMON_NODE_FUNCTIONS(ArgumentListNode); 333 DECLARE_COMMON_NODE_FUNCTIONS(ArgumentListNode);
301 334
302 private: 335 private:
336 // At most one of type_args_var_ and type_arguments_ can be set, not both.
337 LocalVariable* type_args_var_;
338 const TypeArguments& type_arguments_;
339 intptr_t type_args_len_;
303 GrowableArray<AstNode*> nodes_; 340 GrowableArray<AstNode*> nodes_;
304 Array& names_; 341 Array& names_;
305 342
306 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode); 343 DISALLOW_COPY_AND_ASSIGN(ArgumentListNode);
307 }; 344 };
308 345
309 346
310 class LetNode : public AstNode { 347 class LetNode : public AstNode {
311 public: 348 public:
312 explicit LetNode(TokenPosition token_pos); 349 explicit LetNode(TokenPosition token_pos);
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 const intptr_t try_index_; 2012 const intptr_t try_index_;
1976 2013
1977 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 2014 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1978 }; 2015 };
1979 2016
1980 } // namespace dart 2017 } // namespace dart
1981 2018
1982 #undef DECLARE_COMMON_NODE_FUNCTIONS 2019 #undef DECLARE_COMMON_NODE_FUNCTIONS
1983 2020
1984 #endif // RUNTIME_VM_AST_H_ 2021 #endif // RUNTIME_VM_AST_H_
OLDNEW
« no previous file with comments | « runtime/vm/assembler_dbc_test.cc ('k') | runtime/vm/code_patcher_arm64_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698