CN107239270A - Code process method and apparatus - Google Patents

Code process method and apparatus Download PDF

Info

Publication number
CN107239270A
CN107239270A CN201610188574.5A CN201610188574A CN107239270A CN 107239270 A CN107239270 A CN 107239270A CN 201610188574 A CN201610188574 A CN 201610188574A CN 107239270 A CN107239270 A CN 107239270A
Authority
CN
China
Prior art keywords
file
statement
called
import
imported
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610188574.5A
Other languages
Chinese (zh)
Other versions
CN107239270B (en
Inventor
陈成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610188574.5A priority Critical patent/CN107239270B/en
Publication of CN107239270A publication Critical patent/CN107239270A/en
Application granted granted Critical
Publication of CN107239270B publication Critical patent/CN107239270B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the present application discloses a kind of code process method and apparatus, file to be imported in corresponding file import statement is replaced by file to be called in file call statement, during so that the file import statement after being replaced being performed, the follow-up code file being really called can be imported, the code file called really is needed so that the file that file import statement is imported is programming personnel, avoid causes object code volume additionally to increase due to importing the code file that need not be called, it is ensured that it is subsequently normally used.

Description

Code process method and apparatus
Technical field
The application is related to code development technical field, more particularly to a kind of code process method and apparatus.
Background technology
With the fast development of computer technology, computer equipment is relied on also constantly to increase come the amount of software used Plus, the integrated function of these softwares is increasingly enriched, but abundant function also causes software code volume not Disconnected to increase, this upload follow-up to software, download and loading etc. are had a negative impact using process.Therefore, How on the basis of ensureing that software function is abundant enough control software code volume, have become and close in the industry The emphasis of note.
During existing code development, either the system code of software still relies on pin used in software This code, multiple code files to realize certain function can be typically combined to obtain it is integrated these Function and allow the business module that is imported into, subsequently these business modules are directed into according to functional requirement In the object code currently write so that object code is directly provided with the function of the business module, due to this Way can effectively improve code development efficiency, it has also become means commonly used in the trade.
However, in the prior art, after required business module is directed into object code, in fact it could happen that some The code file for only having partial function in business module is really needed during the object code use, and Not the object code is using required for the code file of other function, these nonessential code files then shape Into redundancy, these redundant files cause object code volume additionally to increase, influence it subsequently to use.
The content of the invention
The purpose of the embodiment of the present application is to provide a kind of method and device of code process, to solve existing skill There is redundant file in art and cause the problem of object code volume additionally increases.
In order to solve the above technical problems, the embodiment of the present application provides a kind of method of code process, including:
File import statement is determined in object code, the file import statement is used to import text to be imported Part;
The file call statement corresponding with the file import statement, institute are determined in the object code Stating file call statement is used to call the file to be called in the file to be imported;
Using the mark of the file to be called in the corresponding file call statement, replace the file and lead Enter the mark of the file to be imported in sentence.
In order to solve the above technical problems, the embodiment of the present application provides a kind of device of code process, including:
Import statement determining module, for determining file import statement in object code, the file is led Entering sentence is used to import file to be imported;
Call statement determining module, for being determined in the object code and the file import statement phase Corresponding file call statement, the file call statement is to be called in the file to be imported for calling File;
File replacement module, for the mark using the file to be called in the corresponding file call statement Know, replace the mark of the file to be imported in the file import statement.
At the technical scheme provided from above the embodiment of the present application, the code that the embodiment of the present application is provided Method and apparatus are managed, are replaced by file to be called in file call statement in corresponding file import statement File to be imported so that when the file import statement after being replaced is performed, can be imported follow-up real called File so that the file that file import statement is imported be programming personnel really need call, it is to avoid Object code volume is caused additionally to increase due to importing the redundant file that need not be called, it is ensured that it is subsequently just Often use.
Brief description of the drawings
, below will be to implementing in order to illustrate more clearly of the embodiment of the present application or technical scheme of the prior art The accompanying drawing used required in example or description of the prior art is briefly described, it should be apparent that, describe below In accompanying drawing be only some embodiments described in the application, for those of ordinary skill in the art, Without having to pay creative labor, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is the process of code process method in the embodiment of the application one.
Fig. 2 be determined in the object code in code process method in the embodiment of the application one with it is described The detailed process of the corresponding file call statement of file import statement.
Fig. 3 is the process of code process method in another embodiment of the application.
Fig. 4 is the structure of code processing apparatus in the embodiment of the application one.
Embodiment
The embodiment of the present application provides a kind of code process method and device.
In order that those skilled in the art more fully understand the technical scheme in the application, below in conjunction with this Apply for the accompanying drawing in embodiment, the technical scheme in the embodiment of the present application be clearly and completely described, Obviously, described embodiment is only some embodiments of the present application, rather than whole embodiments.Base Embodiment in the application, those of ordinary skill in the art are obtained under the premise of creative work is not made The every other embodiment obtained, should all belong to the scope of the application protection.
Code process method in the embodiment of the present application solves existing skill by handling object code Be likely to occur in art causes the problem of object code volume additionally increases due to importing redundant file, ties below Close accompanying drawing and this method is described in detail.
The targeted object code of code process method in the embodiment of the present application can be the system code of software, Can also be scripted code that support software is used etc., the programming voice that object code is based on is alternatively C++, Java, JavaScript etc., this is technology well known to those of ordinary skill in the art, herein not Repeat.
Fig. 1 is the process of code process method in the application first embodiment, and the executive agent of this method can be with It is that program staff is used to write the computer equipment of object code or the clothes for storing object code Business device etc.;The code process method may include steps of.
S20, file import statement is determined in object code, the file import statement is treated for importing Import file.
Increasingly mature with code development technology, numerous programming languages, which have, introduces other existing codes texts The file of part imports syntax rule, and file import statement, which is used to refer to, meets file importing language in each programming language The code line of method rule.By file import statement can realize by least one realize preset function wait lead Enter file to be directed into object code so that object code there can be the function of these files to be imported, carry Height improves programming efficiency.
File to be imported is in the file for the state for being identified " allowing to be imported into ", file import statement The mark of file to be imported is carried, then can be according to text wherein to be imported when file import statement is performed The mark of part determines the position of file to be imported, and then the file to be imported is directed into object code.
From file dimension, file to be imported can have identified as the single of " allowing to be imported into " state For realize certain preset function code file or by it is multiple it is being identified, realize it is not of the same race The business module of the code file composition of preset function.
From file type dimension, file to be imported can have identified as treating for " allowing to be imported into " state Obj ect file or function file to be imported are imported, obj ect file to be imported shows that file to be imported is object class Type, and function file to be imported then shows that file to be imported is type function.
In the embodiment of the present application, file import statement removes the mark for carrying file to be imported, also carries both Set the goal the mark of file, and set objective file is used to describing object code truly importing demand, set objective File is as the code file for realizing preset function being located in file to be imported specified by programming personnel.
Set objective file is normally in file to be imported, such as file to be imported is by multiple code files During the business module of composition, set objective file can be at least one code file in business module, and treat File is imported when being single code file, set objective file be the file to be imported in itself.
In the embodiment of the present application, the syntax rule that can be applicable according to object code is set to file import statement Determine regular expression, and then object code is scanned based on set regular expression, so that it is determined that Go out to be located at the All Files import statement in object code.The specific building process of regular expression, can be with pin Code composition to file import statement under different programming languages is preset, and this is ordinary skill people Technology known to member, will not be described here.
In actual applications, can be according to treating when building the regular expression for determining file import statement The position of file is imported to determine multiple regular expressions, and scans target using each regular expression successively Code, so that the file import statement of the file to be imported for diverse location is obtained, to be subsequently directed to this A little file import statements do adaptive processes.
In the generation that the embodiment of the present application is provided, is described in detail so that object code is based on JavaScript language environment as an example Code processing method, corresponding object code can be the scripted code based on JavaScript language environment, example Some the Webpage script such as loaded by browser;Corresponding, file import statement can be based on Import sentences under JavaScript language environment, the import sentences are located in object code, for inciting somebody to action The business that the code file that some existing suffix are JS by JS code file or by these suffix is constituted Module is directed into object code.
Continuation of the previous cases, for ease of understanding file import statement and file to be imported, to the part piece of object code Duan Jinhang illustrates, specific as follows:
export funbtion a(…){
};
export funbtion b(…){
};
export a from'./lia/a.js';
export b from'./lia/b.js';
// mark X modules, including function a and function b;
export funbtion c(…){
};
export c from'./lia/c.js';
// mark Y modules, including function c;
import X from'X';
// the X object imported under X modules;
a(…){
};
// call function a under X modules;
import{a,b}from'X';
// function a and b imported under X modules;
b(…){
};
// call function b under X modules;
import{c}from'Y';
// function the c imported under Y modules;
c(…){
};
// function the c imported under Y modules;
d(…){
};
// call user function d newly-built in object code.
, can be by building import**from** canonical table for the fragment of the foregoing object code enumerated Up to formula, then all file import statements can be determined in object code.In the embodiment of the present application, The two regular expressions of import**from*X* and import**from*Y* can be set, so that really The position of file to be imported is made in module X and Y.
Based on regular expression import**from*X*, it may be determined that go out import X from'X' and Import { a, b } from'X' both of these documents import statements, its file to be imported is module X;Difference It is, import X from'X' set objective file is then object X, import { a, b } from'X' Set objective file then be function a and b.
Based on regular expression import**from*Y*, it may be determined that go out import c from'Y', it is treated Importing file is module Y;Set objective file is then object c.
S40, in the object code determine that the file corresponding with the file import statement calls language Sentence, the file call statement is used to call the file to be called in the file to be imported.
The continuity that file call statement is acted on as file import statement, is treated for being imported in file import statement File to be called is called after importing file.
File to be called can be understood as in file to be imported:File to be called be file to be imported in itself or The code file of certain preset function is realized in the file to be imported, can be with by performing sentence to be called Be so that object code can really realize function of file to be imported itself or in the file to be imported certain A little functions.
With reference to shown in Fig. 2, in the embodiment of the present application, S40 specifically includes following steps.
S42, determine file call statement in the object code, the file call statement is used to adjust Use file to be called.
In actual applications, it again may be by setting regular expression to file call statement, then based on just Then expression formula is scanned to object code, so that it is determined that the All Files gone out in object code calls language Sentence.The building process of specific regular expression, refers to the foregoing expression formula to file import statement, herein Do not repeat.
Still continuation of the previous cases, for the fragment of the foregoing object code enumerated, file call statement can be by building Vertical * (* *) { * * } regular expression, then can determine All Files call statement in object code.
S44, mark identical set objective file is judged whether and during file to be called, if so, holding Row step S46, if it is not, performing step S48.
In the embodiment of the present application, code process method also includes the following step being located between step S20 and S40 Suddenly:The mark of set objective file in the file import statement determined is preserved to default storage region.
Default storage region can be a data data storage storehouse or list, can be carried on hard disk, caching Deng in computer memory space, this is technology well known to those of ordinary skill in the art, be will not be described here.
In actual applications, set objective file includes:Set objective obj ect file or set objective function text Part, the file to be called includes:Obj ect file to be called or function file to be called.
Corresponding, the mark by set objective file in the file import statement determined is preserved to pre- If storage region, specifically include at least one of following:
The mark of set objective obj ect file in the file import statement determined is preserved to default storage First position in region;
The mark of set objective function file in the file import statement determined is preserved to default storage The second place in region.
In actual applications, the type identification of set objective file can be set up and judge keyword, it is determined that Go out after file import statement, the type of set objective file is judged by judging keyword.It can such as lead to Bracket mark " { } " is crossed to set up function keyword, when there is bracket mark " { } " in set keyword, Judge the set objective file as set objective function file.
Because first position and the second place are two relatively independent storage locations, for storing class respectively The different set objective file of type, in order to subsequent match efficiency.
The step S44 of correspondence is adjusted to:Determine exist in the default storage region and set objective text Part identifies identical file to be called.
Specifically, determining exist and the obj ect file to be called in the first position of the default storage region Identify identical set objective obj ect file;Determine exist and institute in the second place of the default storage region State function file mark identical set objective function file to be called.
Storage file is distinguished according to the type of set objective file, is easy to the follow-up class according to file to be called Type identifies identical set objective file to determine whether to exist, and improves judgement efficiency.
S46, determine the file to be called where file call statement and file where the set objective file Import statement is corresponding.
S48, determine the file to be called where file call statement and file where the set objective file Import statement is not corresponded to.
In the embodiment of the present application, scanned by corresponding regular expression after object code, can obtain corresponding File import statement and file call statement, and then determine wherein set objective file and file to be called Mark.It is determined that wherein after the mark of set objective file and file to be called, it is determined whether there is mark phase Same mark identical set objective file and file to be called, if so, determining text where the file to be called Part call statement is corresponding with file import statement where the set objective file;Conversely, determining that this waits to adjust It is not corresponding with file call statement where file and file import statement where the set objective file.
Still continuation of the previous cases, based on regular expression import**from*X*, to determine import X from ' exemplified by X' and import { a, b } from'X' both of these documents import statements, it may be determined that set objective file Be designated a and b, file to be called is designated a, b, c and d.By the mark of file to be called with Set objective file is matched, and obtains identifying a and b file importing of the file to be called with foregoing determination Sentence is corresponding.
Still continuation of the previous cases, based on regular expression import**from*Y*, to determine import c from ' exemplified by Y', it may be determined that set objective file is designated c, file to be called be designated a, b, c and d.The mark of file to be called is matched with set objective file, obtains identifying c file to be called File import statement with foregoing determination is corresponding.
S60, the mark using the file to be called in the corresponding file call statement, replace described The mark of file to be imported in file import statement.
What it is due to file to be called replacement is file to be imported in corresponding file import statement, can be caused When file import statement after being replaced is performed, the follow-up code file being really called can be imported and (treated Call file) so that the file that file import statement is imported is the code that programming personnel really needs to call File, it is to avoid the code file that importing to be called causes the object code volume additionally to increase.Still prolong Continuous upper example, for the scripted code of Webpage, the code process method provided by the embodiment of the present application Afterwards, can avoid the script of the Webpage that volume additionally increases downloaded by browser and implementation procedure in consume When it is longer the problem of.
In actual applications, the quantity of file to be called imports language with corresponding file in file call statement The quantity of file to be imported should be identical in sentence, and each file to be called is replaced into corresponding file one by one imports File to be imported in sentence.In replacement process, directly the mark of file to be imported can be replaced with The mark of file to be called, will not be described here.
In the embodiment of the present application, file to be called in file call statement can be also implemented by the following steps It is specific as follows to replace file to be imported in corresponding file import statement:
File import statement where deleting the file to be imported is simultaneously newly-increased such as in the first trip of the object code Lower sentence:Mark/lib/ texts to be called of the mark from' target service modules of import files to be called The mark of part '.The mark of target service module is business mould where the file to be imported of this document import statement The mark of block, it can determine that the regular expression set during file import statement is obtained by abovementioned steps, Object code fragment below in conjunction with aforementioned list is described in detail, and can specifically be joined shown in table 1.
Table 1
Such as the example of sequence number 1 in table 1, file to be called is function b, file import statement import a from ' a' is processed into:Import b from'a/lib/b', wherein as the object a of set objective file by according to treating The mark of file is called to be adjusted to object b, as the module a of file to be imported by according to target service module A/lib/b is adjusted to the mark of file to be called.
Such as the example of sequence number 2 in table 1, file to be called is function c, file import statement import { b, c } From'a' is processed into:Import c from'a/lib/c', wherein being used as the function b and c of set objective file Object c is adjusted to by the mark according to file to be called, as the module a of file to be imported by according to target The mark of business module and file to be called is adjusted to a/lib/c.
To sum up, the code process method that the embodiment of the present application is provided, by be called in file call statement File replaces file to be imported in corresponding file import statement so that the file import statement after being replaced When being performed, the follow-up code file being really called can be imported so that the text that file import statement is imported Part is the code file that programming personnel really needs to call, it is to avoid import the code file that need not be called Object code volume is caused additionally to increase.
Fig. 3 is the process of code process method in the application second embodiment, compared with first embodiment, area It is not, also comprises the following steps between step S20 and S40.
S30, judge the file to be imported whether include at least two code files, if so, directly execution Step S40, if it is not, then performing step S70.
Because file to be imported is existing module or code file, whether it includes at least two codes text Part can be obtained by inquiry, will not be described here.Continuation of the previous cases, if file to be imported is module X, It includes two code files (function a and b), if file to be imported is module Y, it only includes one Code file (function c).
S70, send without process signal.
When file to be imported only has a code file, redundant case can't occur for importing process, therefore Handled without to object code.It can be sent to without process signal and initiate code process request On terminal device so that promoter can be clearly without handling code.
Certainly, in the other embodiment of the application, step S30 may be located on before step S20, only File identical file import statement to be imported is determined when need to perform step S20 again, for example, only determines to treat Import file be module X file import statement, you can by the direct judge module X of step 30 whether Including at least two code files, if so, then perform step S20 and subsequent step to carry out code process, If it is not, directly performing step S70, it will not be described here.
To sum up, the code processing apparatus that the embodiment of the present application is provided, by be called in file call statement File replaces file to be imported in corresponding file import statement so that the file import statement after being replaced When being performed, the follow-up code file being really called can be imported so that the text that file import statement is imported Part is the code file that programming personnel really needs to call, it is to avoid due to importing the code that need not be called File causes object code volume additionally to increase, it is ensured that it is normally used.
Fig. 4 is the module map of code processing apparatus in the embodiment of the present application, and the code processing apparatus is before being based on State in each embodiment that code process method is come what is run, its technical principle and details refer to preceding method, It will not be described here.
In the embodiment of the present application, code processing apparatus includes:
Import statement determining module 20, for determining file import statement, the file in object code Import statement is used to import file to be imported;
Call statement determining module 40, for being determined in the object code and the file import statement Corresponding file call statement, the file call statement is used to call treating in the file to be imported to adjust Use file;
File replacement module 60, for using the file to be called in the corresponding file call statement Mark, replaces the mark of the file to be imported in the file import statement.
In the embodiment of the present application, described device also includes judge module and signal generating module;
The judge module is used for:Judge whether the file to be imported includes at least two code files;
When the file to be imported includes at least two code files, the call statement determining module 40 For determining the file call statement corresponding with the file import statement in the object code;
When the file to be imported does not include at least two code files, the signal generating module is used to send out Go out without process signal.
In the embodiment of the present application, the file import statement is carried:Truly imported for describing object code The mark of the set objective file of demand;
The call statement determining module 40, specifically for:
File call statement is determined in the object code, the file call statement is used to call to wait to adjust Use file;
When there is mark identical set objective file and file to be called, file place to be called is determined File call statement is corresponding with file import statement where the set objective file, and the file calls language The file to be called that sentence is called is in the file to be imported.
In the embodiment of the present application, described device also includes memory module, and the memory module is used for:By really The mark of set objective file is preserved to default storage region in the file import statement made;
The call statement determining module 40, specifically for:
Determine exist and the set objective file identification identical text to be called in the default storage region Part.
In the embodiment of the present application, the set objective file includes:Set objective obj ect file or set objective Function file, the file to be called includes:Obj ect file to be called or function file to be called;
The memory module specifically for:
The mark of set objective obj ect file in the file import statement determined is preserved to default storage First position in region;
The mark of set objective function file in the file import statement determined is preserved to default storage The second place in region;
The call statement determining module 40, specifically for:
Determine exist in the first position of the default storage region and the obj ect file mark phase to be called Same set objective obj ect file;
Determine exist in the second place of the default storage region and the function file mark phase to be called Same set objective function file.
In the embodiment of the present application, the object code is the browser scripted code based on JavaScript.
To sum up, the code processing apparatus that the embodiment of the present application is provided, by be called in file call statement File replaces file to be imported in corresponding file import statement so that the file import statement after being replaced When being performed, the follow-up code file being really called can be imported so that the text that file import statement is imported Part is the code file that programming personnel really needs to call, it is to avoid due to importing the code that need not be called File causes object code volume additionally to increase, it is ensured that it is normally used.
In the 1990s, can clearly to distinguish be changing on hardware for the improvement of a technology The improvement entered on (for example, improvement to circuit structures such as diode, transistor, switches) or software is (right In the improvement of method flow).However, with the development of technology, the improvement of many method flows now is Through directly improving for hardware circuit can be considered as.Designer is nearly all by by improved method flow It is programmed into hardware circuit to obtain corresponding hardware circuit.Therefore, it cannot be said that method flow Improvement cannot be realized with hardware entities module.For example, PLD (Programmable Logic Device, PLD) (for example field programmable gate array (Field Programmable Gate Array, FPGA)) it is exactly such a integrated circuit, its logic function is determined by user to device programming.By setting Meter personnel are voluntarily programmed a digital display circuit " integrated " on a piece of PLD, without asking chip Manufacturer designs and made special IC chip 2.Moreover, nowadays, substitution manually makes " logic compiler (logic compiler) " software is also used in IC chip, this programming instead mostly Realize, software compiler used is similar when it writes with program development, and the original generation before compiling Code also write by handy specific programming language, and this is referred to as hardware description language (Hardware Description Language, HDL), and HDL is also not only a kind of, but have many kinds, such as ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、 MyHDL, PALASM, RHDL (Ruby Hardware Description Language) etc., at present Most generally use VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog2.Those skilled in the art also will be apparent to the skilled artisan that only need to by Method flow slightly programming in logic and is programmed into integrated circuit with above-mentioned several hardware description languages, it is possible to It is readily available the hardware circuit for realizing the logical method flow.
Controller can be implemented in any suitable manner, for example, controller can take such as microprocessor Or processor and storage can by (micro-) computing device computer readable program code (such as software Or firmware) computer-readable medium, gate, switch, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), the form of programmable logic controller (PLC) and embedded microcontroller, controller Example include but is not limited to following microcontroller:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20 and Silicone Labs C8051F320, Memory Controller is also implemented as depositing A part for the control logic of reservoir.It is also known in the art that except with pure computer-readable program Code means are realized beyond controller, can cause control by the way that method and step is carried out into programming in logic completely Device is with the shape of gate, switch, application specific integrated circuit, programmable logic controller (PLC) and embedded microcontroller etc. Formula realizes identical function.Therefore this controller is considered a kind of hardware component, and to being wrapped in it The device for realizing various functions included can also be considered as the structure in hardware component.Or even, can be with It not only can will be the software module of implementation method for realizing that the device of various functions is considered as but also can be hardware Structure in part.
System, device, module or unit that above-described embodiment is illustrated, specifically can be by computer chip or reality Body is realized, or is realized by the product with certain function.
For convenience of description, it is divided into various units during description apparatus above with function to describe respectively.Certainly, The function of each unit can be realized in same or multiple softwares and/or hardware when implementing the application.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or meter Calculation machine program product.Therefore, the present invention can be using complete hardware embodiment, complete software embodiment or knot The form of embodiment in terms of conjunction software and hardware.Wherein wrapped one or more moreover, the present invention can be used Containing computer usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) on the form of computer program product implemented.
The present invention is with reference to the production of method according to embodiments of the present invention, equipment (system) and computer program The flow chart and/or block diagram of product is described.It should be understood that can by computer program instructions implementation process figure and / or each flow and/or square frame in block diagram and the flow in flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions can be provided to all-purpose computer, special-purpose computer, insertion Formula processor or the processor of other programmable data processing devices are to produce a machine so that pass through and calculate The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one The device for the function of being specified in individual flow or multiple flows and/or one square frame of block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or the processing of other programmable datas to set In the standby computer-readable memory worked in a specific way so that be stored in the computer-readable memory Instruction produce include the manufacture of command device, the command device realization in one flow or multiple of flow chart The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made Obtain and perform series of operation steps on computer or other programmable devices to produce computer implemented place Reason, so that the instruction performed on computer or other programmable devices is provided for realizing in flow chart one The step of function of being specified in flow or multiple flows and/or one square frame of block diagram or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/defeated Outgoing interface, network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory And/or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory (RAM). Internal memory is the example of computer-readable medium.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by appointing What method or technique realizes that information is stored.Information can be computer-readable instruction, data structure, program Module or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic random access memory (DRAM), its Random access memory (RAM), read-only storage (ROM), the electrically erasable of his type are read-only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape magnetic Disk storage or other magnetic storage apparatus or any other non-transmission medium, can be calculated available for storage The information that equipment is accessed.Defined according to herein, computer-readable medium does not include temporary computer-readable matchmaker The data-signal and carrier wave of body (transitory media), such as modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant be intended to it is non- It is exclusive to include, so that process, method, commodity or equipment including a series of key elements are not only wrapped Include those key elements, but also other key elements including being not expressly set out, or also include for this process, Method, commodity or the intrinsic key element of equipment.In the absence of more restrictions, by sentence " including One ... " key element that limits, it is not excluded that in the process including the key element, method, commodity or set Also there is other identical element in standby.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer journey Sequence product.Therefore, the application can using complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the application can be used wherein includes calculating one or more Machine usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM, Optical memory etc.) on the form of computer program product implemented.
The application can be described in the general context of computer executable instructions, example Such as program module.Usually, program module includes performing particular task or realizes particular abstract data type Routine, program, object, component, data structure etc..This can also be put into practice in a distributed computing environment Application, in these DCEs, by the remote processing devices connected by communication network come Execution task.In a distributed computing environment, program module can be located at local including storage device In remote computer storage medium.
Each embodiment in this specification is described by the way of progressive, identical phase between each embodiment As part mutually referring to, what each embodiment was stressed be it is different from other embodiment it Place.For system embodiment, because it is substantially similar to embodiment of the method, so description Fairly simple, the relevent part can refer to the partial explaination of embodiments of method.
Embodiments herein is the foregoing is only, the application is not limited to.For this area skill For art personnel, the application can have various modifications and variations.All institutes within spirit herein and principle Any modification, equivalent substitution and improvements of work etc., should be included within the scope of claims hereof.

