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

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

Issue 2419013004: Add local variable declaration token position to service protocol (Closed)
Patch Set: ... Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #include "vm/ast.h" 5 #include "vm/ast.h"
6 #include "vm/compiler.h" 6 #include "vm/compiler.h"
7 #include "vm/dart_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 105
106 LocalVariable* LetNode::AddInitializer(AstNode* node) { 106 LocalVariable* LetNode::AddInitializer(AstNode* node) {
107 Thread* thread = Thread::Current(); 107 Thread* thread = Thread::Current();
108 Zone* zone = thread->zone(); 108 Zone* zone = thread->zone();
109 initializers_.Add(node); 109 initializers_.Add(node);
110 char name[64]; 110 char name[64];
111 OS::SNPrint(name, sizeof(name), ":lt%s_%" Pd "", 111 OS::SNPrint(name, sizeof(name), ":lt%s_%" Pd "",
112 token_pos().ToCString(), vars_.length()); 112 token_pos().ToCString(), vars_.length());
113 LocalVariable* temp_var = 113 LocalVariable* temp_var =
114 new LocalVariable(token_pos(), 114 new LocalVariable(TokenPosition::kNoSource,
115 token_pos(),
115 String::ZoneHandle(zone, Symbols::New(thread, name)), 116 String::ZoneHandle(zone, Symbols::New(thread, name)),
116 Object::dynamic_type()); 117 Object::dynamic_type());
117 vars_.Add(temp_var); 118 vars_.Add(temp_var);
118 return temp_var; 119 return temp_var;
119 } 120 }
120 121
121 122
122 void LetNode::VisitChildren(AstNodeVisitor* visitor) const { 123 void LetNode::VisitChildren(AstNodeVisitor* visitor) const {
123 for (intptr_t i = 0; i < num_temps(); ++i) { 124 for (intptr_t i = 0; i < num_temps(); ++i) {
124 initializers_[i]->Visit(visitor); 125 initializers_[i]->Visit(visitor);
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 if (result.IsError() || result.IsNull()) { 821 if (result.IsError() || result.IsNull()) {
821 // TODO(turnidge): We could get better error messages by returning 822 // TODO(turnidge): We could get better error messages by returning
822 // the Error object directly to the parser. This will involve 823 // the Error object directly to the parser. This will involve
823 // replumbing all of the EvalConstExpr methods. 824 // replumbing all of the EvalConstExpr methods.
824 return NULL; 825 return NULL;
825 } 826 }
826 return &Instance::ZoneHandle(Instance::Cast(result).raw()); 827 return &Instance::ZoneHandle(Instance::Cast(result).raw());
827 } 828 }
828 829
829 } // namespace dart 830 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/local_variable_declaration_test.dart ('k') | runtime/vm/ast_printer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698