| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 // Parser is at the opening parenthesis of the formal parameter | 2062 // Parser is at the opening parenthesis of the formal parameter |
| 2063 // declaration of the function or constructor. | 2063 // declaration of the function or constructor. |
| 2064 // Parse the formal parameters and code. | 2064 // Parse the formal parameters and code. |
| 2065 SequenceNode* Parser::ParseFunc(const Function& func, | 2065 SequenceNode* Parser::ParseFunc(const Function& func, |
| 2066 Array& default_parameter_values) { | 2066 Array& default_parameter_values) { |
| 2067 TRACE_PARSER("ParseFunc"); | 2067 TRACE_PARSER("ParseFunc"); |
| 2068 Function& saved_innermost_function = | 2068 Function& saved_innermost_function = |
| 2069 Function::Handle(innermost_function().raw()); | 2069 Function::Handle(innermost_function().raw()); |
| 2070 innermost_function_ = func.raw(); | 2070 innermost_function_ = func.raw(); |
| 2071 | 2071 |
| 2072 // Check to ensure we don't have classes with native fields in libraries |
| 2073 // which do not have a native resolver. This check is delayed until the class |
| 2074 // is actually used. Invocation of a function in the class is the first point |
| 2075 // of use. Access of const static fields in the class do not trigger an error. |
| 2076 if (current_class().num_native_fields() != 0) { |
| 2077 const Library& lib = Library::Handle(current_class().library()); |
| 2078 if (lib.native_entry_resolver() == NULL) { |
| 2079 const String& cls_name = String::Handle(current_class().Name()); |
| 2080 const String& lib_name = String::Handle(lib.url()); |
| 2081 ErrorMsg(current_class().token_pos(), |
| 2082 "class '%s' is trying to extend a native fields class, " |
| 2083 "but library '%s' has no native resolvers", |
| 2084 cls_name.ToCString(), lib_name.ToCString()); |
| 2085 } |
| 2086 } |
| 2087 |
| 2072 if (func.IsConstructor()) { | 2088 if (func.IsConstructor()) { |
| 2073 SequenceNode* statements = ParseConstructor(func, default_parameter_values); | 2089 SequenceNode* statements = ParseConstructor(func, default_parameter_values); |
| 2074 innermost_function_ = saved_innermost_function.raw(); | 2090 innermost_function_ = saved_innermost_function.raw(); |
| 2075 return statements; | 2091 return statements; |
| 2076 } | 2092 } |
| 2077 | 2093 |
| 2078 ASSERT(!func.IsConstructor()); | 2094 ASSERT(!func.IsConstructor()); |
| 2079 OpenFunctionBlock(func); // Build local scope for function. | 2095 OpenFunctionBlock(func); // Build local scope for function. |
| 2080 | 2096 |
| 2081 ParamList params; | 2097 ParamList params; |
| (...skipping 7128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9210 void Parser::SkipQualIdent() { | 9226 void Parser::SkipQualIdent() { |
| 9211 ASSERT(IsIdentifier()); | 9227 ASSERT(IsIdentifier()); |
| 9212 ConsumeToken(); | 9228 ConsumeToken(); |
| 9213 if (CurrentToken() == Token::kPERIOD) { | 9229 if (CurrentToken() == Token::kPERIOD) { |
| 9214 ConsumeToken(); // Consume the kPERIOD token. | 9230 ConsumeToken(); // Consume the kPERIOD token. |
| 9215 ExpectIdentifier("identifier expected after '.'"); | 9231 ExpectIdentifier("identifier expected after '.'"); |
| 9216 } | 9232 } |
| 9217 } | 9233 } |
| 9218 | 9234 |
| 9219 } // namespace dart | 9235 } // namespace dart |
| OLD | NEW |