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

Side by Side Diff: lib/src/codegen/js_codegen.dart

Issue 1060813008: Handle symbol literals (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dev_compiler.src.codegen.js_codegen; 5 library dev_compiler.src.codegen.js_codegen;
6 6
7 import 'dart:collection' show HashSet, HashMap; 7 import 'dart:collection' show HashSet, HashMap;
8 8
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 @override 2046 @override
2047 visitIntegerLiteral(IntegerLiteral node) => js.number(node.value); 2047 visitIntegerLiteral(IntegerLiteral node) => js.number(node.value);
2048 2048
2049 @override 2049 @override
2050 visitDoubleLiteral(DoubleLiteral node) => js.number(node.value); 2050 visitDoubleLiteral(DoubleLiteral node) => js.number(node.value);
2051 2051
2052 @override 2052 @override
2053 visitNullLiteral(NullLiteral node) => new JS.LiteralNull(); 2053 visitNullLiteral(NullLiteral node) => new JS.LiteralNull();
2054 2054
2055 @override 2055 @override
2056 visitSymbolLiteral(SymbolLiteral node) {
2057 // TODO(vsm): When we canonicalize, we need to treat private symbols
2058 // correctly.
2059 var name = js.escapedString(node.components.join('.'));
2060 var symbol = js.call('new _internal.Symbol(#)', name);
Jennifer Messerly 2015/04/21 21:23:35 this should be core.Symbol right? (the impl of cor
2061 return js.commentExpression('Unimplemented const', symbol);
2062 }
2063
2064 @override
2056 visitListLiteral(ListLiteral node) { 2065 visitListLiteral(ListLiteral node) {
2057 JS.Expression list = new JS.ArrayInitializer(_visitList(node.elements)); 2066 JS.Expression list = new JS.ArrayInitializer(_visitList(node.elements));
2058 2067
2059 ParameterizedType type = node.staticType; 2068 ParameterizedType type = node.staticType;
2060 if (type.typeArguments.any((a) => a != types.dynamicType)) { 2069 if (type.typeArguments.any((a) => a != types.dynamicType)) {
2061 list = js.call('dart.setType(#, #)', [list, _emitTypeName(type)]); 2070 list = js.call('dart.setType(#, #)', [list, _emitTypeName(type)]);
2062 } 2071 }
2063 if (node.constKeyword != null) { 2072 if (node.constKeyword != null) {
2064 list = js.commentExpression('Unimplemented const', list); 2073 list = js.commentExpression('Unimplemented const', list);
2065 } 2074 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 return filepath; 2393 return filepath;
2385 } 2394 }
2386 2395
2387 // TODO(jmesserly): validate the library. See issue #135. 2396 // TODO(jmesserly): validate the library. See issue #135.
2388 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName'; 2397 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName';
2389 2398
2390 // TODO(jacobr): we would like to do something like the following 2399 // TODO(jacobr): we would like to do something like the following
2391 // but we don't have summary support yet. 2400 // but we don't have summary support yet.
2392 // bool _supportJsExtensionMethod(AnnotatedNode node) => 2401 // bool _supportJsExtensionMethod(AnnotatedNode node) =>
2393 // _getAnnotation(node, "SupportJsExtensionMethod") != null; 2402 // _getAnnotation(node, "SupportJsExtensionMethod") != null;
OLDNEW
« no previous file with comments | « lib/runtime/dart/_js_helper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698