| 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 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2604 // Parser is at the opening parenthesis of the formal parameter | 2604 // Parser is at the opening parenthesis of the formal parameter |
| 2605 // declaration of the function or constructor. | 2605 // declaration of the function or constructor. |
| 2606 // Parse the formal parameters and code. | 2606 // Parse the formal parameters and code. |
| 2607 SequenceNode* Parser::ParseFunc(const Function& func, | 2607 SequenceNode* Parser::ParseFunc(const Function& func, |
| 2608 Array& default_parameter_values) { | 2608 Array& default_parameter_values) { |
| 2609 TRACE_PARSER("ParseFunc"); | 2609 TRACE_PARSER("ParseFunc"); |
| 2610 Function& saved_innermost_function = | 2610 Function& saved_innermost_function = |
| 2611 Function::Handle(innermost_function().raw()); | 2611 Function::Handle(innermost_function().raw()); |
| 2612 innermost_function_ = func.raw(); | 2612 innermost_function_ = func.raw(); |
| 2613 | 2613 |
| 2614 // Check to ensure we don't have classes with native fields in libraries | 2614 // TODO(12455) : Need better validation mechanism. |
| 2615 // which do not have a native resolver. This check is delayed until the class | |
| 2616 // is actually used. Invocation of a function in the class is the first point | |
| 2617 // of use. Access of const static fields in the class do not trigger an error. | |
| 2618 if (current_class().num_native_fields() != 0) { | |
| 2619 const Library& lib = Library::Handle(current_class().library()); | |
| 2620 if (lib.native_entry_resolver() == NULL) { | |
| 2621 const String& cls_name = String::Handle(current_class().Name()); | |
| 2622 const String& lib_name = String::Handle(lib.url()); | |
| 2623 ErrorMsg(current_class().token_pos(), | |
| 2624 "class '%s' is trying to extend a native fields class, " | |
| 2625 "but library '%s' has no native resolvers", | |
| 2626 cls_name.ToCString(), lib_name.ToCString()); | |
| 2627 } | |
| 2628 } | |
| 2629 | 2615 |
| 2630 if (func.IsConstructor()) { | 2616 if (func.IsConstructor()) { |
| 2631 SequenceNode* statements = ParseConstructor(func, default_parameter_values); | 2617 SequenceNode* statements = ParseConstructor(func, default_parameter_values); |
| 2632 innermost_function_ = saved_innermost_function.raw(); | 2618 innermost_function_ = saved_innermost_function.raw(); |
| 2633 return statements; | 2619 return statements; |
| 2634 } | 2620 } |
| 2635 | 2621 |
| 2636 ASSERT(!func.IsConstructor()); | 2622 ASSERT(!func.IsConstructor()); |
| 2637 OpenFunctionBlock(func); // Build local scope for function. | 2623 OpenFunctionBlock(func); // Build local scope for function. |
| 2638 | 2624 |
| (...skipping 7702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10341 void Parser::SkipQualIdent() { | 10327 void Parser::SkipQualIdent() { |
| 10342 ASSERT(IsIdentifier()); | 10328 ASSERT(IsIdentifier()); |
| 10343 ConsumeToken(); | 10329 ConsumeToken(); |
| 10344 if (CurrentToken() == Token::kPERIOD) { | 10330 if (CurrentToken() == Token::kPERIOD) { |
| 10345 ConsumeToken(); // Consume the kPERIOD token. | 10331 ConsumeToken(); // Consume the kPERIOD token. |
| 10346 ExpectIdentifier("identifier expected after '.'"); | 10332 ExpectIdentifier("identifier expected after '.'"); |
| 10347 } | 10333 } |
| 10348 } | 10334 } |
| 10349 | 10335 |
| 10350 } // namespace dart | 10336 } // namespace dart |
| OLD | NEW |