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

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

Issue 12315087: Hook up simulator (if needed) when calling Dart code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/resolver_test.cc » ('j') | 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) 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 "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 8167 matching lines...) Expand 10 before | Expand all | Expand 10 after
8178 const int kNumArguments = 0; // no arguments. 8178 const int kNumArguments = 0; // no arguments.
8179 const Function& func = 8179 const Function& func =
8180 Function::Handle(Resolver::ResolveStatic(cls, 8180 Function::Handle(Resolver::ResolveStatic(cls,
8181 getter_name, 8181 getter_name,
8182 kNumArguments, 8182 kNumArguments,
8183 Object::empty_array(), 8183 Object::empty_array(),
8184 Resolver::kIsQualified)); 8184 Resolver::kIsQualified));
8185 ASSERT(!func.IsNull()); 8185 ASSERT(!func.IsNull());
8186 ASSERT(func.kind() == RawFunction::kConstImplicitGetter); 8186 ASSERT(func.kind() == RawFunction::kConstImplicitGetter);
8187 Object& const_value = Object::Handle( 8187 Object& const_value = Object::Handle(
8188 DartEntry::InvokeStatic(func, Object::empty_array())); 8188 DartEntry::InvokeFunction(func, Object::empty_array()));
8189 if (const_value.IsError()) { 8189 if (const_value.IsError()) {
8190 const Error& error = Error::Cast(const_value); 8190 const Error& error = Error::Cast(const_value);
8191 if (error.IsUnhandledException()) { 8191 if (error.IsUnhandledException()) {
8192 field.set_value(Instance::Handle()); 8192 field.set_value(Instance::Handle());
8193 // It is a compile-time error if evaluation of a compile-time constant 8193 // It is a compile-time error if evaluation of a compile-time constant
8194 // would raise an exception. 8194 // would raise an exception.
8195 AppendErrorMsg(error, TokenPos(), 8195 AppendErrorMsg(error, TokenPos(),
8196 "error initializing const field '%s'", 8196 "error initializing const field '%s'",
8197 String::Handle(field.name()).ToCString()); 8197 String::Handle(field.name()).ToCString());
8198 } else { 8198 } else {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
8241 for (int i = 0; i < arguments->length(); i++) { 8241 for (int i = 0; i < arguments->length(); i++) {
8242 AstNode* arg = arguments->NodeAt(i); 8242 AstNode* arg = arguments->NodeAt(i);
8243 // Arguments have been evaluated to a literal value already. 8243 // Arguments have been evaluated to a literal value already.
8244 ASSERT(arg->IsLiteralNode()); 8244 ASSERT(arg->IsLiteralNode());
8245 arg_values.SetAt((i + kNumExtraArgs), arg->AsLiteralNode()->literal()); 8245 arg_values.SetAt((i + kNumExtraArgs), arg->AsLiteralNode()->literal());
8246 } 8246 }
8247 const Array& arg_descriptor = 8247 const Array& arg_descriptor =
8248 Array::Handle(ArgumentsDescriptor::New(num_arguments, 8248 Array::Handle(ArgumentsDescriptor::New(num_arguments,
8249 arguments->names())); 8249 arguments->names()));
8250 const Object& result = 8250 const Object& result =
8251 Object::Handle(DartEntry::InvokeStatic(constructor, 8251 Object::Handle(DartEntry::InvokeFunction(constructor,
8252 arg_values, 8252 arg_values,
8253 arg_descriptor)); 8253 arg_descriptor));
8254 if (result.IsError()) { 8254 if (result.IsError()) {
8255 if (result.IsUnhandledException()) { 8255 if (result.IsUnhandledException()) {
8256 return result.raw(); 8256 return result.raw();
8257 } else { 8257 } else {
8258 Isolate::Current()->long_jump_base()->Jump(1, Error::Cast(result)); 8258 Isolate::Current()->long_jump_base()->Jump(1, Error::Cast(result));
8259 UNREACHABLE(); 8259 UNREACHABLE();
8260 return Object::null(); 8260 return Object::null();
8261 } 8261 }
8262 } else { 8262 } else {
8263 if (!instance.IsNull()) { 8263 if (!instance.IsNull()) {
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
9452 ASSERT(values[i]->IsLiteralNode()); 9452 ASSERT(values[i]->IsLiteralNode());
9453 value_arr.SetAt(i, values[i]->AsLiteralNode()->literal()); 9453 value_arr.SetAt(i, values[i]->AsLiteralNode()->literal());
9454 } 9454 }
9455 9455
9456 // Build argument array to pass to the interpolation function. 9456 // Build argument array to pass to the interpolation function.
9457 const Array& interpolate_arg = Array::Handle(Array::New(1)); 9457 const Array& interpolate_arg = Array::Handle(Array::New(1));
9458 interpolate_arg.SetAt(0, value_arr); 9458 interpolate_arg.SetAt(0, value_arr);
9459 9459
9460 // Call interpolation function. 9460 // Call interpolation function.
9461 String& concatenated = String::ZoneHandle(); 9461 String& concatenated = String::ZoneHandle();
9462 concatenated ^= DartEntry::InvokeStatic(func, interpolate_arg); 9462 concatenated ^= DartEntry::InvokeFunction(func, interpolate_arg);
9463 if (concatenated.IsUnhandledException()) { 9463 if (concatenated.IsUnhandledException()) {
9464 ErrorMsg("Exception thrown in Parser::Interpolate"); 9464 ErrorMsg("Exception thrown in Parser::Interpolate");
9465 } 9465 }
9466 concatenated = Symbols::New(concatenated); 9466 concatenated = Symbols::New(concatenated);
9467 return concatenated; 9467 return concatenated;
9468 } 9468 }
9469 9469
9470 9470
9471 // A string literal consists of the concatenation of the next n tokens 9471 // A string literal consists of the concatenation of the next n tokens
9472 // that satisfy the EBNF grammar: 9472 // that satisfy the EBNF grammar:
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
10042 void Parser::SkipQualIdent() { 10042 void Parser::SkipQualIdent() {
10043 ASSERT(IsIdentifier()); 10043 ASSERT(IsIdentifier());
10044 ConsumeToken(); 10044 ConsumeToken();
10045 if (CurrentToken() == Token::kPERIOD) { 10045 if (CurrentToken() == Token::kPERIOD) {
10046 ConsumeToken(); // Consume the kPERIOD token. 10046 ConsumeToken(); // Consume the kPERIOD token.
10047 ExpectIdentifier("identifier expected after '.'"); 10047 ExpectIdentifier("identifier expected after '.'");
10048 } 10048 }
10049 } 10049 }
10050 10050
10051 } // namespace dart 10051 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/resolver_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698