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

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

Issue 2419013004: Add local variable declaration token position to service protocol (Closed)
Patch Set: test closure variables 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) 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 #include "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/assembler.h" 10 #include "vm/assembler.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 new ReturnNode(kPos, new StaticCallNode(kPos, function, no_arguments))); 43 new ReturnNode(kPos, new StaticCallNode(kPos, function, no_arguments)));
44 } 44 }
45 CODEGEN_TEST2_RUN(SimpleStaticCallCodegen, SmiReturnCodegen, Smi::New(3)) 45 CODEGEN_TEST2_RUN(SimpleStaticCallCodegen, SmiReturnCodegen, Smi::New(3))
46 46
47 47
48 // Helper to allocate and return a LocalVariable. 48 // Helper to allocate and return a LocalVariable.
49 static LocalVariable* NewTestLocalVariable(const char* name) { 49 static LocalVariable* NewTestLocalVariable(const char* name) {
50 const String& variable_name = String::ZoneHandle( 50 const String& variable_name = String::ZoneHandle(
51 Symbols::New(Thread::Current(), name)); 51 Symbols::New(Thread::Current(), name));
52 const Type& variable_type = Type::ZoneHandle(Type::DynamicType()); 52 const Type& variable_type = Type::ZoneHandle(Type::DynamicType());
53 return new LocalVariable(kPos, variable_name, variable_type); 53 return new LocalVariable(kPos, kPos, variable_name, variable_type);
54 } 54 }
55 55
56 56
57 CODEGEN_TEST_GENERATE(ReturnParameterCodegen, test) { 57 CODEGEN_TEST_GENERATE(ReturnParameterCodegen, test) {
58 SequenceNode* node_seq = test->node_sequence(); 58 SequenceNode* node_seq = test->node_sequence();
59 const int num_params = 1; 59 const int num_params = 1;
60 LocalVariable* parameter = NewTestLocalVariable("parameter"); 60 LocalVariable* parameter = NewTestLocalVariable("parameter");
61 LocalScope* local_scope = node_seq->scope(); 61 LocalScope* local_scope = node_seq->scope();
62 local_scope->InsertParameterAt(0, parameter); 62 local_scope->InsertParameterAt(0, parameter);
63 ASSERT(local_scope->num_variables() == num_params); 63 ASSERT(local_scope->num_variables() == num_params);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 Library& app_lib = Library::Handle(); 365 Library& app_lib = Library::Handle();
366 app_lib ^= libs.At(num_libs - 1); 366 app_lib ^= libs.At(num_libs - 1);
367 ASSERT(!app_lib.IsNull()); 367 ASSERT(!app_lib.IsNull());
368 const Class& cls = Class::Handle( 368 const Class& cls = Class::Handle(
369 app_lib.LookupClass(String::Handle(Symbols::New(Thread::Current(), 369 app_lib.LookupClass(String::Handle(Symbols::New(Thread::Current(),
370 "A")))); 370 "A"))));
371 EXPECT_EQ(cls.raw(), result.clazz()); 371 EXPECT_EQ(cls.raw(), result.clazz());
372 } 372 }
373 373
374 } // namespace dart 374 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698