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

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

Issue 256623005: - Remove unneeded creation of :saved_current_context_var (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | « 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) 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 "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 kResolveGetter, 1903 kResolveGetter,
1904 &is_no_such_method)); 1904 &is_no_such_method));
1905 if (super_function.IsGetterFunction() || 1905 if (super_function.IsGetterFunction() ||
1906 super_function.IsImplicitGetterFunction()) { 1906 super_function.IsImplicitGetterFunction()) {
1907 const Class& super_class = Class::ZoneHandle(current_class().SuperClass()); 1907 const Class& super_class = Class::ZoneHandle(current_class().SuperClass());
1908 AstNode* closure = new StaticGetterNode(supercall_pos, 1908 AstNode* closure = new StaticGetterNode(supercall_pos,
1909 LoadReceiver(supercall_pos), 1909 LoadReceiver(supercall_pos),
1910 /* is_super_getter */ true, 1910 /* is_super_getter */ true,
1911 super_class, 1911 super_class,
1912 function_name); 1912 function_name);
1913 EnsureSavedCurrentContext();
1914 // 'this' is not passed as parameter to the closure. 1913 // 'this' is not passed as parameter to the closure.
1915 ArgumentListNode* closure_arguments = new ArgumentListNode(supercall_pos); 1914 ArgumentListNode* closure_arguments = new ArgumentListNode(supercall_pos);
1916 for (int i = 1; i < arguments->length(); i++) { 1915 for (int i = 1; i < arguments->length(); i++) {
1917 closure_arguments->Add(arguments->NodeAt(i)); 1916 closure_arguments->Add(arguments->NodeAt(i));
1918 } 1917 }
1919 return BuildClosureCall(supercall_pos, closure, closure_arguments); 1918 return BuildClosureCall(supercall_pos, closure, closure_arguments);
1920 } 1919 }
1921 if (is_no_such_method) { 1920 if (is_no_such_method) {
1922 arguments = BuildNoSuchMethodArguments( 1921 arguments = BuildNoSuchMethodArguments(
1923 supercall_pos, function_name, *arguments, NULL, true); 1922 supercall_pos, function_name, *arguments, NULL, true);
(...skipping 4821 matching lines...) Expand 10 before | Expand all | Expand 10 after
6745 return MakeStaticCall(Symbols::AssertionError(), 6744 return MakeStaticCall(Symbols::AssertionError(),
6746 Library::PrivateCoreLibName(Symbols::ThrowNew()), 6745 Library::PrivateCoreLibName(Symbols::ThrowNew()),
6747 arguments); 6746 arguments);
6748 } 6747 }
6749 6748
6750 6749
6751 AstNode* Parser::InsertClosureCallNodes(AstNode* condition) { 6750 AstNode* Parser::InsertClosureCallNodes(AstNode* condition) {
6752 if (condition->IsClosureNode() || 6751 if (condition->IsClosureNode() ||
6753 (condition->IsStoreLocalNode() && 6752 (condition->IsStoreLocalNode() &&
6754 condition->AsStoreLocalNode()->value()->IsClosureNode())) { 6753 condition->AsStoreLocalNode()->value()->IsClosureNode())) {
6755 EnsureSavedCurrentContext();
6756 // Function literal in assert implies a call. 6754 // Function literal in assert implies a call.
6757 const intptr_t pos = condition->token_pos(); 6755 const intptr_t pos = condition->token_pos();
6758 condition = BuildClosureCall(pos, condition, new ArgumentListNode(pos)); 6756 condition = BuildClosureCall(pos, condition, new ArgumentListNode(pos));
6759 } else if (condition->IsConditionalExprNode()) { 6757 } else if (condition->IsConditionalExprNode()) {
6760 ConditionalExprNode* cond_expr = condition->AsConditionalExprNode(); 6758 ConditionalExprNode* cond_expr = condition->AsConditionalExprNode();
6761 cond_expr->set_true_expr(InsertClosureCallNodes(cond_expr->true_expr())); 6759 cond_expr->set_true_expr(InsertClosureCallNodes(cond_expr->true_expr()));
6762 cond_expr->set_false_expr(InsertClosureCallNodes(cond_expr->false_expr())); 6760 cond_expr->set_false_expr(InsertClosureCallNodes(cond_expr->false_expr()));
6763 } 6761 }
6764 return condition; 6762 return condition;
6765 } 6763 }
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after
8261 // No field, check if we have an explicit getter function. 8259 // No field, check if we have an explicit getter function.
8262 const String& getter_name = 8260 const String& getter_name =
8263 String::ZoneHandle(Field::GetterName(func_name)); 8261 String::ZoneHandle(Field::GetterName(func_name));
8264 const int kNumArguments = 0; // no arguments. 8262 const int kNumArguments = 0; // no arguments.
8265 func = Resolver::ResolveStatic(cls, 8263 func = Resolver::ResolveStatic(cls,
8266 getter_name, 8264 getter_name,
8267 kNumArguments, 8265 kNumArguments,
8268 Object::empty_array()); 8266 Object::empty_array());
8269 if (!func.IsNull()) { 8267 if (!func.IsNull()) {
8270 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter); 8268 ASSERT(func.kind() != RawFunction::kImplicitStaticFinalGetter);
8271 EnsureSavedCurrentContext();
8272 closure = new StaticGetterNode(call_pos, 8269 closure = new StaticGetterNode(call_pos,
8273 NULL, 8270 NULL,
8274 false, 8271 false,
8275 Class::ZoneHandle(cls.raw()), 8272 Class::ZoneHandle(cls.raw()),
8276 func_name); 8273 func_name);
8277 return BuildClosureCall(call_pos, closure, arguments); 8274 return BuildClosureCall(call_pos, closure, arguments);
8278 } 8275 }
8279 } else { 8276 } else {
8280 EnsureSavedCurrentContext();
8281 closure = GenerateStaticFieldLookup(field, call_pos); 8277 closure = GenerateStaticFieldLookup(field, call_pos);
8282 return BuildClosureCall(call_pos, closure, arguments); 8278 return BuildClosureCall(call_pos, closure, arguments);
8283 } 8279 }
8284 // Could not resolve static method: throw a NoSuchMethodError. 8280 // Could not resolve static method: throw a NoSuchMethodError.
8285 return ThrowNoSuchMethodError(ident_pos, 8281 return ThrowNoSuchMethodError(ident_pos,
8286 cls, 8282 cls,
8287 func_name, 8283 func_name,
8288 arguments, 8284 arguments,
8289 InvocationMirror::kStatic, 8285 InvocationMirror::kStatic,
8290 InvocationMirror::kMethod, 8286 InvocationMirror::kMethod,
(...skipping 19 matching lines...) Expand all
8310 CheckToken(Token::kLPAREN); 8306 CheckToken(Token::kLPAREN);
8311 ArgumentListNode* arguments = ParseActualParameters(NULL, kAllowConst); 8307 ArgumentListNode* arguments = ParseActualParameters(NULL, kAllowConst);
8312 return new InstanceCallNode(call_pos, receiver, func_name, arguments); 8308 return new InstanceCallNode(call_pos, receiver, func_name, arguments);
8313 } 8309 }
8314 8310
8315 8311
8316 AstNode* Parser::ParseClosureCall(AstNode* closure) { 8312 AstNode* Parser::ParseClosureCall(AstNode* closure) {
8317 TRACE_PARSER("ParseClosureCall"); 8313 TRACE_PARSER("ParseClosureCall");
8318 const intptr_t call_pos = TokenPos(); 8314 const intptr_t call_pos = TokenPos();
8319 ASSERT(CurrentToken() == Token::kLPAREN); 8315 ASSERT(CurrentToken() == Token::kLPAREN);
8320 EnsureSavedCurrentContext();
8321 ArgumentListNode* arguments = ParseActualParameters(NULL, kAllowConst); 8316 ArgumentListNode* arguments = ParseActualParameters(NULL, kAllowConst);
8322 return BuildClosureCall(call_pos, closure, arguments); 8317 return BuildClosureCall(call_pos, closure, arguments);
8323 } 8318 }
8324 8319
8325 8320
8326 AstNode* Parser::GenerateStaticFieldLookup(const Field& field, 8321 AstNode* Parser::GenerateStaticFieldLookup(const Field& field,
8327 intptr_t ident_pos) { 8322 intptr_t ident_pos) {
8328 // If the static field has an initializer, initialize the field at compile 8323 // If the static field has an initializer, initialize the field at compile
8329 // time, which is only possible if the field is const. 8324 // time, which is only possible if the field is const.
8330 AstNode* initializing_getter = RunStaticFieldInitializer(field, ident_pos); 8325 AstNode* initializing_getter = RunStaticFieldInitializer(field, ident_pos);
(...skipping 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after
10952 void Parser::SkipQualIdent() { 10947 void Parser::SkipQualIdent() {
10953 ASSERT(IsIdentifier()); 10948 ASSERT(IsIdentifier());
10954 ConsumeToken(); 10949 ConsumeToken();
10955 if (CurrentToken() == Token::kPERIOD) { 10950 if (CurrentToken() == Token::kPERIOD) {
10956 ConsumeToken(); // Consume the kPERIOD token. 10951 ConsumeToken(); // Consume the kPERIOD token.
10957 ExpectIdentifier("identifier expected after '.'"); 10952 ExpectIdentifier("identifier expected after '.'");
10958 } 10953 }
10959 } 10954 }
10960 10955
10961 } // namespace dart 10956 } // namespace dart
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