Chromium Code Reviews| 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 #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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 if (identifier === null) { | 316 if (identifier === null) { |
| 317 compiler.cancel('library prefixes not handled', | 317 compiler.cancel('library prefixes not handled', |
| 318 node: typeAnnotation.typeName); | 318 node: typeAnnotation.typeName); |
| 319 } | 319 } |
| 320 final SourceString name = identifier.source; | 320 final SourceString name = identifier.source; |
| 321 Element element = library.find(name); | 321 Element element = library.find(name); |
| 322 if (element !== null && element.kind === ElementKind.CLASS) { | 322 if (element !== null && element.kind === ElementKind.CLASS) { |
| 323 // TODO(karlklose): substitute type parameters. | 323 // TODO(karlklose): substitute type parameters. |
| 324 return element.computeType(compiler); | 324 return element.computeType(compiler); |
| 325 } | 325 } |
| 326 return compiler.types.lookup(name); | 326 Type type = compiler.types.lookup(name); |
|
kasperl
2012/02/15 09:22:30
Would it be cleaner to have a way of querying if t
ahe
2012/02/15 09:46:55
Interesting difference of opinion here: I really p
kasperl
2012/02/15 10:01:29
Yeah, I think it would be neater with something li
ahe
2012/02/15 15:08:42
Actually, this entire method is somewhat broken. I
| |
| 327 if (type === null) { | |
| 328 type = compiler.types.dynamicType; | |
| 329 } | |
| 330 return type; | |
| 327 } | 331 } |
| 328 | 332 |
| 329 class FunctionParameters { | 333 class FunctionParameters { |
| 330 Link<Element> requiredParameters; | 334 Link<Element> requiredParameters; |
| 331 Link<Element> optionalParameters; | 335 Link<Element> optionalParameters; |
| 332 int requiredParameterCount; | 336 int requiredParameterCount; |
| 333 int optionalParameterCount; | 337 int optionalParameterCount; |
| 334 FunctionParameters(this.requiredParameters, | 338 FunctionParameters(this.requiredParameters, |
| 335 this.optionalParameters, | 339 this.optionalParameters, |
| 336 this.requiredParameterCount, | 340 this.requiredParameterCount, |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 else if (str === '>=') str = 'ge'; | 698 else if (str === '>=') str = 'ge'; |
| 695 else if (str === '>') str = 'gt'; | 699 else if (str === '>') str = 'gt'; |
| 696 else if (str === '<=') str = 'le'; | 700 else if (str === '<=') str = 'le'; |
| 697 else if (str === '<') str = 'lt'; | 701 else if (str === '<') str = 'lt'; |
| 698 else if (str === '&' || str === '&=') str = 'and'; | 702 else if (str === '&' || str === '&=') str = 'and'; |
| 699 else if (str === '^' || str === '^=') str = 'xor'; | 703 else if (str === '^' || str === '^=') str = 'xor'; |
| 700 else if (str === '|' || str === '|=') str = 'or'; | 704 else if (str === '|' || str === '|=') str = 'or'; |
| 701 return new SourceString('$receiver\$$str'); | 705 return new SourceString('$receiver\$$str'); |
| 702 } | 706 } |
| 703 } | 707 } |
| OLD | NEW |