~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to src/embind/embind.js

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-20 22:44:35 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130920224435-apuwj4fsl3fqv1a6
Tags: 1.5.6~20130920~6010666-1
* New snapshot release
* Update the list of supported architectures to the same as libv8
  (Closes: #723129)
* emlibtool has been removed from upstream.
* Fix warning syntax-error-in-dep5-copyright
* Refresh of the patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
/*global __emval_register, _emval_handle_array, __emval_decref*/
6
6
/*global ___getTypeName*/
7
7
/*jslint sub:true*/ /* The symbols 'fromWireType' and 'toWireType' must be accessed via array notation to be closure-safe since craftInvokerFunction crafts functions as strings that can't be closured. */
8
 
var InternalError = Module.InternalError = extendError(Error, 'InternalError');
9
 
var BindingError = Module.BindingError = extendError(Error, 'BindingError');
10
 
var UnboundTypeError = Module.UnboundTypeError = extendError(BindingError, 'UnboundTypeError');
 
8
var InternalError = Module['InternalError'] = extendError(Error, 'InternalError');
 
9
var BindingError = Module['BindingError'] = extendError(Error, 'BindingError');
 
10
var UnboundTypeError = Module['UnboundTypeError'] = extendError(BindingError, 'UnboundTypeError');
11
11
 
12
12
function throwInternalError(message) {
13
13
    throw new InternalError(message);
638
638
 
639
639
var tupleRegistrations = {};
640
640
 
641
 
function __embind_register_tuple(rawType, name, rawConstructor, rawDestructor) {
 
641
function __embind_register_value_array(rawType, name, rawConstructor, rawDestructor) {
642
642
    tupleRegistrations[rawType] = {
643
643
        name: readLatin1String(name),
644
644
        rawConstructor: FUNCTION_TABLE[rawConstructor],
647
647
    };
648
648
}
649
649
 
650
 
function __embind_register_tuple_element(
 
650
function __embind_register_value_array_element(
651
651
    rawTupleType,
652
652
    getterReturnType,
653
653
    getter,
666
666
    });
667
667
}
668
668
 
669
 
function __embind_finalize_tuple(rawTupleType) {
 
669
function __embind_finalize_value_array(rawTupleType) {
670
670
    var reg = tupleRegistrations[rawTupleType];
671
671
    delete tupleRegistrations[rawTupleType];
672
672
    var elements = reg.elements;
725
725
 
726
726
var structRegistrations = {};
727
727
 
728
 
function __embind_register_struct(
 
728
function __embind_register_value_object(
729
729
    rawType,
730
730
    name,
731
731
    rawConstructor,
739
739
    };
740
740
}
741
741
 
742
 
function __embind_register_struct_field(
 
742
function __embind_register_value_object_field(
743
743
    structType,
744
744
    fieldName,
745
745
    getterReturnType,
760
760
    });
761
761
}
762
762
 
763
 
function __embind_finalize_struct(structType) {
 
763
function __embind_finalize_value_object(structType) {
764
764
    var reg = structRegistrations[structType];
765
765
    delete structRegistrations[structType];
766
766
 
879
879
                if (handle.$$.smartPtrType === this) {
880
880
                    ptr = handle.$$.smartPtr;
881
881
                } else {
882
 
                    var clonedHandle = handle.clone();
 
882
                    var clonedHandle = handle['clone']();
883
883
                    ptr = this.rawShare(
884
884
                        ptr,
885
885
                        __emval_register(function() {
886
 
                            clonedHandle.delete();
 
886
                            clonedHandle['delete']();
887
887
                        })
888
888
                    );
889
889
                    if (destructors !== null) {
1088
1088
    return handle.$$.ptrType.registeredClass.name;
1089
1089
}
1090
1090
 
1091
 
ClassHandle.prototype.isAliasOf = function(other) {
 
1091
ClassHandle.prototype['isAliasOf'] = function(other) {
1092
1092
    if (!(this instanceof ClassHandle)) {
1093
1093
        return false;
1094
1094
    }
1118
1118
    throwBindingError(getInstanceTypeName(obj) + ' instance already deleted');
1119
1119
}
1120
1120
 
1121
 
ClassHandle.prototype.clone = function() {
 
1121
ClassHandle.prototype['clone'] = function() {
1122
1122
    if (!this.$$.ptr) {
1123
1123
        throwInstanceAlreadyDeleted(this);
1124
1124
    }