Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1245)

Side by Side Diff: frog/library.dart

Issue 8763001: Fix names with '$' to not conflict with operators or internal helpers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged again Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/lib/natives.dart ('k') | frog/member.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 world._addMember(member); 107 world._addMember(member);
108 } 108 }
109 } 109 }
110 110
111 // TODO(jimhug): Cache and share the types as interfaces! 111 // TODO(jimhug): Cache and share the types as interfaces!
112 Type getOrAddFunctionType(Element enclosingElement, String name, 112 Type getOrAddFunctionType(Element enclosingElement, String name,
113 FunctionDefinition func) { 113 FunctionDefinition func) {
114 // TODO(jimhug): This is redundant now that FunctionDef has type params. 114 // TODO(jimhug): This is redundant now that FunctionDef has type params.
115 final def = new FunctionTypeDefinition(func, null, func.span); 115 final def = new FunctionTypeDefinition(func, null, func.span);
116 final type = new DefinedType(name, this, def, false); 116 final type = new DefinedType(name, this, def, false);
117 type.addMethod('\$call', func); 117 type.addMethod(':call', func);
118 var m = type.members['\$call']; 118 var m = type.members[':call'];
119 m.enclosingElement = enclosingElement; 119 m.enclosingElement = enclosingElement;
120 m.resolve(); 120 m.resolve();
121 // Function types implement the Function interface. 121 // Function types implement the Function interface.
122 type.interfaces = [world.functionType]; 122 type.interfaces = [world.functionType];
123 return type; 123 return type;
124 } 124 }
125 125
126 /** Adds a type to the library. */ 126 /** Adds a type to the library. */
127 DefinedType addType(String name, Node definition, bool isClass) { 127 DefinedType addType(String name, Node definition, bool isClass) {
128 if (types.containsKey(name)) { 128 if (types.containsKey(name)) {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 void visitVariableDefinition(VariableDefinition node) { 477 void visitVariableDefinition(VariableDefinition node) {
478 currentType.addField(node); 478 currentType.addField(node);
479 } 479 }
480 480
481 void visitFunctionDefinition(FunctionDefinition node) { 481 void visitFunctionDefinition(FunctionDefinition node) {
482 currentType.addMethod(node.name.name, node); 482 currentType.addMethod(node.name.name, node);
483 } 483 }
484 484
485 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { 485 void visitFunctionTypeDefinition(FunctionTypeDefinition node) {
486 var type = library.addType(node.func.name.name, node, false); 486 var type = library.addType(node.func.name.name, node, false);
487 type.addMethod('\$call', node.func); 487 type.addMethod(':call', node.func);
488 } 488 }
489 } 489 }
OLDNEW
« no previous file with comments | « frog/lib/natives.dart ('k') | frog/member.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698