| 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 #library('elements'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 class ForeignElement extends Element { | 113 class ForeignElement extends Element { |
| 114 ForeignElement(SourceString name) : super(name, ElementKind.FOREIGN, null); | 114 ForeignElement(SourceString name) : super(name, ElementKind.FOREIGN, null); |
| 115 | 115 |
| 116 Type computeType(Compiler compiler, types) { | 116 Type computeType(Compiler compiler, types) { |
| 117 return types.dynamicType; | 117 return types.dynamicType; |
| 118 } | 118 } |
| 119 | 119 |
| 120 parseNode(compiler, types) { | 120 parseNode(Canceler canceler, Logger logger) { |
| 121 throw "internal error: ForeignElement has no node"; | 121 throw "internal error: ForeignElement has no node"; |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 /** | 125 /** |
| 126 * TODO(ngeoffray): Remove this method in favor of using the universe. | 126 * TODO(ngeoffray): Remove this method in favor of using the universe. |
| 127 * | 127 * |
| 128 * Return the type referred to by the type annotation. This method | 128 * Return the type referred to by the type annotation. This method |
| 129 * accepts annotations with 'typeName == null' to indicate a missing | 129 * accepts annotations with 'typeName == null' to indicate a missing |
| 130 * annotation. | 130 * annotation. |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // TODO(ngeoffray): Implement these. | 272 // TODO(ngeoffray): Implement these. |
| 273 bool canHaveDefaultConstructor() => true; | 273 bool canHaveDefaultConstructor() => true; |
| 274 | 274 |
| 275 SynthesizedConstructorElement getSynthesizedConstructor() { | 275 SynthesizedConstructorElement getSynthesizedConstructor() { |
| 276 if (synthesizedConstructor === null && canHaveDefaultConstructor()) { | 276 if (synthesizedConstructor === null && canHaveDefaultConstructor()) { |
| 277 synthesizedConstructor = new SynthesizedConstructorElement(this); | 277 synthesizedConstructor = new SynthesizedConstructorElement(this); |
| 278 } | 278 } |
| 279 return synthesizedConstructor; | 279 return synthesizedConstructor; |
| 280 } | 280 } |
| 281 | 281 |
| 282 parseNode(compiler, types) => node; | 282 parseNode(Canceler canceler, Logger logger) => node; |
| 283 } | 283 } |
| 284 | 284 |
| 285 class Elements { | 285 class Elements { |
| 286 static bool isInstanceField(Element element) { | 286 static bool isInstanceField(Element element) { |
| 287 return (element !== null) | 287 return (element !== null) |
| 288 && element.isInstanceMember() | 288 && element.isInstanceMember() |
| 289 && (element.kind === ElementKind.FIELD); | 289 && (element.kind === ElementKind.FIELD); |
| 290 } | 290 } |
| 291 | 291 |
| 292 static bool isStaticOrTopLevelField(Element element) { | 292 static bool isStaticOrTopLevelField(Element element) { |
| 293 return (element != null) | 293 return (element != null) |
| 294 && !element.isInstanceMember() | 294 && !element.isInstanceMember() |
| 295 && (element.kind === ElementKind.FIELD); | 295 && (element.kind === ElementKind.FIELD); |
| 296 } | 296 } |
| 297 | 297 |
| 298 static bool isInstanceMethod(Element element) { | 298 static bool isInstanceMethod(Element element) { |
| 299 return (element != null) | 299 return (element != null) |
| 300 && element.isInstanceMember() | 300 && element.isInstanceMember() |
| 301 && (element.kind === ElementKind.FUNCTION); | 301 && (element.kind === ElementKind.FUNCTION); |
| 302 } | 302 } |
| 303 } | 303 } |
| OLD | NEW |