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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 " final f2; \n" | 107 " final f2; \n" |
108 " final int f3, f4; \n" | 108 " final int f3, f4; \n" |
109 " static String s1, s2; \n" | 109 " static String s1, s2; \n" |
110 " static final int s3 = 8675309; \n" | 110 " static final int s3 = 8675309; \n" |
111 " static bar(i, [var d = 5]) { return 77; } \n" | 111 " static bar(i, [var d = 5]) { return 77; } \n" |
112 " static foo() native \"native_function_name\"; \n" | 112 " static foo() native \"native_function_name\"; \n" |
113 "} \n"; | 113 "} \n"; |
114 | 114 |
115 String& url = String::Handle(String::New("dart-test:Parser_TopLevel")); | 115 String& url = String::Handle(String::New("dart-test:Parser_TopLevel")); |
116 String& source = String::Handle(String::New(script_chars)); | 116 String& source = String::Handle(String::New(script_chars)); |
117 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); | 117 Script& script = Script::Handle(Script::New(url, |
| 118 source, |
| 119 RawScript::kSourceTag)); |
118 Library& lib = Library::ZoneHandle(Library::CoreLibrary()); | 120 Library& lib = Library::ZoneHandle(Library::CoreLibrary()); |
119 | 121 |
120 script.Tokenize(String::Handle(String::New(""))); | 122 script.Tokenize(String::Handle(String::New(""))); |
121 | 123 |
122 Parser::ParseCompilationUnit(lib, script); | 124 Parser::ParseCompilationUnit(lib, script); |
123 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 125 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
124 CheckField(lib, "A", "f1", false, false); | 126 CheckField(lib, "A", "f1", false, false); |
125 CheckField(lib, "A", "f2", false, true); | 127 CheckField(lib, "A", "f2", false, true); |
126 CheckField(lib, "A", "f3", false, true); | 128 CheckField(lib, "A", "f3", false, true); |
127 CheckField(lib, "A", "f4", false, true); | 129 CheckField(lib, "A", "f4", false, true); |
(...skipping 23 matching lines...) Expand all Loading... |
151 " static foo() { return 42; } \n" | 153 " static foo() { return 42; } \n" |
152 " static baz(var i) { var q = 5; return i + q; } \n" | 154 " static baz(var i) { var q = 5; return i + q; } \n" |
153 "} \n" | 155 "} \n" |
154 " \n" | 156 " \n" |
155 "class B { \n" | 157 "class B { \n" |
156 " static bam(k) { return A.foo(); } \n" | 158 " static bam(k) { return A.foo(); } \n" |
157 "} \n"; | 159 "} \n"; |
158 | 160 |
159 String& url = String::Handle(String::New("dart-test:Parser_TopLevel")); | 161 String& url = String::Handle(String::New("dart-test:Parser_TopLevel")); |
160 String& source = String::Handle(String::New(script_chars)); | 162 String& source = String::Handle(String::New(script_chars)); |
161 Script& script = Script::Handle(Script::New(url, source, RawScript::kSource)); | 163 Script& script = Script::Handle(Script::New(url, |
| 164 source, |
| 165 RawScript::kSourceTag)); |
162 Library& lib = Library::ZoneHandle(Library::CoreLibrary()); | 166 Library& lib = Library::ZoneHandle(Library::CoreLibrary()); |
163 | 167 |
164 script.Tokenize(String::Handle(String::New(""))); | 168 script.Tokenize(String::Handle(String::New(""))); |
165 | 169 |
166 Parser::ParseCompilationUnit(lib, script); | 170 Parser::ParseCompilationUnit(lib, script); |
167 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 171 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
168 | 172 |
169 DumpFunction(lib, "A", "foo"); | 173 DumpFunction(lib, "A", "foo"); |
170 DumpFunction(lib, "A", "bar"); | 174 DumpFunction(lib, "A", "bar"); |
171 DumpFunction(lib, "A", "baz"); | 175 DumpFunction(lib, "A", "baz"); |
172 DumpFunction(lib, "B", "bam"); | 176 DumpFunction(lib, "B", "bam"); |
173 } | 177 } |
174 | 178 |
175 } // namespace dart | 179 } // namespace dart |
OLD | NEW |