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

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

Issue 14097006: A patch class must be given the same name as the class it is patching, otherwise (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | runtime/vm/symbols.h » ('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 3222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3233 } else { 3233 } else {
3234 if (!obj.IsClass()) { 3234 if (!obj.IsClass()) {
3235 ErrorMsg(classname_pos, "'%s' is already defined", 3235 ErrorMsg(classname_pos, "'%s' is already defined",
3236 class_name.ToCString()); 3236 class_name.ToCString());
3237 } 3237 }
3238 cls ^= obj.raw(); 3238 cls ^= obj.raw();
3239 if (is_patch) { 3239 if (is_patch) {
3240 // Preserve and reuse the original type parameters and bounds since the 3240 // Preserve and reuse the original type parameters and bounds since the
3241 // ones defined in the patch class will not be finalized. 3241 // ones defined in the patch class will not be finalized.
3242 orig_type_parameters = cls.type_parameters(); 3242 orig_type_parameters = cls.type_parameters();
3243 String& patch = String::Handle( 3243 // A patch class must be given the same name as the class it is patching,
3244 String::Concat(Symbols::PatchSpace(), class_name)); 3244 // otherwise the generic signature classes it defines will not match the
3245 patch = Symbols::New(patch); 3245 // patched generic signature classes. Therefore, new signature classes
3246 cls = Class::New(patch, script_, classname_pos); 3246 // will be introduced and the original ones will not get finalized.
3247 cls = Class::New(class_name, script_, classname_pos);
3247 cls.set_library(library_); 3248 cls.set_library(library_);
3248 } else { 3249 } else {
3249 // Not patching a class, but it has been found. This must be one of the 3250 // Not patching a class, but it has been found. This must be one of the
3250 // pre-registered classes from object.cc or a duplicate definition. 3251 // pre-registered classes from object.cc or a duplicate definition.
3251 if (cls.functions() != Object::empty_array().raw()) { 3252 if (cls.functions() != Object::empty_array().raw()) {
3252 ErrorMsg(classname_pos, "class '%s' is already defined", 3253 ErrorMsg(classname_pos, "class '%s' is already defined",
3253 class_name.ToCString()); 3254 class_name.ToCString());
3254 } 3255 }
3255 // Pre-registered classes need their scripts connected at this time. 3256 // Pre-registered classes need their scripts connected at this time.
3256 cls.set_script(script_); 3257 cls.set_script(script_);
(...skipping 6660 matching lines...) Expand 10 before | Expand all | Expand 10 after
9917 void Parser::SkipQualIdent() { 9918 void Parser::SkipQualIdent() {
9918 ASSERT(IsIdentifier()); 9919 ASSERT(IsIdentifier());
9919 ConsumeToken(); 9920 ConsumeToken();
9920 if (CurrentToken() == Token::kPERIOD) { 9921 if (CurrentToken() == Token::kPERIOD) {
9921 ConsumeToken(); // Consume the kPERIOD token. 9922 ConsumeToken(); // Consume the kPERIOD token.
9922 ExpectIdentifier("identifier expected after '.'"); 9923 ExpectIdentifier("identifier expected after '.'");
9923 } 9924 }
9924 } 9925 }
9925 9926
9926 } // namespace dart 9927 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698