OLD | NEW |
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.fletch_context; | 5 library fletchc.fletch_context; |
6 | 6 |
7 import 'package:compiler/src/tree/tree.dart' show | 7 import 'package:compiler/src/tree/tree.dart' show |
8 Node; | 8 Node; |
9 | 9 |
10 import 'package:compiler/src/elements/elements.dart' show | 10 import 'package:compiler/src/elements/elements.dart' show |
(...skipping 13 matching lines...) Expand all Loading... |
24 Selector; | 24 Selector; |
25 | 25 |
26 import 'package:compiler/src/constants/expressions.dart' show | 26 import 'package:compiler/src/constants/expressions.dart' show |
27 ConstantExpression; | 27 ConstantExpression; |
28 | 28 |
29 import 'package:compiler/src/constants/values.dart' show | 29 import 'package:compiler/src/constants/values.dart' show |
30 ConstantValue, | 30 ConstantValue, |
31 ConstructedConstantValue, | 31 ConstructedConstantValue, |
32 FunctionConstantValue; | 32 FunctionConstantValue; |
33 | 33 |
| 34 import 'package:compiler/src/common/names.dart' show |
| 35 Names; |
| 36 |
34 import 'fletch_compiler_implementation.dart' show | 37 import 'fletch_compiler_implementation.dart' show |
35 FletchCompilerImplementation; | 38 FletchCompilerImplementation; |
36 | 39 |
37 export 'fletch_compiler_implementation.dart' show | 40 export 'fletch_compiler_implementation.dart' show |
38 FletchCompilerImplementation; | 41 FletchCompilerImplementation; |
39 | 42 |
40 import 'fletch_backend.dart' show | 43 import 'fletch_backend.dart' show |
41 FletchBackend; | 44 FletchBackend; |
42 | 45 |
43 export 'fletch_backend.dart' show | 46 export 'fletch_backend.dart' show |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 void writeNamedArguments(StringBuffer buffer, FunctionSignature signature) { | 132 void writeNamedArguments(StringBuffer buffer, FunctionSignature signature) { |
130 signature.orderedForEachParameter((ParameterElement parameter) { | 133 signature.orderedForEachParameter((ParameterElement parameter) { |
131 if (parameter.isNamed) { | 134 if (parameter.isNamed) { |
132 buffer.write(":"); | 135 buffer.write(":"); |
133 buffer.write(parameter.name); | 136 buffer.write(parameter.name); |
134 } | 137 } |
135 }); | 138 }); |
136 } | 139 } |
137 | 140 |
138 String getSymbolForFunction( | 141 String getSymbolForFunction( |
139 String name, | 142 Name name, |
140 FunctionSignature signature, | 143 FunctionSignature signature) { |
141 LibraryElement library) { | |
142 StringBuffer buffer = new StringBuffer(); | 144 StringBuffer buffer = new StringBuffer(); |
143 buffer.write(mangleName(new Name(name, library))); | 145 buffer.write(mangleName(name)); |
144 writeNamedArguments(buffer, signature); | 146 writeNamedArguments(buffer, signature); |
145 return buffer.toString(); | 147 return buffer.toString(); |
146 } | 148 } |
147 | 149 |
148 String getCallSymbol(FunctionSignature signature) { | 150 String getCallSymbol(FunctionSignature signature) { |
149 return getSymbolForFunction('call', signature, null); | 151 return getSymbolForFunction(Names.call, signature); |
150 } | 152 } |
151 | 153 |
152 int getSymbolId(String symbol) { | 154 int getSymbolId(String symbol) { |
153 return symbolIds.putIfAbsent(symbol, () { | 155 return symbolIds.putIfAbsent(symbol, () { |
154 int id = symbols.length; | 156 int id = symbols.length; |
155 assert(id == symbolIds.length); | 157 assert(id == symbolIds.length); |
156 symbols.add(symbol); | 158 symbols.add(symbol); |
157 backend.systemBuilder.registerSymbol(symbol, id); | 159 backend.systemBuilder.registerSymbol(symbol, id); |
158 return id; | 160 return id; |
159 }); | 161 }); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 ConstantExpression expression = | 249 ConstantExpression expression = |
248 compiler.resolver.constantCompiler.compileNode( | 250 compiler.resolver.constantCompiler.compileNode( |
249 node, elements, enforceConst: isConst); | 251 node, elements, enforceConst: isConst); |
250 return expression; | 252 return expression; |
251 } | 253 } |
252 | 254 |
253 ConstantValue getConstantValue(ConstantExpression expression) { | 255 ConstantValue getConstantValue(ConstantExpression expression) { |
254 return compiler.constants.getConstantValue(expression); | 256 return compiler.constants.getConstantValue(expression); |
255 } | 257 } |
256 } | 258 } |
OLD | NEW |