| 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 class LibraryImport { | 5 class LibraryImport { |
| 6 String prefix; | 6 String prefix; |
| 7 Library library; | 7 Library library; |
| 8 LibraryImport(this.library, [this.prefix = null]); | 8 LibraryImport(this.library, [this.prefix = null]); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 455 } |
| 456 // Even though the collection has one arg, this is the easiest way to get | 456 // Even though the collection has one arg, this is the easiest way to get |
| 457 // the first item. | 457 // the first item. |
| 458 for (var arg in args) { | 458 for (var arg in args) { |
| 459 return _parseStringArgument(arg); | 459 return _parseStringArgument(arg); |
| 460 } | 460 } |
| 461 } | 461 } |
| 462 | 462 |
| 463 String _parseStringArgument(ArgumentNode arg) { | 463 String _parseStringArgument(ArgumentNode arg) { |
| 464 var expr = arg.value; | 464 var expr = arg.value; |
| 465 if (expr is! LiteralExpression || !expr.type.type.isString) { | 465 if (expr is! LiteralExpression || !expr.value.type.isString) { |
| 466 world.error('expected string', expr.span); | 466 world.error('expected string literal', expr.span); |
| 467 } | 467 } |
| 468 return parseStringLiteral(expr.value); | 468 return expr.value.actualValue; |
| 469 } | 469 } |
| 470 | 470 |
| 471 void visitTypeDefinition(TypeDefinition node) { | 471 void visitTypeDefinition(TypeDefinition node) { |
| 472 var oldType = currentType; | 472 var oldType = currentType; |
| 473 currentType = library.addType(node.name.name, node, node.isClass); | 473 currentType = library.addType(node.name.name, node, node.isClass); |
| 474 for (var member in node.body) { | 474 for (var member in node.body) { |
| 475 member.visit(this); | 475 member.visit(this); |
| 476 } | 476 } |
| 477 currentType = oldType; | 477 currentType = oldType; |
| 478 } | 478 } |
| 479 | 479 |
| 480 void visitVariableDefinition(VariableDefinition node) { | 480 void visitVariableDefinition(VariableDefinition node) { |
| 481 currentType.addField(node); | 481 currentType.addField(node); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void visitFunctionDefinition(FunctionDefinition node) { | 484 void visitFunctionDefinition(FunctionDefinition node) { |
| 485 currentType.addMethod(node.name.name, node); | 485 currentType.addMethod(node.name.name, node); |
| 486 } | 486 } |
| 487 | 487 |
| 488 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { | 488 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { |
| 489 var type = library.addType(node.func.name.name, node, false); | 489 var type = library.addType(node.func.name.name, node, false); |
| 490 type.addMethod(':call', node.func); | 490 type.addMethod(':call', node.func); |
| 491 } | 491 } |
| 492 } | 492 } |
| OLD | NEW |