Claims (12)

1. a kind of code process method, it is characterised in that including:
File import statement is determined in object code, the file import statement is used to import text to be imported Part;
The file call statement corresponding with the file import statement, institute are determined in the object code Stating file call statement is used to call the file to be called in the file to be imported;
Using the mark of the file to be called in the corresponding file call statement, replace the file and lead Enter the mark of the file to be imported in sentence.
2. the method as described in claim 1, it is characterised in that described that text is determined in object code After part import statement, it is described determined in the object code it is corresponding with the file import statement Before file call statement, methods described also includes:
Judge whether the file to be imported includes at least two code files;
If so, determining the text corresponding with the file import statement in the object code described in performing Part call statement;
If it is not, sending without process signal.
3. the method as described in claim 1, it is characterised in that the file import statement is carried: For describing the mark that object code truly imports the set objective file of demand;
It is described to determine that the file corresponding with the file import statement calls language in the object code Sentence, the file call statement is used to call the file to be called in the file to be imported, specifically includes:
File call statement is determined in the object code, the file call statement is used to call to wait to adjust Use file;
When there is mark identical set objective file and file to be called, file place to be called is determined File call statement is corresponding with file import statement where the set objective file, and the file calls language The file to be called that sentence is called is in the file to be imported.
4. method as claimed in claim 3, it is characterised in that described that text is determined in object code After part import statement, it is described determined in the object code it is corresponding with the file import statement Before file call statement, methods described also includes:
The mark of set objective file in the file import statement determined is preserved to default storage region;
It is described to determine there is mark identical set objective file and file to be called, specifically include:
Determine exist and the set objective file identification identical text to be called in the default storage region Part.
5. method as claimed in claim 4, it is characterised in that the set objective file includes:Both The obj ect file that sets the goal or set objective function file, the file to be called include:Obj ect file to be called Or function file to be called;
The mark by set objective file in the file import statement determined is preserved to default storage Region, is specifically included:
The mark of set objective obj ect file in the file import statement determined is preserved to default storage First position in region;
The mark of set objective function file in the file import statement determined is preserved to default storage The second place in region;
Exist in the determination default storage region and wait to adjust with the set objective file identification identical With file, specifically include:
Determine exist in the first position of the default storage region and the obj ect file mark phase to be called Same set objective obj ect file;
Determine exist in the second place of the default storage region and the function file mark phase to be called Same set objective function file.
6. the method as described in claim 1, it is characterised in that the object code is based on JavaScript Browser scripted code.
7. a kind of code processing apparatus, it is characterised in that including:
Import statement determining module, for determining file import statement in object code, the file is led Entering sentence is used to import file to be imported;
Call statement determining module, for being determined in the object code and the file import statement phase Corresponding file call statement, the file call statement is to be called in the file to be imported for calling File;
File replacement module, for the mark using the file to be called in the corresponding file call statement Know, replace the mark of the file to be imported in the file import statement.
8. device as claimed in claim 7, it is characterised in that described device also include judge module and Signal generating module;
The judge module is used for:Judge whether the file to be imported includes at least two code files;
When the file to be imported includes at least two code files, the call statement determining module is used for The file call statement corresponding with the file import statement is determined in the object code;
When the file to be imported does not include at least two code files, the signal generating module is used to send out Go out without process signal.
9. device as claimed in claim 7, it is characterised in that the file import statement is carried: For describing the mark that object code truly imports the set objective file of demand;
The call statement determining module, specifically for:
File call statement is determined in the object code, the file call statement is used to call to wait to adjust Use file;
When there is mark identical set objective file and file to be called, file place to be called is determined File call statement is corresponding with file import statement where the set objective file, and the file calls language The file to be called that sentence is called is in the file to be imported.
10. device as claimed in claim 9, it is characterised in that described device also includes memory module, The memory module is used for:By the mark of set objective file in the file import statement determined preserve to Default storage region;
The call statement determining module, specifically for:
Determine exist and the set objective file identification identical text to be called in the default storage region Part.
11. device as claimed in claim 10, it is characterised in that the set objective file includes: Set objective obj ect file or set objective function file, the file to be called include:Object text to be called Part or function file to be called;
The memory module specifically for:
The mark of set objective obj ect file in the file import statement determined is preserved to default storage First position in region;
The mark of set objective function file in the file import statement determined is preserved to default storage The second place in region;
The call statement determining module, specifically for:
Determine exist in the first position of the default storage region and the obj ect file mark phase to be called Same set objective obj ect file;
Determine exist in the second place of the default storage region and the function file mark phase to be called Same set objective function file.
12. device as claimed in claim 7, it is characterised in that the object code is based on JavaScript Browser scripted code.
CN201610188574.5A 2016-03-29 2016-03-29 Code processing method and device Active CN107239270B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610188574.5A CN107239270B (en) 2016-03-29 2016-03-29 Code processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610188574.5A CN107239270B (en) 2016-03-29 2016-03-29 Code processing method and device

