| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** | 5 /** |
| 6 * Tools for Java code generation. | 6 * Tools for Java code generation. |
| 7 */ | 7 */ |
| 8 library CodegenJava; | 8 library CodegenJava; |
| 9 | 9 |
| 10 import 'package:html5lib/dom.dart' as dom; | 10 import 'package:html5lib/dom.dart' as dom; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 throw new Exception("Can't make type buildable"); | 174 throw new Exception("Can't make type buildable"); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 /** | 178 /** |
| 179 * Return true iff the passed [TypeDecl] will represent a primitive Java type. | 179 * Return true iff the passed [TypeDecl] will represent a primitive Java type. |
| 180 */ | 180 */ |
| 181 bool isPrimitive(TypeDecl type) { | 181 bool isPrimitive(TypeDecl type) { |
| 182 if (type is TypeReference) { | 182 if (type is TypeReference) { |
| 183 String typeStr = javaType(type); | 183 String typeStr = javaType(type); |
| 184 return typeStr == 'int' || typeStr == 'boolean'; | 184 return typeStr == 'boolean' || typeStr == 'int' || typeStr == 'long'; |
| 185 } | 185 } |
| 186 return false; | 186 return false; |
| 187 } | 187 } |
| 188 | 188 |
| 189 /** | 189 /** |
| 190 * Return true iff the passed [TypeDecl] is a type declared in the spec_input. | 190 * Return true iff the passed [TypeDecl] is a type declared in the spec_input. |
| 191 */ | 191 */ |
| 192 bool isDeclaredInSpec(TypeDecl type) { | 192 bool isDeclaredInSpec(TypeDecl type) { |
| 193 // TypeReference resolvedType = super.resolveTypeReferenceChain(type); | 193 // TypeReference resolvedType = super.resolveTypeReferenceChain(type); |
| 194 // if(resolvedType is TypeObject) { | 194 // if(resolvedType is TypeObject) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 * Create a [GeneratedFile] that creates Java code and outputs it to [path]. | 292 * Create a [GeneratedFile] that creates Java code and outputs it to [path]. |
| 293 * [path] uses Posix-style path separators regardless of the OS. | 293 * [path] uses Posix-style path separators regardless of the OS. |
| 294 */ | 294 */ |
| 295 GeneratedFile javaGeneratedFile(String path, CodegenJavaVisitor | 295 GeneratedFile javaGeneratedFile(String path, CodegenJavaVisitor |
| 296 createVisitor(Api api)) { | 296 createVisitor(Api api)) { |
| 297 return new GeneratedFile(path, () { | 297 return new GeneratedFile(path, () { |
| 298 CodegenJavaVisitor visitor = createVisitor(readApi()); | 298 CodegenJavaVisitor visitor = createVisitor(readApi()); |
| 299 return visitor.collectCode(visitor.visitApi); | 299 return visitor.collectCode(visitor.visitApi); |
| 300 }); | 300 }); |
| 301 } | 301 } |
| OLD | NEW |