| 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 #include "vm/flags.h" | 6 #include "vm/flags.h" | 
| 7 | 7 | 
| 8 #ifndef DART_PRECOMPILED_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME | 
| 9 | 9 | 
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" | 
| (...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2025     // a closure/function type parameter. We check this at the end | 2025     // a closure/function type parameter. We check this at the end | 
| 2026     // of ParseFormalParameter. | 2026     // of ParseFormalParameter. | 
| 2027     parameter.type = &Object::void_type(); | 2027     parameter.type = &Object::void_type(); | 
| 2028   } | 2028   } | 
| 2029   if (parameter.type == NULL) { | 2029   if (parameter.type == NULL) { | 
| 2030     // At this point, we must see an identifier for the type or the | 2030     // At this point, we must see an identifier for the type or the | 
| 2031     // function parameter. | 2031     // function parameter. | 
| 2032     if (!IsIdentifier()) { | 2032     if (!IsIdentifier()) { | 
| 2033       ReportError("parameter name or type expected"); | 2033       ReportError("parameter name or type expected"); | 
| 2034     } | 2034     } | 
| 2035     // We have not seen a parameter type yet, so we check if the next | 2035 | 
| 2036     // identifier could represent a type before parsing it. | 2036     // Lookahead to determine whether the next tokens are a return type | 
| 2037     Token::Kind follower = LookaheadToken(1); | 2037     // followed by a parameter name. | 
| 2038     // We have an identifier followed by a 'follower' token. | 2038     bool found_type = false; | 
| 2039     // We either parse a type or assume that no type is specified. | 2039     { | 
| 2040     if ((follower == Token::kLT) ||  // Parameterized type. | 2040       TokenPosScope saved_pos(this); | 
| 2041         (follower == Token::kPERIOD) ||  // Qualified class name of type. | 2041       if (TryParseReturnType()) { | 
| 2042         Token::IsIdentifier(follower) ||  // Parameter name following a type. | 2042         if (IsIdentifier() || (CurrentToken() == Token::kTHIS)) { | 
| 2043         (follower == Token::kTHIS)) {  // Field parameter following a type. | 2043           found_type = true; | 
|  | 2044         } | 
|  | 2045       } | 
|  | 2046     } | 
|  | 2047     if (found_type) { | 
| 2044       // The types of formal parameters are never ignored, even in unchecked | 2048       // The types of formal parameters are never ignored, even in unchecked | 
| 2045       // mode, because they are part of the function type of closurized | 2049       // mode, because they are part of the function type of closurized | 
| 2046       // functions appearing in type tests with typedefs. | 2050       // functions appearing in type tests with typedefs. | 
| 2047       parameter.has_explicit_type = true; | 2051       parameter.has_explicit_type = true; | 
| 2048       parameter.type = &AbstractType::ZoneHandle(Z, | 2052       parameter.type = &AbstractType::ZoneHandle(Z, | 
| 2049           ParseType(is_top_level_ ? ClassFinalizer::kResolveTypeParameters : | 2053           ParseType(is_top_level_ ? ClassFinalizer::kResolveTypeParameters : | 
| 2050                                     ClassFinalizer::kCanonicalize)); | 2054                                     ClassFinalizer::kCanonicalize)); | 
| 2051     } else { | 2055     } else { | 
| 2052       // If this is an initializing formal, its type will be set to the type of | 2056       // If this is an initializing formal, its type will be set to the type of | 
| 2053       // the respective field when the constructor is fully parsed. | 2057       // the respective field when the constructor is fully parsed. | 
| (...skipping 12899 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 14953     const ArgumentListNode& function_args, | 14957     const ArgumentListNode& function_args, | 
| 14954     const LocalVariable* temp_for_last_arg, | 14958     const LocalVariable* temp_for_last_arg, | 
| 14955     bool is_super_invocation) { | 14959     bool is_super_invocation) { | 
| 14956   UNREACHABLE(); | 14960   UNREACHABLE(); | 
| 14957   return NULL; | 14961   return NULL; | 
| 14958 } | 14962 } | 
| 14959 | 14963 | 
| 14960 }  // namespace dart | 14964 }  // namespace dart | 
| 14961 | 14965 | 
| 14962 #endif  // DART_PRECOMPILED_RUNTIME | 14966 #endif  // DART_PRECOMPILED_RUNTIME | 
| OLD | NEW | 
|---|