| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** A formal parameter to a [Method]. */ | 5 /** A formal parameter to a [Method]. */ |
| 6 class Parameter { | 6 class Parameter { |
| 7 FormalNode definition; | 7 FormalNode definition; |
| 8 Member method; | 8 Member method; |
| 9 | 9 |
| 10 String name; | 10 String name; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 name = name.substring(5); | 21 name = name.substring(5); |
| 22 isInitializer = true; | 22 isInitializer = true; |
| 23 } | 23 } |
| 24 | 24 |
| 25 type = method.resolveType(definition.type, false); | 25 type = method.resolveType(definition.type, false); |
| 26 | 26 |
| 27 if (definition.value != null) { | 27 if (definition.value != null) { |
| 28 // To match VM, detect cases where value was not actually specified in | 28 // To match VM, detect cases where value was not actually specified in |
| 29 // code and don't signal errors. | 29 // code and don't signal errors. |
| 30 // TODO(jimhug): Clean up after issue #352 is resolved. | 30 // TODO(jimhug): Clean up after issue #352 is resolved. |
| 31 if (definition.value.span.start == definition.span.start) { | 31 if (!hasDefaultValue) return; |
| 32 return; | |
| 33 } | |
| 34 | 32 |
| 35 if (method.name == ':call') { | 33 if (method.name == ':call') { |
| 36 // TODO(jimhug): Need simpler way to detect "true" function types vs. | 34 // TODO(jimhug): Need simpler way to detect "true" function types vs. |
| 37 // regular methods being used as function types for closures. | 35 // regular methods being used as function types for closures. |
| 38 // TODO(sigmund): Disallow non-null default values for native calls? | 36 // TODO(sigmund): Disallow non-null default values for native calls? |
| 39 if (method.definition.body == null && !method.isNative) { | 37 if (method.definition.body == null && !method.isNative) { |
| 40 world.error('default value not allowed on function type', | 38 world.error('default value not allowed on function type', |
| 41 definition.span); | 39 definition.span); |
| 42 } | 40 } |
| 43 } else if (method.isAbstract) { | 41 } else if (method.isAbstract) { |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 } | 1586 } |
| 1589 | 1587 |
| 1590 void forEach(void f(Member member)) { | 1588 void forEach(void f(Member member)) { |
| 1591 factories.forEach((_, Map constructors) { | 1589 factories.forEach((_, Map constructors) { |
| 1592 constructors.forEach((_, Member member) { | 1590 constructors.forEach((_, Member member) { |
| 1593 f(member); | 1591 f(member); |
| 1594 }); | 1592 }); |
| 1595 }); | 1593 }); |
| 1596 } | 1594 } |
| 1597 } | 1595 } |
| OLD | NEW |