| OLD | NEW |
| 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 | 5 |
| 6 #include "vm/ast_printer.h" | 6 #include "vm/ast_printer.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/longjump.h" | 8 #include "vm/longjump.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 TEST_CASE(ParseClassDefinition) { | 102 TEST_CASE(ParseClassDefinition) { |
| 103 const char* script_chars = | 103 const char* script_chars = |
| 104 "class C { } \n" | 104 "class C { } \n" |
| 105 "class A { \n" | 105 "class A { \n" |
| 106 " var f0; \n" | 106 " var f0; \n" |
| 107 " int f1; \n" | 107 " int f1; \n" |
| 108 " final f2; \n" | 108 " final f2; \n" |
| 109 " final int f3, f4; \n" | 109 " final int f3, f4; \n" |
| 110 " static String s1, s2; \n" | 110 " static String s1, s2; \n" |
| 111 " static final int s3 = 8675309; \n" | 111 " static const int s3 = 8675309; \n" |
| 112 " static bar(i, [var d = 5]) { return 77; } \n" | 112 " static bar(i, [var d = 5]) { return 77; } \n" |
| 113 " static foo() native \"native_function_name\"; \n" | 113 " static foo() native \"native_function_name\"; \n" |
| 114 "} \n"; | 114 "} \n"; |
| 115 | 115 |
| 116 String& url = String::Handle(String::New("dart-test:Parser_TopLevel")); | 116 String& url = String::Handle(String::New("dart-test:Parser_TopLevel")); |
| 117 String& source = String::Handle(String::New(script_chars)); | 117 String& source = String::Handle(String::New(script_chars)); |
| 118 Script& script = Script::Handle(Script::New(url, | 118 Script& script = Script::Handle(Script::New(url, |
| 119 source, | 119 source, |
| 120 RawScript::kSourceTag)); | 120 RawScript::kSourceTag)); |
| 121 Library& lib = Library::ZoneHandle(Library::CoreLibrary()); | 121 Library& lib = Library::ZoneHandle(Library::CoreLibrary()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 Parser::ParseCompilationUnit(lib, script); | 160 Parser::ParseCompilationUnit(lib, script); |
| 161 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 161 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 162 | 162 |
| 163 DumpFunction(lib, "A", "foo"); | 163 DumpFunction(lib, "A", "foo"); |
| 164 DumpFunction(lib, "A", "bar"); | 164 DumpFunction(lib, "A", "bar"); |
| 165 DumpFunction(lib, "A", "baz"); | 165 DumpFunction(lib, "A", "baz"); |
| 166 DumpFunction(lib, "B", "bam"); | 166 DumpFunction(lib, "B", "bam"); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace dart | 169 } // namespace dart |
| OLD | NEW |