Publications (2)

Publication Number Publication Date
CN107239270A true CN107239270A (en) 2017-10-10
CN107239270B CN107239270B (en) 2020-10-27

Family

ID=59983310

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610188574.5A Active CN107239270B (en) 2016-03-29 2016-03-29 Code processing method and device

Country Status (1)

Country Link
CN (1) CN107239270B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109960497A (en) * 2017-12-26 2019-07-02 北京高德云图科技有限公司 Call method and device between a kind of script file
CN110389753A (en) * 2019-06-06 2019-10-29 五八有限公司 Chain type call method, device, electronic equipment and the storage medium of native applications

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1826586A (en) * 2002-06-03 2006-08-30 住商信息系统株式会社 Software atomization
CN101582039A (en) * 2009-06-18 2009-11-18 深圳市汇海科技开发有限公司 Plug-in loading method for saving memory cost
CN102073496A (en) * 2010-12-29 2011-05-25 浙大网新科技股份有限公司 Method for intercepting and tracking call DLL (dynamic link library) export functions
CN103902255A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Generating method and system of function relationship call tree
CN104156314A (en) * 2014-08-14 2014-11-19 北京航空航天大学 Code reuse method applied to test system
CN104951290A (en) * 2014-03-31 2015-09-30 国际商业机器公司 Method and equipment for optimizing software

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1826586A (en) * 2002-06-03 2006-08-30 住商信息系统株式会社 Software atomization
CN101582039A (en) * 2009-06-18 2009-11-18 深圳市汇海科技开发有限公司 Plug-in loading method for saving memory cost
CN102073496A (en) * 2010-12-29 2011-05-25 浙大网新科技股份有限公司 Method for intercepting and tracking call DLL (dynamic link library) export functions
CN103902255A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Generating method and system of function relationship call tree
CN104951290A (en) * 2014-03-31 2015-09-30 国际商业机器公司 Method and equipment for optimizing software
CN104156314A (en) * 2014-08-14 2014-11-19 北京航空航天大学 Code reuse method applied to test system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109960497A (en) * 2017-12-26 2019-07-02 北京高德云图科技有限公司 Call method and device between a kind of script file
CN110389753A (en) * 2019-06-06 2019-10-29 五八有限公司 Chain type call method, device, electronic equipment and the storage medium of native applications
CN110389753B (en) * 2019-06-06 2024-01-23 五八有限公司 Chained calling method and device of native application, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN107239270B (en) 2020-10-27

