Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/bootstrap.h" | 9 #include "vm/bootstrap.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2598 | 2598 |
| 2599 | 2599 |
| 2600 // Parser is at the opening parenthesis of the formal parameter | 2600 // Parser is at the opening parenthesis of the formal parameter |
| 2601 // declaration of the function or constructor. | 2601 // declaration of the function or constructor. |
| 2602 // Parse the formal parameters and code. | 2602 // Parse the formal parameters and code. |
| 2603 SequenceNode* Parser::ParseFunc(const Function& func, | 2603 SequenceNode* Parser::ParseFunc(const Function& func, |
| 2604 Array& default_parameter_values) { | 2604 Array& default_parameter_values) { |
| 2605 TRACE_PARSER("ParseFunc"); | 2605 TRACE_PARSER("ParseFunc"); |
| 2606 Function& saved_innermost_function = | 2606 Function& saved_innermost_function = |
| 2607 Function::Handle(innermost_function().raw()); | 2607 Function::Handle(innermost_function().raw()); |
| 2608 innermost_function_ = func.raw(); | 2608 innermost_function_ = func.raw(); |
|
siva
2013/08/13 00:43:05
I think we need some framework for validation. Iva
| |
| 2609 | 2609 |
| 2610 // Check to ensure we don't have classes with native fields in libraries | |
| 2611 // which do not have a native resolver. This check is delayed until the class | |
| 2612 // is actually used. Invocation of a function in the class is the first point | |
| 2613 // of use. Access of const static fields in the class do not trigger an error. | |
| 2614 if (current_class().num_native_fields() != 0) { | |
| 2615 const Library& lib = Library::Handle(current_class().library()); | |
| 2616 if (lib.native_entry_resolver() == NULL) { | |
| 2617 const String& cls_name = String::Handle(current_class().Name()); | |
| 2618 const String& lib_name = String::Handle(lib.url()); | |
| 2619 ErrorMsg(current_class().token_pos(), | |
| 2620 "class '%s' is trying to extend a native fields class, " | |
| 2621 "but library '%s' has no native resolvers", | |
| 2622 cls_name.ToCString(), lib_name.ToCString()); | |
| 2623 } | |
| 2624 } | |
| 2625 | |
| 2626 if (func.IsConstructor()) { | 2610 if (func.IsConstructor()) { |
| 2627 SequenceNode* statements = ParseConstructor(func, default_parameter_values); | 2611 SequenceNode* statements = ParseConstructor(func, default_parameter_values); |
| 2628 innermost_function_ = saved_innermost_function.raw(); | 2612 innermost_function_ = saved_innermost_function.raw(); |
| 2629 return statements; | 2613 return statements; |
| 2630 } | 2614 } |
| 2631 | 2615 |
| 2632 ASSERT(!func.IsConstructor()); | 2616 ASSERT(!func.IsConstructor()); |
| 2633 OpenFunctionBlock(func); // Build local scope for function. | 2617 OpenFunctionBlock(func); // Build local scope for function. |
| 2634 | 2618 |
| 2635 ParamList params; | 2619 ParamList params; |
| (...skipping 7652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10288 void Parser::SkipQualIdent() { | 10272 void Parser::SkipQualIdent() { |
| 10289 ASSERT(IsIdentifier()); | 10273 ASSERT(IsIdentifier()); |
| 10290 ConsumeToken(); | 10274 ConsumeToken(); |
| 10291 if (CurrentToken() == Token::kPERIOD) { | 10275 if (CurrentToken() == Token::kPERIOD) { |
| 10292 ConsumeToken(); // Consume the kPERIOD token. | 10276 ConsumeToken(); // Consume the kPERIOD token. |
| 10293 ExpectIdentifier("identifier expected after '.'"); | 10277 ExpectIdentifier("identifier expected after '.'"); |
| 10294 } | 10278 } |
| 10295 } | 10279 } |
| 10296 | 10280 |
| 10297 } // namespace dart | 10281 } // namespace dart |
| OLD | NEW |