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

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

Issue 11049038: Change compile-time errors into dynamic errors in instance creation expression (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "vm/ast_printer.h" 7 #include "vm/ast_printer.h"
8 #include "vm/code_descriptors.h" 8 #include "vm/code_descriptors.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 getter_function = 1987 getter_function =
1988 Resolver::ResolveDynamicAnyArgs(node->cls(), getter_name); 1988 Resolver::ResolveDynamicAnyArgs(node->cls(), getter_name);
1989 ASSERT(!getter_function.IsNull()); 1989 ASSERT(!getter_function.IsNull());
1990 ASSERT(node->receiver() != NULL); 1990 ASSERT(node->receiver() != NULL);
1991 ValueGraphVisitor receiver_value(owner(), temp_index()); 1991 ValueGraphVisitor receiver_value(owner(), temp_index());
1992 node->receiver()->Visit(&receiver_value); 1992 node->receiver()->Visit(&receiver_value);
1993 Append(receiver_value); 1993 Append(receiver_value);
1994 arguments->Add(PushArgument(receiver_value.value())); 1994 arguments->Add(PushArgument(receiver_value.value()));
1995 } else { 1995 } else {
1996 getter_function = node->cls().LookupStaticFunction(getter_name); 1996 getter_function = node->cls().LookupStaticFunction(getter_name);
1997 ASSERT(!getter_function.IsNull()); 1997 if (getter_function.IsNull()) {
1998 // A StaticGetterNode without a function is created by the parser when
1999 // a corresponding setter exists so that the getter can be transformed
2000 // into the setter. In this case, the fake getter was not transformed into
2001 // a setter, so we throw a NoSuchMethodError.
srdjan 2012/10/03 23:28:03 The comment is not very clear.
regis 2012/10/04 00:12:23 I tried to improve it.
2002 // Location argument.
2003 Value* call_pos = Bind(
2004 new ConstantInstr(Smi::ZoneHandle(Smi::New(node->token_pos()))));
2005 arguments->Add(PushArgument(call_pos));
2006 // Function name argument.
2007 const String& method_name = String::ZoneHandle(Symbols::New(getter_name));
2008 Value* method_name_value = Bind(new ConstantInstr(method_name));
2009 arguments->Add(PushArgument(method_name_value));
2010 const String& cls_name = String::Handle(Symbols::NoSuchMethodError());
2011 const String& func_name = String::Handle(Symbols::ThrowNew());
2012 const Class& cls = Class::Handle(
2013 Library::Handle(Library::CoreImplLibrary()).LookupClass(cls_name));
2014 ASSERT(!cls.IsNull());
2015 getter_function = Resolver::ResolveStatic(cls,
2016 func_name,
2017 arguments->length(),
2018 Array::ZoneHandle(),
2019 Resolver::kIsQualified);
2020 ASSERT(!getter_function.IsNull());
2021 }
1998 } 2022 }
1999 StaticCallInstr* call = new StaticCallInstr(node->token_pos(), 2023 StaticCallInstr* call = new StaticCallInstr(node->token_pos(),
2000 getter_function, 2024 getter_function,
2001 Array::ZoneHandle(), // No names. 2025 Array::ZoneHandle(), // No names.
2002 arguments); 2026 arguments);
2003 ReturnDefinition(call); 2027 ReturnDefinition(call);
2004 } 2028 }
2005 2029
2006 2030
2007 void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node, 2031 void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node,
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; 2667 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1;
2644 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 2668 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
2645 OS::SNPrint(chars, len, kFormat, function_name, reason); 2669 OS::SNPrint(chars, len, kFormat, function_name, reason);
2646 const Error& error = Error::Handle( 2670 const Error& error = Error::Handle(
2647 LanguageError::New(String::Handle(String::New(chars)))); 2671 LanguageError::New(String::Handle(String::New(chars))));
2648 Isolate::Current()->long_jump_base()->Jump(1, error); 2672 Isolate::Current()->long_jump_base()->Jump(1, error);
2649 } 2673 }
2650 2674
2651 2675
2652 } // namespace dart 2676 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/parser.h » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698