Similar Documents

Publication Publication Date Title
JP7036826B2 (en) Service processing method and equipment
CN107196900A (en) A kind of method and device for verification of knowing together
CN108415941A (en) A kind of spiders method, apparatus and electronic equipment
CN107679700A (en) Business flow processing method, apparatus and server
CN109214632A (en) A kind of risk control method and equipment
CN107368292A (en) A kind of resource Compilation Method and device
CN111966334B (en) Service processing method, device and equipment
CN112672184A (en) Video auditing and publishing method
CN109657177A (en) The generation method of the page, device, storage medium and computer equipment after upgrading
CN107038058A (en) A kind of code process method and device
CN107203465A (en) System interface method of testing and device
CN106293669A (en) A kind of generation method and apparatus of web pages component
CN108427737A (en) A kind of data clearing method, equipment and computer-readable medium
CN113765818A (en) Distributed current limiting method, device, equipment, storage medium and system
CN107291623A (en) A kind of applied program testing method and device
US11295258B2 (en) Cross domain integration in product lifecycle management
CN107239270A (en) Code process method and apparatus
CN110046052B (en) Service calling method and device
CN109656946A (en) A kind of multilist relation query method, device and equipment
CN110022351B (en) Service request processing method and device
CN107908552A (en) A kind of test method based on link, device and equipment
CN107918863A (en) Preposition processing and collocation method, device and equipment based on financial product
TWI707289B (en) Method and device for sending electronic tickets
WO2020024902A1 (en) Method, device, and storage medium for searching for blockchain data
CN116822606A (en) Training method, device, equipment and storage medium of anomaly detection model

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant