Chromium Code Reviews| 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 /** | 5 /** |
| 6 * Top level generator object for writing code and keeping track of | 6 * Top level generator object for writing code and keeping track of |
| 7 * dependencies. | 7 * dependencies. |
| 8 * | 8 * |
| 9 * Should have two compilation models, but only one implemented so far. | 9 * Should have two compilation models, but only one implemented so far. |
| 10 * | 10 * |
| (...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2102 typeRef = new NameTypeReference( | 2102 typeRef = new NameTypeReference( |
| 2103 typeRef.isFinal, typeRef.name, names, typeRef.span); | 2103 typeRef.isFinal, typeRef.name, names, typeRef.span); |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 var type = method.resolveType(typeRef, true); | 2106 var type = method.resolveType(typeRef, true); |
| 2107 if (type.isTop) { | 2107 if (type.isTop) { |
| 2108 type = type.library.findTypeByName(constructorName); | 2108 type = type.library.findTypeByName(constructorName); |
| 2109 constructorName = ''; | 2109 constructorName = ''; |
| 2110 } | 2110 } |
| 2111 | 2111 |
| 2112 if (method.isStatic | |
| 2113 && ((method.typeParameters === null && type.hasTypeParams) | |
|
Jennifer Messerly
2011/12/06 22:14:55
I don't understand the (method.typeParameters ===
| |
| 2114 || type is ParameterType)) { | |
| 2115 world.error('using type parameter in static context', node.span); | |
| 2116 return _makeMissingValue(constructorName); | |
| 2117 } else if (type is ParameterType) { | |
| 2118 world.error('cannot instantiate a type parameter', node.span); | |
| 2119 return _makeMissingValue(constructorName); | |
| 2120 } | |
| 2121 | |
| 2112 var m = type.getConstructor(constructorName); | 2122 var m = type.getConstructor(constructorName); |
| 2113 if (m == null) { | 2123 if (m == null) { |
| 2114 var name = type.jsname; | 2124 var name = type.jsname; |
| 2115 if (type.isVar) { | 2125 if (type.isVar) { |
| 2116 name = typeRef.name.name; | 2126 name = typeRef.name.name; |
| 2117 } | 2127 } |
| 2118 world.error('no matching constructor for $name', node.span); | 2128 world.error('no matching constructor for $name', node.span); |
| 2119 return _makeMissingValue(name); | 2129 return _makeMissingValue(name); |
| 2120 } | 2130 } |
| 2121 | 2131 |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2463 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false)); | 2473 result.add(new Value(world.varType, '\$$i', null, /*needsTemp:*/false)); |
| 2464 } | 2474 } |
| 2465 for (int i = bareCount; i < length; i++) { | 2475 for (int i = bareCount; i < length; i++) { |
| 2466 var name = getName(i); | 2476 var name = getName(i); |
| 2467 if (name == null) name = '\$$i'; | 2477 if (name == null) name = '\$$i'; |
| 2468 result.add(new Value(world.varType, name, null, /*needsTemp:*/false)); | 2478 result.add(new Value(world.varType, name, null, /*needsTemp:*/false)); |
| 2469 } | 2479 } |
| 2470 return new Arguments(nodes, result); | 2480 return new Arguments(nodes, result); |
| 2471 } | 2481 } |
| 2472 } | 2482 } |
| OLD | NEW |