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

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

Issue 177633008: Better error message for assignment to final local variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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/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 7854 matching lines...) Expand 10 before | Expand all | Expand 10 after
7865 target_cls = 7865 target_cls =
7866 &Class::Handle(original->AsLoadStaticFieldNode()->field().owner()); 7866 &Class::Handle(original->AsLoadStaticFieldNode()->field().owner());
7867 } else if ((left_ident != NULL) && 7867 } else if ((left_ident != NULL) &&
7868 (original->IsLiteralNode() || 7868 (original->IsLiteralNode() ||
7869 original->IsLoadLocalNode())) { 7869 original->IsLoadLocalNode())) {
7870 name = left_ident->raw(); 7870 name = left_ident->raw();
7871 } 7871 }
7872 if (name.IsNull()) { 7872 if (name.IsNull()) {
7873 ErrorMsg(left_pos, "expression is not assignable"); 7873 ErrorMsg(left_pos, "expression is not assignable");
7874 } 7874 }
7875 result = ThrowNoSuchMethodError(original->token_pos(), 7875 result = ThrowNoSuchMethodError(
7876 *target_cls, 7876 original->token_pos(),
Ivan Posva 2014/02/25 07:10:07 Bad indentation.
hausner 2014/02/25 18:47:05 Moved parameters to the left. I find it unreadable
7877 name, 7877 *target_cls,
7878 NULL, // No arguments. 7878 name,
7879 InvocationMirror::kStatic, 7879 NULL, // No arguments.
7880 InvocationMirror::kSetter, 7880 InvocationMirror::kStatic,
7881 NULL); // No existing function. 7881 original->IsLoadLocalNode() ?
7882 InvocationMirror::kLocalVar : InvocationMirror::kSetter,
7883 NULL); // No existing function.
7882 } else if (result->IsStoreIndexedNode() || 7884 } else if (result->IsStoreIndexedNode() ||
7883 result->IsInstanceSetterNode() || 7885 result->IsInstanceSetterNode() ||
7884 result->IsStaticSetterNode() || 7886 result->IsStaticSetterNode() ||
7885 result->IsStoreStaticFieldNode() || 7887 result->IsStoreStaticFieldNode() ||
7886 result->IsStoreLocalNode()) { 7888 result->IsStoreLocalNode()) {
7887 // Ensure that the expression temp is allocated for nodes that may need it. 7889 // Ensure that the expression temp is allocated for nodes that may need it.
7888 EnsureExpressionTemp(); 7890 EnsureExpressionTemp();
7889 } 7891 }
7890 return result; 7892 return result;
7891 } 7893 }
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after
10776 void Parser::SkipQualIdent() { 10778 void Parser::SkipQualIdent() {
10777 ASSERT(IsIdentifier()); 10779 ASSERT(IsIdentifier());
10778 ConsumeToken(); 10780 ConsumeToken();
10779 if (CurrentToken() == Token::kPERIOD) { 10781 if (CurrentToken() == Token::kPERIOD) {
10780 ConsumeToken(); // Consume the kPERIOD token. 10782 ConsumeToken(); // Consume the kPERIOD token.
10781 ExpectIdentifier("identifier expected after '.'"); 10783 ExpectIdentifier("identifier expected after '.'");
10782 } 10784 }
10783 } 10785 }
10784 10786
10785 } // namespace dart 10787 } // namespace dart
OLDNEW
« runtime/lib/errors_patch.dart ('K') | « runtime/lib/invocation_mirror_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698