OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 v8::HandleScope handle_scope; | 134 v8::HandleScope handle_scope; |
135 v8::String::Utf8Value file(args[i]); | 135 v8::String::Utf8Value file(args[i]); |
136 if (*file == NULL) { | 136 if (*file == NULL) { |
137 return v8::ThrowException(v8::String::New("Error loading file")); | 137 return v8::ThrowException(v8::String::New("Error loading file")); |
138 } | 138 } |
139 v8::Handle<v8::String> source = ReadFile(*file); | 139 v8::Handle<v8::String> source = ReadFile(*file); |
140 if (source.IsEmpty()) { | 140 if (source.IsEmpty()) { |
141 return v8::ThrowException(v8::String::New("Error loading file")); | 141 return v8::ThrowException(v8::String::New("Error loading file")); |
142 } | 142 } |
143 if (!ExecuteString(source, v8::String::New(*file), false, false)) { | 143 if (!ExecuteString(source, v8::String::New(*file), false, false)) { |
144 return v8::ThrowException(v8::String::New("Error executing file")); | 144 return v8::ThrowException(v8::String::New("Error executing file")); |
145 } | 145 } |
146 } | 146 } |
147 return v8::Undefined(); | 147 return v8::Undefined(); |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 // The callback that is invoked by v8 whenever the JavaScript 'quit' | 151 // The callback that is invoked by v8 whenever the JavaScript 'quit' |
152 // function is called. Quits. | 152 // function is called. Quits. |
153 v8::Handle<v8::Value> Quit(const v8::Arguments& args) { | 153 v8::Handle<v8::Value> Quit(const v8::Arguments& args) { |
154 // If not arguments are given args[0] will yield undefined which | 154 // If not arguments are given args[0] will yield undefined which |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 for (int i = 0; i < start; i++) { | 263 for (int i = 0; i < start; i++) { |
264 printf(" "); | 264 printf(" "); |
265 } | 265 } |
266 int end = message->GetEndColumn(); | 266 int end = message->GetEndColumn(); |
267 for (int i = start; i < end; i++) { | 267 for (int i = start; i < end; i++) { |
268 printf("^"); | 268 printf("^"); |
269 } | 269 } |
270 printf("\n"); | 270 printf("\n"); |
271 } | 271 } |
272 } | 272 } |
OLD | NEW |