| 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/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 4159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4170 if (found && !is_patch) { | 4170 if (found && !is_patch) { |
| 4171 ErrorMsg(name_pos, "%s for '%s' is already defined", | 4171 ErrorMsg(name_pos, "%s for '%s' is already defined", |
| 4172 is_getter ? "getter" : "setter", | 4172 is_getter ? "getter" : "setter", |
| 4173 field_name->ToCString()); | 4173 field_name->ToCString()); |
| 4174 } else if (!found && is_patch) { | 4174 } else if (!found && is_patch) { |
| 4175 ErrorMsg(name_pos, "missing %s for '%s' cannot be patched", | 4175 ErrorMsg(name_pos, "missing %s for '%s' cannot be patched", |
| 4176 is_getter ? "getter" : "setter", | 4176 is_getter ? "getter" : "setter", |
| 4177 field_name->ToCString()); | 4177 field_name->ToCString()); |
| 4178 } | 4178 } |
| 4179 | 4179 |
| 4180 intptr_t accessor_end_pos = accessor_pos; |
| 4180 if (is_external) { | 4181 if (is_external) { |
| 4181 ExpectSemicolon(); | 4182 ExpectSemicolon(); |
| 4182 } else if (CurrentToken() == Token::kLBRACE) { | 4183 } else if (CurrentToken() == Token::kLBRACE) { |
| 4183 SkipBlock(); | 4184 SkipBlock(); |
| 4185 accessor_end_pos = TokenPos() - 1; |
| 4184 } else if (CurrentToken() == Token::kARROW) { | 4186 } else if (CurrentToken() == Token::kARROW) { |
| 4185 ConsumeToken(); | 4187 ConsumeToken(); |
| 4186 SkipExpr(); | 4188 SkipExpr(); |
| 4187 ExpectSemicolon(); | 4189 ExpectSemicolon(); |
| 4190 accessor_end_pos = TokenPos() - 1; |
| 4188 } else if (IsLiteral("native")) { | 4191 } else if (IsLiteral("native")) { |
| 4189 ParseNativeDeclaration(); | 4192 ParseNativeDeclaration(); |
| 4190 } else { | 4193 } else { |
| 4191 ErrorMsg("function block expected"); | 4194 ErrorMsg("function block expected"); |
| 4192 } | 4195 } |
| 4193 Function& func = Function::Handle( | 4196 Function& func = Function::Handle( |
| 4194 Function::New(accessor_name, | 4197 Function::New(accessor_name, |
| 4195 is_getter? RawFunction::kGetterFunction : | 4198 is_getter? RawFunction::kGetterFunction : |
| 4196 RawFunction::kSetterFunction, | 4199 RawFunction::kSetterFunction, |
| 4197 is_static, | 4200 is_static, |
| 4198 /* is_const = */ false, | 4201 /* is_const = */ false, |
| 4199 /* is_abstract = */ false, | 4202 /* is_abstract = */ false, |
| 4200 is_external, | 4203 is_external, |
| 4201 current_class(), | 4204 current_class(), |
| 4202 accessor_pos)); | 4205 accessor_pos)); |
| 4203 func.set_result_type(result_type); | 4206 func.set_result_type(result_type); |
| 4207 func.set_end_token_pos(accessor_end_pos); |
| 4204 AddFormalParamsToFunction(¶ms, func); | 4208 AddFormalParamsToFunction(¶ms, func); |
| 4205 top_level->functions.Add(func); | 4209 top_level->functions.Add(func); |
| 4206 if (!is_patch) { | 4210 if (!is_patch) { |
| 4207 library_.AddObject(func, accessor_name); | 4211 library_.AddObject(func, accessor_name); |
| 4208 } else { | 4212 } else { |
| 4209 library_.ReplaceObject(func, accessor_name); | 4213 library_.ReplaceObject(func, accessor_name); |
| 4210 } | 4214 } |
| 4211 } | 4215 } |
| 4212 | 4216 |
| 4213 | 4217 |
| (...skipping 5725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9939 void Parser::SkipQualIdent() { | 9943 void Parser::SkipQualIdent() { |
| 9940 ASSERT(IsIdentifier()); | 9944 ASSERT(IsIdentifier()); |
| 9941 ConsumeToken(); | 9945 ConsumeToken(); |
| 9942 if (CurrentToken() == Token::kPERIOD) { | 9946 if (CurrentToken() == Token::kPERIOD) { |
| 9943 ConsumeToken(); // Consume the kPERIOD token. | 9947 ConsumeToken(); // Consume the kPERIOD token. |
| 9944 ExpectIdentifier("identifier expected after '.'"); | 9948 ExpectIdentifier("identifier expected after '.'"); |
| 9945 } | 9949 } |
| 9946 } | 9950 } |
| 9947 | 9951 |
| 9948 } // namespace dart | 9952 } // namespace dart |
| OLD | NEW |