| 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 | 8 |
| 9 String name; | 9 String name; |
| 10 Type type; | 10 Type type; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 world.error('${mod} modifier not allowed on field', mod.span); | 288 world.error('${mod} modifier not allowed on field', mod.span); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 type = inType.resolveType(definition.type, false); | 292 type = inType.resolveType(definition.type, false); |
| 293 if (isStatic && type.hasTypeParams) { | 293 if (isStatic && type.hasTypeParams) { |
| 294 world.error('using type parameter in static context', | 294 world.error('using type parameter in static context', |
| 295 definition.type.span); | 295 definition.type.span); |
| 296 } | 296 } |
| 297 | 297 |
| 298 if (isStatic && isFinal && value == null) { |
| 299 world.error('static final field is missing initializer', span); |
| 300 } |
| 301 |
| 298 library._addMember(this); | 302 library._addMember(this); |
| 299 } | 303 } |
| 300 | 304 |
| 301 | 305 |
| 302 bool _computing = false; | 306 bool _computing = false; |
| 303 /** Generates the initial value for this field, if any. Marks it as used. */ | 307 /** Generates the initial value for this field, if any. Marks it as used. */ |
| 304 Value computeValue() { | 308 Value computeValue() { |
| 305 if (value == null) return null; | 309 if (value == null) return null; |
| 306 | 310 |
| 307 if (_computedValue == null) { | 311 if (_computedValue == null) { |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 name = member.name, members = [member], jsname = member.jsname; | 1239 name = member.name, members = [member], jsname = member.jsname; |
| 1236 | 1240 |
| 1237 toString() => '$name:${members.length}'; | 1241 toString() => '$name:${members.length}'; |
| 1238 | 1242 |
| 1239 // TODO(jimhug): Still working towards the right logic for conflicts... | 1243 // TODO(jimhug): Still working towards the right logic for conflicts... |
| 1240 bool get containsProperties() => members.some((m) => m is PropertyMember); | 1244 bool get containsProperties() => members.some((m) => m is PropertyMember); |
| 1241 bool get containsMethods() => members.some((m) => m is MethodMember); | 1245 bool get containsMethods() => members.some((m) => m is MethodMember); |
| 1242 | 1246 |
| 1243 void add(Member member) => members.add(member); | 1247 void add(Member member) => members.add(member); |
| 1244 | 1248 |
| 1249 // TODO(jimhug): Always false, or is this needed? |
| 1250 bool get isStatic() => members.length == 1 && members[0].isStatic; |
| 1251 |
| 1245 bool canInvoke(MethodGenerator context, Arguments args) => | 1252 bool canInvoke(MethodGenerator context, Arguments args) => |
| 1246 members.some((m) => m.canInvoke(context, args)); | 1253 members.some((m) => m.canInvoke(context, args)); |
| 1247 | 1254 |
| 1248 Value _makeError(Node node, Value target, String action) { | 1255 Value _makeError(Node node, Value target, String action) { |
| 1249 if (!target.type.isVar) { | 1256 if (!target.type.isVar) { |
| 1250 world.warning('could not find applicable $action for "$name"', node.span); | 1257 world.warning('could not find applicable $action for "$name"', node.span); |
| 1251 } | 1258 } |
| 1252 return new Value(null, '${target.code}.$jsname() /*no applicable $action*/')
; | 1259 return new Value(null, '${target.code}.$jsname() /*no applicable $action*/')
; |
| 1253 } | 1260 } |
| 1254 | 1261 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 } | 1497 } |
| 1491 | 1498 |
| 1492 void forEach(void f(Member member)) { | 1499 void forEach(void f(Member member)) { |
| 1493 factories.forEach((_, Map constructors) { | 1500 factories.forEach((_, Map constructors) { |
| 1494 constructors.forEach((_, Member member) { | 1501 constructors.forEach((_, Member member) { |
| 1495 f(member); | 1502 f(member); |
| 1496 }); | 1503 }); |
| 1497 }); | 1504 }); |
| 1498 } | 1505 } |
| 1499 } | 1506 } |
| OLD | NEW |