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

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

Issue 1033443003: Add missing visit methods (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | 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 import 'dart:io' show Directory, File; 8 import 'dart:io' show Directory, File;
9 9
10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 var classExpr = new JS.ClassExpression(new JS.VariableDeclaration(name), 289 var classExpr = new JS.ClassExpression(new JS.VariableDeclaration(name),
290 _classHeritage(node), _emitClassMethods(node, ctors, fields)); 290 _classHeritage(node), _emitClassMethods(node, ctors, fields));
291 291
292 var body = _finishClassMembers(name, classExpr, ctors, staticFields); 292 var body = _finishClassMembers(name, classExpr, ctors, staticFields);
293 currentClass = null; 293 currentClass = null;
294 294
295 return _finishClassDef(classElem, body); 295 return _finishClassDef(classElem, body);
296 } 296 }
297 297
298 @override
299 JS.Statement visitEnumDeclaration(EnumDeclaration node) =>
300 _unimplementedCall("Unimplemented enum: $node").toStatement();
301
298 /// Given a class element and body, complete the class declaration. 302 /// Given a class element and body, complete the class declaration.
299 /// This handles generic type parameters, laziness (in library-cycle cases), 303 /// This handles generic type parameters, laziness (in library-cycle cases),
300 /// and ensuring dependencies are loaded first. 304 /// and ensuring dependencies are loaded first.
301 JS.Statement _finishClassDef(ClassElement classElem, JS.Statement body) { 305 JS.Statement _finishClassDef(ClassElement classElem, JS.Statement body) {
302 var name = classElem.name; 306 var name = classElem.name;
303 var genericName = '$name\$'; 307 var genericName = '$name\$';
304 308
305 JS.Statement genericDef; 309 JS.Statement genericDef;
306 JS.Expression genericInst; 310 JS.Expression genericInst;
307 if (classElem.typeParameters.isNotEmpty) { 311 if (classElem.typeParameters.isNotEmpty) {
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 visitInterpolationExpression(InterpolationExpression node) => 1953 visitInterpolationExpression(InterpolationExpression node) =>
1950 _visit(node.expression); 1954 _visit(node.expression);
1951 1955
1952 @override 1956 @override
1953 visitBooleanLiteral(BooleanLiteral node) => js.boolean(node.value); 1957 visitBooleanLiteral(BooleanLiteral node) => js.boolean(node.value);
1954 1958
1955 @override 1959 @override
1956 JS.Expression visitExpression(Expression node) => 1960 JS.Expression visitExpression(Expression node) =>
1957 _unimplementedCall('Unimplemented ${node.runtimeType}: $node'); 1961 _unimplementedCall('Unimplemented ${node.runtimeType}: $node');
1958 1962
1963 @override
1964 JS.Statement visitYieldStatement(YieldStatement node) =>
1965 _unimplementedCall('Unimplemented yield: $node').toStatement();
1966
1959 JS.Expression _unimplementedCall(String comment) { 1967 JS.Expression _unimplementedCall(String comment) {
1960 return js.call('dart.throw_(#)', [js.escapedString(comment)]); 1968 return js.call('dart.throw_(#)', [js.escapedString(comment)]);
1961 } 1969 }
1962 1970
1963 @override 1971 @override
1964 visitNode(AstNode node) { 1972 visitNode(AstNode node) {
1965 // TODO(jmesserly): verify this is unreachable. 1973 // TODO(jmesserly): verify this is unreachable.
1966 throw 'Unimplemented ${node.runtimeType}: $node'; 1974 throw 'Unimplemented ${node.runtimeType}: $node';
1967 } 1975 }
1968 1976
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 2308
2301 // TODO(jmesserly): in many cases marking the end will be unncessary. 2309 // TODO(jmesserly): in many cases marking the end will be unncessary.
2302 printer.mark(_location(node.end)); 2310 printer.mark(_location(node.end));
2303 } 2311 }
2304 2312
2305 String _getIdentifier(AstNode node) { 2313 String _getIdentifier(AstNode node) {
2306 if (node is SimpleIdentifier) return node.name; 2314 if (node is SimpleIdentifier) return node.name;
2307 return null; 2315 return null;
2308 } 2316 }
2309 } 2317 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698