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 interface TreeElements { | 5 interface TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 Type getType(TypeAnnotation annotation); | 8 Type getType(TypeAnnotation annotation); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 !link.isEmpty(); | 392 !link.isEmpty(); |
| 393 link = link.tail) { | 393 link = link.tail) { |
| 394 parameterTypes.addLast(link.head.computeType(compiler)); | 394 parameterTypes.addLast(link.head.computeType(compiler)); |
| 395 // TODO(karlklose): optional parameters. | 395 // TODO(karlklose): optional parameters. |
| 396 } | 396 } |
| 397 return new FunctionType(signature.returnType, | 397 return new FunctionType(signature.returnType, |
| 398 parameterTypes.toLink(), | 398 parameterTypes.toLink(), |
| 399 element); | 399 element); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void resolveMetadataAnnotation(MetadataAnnotation annotation) { | |
| 403 Node node = annotation.parseNode(compiler); | |
| 404 Element fakeElement = new Element(const SourceString(''), | |
|
ngeoffray
2012/08/22 14:28:56
Should we have a metadata element instead? This so
ahe
2012/08/22 17:23:02
Done.
| |
| 405 ElementKind.FUNCTION, | |
| 406 annotation.enclosingElement); | |
|
Johnni Winther
2012/08/22 13:45:40
The element kind should be something else. We cann
ahe
2012/08/22 17:23:02
Done.
| |
| 407 ResolverVisitor visitor = new ResolverVisitor(compiler, fakeElement); | |
| 408 node.accept(visitor); | |
| 409 annotation.value = compiler.constantHandler.compileNodeWithDefinitions( | |
| 410 node, visitor.mapping); | |
| 411 print(annotation); | |
|
Johnni Winther
2012/08/22 13:45:40
Debug output.
ahe
2012/08/22 17:23:02
Done.
| |
| 412 } | |
| 413 | |
| 402 error(Node node, MessageKind kind, [arguments = const []]) { | 414 error(Node node, MessageKind kind, [arguments = const []]) { |
| 403 ResolutionError message = new ResolutionError(kind, arguments); | 415 ResolutionError message = new ResolutionError(kind, arguments); |
| 404 compiler.reportError(node, message); | 416 compiler.reportError(node, message); |
| 405 } | 417 } |
| 406 } | 418 } |
| 407 | 419 |
| 408 class InitializerResolver { | 420 class InitializerResolver { |
| 409 final ResolverVisitor visitor; | 421 final ResolverVisitor visitor; |
| 410 final Map<SourceString, Node> initialized; | 422 final Map<SourceString, Node> initialized; |
| 411 Link<Node> initializers; | 423 Link<Node> initializers; |
| (...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2526 TopScope(LibraryElement library) : super(null, library); | 2538 TopScope(LibraryElement library) : super(null, library); |
| 2527 Element lookup(SourceString name) { | 2539 Element lookup(SourceString name) { |
| 2528 return library.find(name); | 2540 return library.find(name); |
| 2529 } | 2541 } |
| 2530 | 2542 |
| 2531 Element add(Element newElement) { | 2543 Element add(Element newElement) { |
| 2532 throw "Cannot add an element in the top scope"; | 2544 throw "Cannot add an element in the top scope"; |
| 2533 } | 2545 } |
| 2534 String toString() => '$element'; | 2546 String toString() => '$element'; |
| 2535 } | 2547 } |
| OLD | NEW |