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

Side by Side Diff: bin/process_script.cc

Issue 8439028: Fix return statement to return the right result. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 // Handle dart scripts. 5 // Handle dart scripts.
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 10
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 Dart_Handle canon_url = Dart_NewString(canon_url_chars); 124 Dart_Handle canon_url = Dart_NewString(canon_url_chars);
125 free(const_cast<char*>(canon_url_chars)); 125 free(const_cast<char*>(canon_url_chars));
126 126
127 return canon_url; 127 return canon_url;
128 } 128 }
129 129
130 // The tag is either an import or a source tag. Read the file based on the 130 // The tag is either an import or a source tag. Read the file based on the
131 // url chars. 131 // url chars.
132 Dart_Handle source = ReadStringFromFile(url_chars); 132 Dart_Handle source = ReadStringFromFile(url_chars);
133 if (!Dart_IsValid(source)) { 133 if (!Dart_IsValid(source)) {
134 return source; 134 return source; // source contains the error string.
135 } 135 }
136 if (tag == kImportTag) { 136 if (tag == kImportTag) {
137 Dart_Handle new_lib = Dart_LoadLibrary(url, source); 137 Dart_Handle new_lib = Dart_LoadLibrary(url, source);
138 if (import_builtin_lib && Dart_IsValid(new_lib)) { 138 if (import_builtin_lib && Dart_IsValid(new_lib)) {
139 Builtin_ImportLibrary(new_lib); 139 Builtin_ImportLibrary(new_lib);
140 } 140 }
141 return result; 141 return new_lib; // Return library object or an error string.
142 } else if (tag == kSourceTag) { 142 } else if (tag == kSourceTag) {
143 return Dart_LoadSource(library, url, source); 143 return Dart_LoadSource(library, url, source);
144 } 144 }
145 return Dart_Error("wrong tag"); 145 return Dart_Error("wrong tag");
146 } 146 }
147 147
148 static Dart_Handle MainLibraryTagHandler(Dart_LibraryTag tag, 148 static Dart_Handle MainLibraryTagHandler(Dart_LibraryTag tag,
149 Dart_Handle library, 149 Dart_Handle library,
150 Dart_Handle url) { 150 Dart_Handle url) {
151 const bool kImportBuiltinLib = true; // Import builtin library. 151 const bool kImportBuiltinLib = true; // Import builtin library.
(...skipping 22 matching lines...) Expand all
174 174
175 Dart_Handle LoadSnapshotCreationScript(const char* script_name) { 175 Dart_Handle LoadSnapshotCreationScript(const char* script_name) {
176 Dart_Handle source = ReadStringFromFile(script_name); 176 Dart_Handle source = ReadStringFromFile(script_name);
177 if (!Dart_IsValid(source)) { 177 if (!Dart_IsValid(source)) {
178 return source; 178 return source;
179 } 179 }
180 Dart_Handle url = Dart_NewString(script_name); 180 Dart_Handle url = Dart_NewString(script_name);
181 181
182 return Dart_LoadScript(url, source, CreateSnapshotLibraryTagHandler); 182 return Dart_LoadScript(url, source, CreateSnapshotLibraryTagHandler);
183 } 183 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698